diff options
author | JustOff <Off.Just.Off@gmail.com> | 2018-04-23 14:52:50 +0300 |
---|---|---|
committer | JustOff <Off.Just.Off@gmail.com> | 2018-04-23 14:52:50 +0300 |
commit | be2b3635ad7f21582a5cfd5a25fc4ec41653c1c7 (patch) | |
tree | 2efcee5cff17dc0dd8cf9237ddaede584c7b22b1 /toolkit/mozapps/extensions/internal | |
parent | bccb9c1708f007ada1ea8c4879db88a587f0a450 (diff) | |
download | UXP-be2b3635ad7f21582a5cfd5a25fc4ec41653c1c7.tar UXP-be2b3635ad7f21582a5cfd5a25fc4ec41653c1c7.tar.gz UXP-be2b3635ad7f21582a5cfd5a25fc4ec41653c1c7.tar.lz UXP-be2b3635ad7f21582a5cfd5a25fc4ec41653c1c7.tar.xz UXP-be2b3635ad7f21582a5cfd5a25fc4ec41653c1c7.zip |
Fix accessing the bootstrap methods when they are declared in the new lexical scope
Diffstat (limited to 'toolkit/mozapps/extensions/internal')
-rw-r--r-- | toolkit/mozapps/extensions/internal/XPIProvider.jsm | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/toolkit/mozapps/extensions/internal/XPIProvider.jsm b/toolkit/mozapps/extensions/internal/XPIProvider.jsm index 72a460e4a..c43811ba8 100644 --- a/toolkit/mozapps/extensions/internal/XPIProvider.jsm +++ b/toolkit/mozapps/extensions/internal/XPIProvider.jsm @@ -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); |