The default bug view has changed. See this FAQ.

Identity should createInstance XHR, not getService it

RESOLVED FIXED in mozilla17

Status

()

Core
Identity
RESOLVED FIXED
5 years ago
5 years ago

People

(Reporter: khuey, Unassigned)

Tracking

unspecified
mozilla17
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment)

http://mxr.mozilla.org/mozilla-central/source/toolkit/identity/Identity.jsm#257

256     // this appears to be a more successful way to get at xmlhttprequest (which supposedly will close with a window
257     let req = Cc["@mozilla.org/xmlextras/xmlhttprequest;1"]
258                 .getService(Ci.nsIXMLHttpRequest);

This is bad because you'll get the same XHR everytime.  If some other code (say an addon) does the same thing you'll cross the streams, and you could start getting load events fired for a totally different request.
And that would mean total protonic reversal.

Wow - thanks for catching this.  I had no idea getService returned a singleton.  But now I've found this: https://developer.mozilla.org/en/Components.classes and will update the code accordingly.

Thanks again, j.
Created attachment 646632 [details] [diff] [review]
Use createInstance to get a new, not singleton, XHR instance on each invocation

Hi, Kyle,

Is this correct?

Thanks,
j
Attachment #646632 - Flags: review?(khuey)
Comment on attachment 646632 [details] [diff] [review]
Use createInstance to get a new, not singleton, XHR instance on each invocation

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

Yep.
Attachment #646632 - Flags: review?(khuey) → review+
https://hg.mozilla.org/mozilla-central/rev/f6f7358234b3
Status: NEW → RESOLVED
Last Resolved: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla17
You need to log in before you can comment on or make changes to this bug.