From d8ceb0f94f9978d0cb7163fc5b6a4aedd5e53488 Mon Sep 17 00:00:00 2001 From: Sebastian Hengst Date: Mon, 15 May 2017 23:47:30 +0200 Subject: [PATCH] Backed out changeset e12dcb4be855 (bug 1358914) for timing out in toolkit/components/extensions/test/mochitest/test_chrome_ext_hybrid_addons.html. r=backout --- .../mozapps/extensions/internal/XPIProvider.jsm | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/toolkit/mozapps/extensions/internal/XPIProvider.jsm b/toolkit/mozapps/extensions/internal/XPIProvider.jsm index 43d564017f67..99805de85a00 100644 --- a/toolkit/mozapps/extensions/internal/XPIProvider.jsm +++ b/toolkit/mozapps/extensions/internal/XPIProvider.jsm @@ -5217,7 +5217,15 @@ this.XPIProvider = { 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); } @@ -5309,8 +5317,8 @@ this.XPIProvider = { 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.