author | Sebastian Hengst <archaeopteryx@coole-files.de> |
Mon, 15 May 2017 23:47:30 +0200 | |
changeset 358486 | 7a2841383525164d5651218a06f3b5e74bd570af |
parent 358485 | ba0f4d2877263ffea0f71f5311ae8c780606b0fc |
child 358487 | c24d57d10d7153e900afb1f756927311ba93ddf5 |
push id | 31827 |
push user | cbook@mozilla.com |
push date | Tue, 16 May 2017 10:34:19 +0000 |
treeherder | mozilla-central@49365d675cbb [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | backout |
bugs | 1358914 |
milestone | 55.0a1 |
backs out | e12dcb4be8551c14073c891a4c9f790e0d790215 |
first release with | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
last release without | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
--- a/toolkit/mozapps/extensions/internal/XPIProvider.jsm +++ b/toolkit/mozapps/extensions/internal/XPIProvider.jsm @@ -5212,17 +5212,25 @@ this.XPIProvider = { // Add other stuff that extensions want. Object.assign(activeAddon.bootstrapScope, {Worker, ChromeWorker}); // Define a console for the add-on XPCOMUtils.defineLazyGetter( activeAddon.bootstrapScope, "console", () => new ConsoleAPI({ consoleID: "addon/" + aId })); - Services.scriptloader.loadSubScript(uri, activeAddon.bootstrapScope); + // As we don't want our caller to control the JS version used for the + // bootstrap file, we run loadSubScript within the context of the + // sandbox with the latest JS version set explicitly. + activeAddon.bootstrapScope.__SCRIPT_URI_SPEC__ = uri; + Components.utils.evalInSandbox( + "Components.classes['@mozilla.org/moz/jssubscript-loader;1'] \ + .getService(Components.interfaces.mozIJSSubScriptLoader) \ + .loadSubScript(__SCRIPT_URI_SPEC__);", + activeAddon.bootstrapScope, "ECMAv5"); } catch (e) { logger.warn("Error loading bootstrap.js for " + aId, e); } // Only access BrowserToolboxProcess if ToolboxProcess.jsm has been // initialized as otherwise, when it will be initialized, all addons' // globals will be added anyways if (this._toolboxProcessLoaded) { @@ -5304,18 +5312,18 @@ this.XPIProvider = { } // Nothing to call for locales if (aAddon.type == "locale") return; let method = undefined; try { - let scope = activeAddon.bootstrapScope; - method = scope[aMethod] || Cu.evalInSandbox(`${aMethod};`, scope); + method = Components.utils.evalInSandbox(`${aMethod};`, + activeAddon.bootstrapScope, "ECMAv5"); } catch (e) { // An exception will be caught if the expected method is not defined. // That will be logged below. } // Extensions are automatically deinitialized in the correct order at shutdown. if (aMethod == "shutdown" && aReason != BOOTSTRAP_REASONS.APP_SHUTDOWN) { activeAddon.disable = true;