Closed Bug 1311223 Opened 5 years ago Closed 5 years ago

Stop using nsISupportsArray for window args

Categories

(Core :: XPCOM, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla52
Tracking Status
firefox52 --- fixed

People

(Reporter: erahm, Assigned: erahm)

References

Details

Attachments

(1 file)

WindowWatcher allows for either nsIArray or nsISupports array to be passed in
for the arguments param. This converts all internal usage to nsIArray.

MozReview-Commit-ID: DQjtIkobik0
Attachment #8802363 - Flags: review?(nfroyd)
Comment on attachment 8802363 [details] [diff] [review]
Stop using nsISupportsArray for window args

Review of attachment 8802363 [details] [diff] [review]:
-----------------------------------------------------------------

This is pretty straightforward. Basically:
 - "supports-array" => "array"
 - "nsISupportsArray" => "nsIMutableArray"
 - js code: 'AppendElement' => "appendElement"
 - (A|a)ppendElement gets extra "/*weak =*/ false" param
Comment on attachment 8802363 [details] [diff] [review]
Stop using nsISupportsArray for window args

Review of attachment 8802363 [details] [diff] [review]:
-----------------------------------------------------------------

I really wonder if anybody ever passes /*weak*/=true to nsIMutableArray.appendElement.  r=me with changes below.

::: browser/components/nsBrowserContentHandler.js
@@ +223,5 @@
>    return Services.ww.openWindow(parent, url, target, features, argArray);
>  }
>  
>  function openPreferences() {
> +  var sa = Components.classes["@mozilla.org/array;1"]

Might as well rename this to |args| to make it more idiomatic.

@@ +252,5 @@
>    var submission = engine.getSubmission(searchTerm, null, "system");
>  
>    // fill our nsISupportsArray with uri-as-wstring, null, null, postData
> +  var sa = Components.classes["@mozilla.org/array;1"]
> +                     .createInstance(Components.interfaces.nsIMutableArray);

Likewise here.
Attachment #8802363 - Flags: review?(nfroyd) → review+
(In reply to Nathan Froyd [:froydnj] from comment #4)
> Comment on attachment 8802363 [details] [diff] [review]
> Stop using nsISupportsArray for window args
> 
> Review of attachment 8802363 [details] [diff] [review]:
> -----------------------------------------------------------------
> 
> I really wonder if anybody ever passes /*weak*/=true to
> nsIMutableArray.appendElement.  r=me with changes below.

I *highly* doubt it.

> 
> ::: browser/components/nsBrowserContentHandler.js
> @@ +223,5 @@
> >    return Services.ww.openWindow(parent, url, target, features, argArray);
> >  }
> >  
> >  function openPreferences() {
> > +  var sa = Components.classes["@mozilla.org/array;1"]
> 
> Might as well rename this to |args| to make it more idiomatic.
> 
> @@ +252,5 @@
> >    var submission = engine.getSubmission(searchTerm, null, "system");
> >  
> >    // fill our nsISupportsArray with uri-as-wstring, null, null, postData
> > +  var sa = Components.classes["@mozilla.org/array;1"]
> > +                     .createInstance(Components.interfaces.nsIMutableArray);
> 
> Likewise here.

Will update.
https://hg.mozilla.org/mozilla-central/rev/313dee79ed92
Status: ASSIGNED → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla52
Depends on: 1312716
You need to log in before you can comment on or make changes to this bug.