From 0d70925816682c20c4667e3bf80b42fb2dcb3e01 Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Wed, 26 Jul 2023 22:58:09 -0400 Subject: [PATCH] Fix error loading plugin scope after 6a2fcd68980 `AddonManager.getActiveAddons(["extension"])` doesn't return fully loaded addon objects if `getAllAddons()` hasn't been called --- chrome/content/zotero/xpcom/plugins.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/chrome/content/zotero/xpcom/plugins.js b/chrome/content/zotero/xpcom/plugins.js index de0b87433a..75031b7a69 100644 --- a/chrome/content/zotero/xpcom/plugins.js +++ b/chrome/content/zotero/xpcom/plugins.js @@ -46,8 +46,11 @@ Zotero.Plugins = new function () { this.init = async function () { 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) { + if (addon.type != 'extension' || !addon.isActive) continue; addonVersions.set(addon.id, addon.version); _loadScope(addon); setDefaultPrefs(addon);