Bug 1217318 - Remove for-each from uriloader/. r=bz
authorTooru Fujisawa <arai_a@mac.com>
Mon, 19 Oct 2015 05:41:28 +0900
changeset 304550 2c2f35c908d08dffa9cd95dbc47de54b3fd76ebf
parent 304549 0744ace1b2b9a0b1c744536fbb75144154bfe20e
child 304551 ab657569f554a1b1dae9575fb95ca5a94949442a
push id1001
push userraliiev@mozilla.com
push dateMon, 18 Jan 2016 19:06:03 +0000
treeherdermozilla-release@8b89261f3ac4 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbz
bugs1217318
milestone44.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 1217318 - Remove for-each from uriloader/. r=bz
uriloader/exthandler/nsHandlerService.js
uriloader/exthandler/tests/unit_ipc/test_encoding.js
--- a/uriloader/exthandler/nsHandlerService.js
+++ b/uriloader/exthandler/nsHandlerService.js
@@ -214,17 +214,17 @@ HandlerService.prototype = {
                   getService(Ci.nsIPrefService);
 
     let schemesPrefBranch = prefSvc.getBranch("gecko.handlerService.schemes.");
     let schemePrefList = schemesPrefBranch.getChildList("");
 
     var schemes = {};
 
     // read all the scheme prefs into a hash
-    for each (var schemePrefName in schemePrefList) {
+    for (var schemePrefName of schemePrefList) {
 
       let [scheme, handlerNumber, attribute] = schemePrefName.split(".");
 
       try {
         var attrData =
           schemesPrefBranch.getComplexValue(schemePrefName,
                                             Ci.nsIPrefLocalizedString).data;
         if (!(scheme in schemes))
@@ -254,18 +254,18 @@ HandlerService.prototype = {
         this.fillHandlerInfo(protoInfo, null);
       else
         protoSvc.setProtocolHandlerDefaults(protoInfo, 
                                             osDefaultHandlerFound.value);
 
       // cache the possible handlers to avoid extra xpconnect traversals.      
       let possibleHandlers = protoInfo.possibleApplicationHandlers;
 
-      for each (var handlerPrefs in schemes[scheme]) {
-
+      for (let handlerNumber in schemes[scheme]) {
+        let handlerPrefs = schemes[scheme][handlerNumber];
         let handlerApp = Cc["@mozilla.org/uriloader/web-handler-app;1"].
                          createInstance(Ci.nsIWebHandlerApp);
 
         handlerApp.uriTemplate = handlerPrefs.uriTemplate;
         handlerApp.name = handlerPrefs.name;                
 
         if (!this._isInHandlerArray(possibleHandlers, handlerApp)) {
           possibleHandlers.appendElement(handlerApp, false);
@@ -364,17 +364,17 @@ HandlerService.prototype = {
         }
       }
     }
     aHandlerInfo.alwaysAskBeforeHandling = alwaysAsk;
 
     // If the object represents a MIME type handler, then also retrieve
     // any file extensions.
     if (aHandlerInfo instanceof Ci.nsIMIMEInfo)
-      for each (let fileExtension in this._retrieveFileExtensions(typeID))
+      for (let fileExtension of this._retrieveFileExtensions(typeID))
         aHandlerInfo.appendExtension(fileExtension);
   },
 
   store: function HS_store(aHandlerInfo) {
     // FIXME: when we switch from RDF to something with transactions (like
     // SQLite), enclose the following changes in a transaction so they all
     // get rolled back if any of them fail and we don't leave the datastore
     // in an inconsistent state.
@@ -425,17 +425,17 @@ HandlerService.prototype = {
         possibleHandlerIDs.push(possibleHandlerTarget.ValueUTF8);
     }
 
     // Remove the info record.
     this._removeAssertions(infoID);
 
     // Now that we've removed the info record, remove any possible handlers
     // that aren't referenced by other info records.
-    for each (let possibleHandlerID in possibleHandlerIDs)
+    for (let possibleHandlerID of possibleHandlerIDs)
       if (!this._existsResourceTarget(NC_POSSIBLE_APP, possibleHandlerID))
         this._removeAssertions(possibleHandlerID);
 
     var typeID = this._getTypeID(this._getClass(aHandlerInfo), aHandlerInfo.type);
     this._removeAssertions(typeID);
 
     // Now that there's no longer a handler for this type, remove the type
     // from the list of types for which there are known handlers.
--- a/uriloader/exthandler/tests/unit_ipc/test_encoding.js
+++ b/uriloader/exthandler/tests/unit_ipc/test_encoding.js
@@ -224,13 +224,13 @@ var tests = [
 function run_test() {
 //  do_load_child_test_harness();
   httpserver = new HttpServer();
   httpserver.start(4444);
   do_test_pending();
 
   initChildTestEnv();
 
-  for each (set in tests)
+  for (let set of tests)
     httpserver.registerPathHandler(set[0], set[1]);
 
   runNextTest();
 }