Bug 1290701 - Replace in-tree consumer of non-standard Iterator() with Object.{values,entries} in toolkit/. r=dtownsend
authorKashyap Gajera <kashyapgajera92@gmail.com>
Wed, 03 Aug 2016 11:53:10 +0530
changeset 349924 94a0f0b6dadd9cf2ea4222474fe5cda97803d02e
parent 349923 f3f6e368b95efabc65040bb36e17a9114dbec638
child 349925 5e045cadaa9fef76f5b5dc61a25cdd927e425486
push id6570
push userraliiev@mozilla.com
push dateMon, 14 Nov 2016 12:26:13 +0000
treeherdermozilla-beta@f455459b2ae5 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdtownsend
bugs1290701
milestone51.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1290701 - Replace in-tree consumer of non-standard Iterator() with Object.{values,entries} in toolkit/. r=dtownsend
toolkit/components/passwordmgr/LoginHelper.jsm
toolkit/components/passwordmgr/test/LoginTestUtils.jsm
toolkit/components/places/PlacesRemoteTabsAutocompleteProvider.jsm
toolkit/components/places/tests/autocomplete/head_autocomplete.js
toolkit/components/places/tests/queries/test_async.js
toolkit/components/places/tests/queries/test_sorting.js
toolkit/components/places/tests/queries/test_tags.js
toolkit/components/places/tests/unit/test_000_frecency.js
toolkit/components/places/tests/unit/test_463863.js
toolkit/components/places/tests/unit/test_adaptive.js
toolkit/components/places/tests/unit/test_preventive_maintenance.js
toolkit/content/aboutTelemetry.js
toolkit/content/tests/chrome/test_bug253481.xul
toolkit/content/tests/unit/test_contentAreaUtils.js
toolkit/crashreporter/CrashSubmit.jsm
toolkit/modules/Preferences.jsm
toolkit/modules/Sqlite.jsm
toolkit/modules/tests/xpcshell/test_session_recorder.js
toolkit/modules/tests/xpcshell/test_sqlite.js
toolkit/modules/tests/xpcshell/test_sqlite_shutdown.js
toolkit/mozapps/downloads/content/downloads.js
toolkit/mozapps/downloads/tests/chrome/test_unknownContentType_dialog_layout.xul
toolkit/mozapps/downloads/tests/unit/test_syncedDownloadUtils.js
--- a/toolkit/components/passwordmgr/LoginHelper.jsm
+++ b/toolkit/components/passwordmgr/LoginHelper.jsm
@@ -142,17 +142,17 @@ this.LoginHelper = {
    *
    * @return A new property bag, that is an instance of nsIWritablePropertyBag,
    *         nsIWritablePropertyBag2, nsIPropertyBag, and nsIPropertyBag2.
    */
   newPropertyBag(aProperties) {
     let propertyBag = Cc["@mozilla.org/hash-property-bag;1"]
                       .createInstance(Ci.nsIWritablePropertyBag);
     if (aProperties) {
-      for (let [name, value] of Iterator(aProperties)) {
+      for (let [name, value] of Object.entries(aProperties)) {
         propertyBag.setProperty(name, value);
       }
     }
     return propertyBag.QueryInterface(Ci.nsIPropertyBag)
                       .QueryInterface(Ci.nsIPropertyBag2)
                       .QueryInterface(Ci.nsIWritablePropertyBag2);
   },
 
--- a/toolkit/components/passwordmgr/test/LoginTestUtils.jsm
+++ b/toolkit/components/passwordmgr/test/LoginTestUtils.jsm
@@ -106,17 +106,17 @@ this.LoginTestUtils.testData = {
    */
   formLogin(modifications) {
     let loginInfo = new LoginInfo("http://www3.example.com",
                                   "http://www.example.com", null,
                                   "the username", "the password",
                                   "form_field_username", "form_field_password");
     loginInfo.QueryInterface(Ci.nsILoginMetaInfo);
     if (modifications) {
-      for (let [name, value] of Iterator(modifications)) {
+      for (let [name, value] of Object.entries(modifications)) {
         loginInfo[name] = value;
       }
     }
     return loginInfo;
   },
 
   /**
    * Returns a new nsILoginInfo for use with HTTP authentication.
@@ -126,17 +126,17 @@ this.LoginTestUtils.testData = {
    *        in the returned nsILoginInfo or nsILoginMetaInfo.
    */
   authLogin(modifications) {
     let loginInfo = new LoginInfo("http://www.example.org", null,
                                   "The HTTP Realm", "the username",
                                   "the password", "", "");
     loginInfo.QueryInterface(Ci.nsILoginMetaInfo);
     if (modifications) {
-      for (let [name, value] of Iterator(modifications)) {
+      for (let [name, value] of Object.entries(modifications)) {
         loginInfo[name] = value;
       }
     }
     return loginInfo;
   },
 
   /**
    * Returns an array of typical nsILoginInfo that could be stored in the
--- a/toolkit/components/places/PlacesRemoteTabsAutocompleteProvider.jsm
+++ b/toolkit/components/places/PlacesRemoteTabsAutocompleteProvider.jsm
@@ -44,17 +44,17 @@ function buildItems() {
 
   // If Sync isn't initialized (either due to lag at startup or due to no user
   // being signed in), don't reach in to Weave.Service as that may initialize
   // Sync unnecessarily - we'll get an observer notification later when it
   // becomes ready and has synced a list of tabs.
   if (weaveXPCService.ready) {
     let engine = Weave.Service.engineManager.get("tabs");
 
-    for (let [guid, client] in Iterator(engine.getAllClients())) {
+    for (let [guid, client] of Object.entries(engine.getAllClients())) {
       clients.set(guid, client);
       for (let tab of client.tabs) {
         let url = tab.urlHistory[0];
         tabs.set(url, { clientId: guid, tab });
       }
     }
   }
   return { clients, tabs };
--- a/toolkit/components/places/tests/autocomplete/head_autocomplete.js
+++ b/toolkit/components/places/tests/autocomplete/head_autocomplete.js
@@ -263,17 +263,17 @@ function run_test() {
   appendTags = true;
 
   // Do an extra function if necessary
   if (func)
     func();
 
   Task.spawn(function* () {
     // Iterate over all tasks and execute them
-    for (let [, [fn, args]] in Iterator(gNextTestSetupTasks)) {
+    for (let [fn, args] of gNextTestSetupTasks) {
       yield fn.apply(this, args);
     }
 
     // Clean up to allow tests to register more functions.
     gNextTestSetupTasks = [];
 
     // At this point frecency could still be updating due to latest pages
     // updates.  This is not a problem in real life, but autocomplete tests
--- a/toolkit/components/places/tests/queries/test_async.js
+++ b/toolkit/components/places/tests/queries/test_async.js
@@ -337,31 +337,31 @@ var DataHelper = {
    * @param  aData
    *         An object describing a bookmark item.
    * @param  aDefaults
    *         An object describing the default bookmark item.
    * @return A copy of aData with defaults values set.
    */
   _makeDataWithDefaults: function DH__makeDataWithDefaults(aData, aDefaults) {
     let dat = {};
-    for (let [prop, val] in Iterator(aDefaults)) {
+    for (let [prop, val] of Object.entries(aDefaults)) {
       dat[prop] = aData.hasOwnProperty(prop) ? aData[prop] : val;
     }
     return dat;
   }
 };
 
 function run_test()
 {
   run_next_test();
 }
 
 add_task(function* test_async()
 {
-  for (let [, test] in Iterator(tests)) {
+  for (let test of tests) {
     yield PlacesUtils.bookmarks.eraseEverything();
 
     test.__proto__ = new Test();
     yield test.setup();
 
     print("------ Running test: " + test.desc);
     yield test.run();
   }
--- a/toolkit/components/places/tests/queries/test_sorting.js
+++ b/toolkit/components/places/tests/queries/test_sorting.js
@@ -1266,17 +1266,17 @@ tests.push({
 
 function run_test()
 {
   run_next_test();
 }
 
 add_task(function* test_sorting()
 {
-  for (let [, test] in Iterator(tests)) {
+  for (let test of tests) {
     yield test.setup();
     yield PlacesTestUtils.promiseAsyncUpdates();
     test.check();
     // sorting reversed, usually SORT_BY have ASC and DESC
     test.check_reverse();
     // Execute cleanup tasks
     yield PlacesUtils.bookmarks.eraseEverything();
     yield PlacesTestUtils.clearHistory();
--- a/toolkit/components/places/tests/queries/test_tags.js
+++ b/toolkit/components/places/tests/queries/test_tags.js
@@ -295,17 +295,17 @@ add_task(function* tagsAreNot_history() 
   do_print("Querying history using tagsAreNot should work correctly");
   var urisAndTags = {
     "http://example.com/1": ["foo", "bar"],
     "http://example.com/2": ["baz", "qux"],
     "http://example.com/3": null
   };
 
   do_print("Add visits and tag the URIs");
-  for (let [pURI, tags] in Iterator(urisAndTags)) {
+  for (let [pURI, tags] of Object.entries(urisAndTags)) {
     let nsiuri = uri(pURI);
     yield PlacesTestUtils.addVisits(nsiuri);
     if (tags)
       PlacesUtils.tagging.tagURI(nsiuri, tags);
   }
 
   do_print('  Querying for "foo" should match only /2 and /3');
   var [query, opts] = makeQuery(["foo"], true);
@@ -330,34 +330,34 @@ add_task(function* tagsAreNot_history() 
   do_print('  Querying for "bogus" should match all');
   [query, opts] = makeQuery(["bogus"], true);
   queryResultsAre(PlacesUtils.history.executeQuery(query, opts).root,
                   ["http://example.com/1",
                    "http://example.com/2",
                    "http://example.com/3"]);
 
   // Clean up.
-  for (let [pURI, tags] in Iterator(urisAndTags)) {
+  for (let [pURI, tags] of Object.entries(urisAndTags)) {
     let nsiuri = uri(pURI);
     if (tags)
       PlacesUtils.tagging.untagURI(nsiuri, tags);
   }
   yield task_cleanDatabase();
 });
 
 add_task(function* tagsAreNot_bookmarks() {
   do_print("Querying bookmarks using tagsAreNot should work correctly");
   var urisAndTags = {
     "http://example.com/1": ["foo", "bar"],
     "http://example.com/2": ["baz", "qux"],
     "http://example.com/3": null
   };
 
   do_print("Add bookmarks and tag the URIs");
-  for (let [pURI, tags] in Iterator(urisAndTags)) {
+  for (let [pURI, tags] of Object.entries(urisAndTags)) {
     let nsiuri = uri(pURI);
     yield addBookmark(nsiuri);
     if (tags)
       PlacesUtils.tagging.tagURI(nsiuri, tags);
   }
 
   do_print('  Querying for "foo" should match only /2 and /3');
   var [query, opts] = makeQuery(["foo"], true);
@@ -387,17 +387,17 @@ add_task(function* tagsAreNot_bookmarks(
   [query, opts] = makeQuery(["bogus"], true);
   opts.queryType = opts.QUERY_TYPE_BOOKMARKS;
   queryResultsAre(PlacesUtils.history.executeQuery(query, opts).root,
                   ["http://example.com/1",
                    "http://example.com/2",
                    "http://example.com/3"]);
 
   // Clean up.
-  for (let [pURI, tags] in Iterator(urisAndTags)) {
+  for (let [pURI, tags] of Object.entries(urisAndTags)) {
     let nsiuri = uri(pURI);
     if (tags)
       PlacesUtils.tagging.untagURI(nsiuri, tags);
   }
   yield task_cleanDatabase();
 });
 
 add_task(function* duplicate_tags() {
@@ -467,17 +467,17 @@ add_task(function* ORed_queries() {
   // Search with lots of tags to make sure tag parameter substitution in SQL
   // can handle it with more than one query.
   for (let i = 0; i < 11; i++) {
     urisAndTags["http://example.com/1"].push("/1 tag " + i);
     urisAndTags["http://example.com/2"].push("/2 tag " + i);
   }
 
   do_print("Add visits and tag the URIs");
-  for (let [pURI, tags] in Iterator(urisAndTags)) {
+  for (let [pURI, tags] of Object.entries(urisAndTags)) {
     let nsiuri = uri(pURI);
     yield PlacesTestUtils.addVisits(nsiuri);
     if (tags)
       PlacesUtils.tagging.tagURI(nsiuri, tags);
   }
 
   do_print("Query for /1 OR query for /2 should match both /1 and /2");
   var [query1, opts] = makeQuery(urisAndTags["http://example.com/1"]);
@@ -514,17 +514,17 @@ add_task(function* ORed_queries() {
   do_print("Query for /1 OR query for /1 with tagsAreNot should match " +
            "both URIs");
   [query1, opts] = makeQuery(urisAndTags["http://example.com/1"]);
   [query2, dummy] = makeQuery(urisAndTags["http://example.com/1"], true);
   root = PlacesUtils.history.executeQueries([query1, query2], 2, opts).root;
   queryResultsAre(root, ["http://example.com/1", "http://example.com/2"]);
 
   // Clean up.
-  for (let [pURI, tags] in Iterator(urisAndTags)) {
+  for (let [pURI, tags] of Object.entries(urisAndTags)) {
     let nsiuri = uri(pURI);
     if (tags)
       PlacesUtils.tagging.untagURI(nsiuri, tags);
   }
   yield task_cleanDatabase();
 });
 
 // The tag keys in query URIs, i.e., "place:tag=foo&!tags=1"
--- a/toolkit/components/places/tests/unit/test_000_frecency.js
+++ b/toolkit/components/places/tests/unit/test_000_frecency.js
@@ -65,17 +65,17 @@ function* task_initializeBucket(bucket) 
   } catch (ex) {}
 
   if (cutoff < 1)
     return;
 
   // generate a date within the cutoff period
   var dateInPeriod = (now - ((cutoff - 1) * 86400 * 1000)) * 1000;
 
-  for (let [bonusName, visitType] in Iterator(bonusPrefs)) {
+  for (let [bonusName, visitType] of Object.entries(bonusPrefs)) {
     var frecency = -1;
     var calculatedURI = null;
     var matchTitle = "";
     var bonusValue = prefs.getIntPref(prefPrefix + bonusName);
     // unvisited (only for first cutoff date bucket)
     if (bonusName == "unvisitedBookmarkBonus" || bonusName == "unvisitedTypedBonus") {
       if (cutoffName == "firstBucketCutoff") {
         let points = Math.ceil(bonusValue / parseFloat(100.0) * weight);
--- a/toolkit/components/places/tests/unit/test_463863.js
+++ b/toolkit/components/places/tests/unit/test_463863.js
@@ -43,17 +43,17 @@ function runQuery(aResultType) {
 function run_test()
 {
   run_next_test();
 }
 
 add_task(function* test_execute()
 {
   // add visits, one for each transition type
-  for (let [, transition] in Iterator(transitions)) {
+  for (let transition of transitions) {
     yield PlacesTestUtils.addVisits({
       uri: uri("http://" + transition + ".mozilla.org/"),
       transition: transition
     });
   }
 
   runQuery(Ci.nsINavHistoryQueryOptions.RESULTS_AS_VISIT);
   runQuery(Ci.nsINavHistoryQueryOptions.RESULTS_AS_URI);
--- a/toolkit/components/places/tests/unit/test_adaptive.js
+++ b/toolkit/components/places/tests/unit/test_adaptive.js
@@ -379,17 +379,17 @@ var deferEnsureResults;
 /**
  * Test adaptive autocomplete.
  */
 add_task(function* test_adaptive()
 {
   // Disable autoFill for this test.
   Services.prefs.setBoolPref("browser.urlbar.autoFill", false);
   do_register_cleanup(() => Services.prefs.clearUserPref("browser.urlbar.autoFill"));
-  for (let [, test] in Iterator(tests)) {
+  for (let test of tests) {
     // Cleanup.
     PlacesUtils.bookmarks.removeFolderChildren(PlacesUtils.unfiledBookmarksFolderId);
     PlacesUtils.bookmarks.removeFolderChildren(PlacesUtils.tagsFolderId);
     observer.runCount = -1;
 
     let types = ["history", "bookmark", "openpage"];
     for (let type of types) {
       Services.prefs.clearUserPref("browser.urlbar.suggest." + type);
--- a/toolkit/components/places/tests/unit/test_preventive_maintenance.js
+++ b/toolkit/components/places/tests/unit/test_preventive_maintenance.js
@@ -1322,17 +1322,17 @@ add_task(function* test_preventive_maint
 {
   // Get current bookmarks max ID for cleanup
   let stmt = mDBConn.createStatement("SELECT MAX(id) FROM moz_bookmarks");
   stmt.executeStep();
   defaultBookmarksMaxId = stmt.getInt32(0);
   stmt.finalize();
   do_check_true(defaultBookmarksMaxId > 0);
 
-  for (let [, test] in Iterator(tests)) {
+  for (let test of tests) {
     dump("\nExecuting test: " + test.name + "\n" + "*** " + test.desc + "\n");
     yield test.setup();
 
     let promiseMaintenanceFinished =
         promiseTopicObserved(FINISHED_MAINTENANCE_NOTIFICATION_TOPIC);
     Services.prefs.clearUserPref("places.database.lastMaintenance");
     let callbackInvoked = false;
     PlacesDBUtils.maintenanceOnIdle(() => callbackInvoked = true);
--- a/toolkit/content/aboutTelemetry.js
+++ b/toolkit/content/aboutTelemetry.js
@@ -876,17 +876,17 @@ var SlowSQL = {
   /**
    * Fills out the table body
    * Tabs & newlines added to cells to make it easier to copy-paste.
    *
    * @param aTable Parent table element
    * @param aSql SQL stats object
    */
   renderTable: function SlowSQL_renderTable(aTable, aSql) {
-    for (let [sql, [hitCount, totalTime]] of Iterator(aSql)) {
+    for (let [sql, [hitCount, totalTime]] of Object.entries(aSql)) {
       let averageTime = totalTime / hitCount;
 
       let sqlRow = document.createElement("tr");
 
       this.appendColumn(sqlRow, "td", hitCount + "\t");
       this.appendColumn(sqlRow, "td", averageTime.toFixed(0) + "\t");
       this.appendColumn(sqlRow, "td", sql + "\n");
 
@@ -1472,17 +1472,17 @@ var KeyValueTable = {
   /**
    * Create the table body
    * Tabs & newlines added to cells to make it easier to copy-paste.
    *
    * @param aTable Table element
    * @param aMeasurements Key/value map
    */
   renderBody: function KeyValueTable_renderBody(aTable, aMeasurements) {
-    for (let [key, value] of Iterator(aMeasurements)) {
+    for (let [key, value] of Object.entries(aMeasurements)) {
       // use .valueOf() to unbox Number, String, etc. objects
       if (value &&
          (typeof value == "object") &&
          (typeof value.valueOf() == "object")) {
         value = RenderObject(value);
       }
 
       let newRow = document.createElement("tr");
@@ -1505,17 +1505,17 @@ var KeyedHistogram = {
     outerDiv.className = "keyed-histogram";
     outerDiv.id = id;
 
     let divTitle = document.createElement("div");
     divTitle.className = "keyed-histogram-title";
     divTitle.appendChild(document.createTextNode(id));
     outerDiv.appendChild(divTitle);
 
-    for (let [name, hgram] of Iterator(keyedHistogram)) {
+    for (let [name, hgram] of Object.entries(keyedHistogram)) {
       Histogram.render(outerDiv, name, hgram);
     }
 
     parent.appendChild(outerDiv);
     return outerDiv;
   },
 };
 
@@ -1928,17 +1928,17 @@ function displayPingData(ping, updatePay
   let hgramDiv = document.getElementById("histograms");
   removeAllChildNodes(hgramDiv);
 
   let histograms = payload.histograms;
   hasData = Object.keys(histograms).length > 0;
   setHasData("histograms-section", hasData);
 
   if (hasData) {
-    for (let [name, hgram] of Iterator(histograms)) {
+    for (let [name, hgram] of Object.entries(histograms)) {
       Histogram.render(hgramDiv, name, hgram, {unpacked: true});
     }
 
     let filterBox = document.getElementById("histograms-filter");
     filterBox.addEventListener("input", Histogram.histogramFilterChanged, false);
     if (filterBox.value.trim() != "") { // on load, no need to filter if empty
       Histogram.filterHistograms(hgramDiv, filterBox.value);
     }
@@ -1949,34 +1949,34 @@ function displayPingData(ping, updatePay
   // Show keyed histogram data
   let keyedDiv = document.getElementById("keyed-histograms");
   removeAllChildNodes(keyedDiv);
 
   setHasData("keyed-histograms-section", false);
   let keyedHistograms = payload.keyedHistograms;
   if (keyedHistograms) {
     let hasData = false;
-    for (let [id, keyed] of Iterator(keyedHistograms)) {
+    for (let [id, keyed] of Object.entries(keyedHistograms)) {
       if (Object.keys(keyed).length > 0) {
         hasData = true;
         KeyedHistogram.render(keyedDiv, id, keyed, {unpacked: true});
       }
     }
     setHasData("keyed-histograms-section", hasData);
   }
 
   // Show addon histogram data
   let addonDiv = document.getElementById("addon-histograms");
   removeAllChildNodes(addonDiv);
 
   let addonHistogramsRendered = false;
   let addonData = payload.addonHistograms;
   if (addonData) {
-    for (let [addon, histograms] of Iterator(addonData)) {
-      for (let [name, hgram] of Iterator(histograms)) {
+    for (let [addon, histograms] of Object.entries(addonData)) {
+      for (let [name, hgram] of Object.entries(histograms)) {
         addonHistogramsRendered = true;
         Histogram.render(addonDiv, addon + ": " + name, hgram, {unpacked: true});
       }
     }
   }
 
   setHasData("addon-histograms-section", addonHistogramsRendered);
 }
--- a/toolkit/content/tests/chrome/test_bug253481.xul
+++ b/toolkit/content/tests/chrome/test_bug253481.xul
@@ -66,17 +66,17 @@ var expectedResults = {
 };
 
 // Put a multi-line string in the clipboard
 SimpleTest.waitForClipboard(testString, function() {
   var clip = Components.classes["@mozilla.org/widget/clipboardhelper;1"]
                        .getService(Components.interfaces.nsIClipboardHelper);
   clip.copyString(testString);
 }, function() {
-  for (let [item, expected] in Iterator(expectedResults)) {
+  for (let [item, expected] of Object.entries(expectedResults)) {
      testPaste(item, $(item), expected);
   }
 
   SimpleTest.finish();
 }, function() {
   ok(false, "Could not copy the string to clipboard, giving up");
 
   SimpleTest.finish();
--- a/toolkit/content/tests/unit/test_contentAreaUtils.js
+++ b/toolkit/content/tests/unit/test_contentAreaUtils.js
@@ -57,17 +57,17 @@ function test_stringBundle() {
   //  These keys are part of the contentAreaUtils.js public API.
   var validFilePickerTitleKeys = [
     "SaveImageTitle",
     "SaveVideoTitle",
     "SaveAudioTitle",
     "SaveLinkTitle",
   ];
 
-  for (let [, filePickerTitleKey] in Iterator(validFilePickerTitleKeys)) {
+  for (let filePickerTitleKey of validFilePickerTitleKeys) {
     // Just check that the string exists
     try {
       ContentAreaUtils.stringBundle.GetStringFromName(filePickerTitleKey);
     } catch (e) {
       do_throw("Error accessing file picker title key: " + filePickerTitleKey);
     }
   }
 }
--- a/toolkit/crashreporter/CrashSubmit.jsm
+++ b/toolkit/crashreporter/CrashSubmit.jsm
@@ -272,17 +272,17 @@ Submitter.prototype = {
 
     let xhr = Cc["@mozilla.org/xmlextras/xmlhttprequest;1"]
               .createInstance(Ci.nsIXMLHttpRequest);
     xhr.open("POST", serverURL, true);
 
     let formData = Cc["@mozilla.org/files/formdata;1"]
                    .createInstance(Ci.nsIDOMFormData);
     // add the data
-    for (let [name, value] in Iterator(this.extraKeyVals)) {
+    for (let [name, value] of Object.entries(this.extraKeyVals)) {
       if (name != "ServerURL") {
         formData.append(name, value);
       }
     }
     if (this.noThrottle) {
       // tell the server not to throttle this, since it was manually submitted
       formData.append("Throttleable", "0");
     }
--- a/toolkit/modules/Preferences.jsm
+++ b/toolkit/modules/Preferences.jsm
@@ -96,17 +96,17 @@ Preferences._get = function(prefName, de
  * the signed 32-bit range -(2^31-1) to 2^31-1, If you have such a number,
  * store it as a string by calling toString() on the number before passing
  * it to this method, i.e.:
  *   Preferences.set("pi", 3.14159.toString())
  *   Preferences.set("big", Math.pow(2, 31).toString()).
  */
 Preferences.set = function(prefName, prefValue) {
   if (isObject(prefName)) {
-    for (let [name, value] in Iterator(prefName))
+    for (let [name, value] of Object.entries(prefName))
       this.set(name, value);
     return;
   }
 
   this._set(prefName, prefValue);
 };
 
 Preferences._set = function(prefName, prefValue) {
--- a/toolkit/modules/Sqlite.jsm
+++ b/toolkit/modules/Sqlite.jsm
@@ -680,17 +680,17 @@ ConnectionData.prototype = Object.freeze
     }
 
     if (Array.isArray(params)) {
       // It's an array of separate params.
       if (params.length && (typeof(params[0]) == "object")) {
         let paramsArray = statement.newBindingParamsArray();
         for (let p of params) {
           let bindings = paramsArray.newBindingParams();
-          for (let [key, value] of Iterator(p)) {
+          for (let [key, value] of Object.entries(p)) {
             bindings.bindByName(key, value);
           }
           paramsArray.addParams(bindings);
         }
 
         statement.bindParameters(paramsArray);
         return;
       }
--- a/toolkit/modules/tests/xpcshell/test_session_recorder.js
+++ b/toolkit/modules/tests/xpcshell/test_session_recorder.js
@@ -236,17 +236,17 @@ add_task(function* test_multiple_session
   }
 
   let recorder = getRecorder("multiple_sessions");
   recorder.onStartup();
 
   let sessions = recorder.getPreviousSessions();
   do_check_eq(Object.keys(sessions).length, 10);
 
-  for (let [i, session] in Iterator(sessions)) {
+  for (let [i, session] of Object.entries(sessions)) {
     do_check_eq(session.activeTicks, i);
 
     if (i > 0) {
       do_check_true(session.startDate.getTime() > sessions[i-1].startDate.getTime());
     }
   }
 
   // #6 is preserved since >=.
--- a/toolkit/modules/tests/xpcshell/test_sqlite.js
+++ b/toolkit/modules/tests/xpcshell/test_sqlite.js
@@ -38,50 +38,50 @@ function sleep(ms) {
 // an uncatchable `Promise.reject`
 function failTestsOnAutoClose(enabled)  {
   Cu.getGlobalForObject(Sqlite).Debugging.failTestsOnAutoClose = enabled;
 }
 
 function getConnection(dbName, extraOptions={}) {
   let path = dbName + ".sqlite";
   let options = {path: path};
-  for (let [k, v] in Iterator(extraOptions)) {
+  for (let [k, v] of Object.entries(extraOptions)) {
     options[k] = v;
   }
 
   return Sqlite.openConnection(options);
 }
 
 function* getDummyDatabase(name, extraOptions={}) {
   const TABLES = {
     dirs: "id INTEGER PRIMARY KEY AUTOINCREMENT, path TEXT",
     files: "id INTEGER PRIMARY KEY AUTOINCREMENT, dir_id INTEGER, path TEXT",
   };
 
   let c = yield getConnection(name, extraOptions);
   c._initialStatementCount = 0;
 
-  for (let [k, v] in Iterator(TABLES)) {
+  for (let [k, v] of Object.entries(TABLES)) {
     yield c.execute("CREATE TABLE " + k + "(" + v + ")");
     c._initialStatementCount++;
   }
 
   return c;
 }
 
 function* getDummyTempDatabase(name, extraOptions={}) {
   const TABLES = {
     dirs: "id INTEGER PRIMARY KEY AUTOINCREMENT, path TEXT",
     files: "id INTEGER PRIMARY KEY AUTOINCREMENT, dir_id INTEGER, path TEXT",
   };
 
   let c = yield getConnection(name, extraOptions);
   c._initialStatementCount = 0;
 
-  for (let [k, v] in Iterator(TABLES)) {
+  for (let [k, v] of Object.entries(TABLES)) {
     yield c.execute("CREATE TEMP TABLE " + k + "(" + v + ")");
     c._initialStatementCount++;
   }
 
   return c;
 }
 
 function run_test() {
--- a/toolkit/modules/tests/xpcshell/test_sqlite_shutdown.js
+++ b/toolkit/modules/tests/xpcshell/test_sqlite_shutdown.js
@@ -13,33 +13,33 @@ Cu.import("resource://gre/modules/Sqlite
 Cu.import("resource://gre/modules/Task.jsm");
 Cu.import("resource://gre/modules/Services.jsm");
 Cu.import("resource://gre/modules/AsyncShutdown.jsm");
 Cu.import("resource://gre/modules/Promise.jsm");
 
 function getConnection(dbName, extraOptions={}) {
   let path = dbName + ".sqlite";
   let options = {path: path};
-  for (let [k, v] in Iterator(extraOptions)) {
+  for (let [k, v] of Object.entries(extraOptions)) {
     options[k] = v;
   }
 
   return Sqlite.openConnection(options);
 }
 
 function* getDummyDatabase(name, extraOptions={}) {
   const TABLES = {
     dirs: "id INTEGER PRIMARY KEY AUTOINCREMENT, path TEXT",
     files: "id INTEGER PRIMARY KEY AUTOINCREMENT, dir_id INTEGER, path TEXT",
   };
 
   let c = yield getConnection(name, extraOptions);
   c._initialStatementCount = 0;
 
-  for (let [k, v] in Iterator(TABLES)) {
+  for (let [k, v] of Object.entries(TABLES)) {
     yield c.execute("CREATE TABLE " + k + "(" + v + ")");
     c._initialStatementCount++;
   }
 
   return c;
 }
 
 function sleep(ms) {
--- a/toolkit/mozapps/downloads/content/downloads.js
+++ b/toolkit/mozapps/downloads/content/downloads.js
@@ -410,17 +410,17 @@ function onUpdateProgress()
 function Startup()
 {
   gDownloadsView = document.getElementById("downloadView");
   gSearchBox = document.getElementById("searchbox");
 
   // convert strings to those in the string bundle
   let sb = document.getElementById("downloadStrings");
   let getStr = string => sb.getString(string);
-  for (let [name, value] in Iterator(gStr))
+  for (let [name, value] of Object.entries(gStr))
     gStr[name] = typeof value == "string" ? getStr(value) : value.map(getStr);
 
   initStatement();
   buildDownloadList(true);
 
   // The DownloadProgressListener (DownloadProgressListener.js) handles progress
   // notifications.
   gDownloadListener = new DownloadProgressListener();
--- a/toolkit/mozapps/downloads/tests/chrome/test_unknownContentType_dialog_layout.xul
+++ b/toolkit/mozapps/downloads/tests/chrome/test_unknownContentType_dialog_layout.xul
@@ -77,19 +77,19 @@ function loadNextTest() {
     SimpleTest.finish();
     return;
   }
   let frame = document.getElementById("testframe");
   frame.setAttribute("src", tests[testIndex].url);
 }
 
 function checkWindow(win) {
-  for (let [id, props] in Iterator(tests[testIndex].elements)) {
+  for (let [id, props] of Object.entries(tests[testIndex].elements)) {
     let elem = win.dialog.dialogElement(id);
-    for (let [prop, value] in Iterator(props)) {
+    for (let [prop, value] of Object.entries(props)) {
       is(elem[prop], value,
          "Element with id " + id + " has property " +
          prop + " set to " + value);
     }
   }
   win.document.documentElement.cancelDialog();
 }
 
--- a/toolkit/mozapps/downloads/tests/unit/test_syncedDownloadUtils.js
+++ b/toolkit/mozapps/downloads/tests/unit/test_syncedDownloadUtils.js
@@ -16,11 +16,11 @@ function run_test()
   // Simulate having multiple downloads requesting time left
   let downloadTimes = {};
   for (let time of [1, 30, 60, 3456, 9999])
     downloadTimes[time] = DownloadUtils.getTimeLeft(time)[0];
 
   // Pretend we're a download status bar also asking for a time left, but we're
   // using a different "last sec". We need to make sure we get the same time.
   let lastSec = 314;
-  for (let [time, text] in Iterator(downloadTimes))
+  for (let [time, text] of Object.entries(downloadTimes))
     do_check_eq(DownloadUtils.getTimeLeft(time, lastSec)[0], text);
 }