Fix accessing the bootstrap methods when they are declared in the new lexical scope

This commit is contained in:
JustOff 2018-04-23 14:52:50 +03:00 • committed by Roy Tam
commit c54e714ef5
5 changed files with 61 additions and 3 deletions

View file

@ -4436,7 +4436,18 @@ this.XPIProvider = {
if (aAddon.type == "locale")
return;
if (!(aMethod in this.bootstrapScopes[aAddon.id])) {
let method = undefined;
try {
method = Components.utils.evalInSandbox(`${aMethod};`,
this.bootstrapScopes[aAddon.id],
"ECMAv5");
}
catch (e) {
// An exception will be caught if the expected method is not defined.
// That will be logged below.
}
if (!method) {
logger.warn("Add-on " + aAddon.id + " is missing bootstrap method " + aMethod);
return;
}
@ -4455,9 +4466,9 @@ this.XPIProvider = {
}
logger.debug("Calling bootstrap method " + aMethod + " on " + aAddon.id + " version " +
aAddon.version);
aAddon.version);
try {
this.bootstrapScopes[aAddon.id][aMethod](params, aReason);
method(params, aReason);
}
catch (e) {
logger.warn("Exception running bootstrap method " + aMethod + " on " + aAddon.id, e);