Bug 1153671 - Part 3: Remove non-standard for-each-in from suite/. r=Ian,Ratty a=ewong DONTBUILD SEAMONKEY_2_49_ESR_RELBRANCH
authorRavi Shankar <wafflespeanut@gmail.com>
Wed, 24 Jun 2015 08:56:00 +0900
branchSEAMONKEY_2_49_ESR_RELBRANCH
changeset 28333 3227bef590b8771914e24ea7be5981ddd4c7f154
parent 28332 f36daf7e1905a52393c528eec9527a624fa3663d
child 28334 5cf3e0e5e5b1dac295de52fb7b21628ab5b42eb3
push id2136
push userfrgrahl@gmx.net
push dateMon, 15 Jul 2019 16:13:42 +0000
treeherdercomm-esr52@6b30146aa411 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersIan, Ratty, ewong
bugs1153671
Bug 1153671 - Part 3: Remove non-standard for-each-in from suite/. r=Ian,Ratty a=ewong DONTBUILD SeaMonkey ESR52 release branch only.
suite/common/pref/pref-applications.js
suite/common/search/engineManager.js
suite/common/src/nsSessionStore.js
suite/common/sync/syncNotification.xml
suite/common/sync/syncQuota.js
suite/common/sync/syncSetup.js
suite/mailnews/mailViewList.js
suite/mailnews/mailWindow.js
suite/mailnews/mailWindowOverlay.js
suite/mailnews/msgHdrViewOverlay.js
suite/mailnews/msgViewNavigation.js
--- a/suite/common/pref/pref-applications.js
+++ b/suite/common/pref/pref-applications.js
@@ -568,17 +568,17 @@ FeedHandlerInfo.prototype = {
       let defaultApp = this._defaultApplicationHandler;
       if (!defaultApp || !defaultApp.equals(preferredApp))
         this._possibleApplicationHandlers.appendElement(preferredApp, false);
     }
 
     if (converterSvc) {
       // Add the registered web handlers.  There can be any number of these.
       var webHandlers = converterSvc.getContentHandlers(this.type, {});
-      for each (let webHandler in webHandlers)
+      for (let webHandler of webHandlers)
         this._possibleApplicationHandlers.appendElement(webHandler, false);
     }
 
     return this._possibleApplicationHandlers;
   },
 
   __defaultApplicationHandler: undefined,
   get _defaultApplicationHandler() {
@@ -713,17 +713,17 @@ FeedHandlerInfo.prototype = {
   // Storage
 
   // Changes to the preferred action and handler take effect immediately
   // (we write them out to the preferences right as they happen),
   // so we when the controller calls store() after modifying the handlers,
   // the only thing we need to store is the removal of possible handlers
   // XXX Should we hold off on making the changes until this method gets called?
   store: function() {
-    for each (let app in this._possibleApplicationHandlers._removed) {
+    for (let app of this._possibleApplicationHandlers._removed) {
       if (app instanceof nsILocalHandlerApp) {
         let pref = document.getElementById(PREF_FEED_SELECTED_APP);
         var preferredAppFile = pref.value;
         if (preferredAppFile) {
           let preferredApp = getLocalHandlerApp(preferredAppFile);
           if (app.equals(preferredApp))
             pref.reset();
         }
@@ -1099,17 +1099,17 @@ var gApplicationsPane = {
       this._list.lastChild.remove();
 
     var visibleTypes = this._visibleTypes;
 
     // If the user is filtering the list, then only show matching types.
     if (this._filter.value)
       visibleTypes = visibleTypes.filter(this._matchesFilter, this);
 
-    for each (let visibleType in visibleTypes) {
+    for (let visibleType of visibleTypes) {
       let item = document.createElement("listitem");
       item.setAttribute("allowevents", "true");
       item.setAttribute("type", visibleType.type);
       item.setAttribute("typeDescription", this._describeType(visibleType));
       if (visibleType.smallIcon)
         item.setAttribute("typeIcon", visibleType.smallIcon);
       else
         item.setAttribute("typeClass", visibleType.typeClass);
--- a/suite/common/search/engineManager.js
+++ b/suite/common/search/engineManager.js
@@ -282,17 +282,17 @@ EngineStore.prototype = {
     return val;
   },
 
   _getIndexForEngine: function ES_getIndexForEngine(aEngine) {
     return this._engines.indexOf(aEngine);
   },
 
   _getEngineByName: function ES_getEngineByName(aName) {
-    for each (var engine in this._engines)
+    for (var engine of this._engines)
       if (engine.name == aName)
         return engine;
 
     return null;
   },
 
   _cloneEngine: function ES_cloneEngine(aEngine) {
     var clonedObj={};
--- a/suite/common/src/nsSessionStore.js
+++ b/suite/common/src/nsSessionStore.js
@@ -2137,17 +2137,17 @@ SessionStoreService.prototype = {
       ids.push(ix);
       if (!this._windows[ix].isPopup)
         nonPopupCount++;
     }
     this._updateCookies(total);
 
     // collect the data for all windows yet to be restored
     for (ix in this._statesToRestore) {
-      for each (let winData in this._statesToRestore[ix].windows) {
+      for (let winData of this._statesToRestore[ix].windows) {
         total.push(winData);
         if (!winData.isPopup)
           nonPopupCount++;
       }
     }
 
     // shallow copy this._closedWindows to preserve current state
     let lastClosedWindowsCopy = this._closedWindows.slice();
--- a/suite/common/sync/syncNotification.xml
+++ b/suite/common/sync/syncNotification.xml
@@ -39,17 +39,17 @@
       </method>
 
       <method name="onNotificationRemoved">
         <parameter name="subject"/>
         <parameter name="data"/>
         <body><![CDATA[
           // If the view of the notification hasn't been removed yet, remove it.
           var notifications = this.allNotifications;
-          for each (var notification in notifications) {
+          for (let notification of notifications) {
             if (notification.notification == subject) {
               notification.close();
               break;
             }
           }
         ]]></body>
       </method>
 
--- a/suite/common/sync/syncQuota.js
+++ b/suite/common/sync/syncQuota.js
@@ -59,17 +59,17 @@ var gSyncQuota = {
     if (this._usage_req)
       this._usage_req.abort();
     if (this._quota_req)
       this._quota_req.abort();
   },
 
   onAccept: function onAccept() {
     let engines = gUsageTreeView.getEnginesToDisable();
-    for each (let engine in engines) {
+    for (let engine of engines) {
       Weave.Service.engineManager.get(engine).enabled = false;
     }
     if (engines.length) {
       // The 'Weave' object will disappear once the window closes.
       let Service = Weave.Service;
       Weave.Utils.nextTick(function() { Service.sync(); });
     }
     return true;
@@ -90,17 +90,17 @@ var gUsageTreeView = {
   /*
    * Internal data structures underlaying the tree.
    */
   _collections: [],
   _byname: {},
 
   init: function init() {
     let retrievingLabel = gSyncQuota.bundle.getString("quota.retrieving.label");
-    for each (let engine in Weave.Service.engineManager.getEnabled()) {
+    for (let engine of Weave.Service.engineManager.getEnabled()) {
       if (this._ignored[engine.name])
         continue;
 
       // Some engines use the same pref, which means they can only be turned on
       // and off together. We need to combine them here as well.
       let existing = this._byname[engine.prefName];
       if (existing) {
         existing.engines.push(engine.name);
@@ -125,25 +125,25 @@ var gUsageTreeView = {
       return engine.Name;
     }
   },
 
   /*
    * Process the quota information as returned by info/collection_usage.
    */
   displayUsageData: function displayUsageData(data) {
-    for each (let coll in this._collections) {
+    for (let coll of this._collections) {
       coll.size = 0;
       // If we couldn't retrieve any data, just blank out the label.
       if (!data) {
         coll.sizeLabel = "";
         continue;
       }
 
-      for each (let engineName in coll.engines)
+      for (let engineName of coll.engines)
         coll.size += data[engineName] || 0;
       let sizeLabel = "";
       sizeLabel = gSyncQuota.bundle.getFormattedString(
         "quota.sizeValueUnit.label", gSyncQuota.convertKB(coll.size));
       coll.sizeLabel = sizeLabel;
     }
     let sizeColumn = this.treeBox.columns.getNamedColumn("size");
     this.treeBox.invalidateColumn(sizeColumn);
@@ -168,17 +168,17 @@ var gUsageTreeView = {
     // Update the tree
     let collection = this._collections[row];
     collection.enabled = !collection.enabled;
     this.treeBox.invalidateRow(row);
 
     // Display which ones will be removed
     let freeup = 0;
     let toremove = [];
-    for each (collection in this._collections) {
+    for (let collection of this._collections) {
       if (collection.enabled)
         continue;
       toremove.push(collection.name);
       freeup += collection.size;
     }
 
     let caption = document.getElementById("treeCaption");
     if (!toremove.length) {
--- a/suite/common/sync/syncSetup.js
+++ b/suite/common/sync/syncSetup.js
@@ -855,21 +855,17 @@ var gSyncSetup = {
                       .replace("#1", logins.length);
         } else {
           document.getElementById("passwordCount").hidden = true;
         }
 
         let addonsEngine = Weave.Service.engineManager.get("addons");
         if (addonsEngine.enabled) {
           let ids = addonsEngine._store.getAllIDs();
-          let blessedcount = 0;
-          for each (let i in ids) {
-            if (i)
-              blessedcount++;
-          }
+          let blessedcount = Object.keys(ids).filter(id => ids[id]).length;
           // Bug 600141 does not apply as this does not have to support existing strings.
           document.getElementById("addonCount").value =
             PluralForm.get(blessedcount,
                            this._stringBundle.GetStringFromName("addonsCount.label"))
                       .replace("#1", blessedcount);
         } else {
           document.getElementById("addonCount").hidden = true;
         }
@@ -887,17 +883,17 @@ var gSyncSetup = {
         function appendNode(label) {
           let box = document.getElementById("clientList");
           let node = document.createElement("label");
           node.setAttribute("value", label);
           node.setAttribute("class", "data indent");
           box.appendChild(node);
         }
 
-        for each (let name in Weave.Service.clientsEngine.stats.names) {
+        for (let name of Weave.Service.clientsEngine.stats.names) {
           // Don't list the current client
           if (name == Weave.Service.clientsEngine.localName)
             continue;
 
           // Only show the first several client names
           if (++count <= 5)
             appendNode(name);
         }
--- a/suite/mailnews/mailViewList.js
+++ b/suite/mailnews/mailViewList.js
@@ -50,17 +50,17 @@ var gMailViewListController =
         break;
     }
   },
 
   onEvent: function(aEvent) {},
 
   onCommandUpdate: function()
   {
-    for each (let command in ["cmd_new", "cmd_edit", "cmd_delete"])
+    for (let command of ["cmd_new", "cmd_edit", "cmd_delete"])
       goUpdateCommand(command);
   }
 };
 
 function MailViewListOnLoad()
 {
   gMailListView = Components.classes["@mozilla.org/messenger/mailviewlist;1"]
                             .getService(Components.interfaces.nsIMsgMailViewList);
--- a/suite/mailnews/mailWindow.js
+++ b/suite/mailnews/mailWindow.js
@@ -236,17 +236,17 @@ function InitMsgWindow()
 }
 
 function messagePaneOnResize(event)
 {
   // scale any overflowing images
   var messagepane = getMessageBrowser();
   var doc = messagepane.contentDocument;
   var imgs = doc.images;
-  for each (var img in imgs)
+  for (var img of imgs)
   {
     if (img.className == "moz-attached-image")
     {
       if (img.naturalWidth <= doc.body.clientWidth)
       {
         img.removeAttribute("isshrunk");
         img.removeAttribute("overflowing");
       }
--- a/suite/mailnews/mailWindowOverlay.js
+++ b/suite/mailnews/mailWindowOverlay.js
@@ -2893,17 +2893,17 @@ function OnMsgParsed(aUrl)
   // notify anyone (e.g., extensions) who's interested in when a message is loaded.
   var msgURI = GetLoadedMessage();
   Services.obs.notifyObservers(msgWindow.msgHeaderSink,
                                "MsgMsgDisplayed", msgURI);
 
   // scale any overflowing images
   var doc = getMessageBrowser().contentDocument;
   var imgs = doc.getElementsByTagName("img");
-  for each (var img in imgs)
+  for (var img of imgs)
   {
     if (img.className == "moz-attached-image" &&
         img.naturalWidth > doc.body.clientWidth)
     {
       if (img.hasAttribute("shrinktofit"))
         img.setAttribute("isshrunk", "true");
       else
         img.setAttribute("overflowing", "true");
--- a/suite/mailnews/msgHdrViewOverlay.js
+++ b/suite/mailnews/msgHdrViewOverlay.js
@@ -692,17 +692,17 @@ function SetTagHeader()
     return; // no msgHdr to add our tags to
   }
 
   // get the list of known tags
   var tagService = Components.classes["@mozilla.org/messenger/tagservice;1"]
                    .getService(Components.interfaces.nsIMsgTagService);
   var tagArray = tagService.getAllTags({});
   var tagKeys = {};
-  for each (var tagInfo in tagArray)
+  for (var tagInfo of tagArray)
     if (tagInfo.tag)
       tagKeys[tagInfo.key] = true;
 
   // extract the tag keys from the msgHdr
   var msgKeyArray = msgHdr.getStringProperty("keywords").split(" ");
 
   // attach legacy label to the front if not already there
   var label = msgHdr.label;
--- a/suite/mailnews/msgViewNavigation.js
+++ b/suite/mailnews/msgViewNavigation.js
@@ -117,17 +117,17 @@ function FindNextFolder()
   return null;
 }
 
 function GetRootFoldersInFolderPaneOrder()
 {
   var accounts = allAccountsSorted(false);
 
   var serversMsgFolders = [];
-  for each (var account in accounts)
+  for (var account of accounts)
     serversMsgFolders.push(account.incomingServer.rootMsgFolder);
 
   return serversMsgFolders;
 }
 
 function CrossFolderNavigation(type)
 {
   // do cross folder navigation for next unread message/thread and message history