Plugin lifecycle fixes
- Call `shutdown()`/`uninstall()` with `ADDON_UPGRADE`/`ADDON_DOWNGRADE` during plugin upgrade/downgrade - Actually call new version's bootstrap.js, not cached old version - Create new scope for new version - Don't call `shutdown()` on uninstall if not active Fixes #3159
This commit is contained in:
parent
fcb30b5e5d
commit
1766f8bb53
2 changed files with 62 additions and 12 deletions
|
@ -221,6 +221,20 @@ function modify_omni {
|
|||
replace_line '\} else if \(info.addon.sitePermissions\) \{' '} else if (false) {' modules/AddonManager.jsm
|
||||
replace_line '\} else if \(requireConfirm\) \{' '} else if (false) {' modules/AddonManager.jsm
|
||||
|
||||
# Make addon listener methods wait for promises, to allow calling asynchronous plugin `shutdown`
|
||||
# and `uninstall` methods in our `onInstalling` handler
|
||||
replace_line 'callAddonListeners\(aMethod' 'async callAddonListeners(aMethod' modules/AddonManager.jsm
|
||||
# Don't need this one to be async, but we can't easily avoid modifying its `listener[aMethod].apply()` call
|
||||
replace_line 'callManagerListeners\(aMethod' 'async callManagerListeners(aMethod' modules/AddonManager.jsm
|
||||
replace_line 'AddonManagerInternal.callAddonListeners.apply\(AddonManagerInternal, aArgs\);' \
|
||||
'return AddonManagerInternal.callAddonListeners.apply(AddonManagerInternal, aArgs);' modules/AddonManager.jsm
|
||||
replace_line 'listener\[aMethod\].apply\(listener, aArgs\);' \
|
||||
'let maybePromise = listener[aMethod].apply(listener, aArgs);
|
||||
if (maybePromise && maybePromise.then) await maybePromise;' modules/AddonManager.jsm
|
||||
replace_line 'AddonManagerPrivate.callAddonListeners' 'await AddonManagerPrivate.callAddonListeners' modules/addons/XPIInstall.jsm
|
||||
replace_line 'let uninstall = \(\) => \{' 'let uninstall = async () => {' modules/addons/XPIInstall.jsm
|
||||
replace_line 'cancelUninstallAddon\(aAddon\)' 'async cancelUninstallAddon(aAddon)' modules/addons/XPIInstall.jsm
|
||||
|
||||
# No idea why this is necessary, but without it initialization fails with "TypeError: "constructor" is read-only"
|
||||
replace_line 'LoginStore.prototype.constructor = LoginStore;' '\/\/LoginStore.prototype.constructor = LoginStore;' modules/LoginStore.jsm
|
||||
#
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue