From 913d15632b8dab14e53344279bb4584702feb08b Mon Sep 17 00:00:00 2001 From: windingwind <33902321+windingwind@users.noreply.github.com> Date: Mon, 15 Sep 2025 10:07:46 +0200 Subject: [PATCH] Fix menu API async unregister and event listener --- chrome/content/zotero/xpcom/pluginAPI/menuManager.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/chrome/content/zotero/xpcom/pluginAPI/menuManager.js b/chrome/content/zotero/xpcom/pluginAPI/menuManager.js index 0cd95c82eb..a8a3d8b308 100644 --- a/chrome/content/zotero/xpcom/pluginAPI/menuManager.js +++ b/chrome/content/zotero/xpcom/pluginAPI/menuManager.js @@ -285,8 +285,8 @@ }; } - _unregisterByPluginID(pluginID) { - let removedKeys = super._unregisterByPluginID(pluginID); + async _unregisterByPluginID(pluginID) { + let removedKeys = await super._unregisterByPluginID(pluginID); if (!removedKeys) { return []; } @@ -625,7 +625,7 @@ if (ev.target !== ev.currentTarget) { return; } - menuElem.removeEventListener("command", menuCommandListener); + requestIdleCallback(() => menuElem.removeEventListener("command", menuCommandListener)); ev.target.removeEventListener("popuphidden", removeMenuCommandListener); }; popupElem.addEventListener("popuphidden", removeMenuCommandListener);