Bug 1293006 - Replace in-tree consumer of non-standard Iterator() with Object.{values,entries} in mail/ in comm-central. r=mkmelin
authorAman Dwivedi <dwivedi.aman96@gmail.com>
Thu, 05 Jan 2017 15:38:16 +0530
changeset 20987 ce82f494b090b9b256122619ce3dc3e069d137df
parent 20986 f3c3430dddfc3e15ede7d7d98abc1943a0ed1aef
child 20988 d9c51a68b3730c824393c84539025cd9296ca581
push id12731
push usermozilla@jorgk.com
push dateTue, 10 Jan 2017 08:04:23 +0000
treeherdercomm-central@d9c51a68b373 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmkmelin
bugs1293006
Bug 1293006 - Replace in-tree consumer of non-standard Iterator() with Object.{values,entries} in mail/ in comm-central. r=mkmelin
mail/base/content/folderPane.js
mail/base/content/multimessageview.js
mail/base/content/specialTabs.js
mail/base/modules/dbViewWrapper.js
mail/base/modules/quickFilterManager.js
mail/base/test/unit/resources/viewWrapperTestUtils.js
mail/base/test/unit/test_windows_font_migration.js
mail/components/about-support/aboutSupport.js
mail/components/activity/content/activity.xml
mail/components/addrbook/content/abTrees.js
mail/test/mozmill/cloudfile/test-cloudfile-add-account-dialog.js
mail/test/mozmill/cloudfile/test-cloudfile-backend-hightail.js
mail/test/mozmill/cloudfile/test-cloudfile-manager.js
mail/test/mozmill/content-tabs/test-about-support.js
mail/test/mozmill/folder-display/test-display-name.js
mail/test/mozmill/folder-display/test-folder-pane-visibility.js
mail/test/mozmill/folder-display/test-message-pane-visibility.js
mail/test/mozmill/newmailaccount/test-newmailaccount.js
mail/test/mozmill/pref-window/test-font-chooser.js
mail/test/mozmill/shared-modules/test-compose-helpers.js
mail/test/mozmill/shared-modules/test-folder-display-helpers.js
mail/test/mozmill/shared-modules/test-observer-helpers.js
mail/test/mozmill/shared-modules/test-window-helpers.js
mail/test/mozmill/utils/test-iteratorUtils.js
--- a/mail/base/content/folderPane.js
+++ b/mail/base/content/folderPane.js
@@ -1030,17 +1030,17 @@ var gFolderTreeView = {
     this._toggleRow(aIndex, true);
   },
 
   recursivelyAddToMap: function ftv_recursivelyAddToMap(aChild, aNewIndex) {
     // When we add sub-children, we're going to need to increase our index
     // for the next add item at our own level.
     let count = 0;
     if (aChild.children.length && aChild.open) {
-      for (let [i, child] in Iterator(this._rowMap[aNewIndex].children)) {
+      for (let [i, child] of Array.from(this._rowMap[aNewIndex].children).entries()) {
         count++;
         let index = Number(aNewIndex) + Number(i) + 1;
         this._rowMap.splice(index, 0, child);
 
         let kidsAdded = this.recursivelyAddToMap(child, index);
         count += kidsAdded;
         // Somehow the aNewIndex turns into a string without this.
         aNewIndex = Number(aNewIndex) + kidsAdded;
--- a/mail/base/content/multimessageview.js
+++ b/mail/base/content/multimessageview.js
@@ -411,17 +411,17 @@ MultiMessageSummary.prototype = {
    * Given a set of items from a gloda collection, process them and update
    * the display accordingly.
    *
    * @param aItems Contents of a gloda collection.
    */
   _processItems: function(aItems) {
     let knownMessageNodes = new Map();
 
-    for (let [,glodaMsg] in Iterator(aItems)) {
+    for (let glodaMsg of aItems) {
       // Unread and starred will get set if any of the messages in a collapsed
       // thread qualify.  The trick here is that we may get multiple items
       // corresponding to the same thread (and hence DOM node), so we need to
       // detect when we get the first item for a particular DOM node, stash the
       // preexisting status of that DOM node, an only do transitions if the
       // items warrant it.
       let key = glodaMsg.messageKey + glodaMsg.folder.uri;
       let headerNode = this._msgNodes[key];
@@ -515,17 +515,17 @@ ThreadSummarizer.prototype = {
         summarizedMessages.push(message);
       }
     }
     let ignoredCount = aMessages.trueLength - summarizedMessages.length;
 
     // Summarize the selected messages.
     let subject = null;
     let maxCountExceeded = false;
-    for (let [i, msgHdr] in Iterator(summarizedMessages)) {
+    for (let [i, msgHdr] of summarizedMessages.entries()) {
       if (i > this.kMaxSummarizedMessages) {
         summarizedMessages.length = i;
         maxCountExceeded = true;
         break;
       }
 
       if (subject == null)
         subject = msgHdr.mime2DecodedSubject;
@@ -615,17 +615,17 @@ MultipleSelectionSummarizer.prototype = 
                                      "numConversations";
     this.context.setHeading(formatString(
       format, [threads.length.toLocaleString()], threads.length
     ));
 
     // Summarize the selected messages by thread.
     let maxCountExceeded = false;
     let messageCount = 0;
-    for (let [i, msgs] in Iterator(threads)) {
+    for (let [i, msgs] of threads.entries()) {
       messageCount += msgs.length;
       if (messageCount > this.kMaxSummarizedMessages ||
           i > this.kMaxSummarizedThreads) {
         threads.length = i;
         maxCountExceeded = true;
         break;
       }
 
--- a/mail/base/content/specialTabs.js
+++ b/mail/base/content/specialTabs.js
@@ -1391,17 +1391,17 @@ var specialTabs = {
             notificationBox.appendNotification(messageString, notificationName,
                                                iconURL,
                                                notificationBox.PRIORITY_WARNING_MEDIUM,
                                                buttons);
           }
         break;
       case "addon-install-failed":
         // XXX TODO This isn't terribly ideal for the multiple failure case
-        for (let [, install] in Iterator(installInfo.installs)) {
+        for (let install of installInfo.installs) {
           let host = (installInfo.originatingURI instanceof Ci.nsIStandardURL) &&
                       installInfo.originatingURI.host;
           if (!host)
             host = (install.sourceURI instanceof Ci.nsIStandardURL) &&
                     install.sourceURI.host;
 
           let error = (host || install.error == 0) ?
                        "addonError" : "addonLocalError";
@@ -1450,17 +1450,17 @@ var specialTabs = {
             label: messengerBundle.getString("addonInstallManage"),
             accessKey: messengerBundle.getString("addonInstallManage.accesskey"),
             popup: null,
             callback: function() {
               // Calculate the add-on type that is most popular in the list of
               // installs.
               let types = {};
               let bestType = null;
-              for (let [, install] in Iterator(installInfo.installs)) {
+              for (let install of installInfo.installs) {
                 if (install.type in types)
                   types[install.type]++;
                 else
                   types[install.type] = 1;
 
                 if (!bestType || types[install.type] > types[bestType])
                   bestType = install.type;
 
--- a/mail/base/modules/dbViewWrapper.js
+++ b/mail/base/modules/dbViewWrapper.js
@@ -1382,17 +1382,17 @@ DBViewWrapper.prototype = {
       this.search.dissociateView(this.dbView);
       this.dbView.close();
       this.dbView = null;
     }
 
     this.dbView = this._createView();
     // if the synthetic view defines columns, add those for it
     if (this.isSynthetic) {
-      for (let [, customCol] in Iterator(this._syntheticView.customColumns)) {
+      for (let customCol of this._syntheticView.customColumns) {
         customCol.bindToView(this.dbView);
         this.dbView.addColumnHandler(customCol.id, customCol);
       }
     }
     this.listener.onCreatedView();
 
     // this ends up being a no-op if there are no search terms
     this.search.associateView(this.dbView);
--- a/mail/base/modules/quickFilterManager.js
+++ b/mail/base/modules/quickFilterManager.js
@@ -1006,17 +1006,17 @@ var MessageTextFilter = {
 
     if (aFilterValue.text) {
       let phrases = this._parseSearchString(aFilterValue.text);
       for (let groupedPhrases of phrases) {
         let firstClause = true;
         term = null;
         let splitPhrases = groupedPhrases.split("|");
         for (let phrase of splitPhrases) {
-          for (let [tfName, tfValue] in Iterator(aFilterValue.states)) {
+          for (let [tfName, tfValue] of Object.entries(aFilterValue.states)) {
             if (!tfValue)
               continue;
             let tfDef = this.textFilterDefs[tfName];
 
             term = aTermCreator.createTerm();
             term.attrib = tfDef.attrib;
             value = term.value;
             value.attrib = tfDef.attrib;
--- a/mail/base/test/unit/resources/viewWrapperTestUtils.js
+++ b/mail/base/test/unit/resources/viewWrapperTestUtils.js
@@ -453,17 +453,17 @@ function verify_view_level_histogram(aEx
   let rowCount = treeView.rowCount;
 
   let actualHisto = {};
   for (let iViewIndex = 0; iViewIndex < rowCount; iViewIndex++) {
     let level = treeView.getLevel(iViewIndex);
     actualHisto[level] = (actualHisto[level] || 0) + 1;
   }
 
-  for (let [level, count] in Iterator(aExpectedHisto)) {
+  for (let [level, count] of Object.entries(aExpectedHisto)) {
     if (actualHisto[level] != count) {
       dump_view_state(aViewWrapper);
       dump("*******************\n");
       dump("Expected count for histogram level " + level + " was " + count +
            " but got " + actualHisto[level] + "\n");
       do_throw("View histogram does not match!");
     }
   }
--- a/mail/base/test/unit/test_windows_font_migration.js
+++ b/mail/base/test/unit/test_windows_font_migration.js
@@ -34,20 +34,20 @@ var kSizesToVerify = ["variableSize", "f
  * whatever's provided in aFonts and aNonDefaultFonts.
  */
 function makeVerifier(aFonts) {
   function verifier(aEncoding, aNonDefaultFonts) {
     if (!aNonDefaultFonts)
       aNonDefaultFonts = {};
 
     let expectedFonts = {};
-    for (let [, key] in Iterator(kNamesToVerify))
+    for (let key of kNamesToVerify)
       expectedFonts[key] = (key in aNonDefaultFonts ? aNonDefaultFonts[key] :
                             aFonts[key]);
-    for (let [, key] in Iterator(kSizesToVerify)) {
+    for (let key of kSizesToVerify) {
       let nonDefaultKey = key + (aFonts.migrated ? "" : "Non") + "Migrated";
       expectedFonts[key] = (nonDefaultKey in aNonDefaultFonts ?
                             aNonDefaultFonts[nonDefaultKey] :
                             aFonts[key]);
     }
 
     // A distinct lack of magic here, so that failing stuff is generally easier
     // to comment out and debug.
@@ -126,18 +126,18 @@ var kPrefBranchesToClear = [
 /**
  * Reset all font prefs we care about (as defined above) to their defaults.
  *
  * @param [aDontResetVersion] Whether mail.font.windows.version should not be
  *     reset, defaults to false.
  */
 function reset_font_prefs(aDontResetVersion) {
   // kPrefBranchesToClear x kEncodingsToClear
-  for (let [, prefBranch] in Iterator(kPrefBranchesToClear)) {
-    for (let [, encoding] in Iterator(kEncodingsToClear)) {
+  for (let prefBranch of kPrefBranchesToClear) {
+    for (let encoding of kEncodingsToClear) {
       let pref = prefBranch + encoding;
       if (Services.prefs.prefHasUserValue(pref))
         Services.prefs.clearUserPref(pref);
     }
   }
   if (!aDontResetVersion &&
       Services.prefs.prefHasUserValue("mail.font.windows.version"))
     Services.prefs.clearUserPref("mail.font.windows.version");
@@ -339,22 +339,22 @@ var testsForEveryVersion = [
 var otherTests = [
   test_migrating_at_most_once,
   test_migrating_at_least_once,
 ];
 
 function run_test() {
   reset_font_prefs();
 
-  for (let [, [version, verifier]] in Iterator(kWindowsVersions)) {
+  for (let [version, verifier] of Object.values(kWindowsVersions)) {
     set_windows_version(version);
 
-    for (let [, test] in Iterator(testsForEveryVersion)) {
+    for (let test of testsForEveryVersion) {
       test(verifier);
       reset_font_prefs();
     }
   }
 
-  for (let [, test] in Iterator(otherTests)) {
+  for (let test of otherTests) {
     test();
     reset_font_prefs();
   }
 }
--- a/mail/components/about-support/aboutSupport.js
+++ b/mail/components/about-support/aboutSupport.js
@@ -18,21 +18,21 @@ else
 Components.utils.import("resource:///modules/iteratorUtils.jsm");
 Components.utils.import("resource://gre/modules/Services.jsm");
 Components.utils.import("resource:///modules/mailServices.js");
 
 var gMessengerBundle = Services.strings.createBundle(
   "chrome://messenger/locale/messenger.properties");
 
 var gSocketTypes = {};
-for (let [str, index] in Iterator(Ci.nsMsgSocketType))
+for (let [str, index] of Object.entries(Ci.nsMsgSocketType))
   gSocketTypes[index] = str;
 
 var gAuthMethods = {};
-for (let [str, index] in Iterator(Ci.nsMsgAuthMethod))
+for (let [str, index] of Object.entries(Ci.nsMsgAuthMethod))
   gAuthMethods[index] = str;
 
 // l10n properties in messenger.properties corresponding to each auth method
 var gAuthMethodProperties = {
   "1": "authOld",
   "2": "authPasswordCleartextInsecurely",
   "3": "authPasswordCleartextViaSSL",
   "4": "authPasswordEncrypted",
--- a/mail/components/activity/content/activity.xml
+++ b/mail/components/activity/content/activity.xml
@@ -132,17 +132,17 @@
             waitingforretry: "waitingForRetry",
             yesterday: "yesterday",
             monthDate: "monthDate"
           };
 
           // convert strings to those in the string bundle
           let sb = document.getElementById("activityStrings");
           let getStr = string => sb.getString(string);
-          for (let [name, value] in Iterator(this.text)) {
+          for (let [name, value] of Object.entries(this.text)) {
             this.text[name] = typeof value == "string" ? getStr(value)
                                                        : value.map(getStr);
           }
         } catch (e) {
           this.log.error("Exception: " + e);
         }
         ]]>
       </constructor>
--- a/mail/components/addrbook/content/abTrees.js
+++ b/mail/components/addrbook/content/abTrees.js
@@ -229,17 +229,17 @@ directoryTreeView.prototype = {
       return;
     //xxx we can optimize this later
     this._rebuild();
 
     if (!this._tree)
       return;
 
     // Now select this new item
-    for (var [i, row] in Iterator(this._rowMap)) {
+    for (var [i, row] of this._rowMap.entries()) {
       if (row.id == aItem.URI) {
         this.selection.select(i);
         break;
       }
     }
   },
 
   onItemRemoved: function dtv_onItemRemoved(aParent, aItem) {
@@ -254,17 +254,17 @@ directoryTreeView.prototype = {
     // If we're deleting a top-level address-book, just select the first book
     if (aParent.URI == kAllDirectoryRoot ||
         aParent.URI == kAllDirectoryRoot + "?") {
       this.selection.select(0);
       return;
     }
 
     // Now select this parent item
-    for (var [i, row] in Iterator(this._rowMap)) {
+    for (var [i, row] of this._rowMap.entries()) {
       if (row.id == aParent.URI) {
         this.selection.select(i);
         break;
       }
     }
   },
 
   onItemPropertyChanged: function dtv_onItemProp(aItem, aProp, aOld, aNew) {
--- a/mail/test/mozmill/cloudfile/test-cloudfile-add-account-dialog.js
+++ b/mail/test/mozmill/cloudfile/test-cloudfile-add-account-dialog.js
@@ -49,17 +49,17 @@ function setupModule(module) {
   collector.getModule('cloudfile-helpers').installInto(module);
 };
 
 function teardownModule(module) {
   // Clear out any leftover entries.
   gCategoryMan.deleteCategory(kCategory);
 
   // Put the old entries back
-  for (let [key, value] in Iterator(gOldProviders))
+  for (let [key, value] of Object.entries(gOldProviders))
     gCategoryMan.addCategoryEntry(kCategory, key, value, false, true);
 }
 
 /**
  * Helper function that ensures that we know the number of registered
  * Filelink service providers.
  *
  * @param aNum the number of expected registered Filelink service providers.
--- a/mail/test/mozmill/cloudfile/test-cloudfile-backend-hightail.js
+++ b/mail/test/mozmill/cloudfile/test-cloudfile-backend-hightail.js
@@ -140,17 +140,17 @@ function test_chained_uploads() {
   });
 
   mc.waitFor(function() {
     return observers.every(aListener => aListener.success);
   }, "Timed out waiting for chained uploads to complete.", 10000);
 
   assert_equals(kFilenames.length, obs.numSightings(kUploadFile));
 
-  for (let [index, filename] in Iterator(kFilenames)) {
+  for (let [index, filename] of kFilenames.entries()) {
     assert_equals(obs.data[kUploadFile][index], filename);
     let file = getFile("./data/" + filename, __file__);
     let expectedUriForFile = kExpectedUrlRoot + filename;
     let uriForFile = provider.urlForFile(files[index]);
     assert_equals(expectedUriForFile, uriForFile);
   }
 
   assert_equals(kFilenames.length, obs.numSightings(kGetFileURL));
--- a/mail/test/mozmill/cloudfile/test-cloudfile-manager.js
+++ b/mail/test/mozmill/cloudfile/test-cloudfile-manager.js
@@ -100,15 +100,15 @@ function test_load_accounts_and_properly
     // Since we're sorting alphabetically by the displayName,
     // case-insensitive, the items should be ordered with the
     // following accountKeys:
     //
     // someKey3, someKey2, someKey4, someKey1
     const kExpected = ["someKey3", "someKey2", "someKey4",
                        "someKey1"];
 
-    for (let [index, expectedKey] in Iterator(kExpected)) {
+    for (let [index, expectedKey] of kExpected.entries()) {
       let item = richList.getItemAtIndex(index);
       assert_equals(expectedKey, item.value,
                     "The account list is out of order");
     }
   });
 }
--- a/mail/test/mozmill/content-tabs/test-about-support.js
+++ b/mail/test/mozmill/content-tabs/test-about-support.js
@@ -83,22 +83,22 @@ function open_send_via_email(aTab) {
  * Test displaying the about:support page. Also perform a couple of basic tests
  * to check that no major errors have occurred. The basic tests are by no means
  * comprehensive.
  */
 function test_display_about_support() {
   let tab = open_about_support();
   // Check that the document has a few strings that indicate that we've loaded
   // the right page.
-  for (let [, str] in Iterator(ABOUT_SUPPORT_STRINGS)) {
+  for (let str of ABOUT_SUPPORT_STRINGS) {
     assert_content_tab_text_present(tab, str);
   }
 
   // Check that error strings aren't present anywhere
-  for (let [, str] in Iterator(ABOUT_SUPPORT_ERROR_STRINGS)) {
+  for (let str of ABOUT_SUPPORT_ERROR_STRINGS) {
     assert_content_tab_text_absent(tab, str);
   }
   close_tab(tab);
 }
 
 /**
  * Test that our accounts are displayed in order.
  */
@@ -190,27 +190,27 @@ function test_private_data() {
 /**
  * Test (well, sort of) the copy to clipboard function with public data.
  */
 function test_copy_to_clipboard_public() {
   let tab = open_about_support();
   // To avoid destroying the current contents of the clipboard, instead of
   // actually copying to it, we just retrieve what would have been copied to it
   let transferable = tab.browser.contentWindow.getClipboardTransferable();
-  for (let [, flavor] in Iterator(["text/html", "text/unicode"])) {
+  for (let flavor of ["text/html", "text/unicode"]) {
     let data = {};
     transferable.getTransferData(flavor, data, {});
     let text = data.value.QueryInterface(Ci.nsISupportsString).data;
 
-    for (let [, str] in Iterator(ABOUT_SUPPORT_STRINGS)) {
+    for (let str of ABOUT_SUPPORT_STRINGS) {
       if (!text.includes(str))
         mark_failure(["Unable to find \"" + str + "\" in flavor \"" + flavor + "\""]);
     }
 
-    for (let [, str] in Iterator(ABOUT_SUPPORT_ERROR_STRINGS)) {
+    for (let str of ABOUT_SUPPORT_ERROR_STRINGS) {
       if (text.includes(str))
         mark_failure(["Found \"" + str + "\" in flavor \"" + flavor + "\""]);
     }
 
     // Check that private data (profile directory) isn't in the output.
     let profD = Services.dirsvc.get("ProfD", Ci.nsIFile).path;
     if (text.includes(profD))
       mark_failure(["Found profile directory in flavor \"" + flavor + "\""]);
@@ -231,27 +231,27 @@ function test_copy_to_clipboard_private(
   // Display private data.
   let privateElem = content_tab_e(tab, "profile-dir-box");
   content_tab_e(tab, "check-show-private-data").click();
   wait_for_content_tab_element_display_value(tab, privateElem, "inline");
 
   // To avoid destroying the current contents of the clipboard, instead of
   // actually copying to it, we just retrieve what would have been copied to it
   let transferable = tab.browser.contentWindow.getClipboardTransferable();
-  for (let [, flavor] in Iterator(["text/html", "text/unicode"])) {
+  for (let flavor of ["text/html", "text/unicode"]) {
     let data = {};
     transferable.getTransferData(flavor, data, {});
     let text = data.value.QueryInterface(Ci.nsISupportsString).data;
 
-    for (let [, str] in Iterator(ABOUT_SUPPORT_STRINGS)) {
+    for (let str of ABOUT_SUPPORT_STRINGS) {
       if (!text.includes(str))
         mark_failure(["Unable to find \"" + str + "\" in flavor \"" + flavor + "\""]);
     }
 
-    for (let [, str] in Iterator(ABOUT_SUPPORT_ERROR_STRINGS)) {
+    for (let str of ABOUT_SUPPORT_ERROR_STRINGS) {
       if (text.includes(str))
         mark_failure(["Found \"" + str + "\" in flavor \"" + flavor + "\""]);
     }
 
     // Check that private data (profile directory) is in the output.
     let profD = Services.dirsvc.get("ProfD", Ci.nsIFile).path;
     if (!text.includes(profD))
       mark_failure(["Unable to find profile directory in flavor \"" + flavor + "\""]);
@@ -268,22 +268,22 @@ function test_copy_to_clipboard_private(
  */
 function test_send_via_email_public() {
   let tab = open_about_support();
   let cwc = open_send_via_email(tab);
 
   let contentFrame = cwc.e("content-frame");
   let text = contentFrame.contentDocument.body.innerHTML;
 
-  for (let [, str] in Iterator(ABOUT_SUPPORT_STRINGS)) {
+  for (let str of ABOUT_SUPPORT_STRINGS) {
     if (!text.includes(str))
       mark_failure(["Unable to find \"" + str + "\" in compose window"]);
   }
 
-  for (let [, str] in Iterator(ABOUT_SUPPORT_ERROR_STRINGS)) {
+  for (let str of ABOUT_SUPPORT_ERROR_STRINGS) {
     if (text.includes(str))
       mark_failure(["Found \"" + str + "\" in compose window"]);
   }
 
   // Check that private data (profile directory) isn't in the output.
   let profD = Services.dirsvc.get("ProfD", Ci.nsIFile).path;
   if (text.includes(profD))
     mark_failure(["Found profile directory in compose window"]);
@@ -307,22 +307,22 @@ function test_send_via_email_private() {
   content_tab_e(tab, "check-show-private-data").click();
   wait_for_content_tab_element_display_value(tab, privateElem, "inline");
 
   let cwc = open_send_via_email(tab);
 
   let contentFrame = cwc.e("content-frame");
   let text = contentFrame.contentDocument.body.innerHTML;
 
-  for (let [, str] in Iterator(ABOUT_SUPPORT_STRINGS)) {
+  for (let str of ABOUT_SUPPORT_STRINGS) {
     if (!text.includes(str))
       mark_failure(["Unable to find \"" + str + "\" in compose window"]);
   }
 
-  for (let [, str] in Iterator(ABOUT_SUPPORT_ERROR_STRINGS)) {
+  for (let str of ABOUT_SUPPORT_ERROR_STRINGS) {
     if (text.includes(str))
       mark_failure(["Found \"" + str + "\" in compose window"]);
   }
 
   // Check that private data (profile directory) is in the output.
   let profD = Services.dirsvc.get("ProfD", Ci.nsIFile).path;
   if (!text.includes(profD))
     mark_failure(["Unable to find profile directory in compose window"]);
--- a/mail/test/mozmill/folder-display/test-display-name.js
+++ b/mail/test/mozmill/folder-display/test-display-name.js
@@ -181,13 +181,13 @@ function check_display_name(index, colum
 
   let tree = mc.folderDisplay.tree;
   let cellText = tree.view.getCellText(index, tree.columns[columnIndex]);
 
   assert_equals(cellText, expectedName, columnName);
 }
 
 // Generate a test for each message in |messages|.
-for (let [i, message] in Iterator(messages)) {
+for (let [i, message] of messages.entries()) {
   this["test_" + message.name] = function(i, message) {
     check_display_name(i, message.expected.column, message.expected.value);
   }.bind(this, i, message);
 }
--- a/mail/test/mozmill/folder-display/test-folder-pane-visibility.js
+++ b/mail/test/mozmill/folder-display/test-folder-pane-visibility.js
@@ -188,17 +188,17 @@ function test_folder_pane_is_sticky() {
  */
 function test_folder_pane_persistence_generally_works() {
   be_in_folder(folder);
 
   // helper to open tabs with the folder pane in the desired states (1 for
   //  visible, 0 for hidden)
   function openTabs(aConfig) {
     let curState;
-    for (let [iTab, folderPaneVisible] in Iterator(aConfig)) {
+    for (let [iTab, folderPaneVisible] of aConfig.entries()) {
       if (iTab == 0) {
         curState = folderPaneVisible;
       }
       else {
         open_folder_in_new_tab(folder);
         if (curState != folderPaneVisible) {
           toggle_folder_pane();
           curState = folderPaneVisible;
@@ -209,17 +209,17 @@ function test_folder_pane_persistence_ge
 
   // close everything but the first tab.
   function closeTabs() {
     while (mc.tabmail.tabInfo.length > 1)
       mc.tabmail.closeTab(1);
   }
 
   function verifyTabs(aConfig) {
-    for (let [iTab, folderPaneVisible] in Iterator(aConfig)) {
+    for (let [iTab, folderPaneVisible] of aConfig.entries()) {
       switch_tab(iTab);
       dump(" checking tab: " + iTab + "\n");
       if (folderPaneVisible)
         assert_folder_pane_visible();
       else
         assert_folder_pane_hidden();
     }
   }
--- a/mail/test/mozmill/folder-display/test-message-pane-visibility.js
+++ b/mail/test/mozmill/folder-display/test-message-pane-visibility.js
@@ -160,17 +160,17 @@ function test_message_pane_is_sticky() {
  */
 function test_message_pane_persistence_generally_works() {
   be_in_folder(folder);
 
   // helper to open tabs with the message pane in the desired states (1 for
   //  visible, 0 for hidden)
   function openTabs(aConfig) {
     let curState;
-    for (let [iTab, messagePaneVisible] in Iterator(aConfig)) {
+    for (let [iTab, messagePaneVisible] of aConfig.entries()) {
       if (iTab == 0) {
         curState = messagePaneVisible;
       }
       else {
         open_folder_in_new_tab(folder);
         if (curState != messagePaneVisible) {
           toggle_message_pane();
           curState = messagePaneVisible;
@@ -181,17 +181,17 @@ function test_message_pane_persistence_g
 
   // close everything but the first tab.
   function closeTabs() {
     while (mc.tabmail.tabInfo.length > 1)
       close_tab(1);
   }
 
   function verifyTabs(aConfig) {
-    for (let [iTab, messagePaneVisible] in Iterator(aConfig)) {
+    for (let [iTab, messagePaneVisible] of aConfig.entries()) {
       switch_tab(iTab);
       dump(" checking tab: " + iTab + "\n");
       if (messagePaneVisible)
         assert_message_pane_visible();
       else
         assert_message_pane_hidden();
     }
   }
--- a/mail/test/mozmill/newmailaccount/test-newmailaccount.js
+++ b/mail/test/mozmill/newmailaccount/test-newmailaccount.js
@@ -1090,31 +1090,31 @@ function subtest_disabled_fields_when_se
 
   // Our slow search has started. We have kSearchMSeconds milliseconds before
   // the search completes. Plenty of time to check that the right things are
   // disabled.
   wait_for_element_enabled(aController, aController.e("searchSubmit"), false);
   wait_for_element_enabled(aController, aController.e("name"), false);
   let providerCheckboxes = doc.querySelectorAll(".providerCheckbox");
 
-  for (let [, checkbox] in Iterator(providerCheckboxes))
+  for (let checkbox of providerCheckboxes)
     wait_for_element_enabled(aController, checkbox, false);
 
   // Check to ensure that the buttons for switching to the wizard and closing
   // the wizard are still enabled.
   wait_for_element_enabled(aController, doc.querySelector(".close"), true);
   wait_for_element_enabled(aController, doc.querySelector(".existing"), true);
 
   // Ok, wait for the results to come through...
   wait_for_search_results(aController);
 
   wait_for_element_enabled(aController, aController.e("searchSubmit"), true);
   wait_for_element_enabled(aController, aController.e("name"), true);
 
-  for (let [, checkbox] in Iterator(providerCheckboxes))
+  for (let checkbox of providerCheckboxes)
     wait_for_element_enabled(aController, checkbox, true);
 
   // Ok, cleanup time. Put the old suggest URL back.
   Services.prefs.setCharPref(kSuggestFromNamePref, originalSuggest);
 
   // The fake HTTP server stops asynchronously, so let's kick off the stop
   // and wait for it to complete.
   let serverStopped = false;
--- a/mail/test/mozmill/pref-window/test-font-chooser.js
+++ b/mail/test/mozmill/pref-window/test-font-chooser.js
@@ -41,17 +41,17 @@ function setupModule(module) {
   let pwh = collector.getModule("pref-window-helpers");
   pwh.installInto(module);
 
   Cc = Components.classes;
   Ci = Components.interfaces;
 
   gFontEnumerator = Cc["@mozilla.org/gfx/fontenumerator;1"]
                       .createInstance(Ci.nsIFontEnumerator);
-  for (let [, fontType] in Iterator(kFontTypes)) {
+  for (let fontType of kFontTypes) {
     gRealFontLists[fontType] =
       gFontEnumerator.EnumerateFonts(kLanguage, fontType, {});
     if (gRealFontLists[fontType].length == 0)
       throw new Error("No fonts found for language " + kLanguage +
                       " and font type " + fontType + ".");
   }
 }
 
@@ -102,17 +102,17 @@ function _verify_fonts_displayed(aSerif,
  * font.name.<type>.<language> is displayed in the font chooser (if it is
  * present on the cocomputer).
  */
 function test_font_name_displayed() {
   Services.prefs.setCharPref("font.language.group", kLanguage);
 
   // Pick the first font for each font type and set it.
   let expected = {};
-  for (let [fontType, fontList] in Iterator(gRealFontLists)) {
+  for (let [fontType, fontList] of Object.entries(gRealFontLists)) {
     // Work around bug 698238 (on Windows, Courier is returned by the enumerator but
     // substituted with Courier New) by getting the standard (substituted) family
     // name for each font.
     let standardFamily = gFontEnumerator.getStandardFamilyName(fontList[0]);
     Services.prefs.setCharPref("font.name." + fontType + "." + kLanguage,
                                standardFamily);
     expected[fontType] = standardFamily;
   }
@@ -135,17 +135,17 @@ var kFakeFonts = {
  * font.name-list.<type>.<language>.
  */
 function test_font_name_not_present() {
   Services.prefs.setCharPref("font.language.group", kLanguage);
 
   // The fonts we're expecting to see selected in the font chooser for
   // test_font_name_not_present.
   let expected = {};
-  for (let [fontType, fakeFont] in Iterator(kFakeFonts)) {
+  for (let [fontType, fakeFont] of Object.entries(kFakeFonts)) {
     // Look at the font.name-list. We need to verify that the first font is the
     // fake one, and that the second one is present on the user's computer.
     let listPref = "font.name-list." + fontType + "." + kLanguage;
     let fontList = Services.prefs.getCharPref(listPref);
     let fonts = fontList.split(",").map(font => font.trim());
     if (fonts.length != 2)
       throw new Error(listPref + " should have exactly two fonts, but it is " +
                       fontList + ".");
--- a/mail/test/mozmill/shared-modules/test-compose-helpers.js
+++ b/mail/test/mozmill/shared-modules/test-compose-helpers.js
@@ -342,17 +342,17 @@ function add_attachments(aComposeWindow,
   if (!Array.isArray(aUrls))
     aUrls = [aUrls];
 
   if (!Array.isArray(aSizes))
     aSizes = [aSizes];
 
   let attachments = [];
 
-  for (let [i, url] in Iterator(aUrls)) {
+  for (let [i, url] of aUrls.entries()) {
     attachments.push(create_msg_attachment(url, aSizes[i]));
   }
 
   aComposeWindow.window.AddAttachments(attachments);
 }
 
 /**
  * Delete an attachment from the compose window
--- a/mail/test/mozmill/shared-modules/test-folder-display-helpers.js
+++ b/mail/test/mozmill/shared-modules/test-folder-display-helpers.js
@@ -2576,17 +2576,17 @@ function assert_folder_at_index_as(n, st
   let folderN = mc.window.gFolderTreeView.getFTVItemForIndex(n);
   assert_equals(folderN.text, str)
 }
 
 /**
  * Since indexOf does strict equality checking, we need this.
  */
 function _non_strict_index_of(aArray, aSearchElement) {
-  for ([i, item] in Iterator(aArray)) {
+  for ([i, item] of aArray.entries()) {
     if (item == aSearchElement)
       return i;
   }
   return -1;
 }
 
 function _prettify_folder_array(aArray) {
   return aArray.map(folder => folder.prettiestName).join(", ");
--- a/mail/test/mozmill/shared-modules/test-observer-helpers.js
+++ b/mail/test/mozmill/shared-modules/test-observer-helpers.js
@@ -58,17 +58,17 @@ ObservationRecorder.prototype = {
    *
    * Example:  obs.resetTopic("topic");
    *           obs.resetTopic(["topic1", "topic2"]);
    */
   resetTopic: function OR_resetTopic(aTopics) {
     if (!Array.isArray(aTopics))
       aTopics = [aTopics];
 
-    for (let [, topic] in Iterator(aTopics)) {
+    for (let topic of aTopics.entries()) {
       if (topic in this.saw)
         delete this.saw[topic];
       if (topic in this.subject)
         delete this.subject[topic];
       if (topic in this.data)
         delete this.data[topic];
     }
   },
--- a/mail/test/mozmill/shared-modules/test-window-helpers.js
+++ b/mail/test/mozmill/shared-modules/test-window-helpers.js
@@ -900,17 +900,17 @@ var AugmentEverybodyWith = {
           let node = anonNodes[iNode];
           let named = node.querySelector(aQuery.tagName);
           if (named)
             return named;
         }
       }
       else {
         let msg = "Query constraint not implemented, query contained:";
-        for (let [key, val] in Iterator(aQuery)) {
+        for (let [key, val] of Object.entries(aQuery)) {
           msg += " '" + key + "': " + val;
         }
         throw new Error(msg);
       }
       return null;
     },
     /**
      * Wraps a call to a() in an elib.Elem.
--- a/mail/test/mozmill/utils/test-iteratorUtils.js
+++ b/mail/test/mozmill/utils/test-iteratorUtils.js
@@ -73,11 +73,11 @@ function test_toArray_custom_content_ite
   const kExpected = [6, 7, 8, 9];
 
   // Yank the iterator out from content
   let iter = gTab.browser.contentWindow.wrappedJSObject.gCustomIterator;
   let iterArray = iteratorUtils.toArray(iter);
 
   assert_equals(kExpected.length, iterArray.length);
 
-  for (let [i, val] in Iterator(kExpected))
+  for (let [i, val] of kExpected.entries())
     assert_equals(val, iterArray[i]);
 }