commit cdebec5f1e634bccde29011849c4359a30396a0e
parent 5af29351cb08c756c24bf6cc4c7f436fc77ed8f8
Author: Tooru Fujisawa <arai_a@mac.com>
Date: Tue, 14 Oct 2025 08:12:52 +0000
Bug 1993731 - Do not show the Ask an AI Chatbot menu item asynchronously. r=Mardak,firefox-ai-ml-reviewers
Differential Revision: https://phabricator.services.mozilla.com/D268488
Diffstat:
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/browser/components/genai/GenAI.sys.mjs b/browser/components/genai/GenAI.sys.mjs
@@ -670,11 +670,10 @@ export const GenAI = {
contextTabs = null,
} = contextMenu;
- showItem(menu, false);
-
// DO NOT show menu when inside an extension panel
const uri = browser.browsingContext.currentURI.spec;
if (uri.startsWith("moz-extension:")) {
+ showItem(menu, false);
return;
}
@@ -698,6 +697,7 @@ export const GenAI = {
break;
}
if (!canShow) {
+ showItem(menu, false);
return;
}
@@ -719,6 +719,9 @@ export const GenAI = {
menu.menupopup?.remove();
}
+ // NOTE: Show the menu item synchronously, before any `await`.
+ showItem(menu, true);
+
// Determine if we have selection or should use page content
const context = {
contentType: "selection",
@@ -806,8 +809,6 @@ export const GenAI = {
Services.prefs.setBoolPref("browser.ml.chat.menu", false);
}
});
-
- showItem(menu, true);
},
/**