summaryrefslogtreecommitdiffstats
path: root/comm/mailnews/addrbook/test/unit/test_bug448165.js
blob: 57337f7fa1613864794fd5540d0433e1aced95cd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
/**
 * A simple test to check for a regression of bug 448165: Mailnews crashes in
 * nsAbMDBDirectory::DeleteCards if aCards is null
 */
function run_test() {
  // get the Personal Address Book
  let pab = MailServices.ab.getDirectory(kPABData.URI);
  Assert.ok(pab instanceof Ci.nsIAbDirectory);
  try {
    pab.deleteCards(null); // this should throw an error
    do_throw(
      "Error, deleteCards should throw an error when null is passed to it"
    );
  } catch (e) {
    // make sure the correct error message was thrown
    Assert.equal(e.result, Cr.NS_ERROR_XPC_CANT_CONVERT_PRIMITIVE_TO_ARRAY);
  }
}