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)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla42
Tracking Status
firefox42 --- fixed

People

(Reporter: fabrice, Assigned: fabrice)

Details

Attachments

(1 file)

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?
You should do options.setVersion(JSVERSION_LATEST) in PrepareScript.
Assignee: nobody → fabrice
Attachment #8628545 - Flags: review?(bobbyholley)
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+
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.

Attachment

General

Created:
Updated:
Size: