Bug 1482040 - Fix failure in test_uid.js by iterating MailServices.ab.directories 'manually'. r=darktrojan a=jorgk
authorNeil Rashbrook <neil@parkwaycc.co.uk>
Tue, 20 Nov 2018 07:29:00 +0100
changeset 31987 707388b59cb577cad0242f36bfa15d902ff65408
parent 31986 a02f10ecb5fdcb78ebe00b432c3c808e86de39c4
child 31988 7afc65db094f2c60dda0e65753d3ddf8b87717a4
push id125
push usermozilla@jorgk.com
push dateSat, 15 Dec 2018 22:50:19 +0000
treeherdercomm-esr60@a85161ecb5ea [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdarktrojan, jorgk
bugs1482040
Bug 1482040 - Fix failure in test_uid.js by iterating MailServices.ab.directories 'manually'. r=darktrojan a=jorgk
mailnews/addrbook/test/unit/test_uid.js
--- a/mailnews/addrbook/test/unit/test_uid.js
+++ b/mailnews/addrbook/test/unit/test_uid.js
@@ -11,32 +11,37 @@ function run_test() {
   let testAB = do_get_file("data/existing.mab");
   testAB.copyTo(profD, kPABData.fileName);
 
   run_next_test();
 }
 
 // Tests that directories have UIDs.
 add_test(function directoryUID() {
-  for (let book of MailServices.ab.directories) {
+  let books = MailServices.ab.directories;
+  while (books.hasMoreElements()) {
+    let book = books.getNext().QueryInterface(Ci.nsIAbDirectory);
     equal(36, book.UID.length, "Existing directory has a UID");
   }
 
   let dirName = MailServices.ab.newAddressBook("test", "", kPABData.dirType);
   let directory = MailServices.ab.getDirectoryFromId(dirName);
   equal(36, directory.UID.length, "New directory has a UID");
 
   run_next_test();
 });
 
 // Tests that an existing contact has a UID generated, and that that UID is
 // saved to the database so that the same UID is used next time.
 add_task(async function existingContactUID() {
   let book = MailServices.ab.getDirectory(kPABData.URI);
-  let bookCards = [...book.childCards];
+  let bookCards = [];
+  let childCards = book.childCards;
+  while (childCards.hasMoreElements())
+    bookCards.push(childCards.getNext().QueryInterface(Ci.nsIAbCard));
   equal(2, bookCards.length, "Loaded test address book");
 
   let card = bookCards[0];
   if (card.isMailList) {
     card = bookCards[1];
   }
   equal(36, card.UID.length, "Existing contact has a UID");