Fix error loading plugin scope after 6a2fcd6898

`AddonManager.getActiveAddons(["extension"])` doesn't return fully
loaded addon objects if `getAllAddons()` hasn't been called
This commit is contained in:
Dan Stillman 2023-07-26 22:58:09 -04:00
parent 987b7ea952
commit 0d70925816

View file

@ -46,8 +46,11 @@ Zotero.Plugins = new function () {
this.init = async function () { this.init = async function () {
this._addonObserver.init(); this._addonObserver.init();
var { addons } = await AddonManager.getActiveAddons(["extension"]); // In Fx102, getActiveAddons(["extension"]) doesn't always return fully loaded addon objects
// if getAllAddons() hasn't been called, so use getAllAddons() and do the checks ourselves
var addons = await AddonManager.getAllAddons();
for (let addon of addons) { for (let addon of addons) {
if (addon.type != 'extension' || !addon.isActive) continue;
addonVersions.set(addon.id, addon.version); addonVersions.set(addon.id, addon.version);
_loadScope(addon); _loadScope(addon);
setDefaultPrefs(addon); setDefaultPrefs(addon);