Bug 1312901 - Part 2: Use nsIArray for URL argument when opening a window. r=Gijs
authorEric Rahm <erahm@mozilla.com>
Thu, 27 Oct 2016 14:22:14 -0700
changeset 319898 d0f100627ed89dfaede75f4ae63be078f35d8e0c
parent 319897 8f6c4c5eb7035be37363cd651aefebd2b8d1c957
child 319899 1da68ee13f25373b5a8f310fe3d598f4f36dcf72
push id20749
push userryanvm@gmail.com
push dateSat, 29 Oct 2016 13:21:21 +0000
treeherderfx-team@1b170b39ed6b [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersGijs
bugs1312901
milestone52.0a1
Bug 1312901 - Part 2: Use nsIArray for URL argument when opening a window. r=Gijs This updates the URL argument to use an nsIMutableArray instead of an nsIArray. MozReview-Commit-ID: 45kvKCBYNK6
browser/components/extensions/ext-windows.js
browser/components/nsBrowserContentHandler.js
--- a/browser/components/extensions/ext-windows.js
+++ b/browser/components/extensions/ext-windows.js
@@ -115,19 +115,19 @@ extensions.registerSchemaAPI("windows", 
           if (createData.incognito !== null && createData.incognito != incognito) {
             return Promise.reject({message: "`incognito` property must match the incognito state of tab"});
           }
           createData.incognito = incognito;
 
           args.appendElement(tab, /* weak = */ false);
         } else if (createData.url !== null) {
           if (Array.isArray(createData.url)) {
-            let array = Cc["@mozilla.org/supports-array;1"].createInstance(Ci.nsISupportsArray);
+            let array = Cc["@mozilla.org/array;1"].createInstance(Ci.nsIMutableArray);
             for (let url of createData.url) {
-              array.AppendElement(mkstr(url));
+              array.appendElement(mkstr(url), /* weak = */ false);
             }
             args.appendElement(array, /* weak = */ false);
           } else {
             args.appendElement(mkstr(createData.url), /* weak = */ false);
           }
         } else {
           args.appendElement(mkstr(aboutNewTabService.newTabURL), /* weak = */ false);
         }
--- a/browser/components/nsBrowserContentHandler.js
+++ b/browser/components/nsBrowserContentHandler.js
@@ -196,23 +196,23 @@ function openWindow(parent, url, target,
   var stringArgs = null;
   if (args instanceof Array) // array
     stringArgs = args;
   else if (args) // string
     stringArgs = [args];
 
   if (stringArgs) {
     // put the URIs into argArray
-    var uriArray = Components.classes["@mozilla.org/supports-array;1"]
-                       .createInstance(Components.interfaces.nsISupportsArray);
+    var uriArray = Components.classes["@mozilla.org/array;1"]
+                       .createInstance(Components.interfaces.nsIMutableArray);
     stringArgs.forEach(function (uri) {
       var sstring = Components.classes["@mozilla.org/supports-string;1"]
                               .createInstance(nsISupportsString);
       sstring.data = uri;
-      uriArray.AppendElement(sstring);
+      uriArray.appendElement(sstring, /* weak = */ false);
     });
     argArray.appendElement(uriArray, /*weak =*/ false);
   } else {
     argArray.appendElement(null, /*weak =*/ false);
   }
 
   // Pass these as null to ensure that we always trigger the "single URL"
   // behavior in browser.js's gBrowserInit.onLoad (which handles the window