Bug 1482040 - Fix failure in test_uid.js by iterating MailServices.ab.directories 'manually'. r=darktrojan a=jorgk DONTBUILD
☠☠ backed out by e4d520b5dc17 ☠ ☠
authorNeil Rashbrook <neil@parkwaycc.co.uk>
Tue, 20 Nov 2018 07:29:00 +0100
changeset 31945 a6e340fe4c07
parent 31944 afa9e6f5d698
child 31946 e3a599bf7d54
push id107
push usermozilla@jorgk.com
push dateWed, 21 Nov 2018 07:41:26 +0000
treeherdercomm-esr60@a6e340fe4c07 [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 DONTBUILD
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");