Fix plugin scope not loaded if plugin is disabled when starting Zotero (#5129)

This commit is contained in:
windingwind 2025-03-18 19:36:53 +01:00 committed by GitHub
parent d92ddd18b7
commit ccf4fd20cc
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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);