Closed
Bug 1163898
Opened 9 years ago
Closed 9 years ago
Expose mozAnon constructor js binding to system scopes
Categories
(Core :: DOM: Core & HTML, defect)
Core
DOM: Core & HTML
Tracking
()
RESOLVED
FIXED
mozilla41
Tracking | Status | |
---|---|---|
firefox41 | --- | fixed |
People
(Reporter: Mardak, Assigned: bzbarsky)
References
(Blocks 1 open bug)
Details
Attachments
(2 files)
(deleted),
patch
|
smaug
:
review+
|
Details | Diff | Splinter Review |
(deleted),
patch
|
smaug
:
review+
|
Details | Diff | Splinter Review |
Looks like MozXMLHttpRequestParameters to set {mozAnon: true} is only usable from a window context.
http://mxr.mozilla.org/mozilla-central/source/dom/webidl/XMLHttpRequest.webidl#35
There isn't a good way to set mozAnon from a javascript module because there's no constructor and the mozAnon attribute is readonly.
http://mxr.mozilla.org/mozilla-central/source/dom/base/nsIXMLHttpRequest.idl#322
Assignee | ||
Comment 1•9 years ago
|
||
Cu.importGlobalProperties("XMLHttpRequest") should work, I would think, and then you can just use the constructor.
I wonder whether we should just expose that constructor to system scopes unconditionally...
Flags: needinfo?(bobbyholley)
Assignee | ||
Comment 2•9 years ago
|
||
Er, I meant Cu.importGlobalProperties(["XMLHttpRequest"])
Reporter | ||
Comment 3•9 years ago
|
||
Just making sure if I'm trying this correctly:
Cu.importGlobalProperties(["XMLHttpRequest"]);
let x = new XMLHttpRequest({mozAnon: true, mozSystem: false});
dump([x.mozAnon, x.mozSystem]); // "false,true"
let x = new XMLHttpRequest({mozAnon: true});
dump([x.mozAnon, x.mozSystem]); // "false,true"
let x = new XMLHttpRequest();
dump([x.mozAnon, x.mozSystem]); // "false,true"
Assignee | ||
Comment 4•9 years ago
|
||
Oh. That's dumb. The issue is that nsXMLHttpRequest::InitParameters tries to do stuff with windows. Fix coming up.
Assignee: nobody → bzbarsky
Assignee | ||
Comment 5•9 years ago
|
||
Oh, and mozSystem will continue to test true, since the XHR has a system principal, of course.
Assignee | ||
Comment 6•9 years ago
|
||
Attachment #8604701 -
Flags: review?(bugs)
Assignee | ||
Comment 7•9 years ago
|
||
Attachment #8604702 -
Flags: review?(bugs)
Comment 8•9 years ago
|
||
Comment on attachment 8604701 [details] [diff] [review]
part 1. Give DOMEventTargetHelper a sane accessor for getting its nsIGlobalObject
Shouldn't nsWindowRoot::GetOwnerGlobal() return the current inner window.
nsIGlobalObject* GetParentObject() const {
{ goes to the next line.
Attachment #8604701 -
Flags: review?(bugs) → review+
Assignee | ||
Comment 9•9 years ago
|
||
> Shouldn't nsWindowRoot::GetOwnerGlobal() return the current inner window.
Yes! Good catch.
> { goes to the next line.
I followed the existing style of GetParentObject. I guess I can change both.
Updated•9 years ago
|
Attachment #8604702 -
Flags: review?(bugs) → review+
Updated•9 years ago
|
Flags: needinfo?(bobbyholley)
Comment 10•9 years ago
|
||
Comment 11•9 years ago
|
||
Reporter | ||
Comment 12•9 years ago
|
||
This seems to have caused mochitest-1 failure:
https://treeherder.mozilla.org/logviewer.html#?job_id=9790367&repo=mozilla-inbound
13:55:32 INFO - 1011 INFO TEST-START | dom/base/test/test_bug927196.html
13:55:32 INFO - 1012 INFO TEST-PASS | dom/base/test/test_bug927196.html | XMLHttpRequest should be mozAnon
13:55:32 INFO - 1013 INFO TEST-PASS | dom/base/test/test_bug927196.html | XMLHttpRequest should not be mozSystem
13:55:32 INFO - 1014 INFO TEST-UNEXPECTED-FAIL | dom/base/test/test_bug927196.html | XMLHttpRequest should be mozAnon - got true, expected false
13:55:32 INFO - 1015 INFO TEST-PASS | dom/base/test/test_bug927196.html | XMLHttpRequest should not be mozSystem
13:55:32 INFO - 1016 INFO TEST-PASS | dom/base/test/test_bug927196.html | XMLHttpRequest should be mozAnon
13:55:32 INFO - 1017 INFO TEST-PASS | dom/base/test/test_bug927196.html | XMLHttpRequest should be mozAnon
13:55:32 INFO - 1018 INFO TEST-PASS | dom/base/test/test_bug927196.html | XMLHttpRequest should not be mozSystem
13:55:32 INFO - 1019 INFO TEST-PASS | dom/base/test/test_bug927196.html | XMLHttpRequest should be mozAnon
13:55:32 INFO - 1020 INFO TEST-PASS | dom/base/test/test_bug927196.html | XMLHttpRequest should be mozSystem
13:55:32 INFO - 1021 INFO TEST-PASS | dom/base/test/test_bug927196.html | XMLHttpRequest should be mozAnon
http://mxr.mozilla.org/mozilla-central/source/dom/base/test/test_bug927196.html?force=1#47
46 req = new XMLHttpRequest({mozAnon: true, mozSystem: true});
47 is(req.mozAnon, false, "XMLHttpRequest should be mozAnon");
Not sure why "should be mozAnon" is checking false..
Assignee | ||
Comment 13•9 years ago
|
||
> Not sure why "should be mozAnon" is checking false..
Because the existing code was buggy and the test was written around the bug without even noticing it. The patches here fix that bug. Anyway, test fix pushed.
https://hg.mozilla.org/mozilla-central/rev/2db3491d59e4
https://hg.mozilla.org/mozilla-central/rev/d9429069ec0e
https://hg.mozilla.org/mozilla-central/rev/6ffbd3150f6c
Status: NEW → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla41
Updated•6 years ago
|
Component: DOM → DOM: Core & HTML
You need to log in
before you can comment on or make changes to this bug.
Description
•