Bug 502928 - refresh and re-enable test_localToImapFilter.js. r=jorgk
authoraceman <acelists@atlas.sk>
Sun, 23 Sep 2018 12:44:00 +0200
changeset 33216 5ed1ac772746107a74dbcc579e8effbaacc62151
parent 33215 e55253fbb27b710e80d766e4d0cec7c43ffaac0b
child 33217 997d19872dcfda69cf137ebc563d9bd2cc8a6ab5
push id387
push userclokep@gmail.com
push dateMon, 10 Dec 2018 21:30:47 +0000
reviewersjorgk
bugs502928
Bug 502928 - refresh and re-enable test_localToImapFilter.js. r=jorgk
mailnews/imap/test/unit/test_localToImapFilter.js
mailnews/imap/test/unit/xpcshell.ini
mailnews/imap/test/unit/xpcshell_maildir.ini
--- a/mailnews/imap/test/unit/test_localToImapFilter.js
+++ b/mailnews/imap/test/unit/test_localToImapFilter.js
@@ -20,25 +20,25 @@ var gLastKey;
 var gMessages = Cc["@mozilla.org/array;1"].createInstance(Ci.nsIMutableArray);
 var gFiles = ["../../../data/bugmail1",
                 "../../../data/draft1"];
 
 var tests = [
   setup,
   function* copyFolder1() {
     dump("gEmpty1 " + gEmptyLocal1.URI + "\n");
-    let folders = new Array;
+    let folders = [];
     folders.push(gEmptyLocal1.QueryInterface(Ci.nsIMsgFolder));
     let array = toXPCOMArray(folders, Ci.nsIMutableArray);
     MailServices.copy.CopyFolders(array, IMAPPump.inbox, false, CopyListener, null);
     yield false;
   },
   function* copyFolder2() {
     dump("gEmpty2 " + gEmptyLocal2.URI + "\n");
-    let folders = new Array;
+    let folders = [];
     folders.push(gEmptyLocal2);
     let array = toXPCOMArray(folders, Ci.nsIMutableArray);
     MailServices.copy.CopyFolders(array, IMAPPump.inbox, false, CopyListener, null);
     yield false;
   },
   function* getLocalMessages() {
     // setup copy then move mail filters on the inbox
     let filterList = gPOP3Pump.fakeServer.getFilterList(null);
@@ -73,46 +73,42 @@ var tests = [
     yield false;
   },
   function verifyFolders() {
     let folder1 = IMAPPump.inbox.getChildNamed("empty 1");
     listMessages(folder1);
     let folder2 = IMAPPump.inbox.getChildNamed("empty 2");
     listMessages(folder2);
     listMessages(localAccountUtils.inboxFolder);
-    Assert.notEqual(folder1, null);
-    Assert.notEqual(folder2, null);
+    Assert.ok(folder1 !== null);
+    Assert.ok(folder2 !== null);
     // folder 1 and 2 should each now have 2 messages in them.
     Assert.equal(folderCount(folder1), 2);
     Assert.equal(folderCount(folder2), 2);
     // the local inbox folder should now be empty, since the second
     // operation was a move
     Assert.equal(folderCount(localAccountUtils.inboxFolder), 0);
   },
   teardown
 ];
 
 function folderCount(folder)
 {
   let enumerator = folder.msgDatabase.EnumerateMessages();
   let count = 0;
-  while (enumerator.hasMoreElements())
-  {
+  for (let hdr of fixIterator(enumerator, Ci.nsIMsgDBHdr)) {
     count++;
-    let hdr = enumerator.getNext();
   }
   return count;
 }
 
 function setup() {
   setupIMAPPump();
-  gEmptyLocal1 = localAccountUtils.incomingServer
-                                  .rootFolder.createLocalSubfolder("empty 1");
-  gEmptyLocal2 = localAccountUtils.incomingServer
-                                  .rootFolder.createLocalSubfolder("empty 2");
+  gEmptyLocal1 = localAccountUtils.rootFolder.createLocalSubfolder("empty 1");
+  gEmptyLocal2 = localAccountUtils.rootFolder.createLocalSubfolder("empty 2");
 
   // these hacks are required because we've created the inbox before
   // running initial folder discovery, and adding the folder bails
   // out before we set it as verified online, so we bail out, and
   // then remove the INBOX folder since it's not verified.
   IMAPPump.inbox.hierarchyDelimiter = '/';
   IMAPPump.inbox.verifiedAsOnlineFolder = true;
 }
@@ -139,20 +135,19 @@ var CopyListener =
 asyncUrlListener.callback = function(aUrl, aExitCode) {
   Assert.equal(aExitCode, 0);
 };
 
 function listMessages(folder) {
   let enumerator = folder.msgDatabase.EnumerateMessages();
   var msgCount = 0;
   dump("listing messages for " + folder.prettyName + "\n");
-  while(enumerator.hasMoreElements())
+  for (let hdr of fixIterator(enumerator, Ci.nsIMsgDBHdr))
   {
     msgCount++;
-    let hdr = enumerator.getNext().QueryInterface(Ci.nsIMsgDBHdr);
     dump(msgCount + ": " + hdr.subject + "\n");
   }
 }
 
 function teardown() {
   gMessages.clear();
   gIMAPTrashFolder = null;
   gEmptyLocal1 = null;
--- a/mailnews/imap/test/unit/xpcshell.ini
+++ b/mailnews/imap/test/unit/xpcshell.ini
@@ -47,18 +47,16 @@ run-sequentially = test depends on delay
 [test_imapStoreMsgOffline.js]
 [test_imapUndo.js]
 [test_imapUrls.js]
 [test_largeOfflineStore.js]
 skip-if = os == 'mac'
 [test_listClosesDB.js]
 [test_listSubscribed.js]
 [test_localToImapFilter.js]
-# Disabled due to intermittent failures, bug 502928
-skip-if = true
 [test_localToImapFilterQuarantine.js]
 [test_lsub.js]
 [test_mailboxes.js]
 [test_nsIMsgFolderListenerIMAP.js]
 [test_offlineCopy.js]
 [test_offlineDraftDataloss.js]
 run-sequentially = Starts server twice.
 [test_offlinePlayback.js]
--- a/mailnews/imap/test/unit/xpcshell_maildir.ini
+++ b/mailnews/imap/test/unit/xpcshell_maildir.ini
@@ -45,18 +45,16 @@ skip-if = true
 [test_imapRename.js]
 [test_imapSearch.js]
 [test_imapStatusCloseDBs.js]
 [test_imapStoreMsgOffline.js]
 [test_imapUndo.js]
 [test_listClosesDB.js]
 [test_listSubscribed.js]
 [test_localToImapFilter.js]
-# Disabled due to intermittent failures, bug 502928
-skip-if = true
 [test_localToImapFilterQuarantine.js]
 [test_lsub.js]
 [test_mailboxes.js]
 [test_nsIMsgFolderListenerIMAP.js]
 [test_offlineCopy.js]
 [test_offlineDraftDataloss.js]
 run-sequentially = Starts server twice.
 [test_offlinePlayback.js]