Closed Bug 778002 Opened 12 years ago Closed 12 years ago

Identity should createInstance XHR, not getService it

Categories

(Core Graveyard :: Identity, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED
mozilla17

People

(Reporter: khuey, Unassigned)

Details

Attachments

(1 file)

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.
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
Closed: 12 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla17
Product: Core → Core Graveyard
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: