From ccf4fd20cc67b4548098e1b2fb3a4109c82f46fa Mon Sep 17 00:00:00 2001 From: windingwind <33902321+windingwind@users.noreply.github.com> Date: Tue, 18 Mar 2025 19:36:53 +0100 Subject: [PATCH] Fix plugin scope not loaded if plugin is disabled when starting Zotero (#5129) --- chrome/content/zotero/xpcom/plugins.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/chrome/content/zotero/xpcom/plugins.js b/chrome/content/zotero/xpcom/plugins.js index 2e435ccf76..cb483cb817 100644 --- a/chrome/content/zotero/xpcom/plugins.js +++ b/chrome/content/zotero/xpcom/plugins.js @@ -122,6 +122,9 @@ Zotero.Plugins = new function () { * https://searchfox.org/mozilla-esr60/source/toolkit/mozapps/extensions/internal/XPIProvider.jsm#4233 */ function _loadScope(addon) { + if (scopes.has(addon.id)) { + return; + } var scope = new Cu.Sandbox( Services.scriptSecurityManager.getSystemPrincipal(), { @@ -662,6 +665,7 @@ Zotero.Plugins = new function () { return; } Zotero.debug("Enabling plugin " + addon.id); + _loadScope(addon); setDefaultPrefs(addon); await registerLocales(addon); await _callMethod(addon, 'startup', REASONS.ADDON_ENABLE);