Closed
Bug 1179102
Opened 10 years ago
Closed 10 years ago
The async version of loadSubscript doesn't get the right JS version.
Categories
(Core :: XPConnect, defect)
Core
XPConnect
Tracking
()
RESOLVED
FIXED
mozilla42
Tracking | Status | |
---|---|---|
firefox42 | --- | fixed |
People
(Reporter: fabrice, Assigned: fabrice)
Details
Attachments
(1 file)
1.06 KB,
patch
|
bholley
:
review+
|
Details | Diff | Splinter Review |
When calling Services.scriptloader.loadSubscriptWithOptions(uri, { async: true }) the JS version at http://mxr.mozilla.org/mozilla-central/source/js/xpconnect/loader/mozJSSubScriptLoader.cpp#220 is 0, which means we can't have nice things.
Loading the same script synchronously we get the correct version, 180.
It seems like we're not using the right JS context here.
Bobby, any idea how to fix that?
Comment 1•10 years ago
|
||
You should do options.setVersion(JSVERSION_LATEST) in PrepareScript.
Assignee | ||
Comment 2•10 years ago
|
||
Assignee: nobody → fabrice
Attachment #8628545 -
Flags: review?(bobbyholley)
Comment 3•10 years ago
|
||
Comment on attachment 8628545 [details] [diff] [review]
asyncload-js-version.patch
Review of attachment 8628545 [details] [diff] [review]:
-----------------------------------------------------------------
::: js/xpconnect/loader/mozJSSubScriptLoader.cpp
@@ +129,5 @@
> MutableHandleFunction function)
> {
> JS::CompileOptions options(cx);
> options.setFileAndLine(uriStr, 1);
> + options.setVersion(JSVERSION_LATEST);
All the setters on CompileOptions return a self-ref. So you can do:
options.setFileAndLine(uriStr, 1)
.setVersion(JSVERSION_LATEST);
Attachment #8628545 -
Flags: review?(bobbyholley) → review+
Comment 5•10 years ago
|
||
Status: NEW → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla42
You need to log in
before you can comment on or make changes to this bug.
Description
•