зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1358914: Avoid calling evalInSandbox when creating bootstrap scopes. r=rhelmer
MozReview-Commit-ID: GDxnEdxe1bu --HG-- extra : source : e12dcb4be8551c14073c891a4c9f790e0d790215 extra : amend_source : 5bf24dbc660892119d147fca574f1601915d7e63
This commit is contained in:
Родитель
0436b5c05b
Коммит
8214c8e5a5
|
@ -5253,15 +5253,8 @@ this.XPIProvider = {
|
||||||
activeAddon.bootstrapScope, "console",
|
activeAddon.bootstrapScope, "console",
|
||||||
() => new ConsoleAPI({ consoleID: "addon/" + aId }));
|
() => new ConsoleAPI({ consoleID: "addon/" + aId }));
|
||||||
|
|
||||||
// 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;
|
activeAddon.bootstrapScope.__SCRIPT_URI_SPEC__ = uri;
|
||||||
Components.utils.evalInSandbox(
|
Services.scriptloader.loadSubScript(uri, activeAddon.bootstrapScope);
|
||||||
"Components.classes['@mozilla.org/moz/jssubscript-loader;1'] \
|
|
||||||
.getService(Components.interfaces.mozIJSSubScriptLoader) \
|
|
||||||
.loadSubScript(__SCRIPT_URI_SPEC__);",
|
|
||||||
activeAddon.bootstrapScope, "ECMAv5");
|
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
logger.warn("Error loading bootstrap.js for " + aId, e);
|
logger.warn("Error loading bootstrap.js for " + aId, e);
|
||||||
}
|
}
|
||||||
|
@ -5353,8 +5346,8 @@ this.XPIProvider = {
|
||||||
|
|
||||||
let method = undefined;
|
let method = undefined;
|
||||||
try {
|
try {
|
||||||
method = Components.utils.evalInSandbox(`${aMethod};`,
|
let scope = activeAddon.bootstrapScope;
|
||||||
activeAddon.bootstrapScope, "ECMAv5");
|
method = scope[aMethod] || Cu.evalInSandbox(`${aMethod};`, scope);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
// An exception will be caught if the expected method is not defined.
|
// An exception will be caught if the expected method is not defined.
|
||||||
// That will be logged below.
|
// That will be logged below.
|
||||||
|
|
Загрузка…
Ссылка в новой задаче