Log reason when calling bootstrap methods

This commit is contained in:
Dan Stillman 2023-06-06 06:16:01 -04:00
parent 6106e379c9
commit 027060ba86

View file

@ -115,7 +115,8 @@ Zotero.Plugins = new function () {
async function _callMethod(addon, method, reason) { async function _callMethod(addon, method, reason) {
try { try {
let id = addon.id; let id = addon.id;
Zotero.debug(`Calling bootstrap method '${method}' for plugin ${id} version ${addon.version}`); Zotero.debug(`Calling bootstrap method '${method}' for plugin ${id} `
+ `version ${addon.version} with reason ${_getReasonName(reason)}`);
let scope = scopes.get(id); let scope = scopes.get(id);
if (!scope) { if (!scope) {
@ -174,6 +175,16 @@ Zotero.Plugins = new function () {
} }
function _getReasonName(reason) {
for (let i in REASONS) {
if (reason == REASONS[i]) {
return i;
}
}
return "UNKNOWN";
}
function _unloadScope(id) { function _unloadScope(id) {
scopes.delete(id); scopes.delete(id);
} }