diff options
author | Moonchild <mcwerewolf@gmail.com> | 2018-04-23 16:37:25 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-04-23 16:37:25 +0200 |
commit | 31187065d93694490b389db9d4cdc00c5c611260 (patch) | |
tree | 2efcee5cff17dc0dd8cf9237ddaede584c7b22b1 /toolkit/mozapps/extensions/internal/XPIProvider.jsm | |
parent | bccb9c1708f007ada1ea8c4879db88a587f0a450 (diff) | |
parent | be2b3635ad7f21582a5cfd5a25fc4ec41653c1c7 (diff) | |
download | UXP-31187065d93694490b389db9d4cdc00c5c611260.tar UXP-31187065d93694490b389db9d4cdc00c5c611260.tar.gz UXP-31187065d93694490b389db9d4cdc00c5c611260.tar.lz UXP-31187065d93694490b389db9d4cdc00c5c611260.tar.xz UXP-31187065d93694490b389db9d4cdc00c5c611260.zip |
Merge pull request #240 from JustOff/PR_bootstrap_scope
Fix accessing the bootstrap methods when they are declared in the new lexical scope
Diffstat (limited to 'toolkit/mozapps/extensions/internal/XPIProvider.jsm')
-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); |