Context menu is providing too many options, many of which don't work or are broken
Categories
(Toolkit :: UI Widgets, defect)
Tracking
()
People
(Reporter: knenad, Unassigned, NeedInfo)
References
Details
Attachments
(5 files)
User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:136.0) Gecko/20100101 Firefox/136.0
Steps to reproduce:
- Go to https://www.reddit.com/r/BuyCanadian/comments/1jcfuud/just_wanted_to_share/
- Click on the image to get a better view
- Elbows up
- Right click on the image and see attached screenshot
Actual results:
It seems like this img element is being misinterpreted as an image, video or audio content at the same time (as well as a piece of text with a phone number, password and an e-mail?). Further, there are some empty context menu items on the bottom which don't seem to do anything.
Expected results:
A context menu which aligns with the JPEG image content should pop up.
Comment 1•28 days ago
|
||
The Bugbug bot thinks this bug should belong to the 'Toolkit::Password Manager' component, and is moving the bug to that component. Please correct in case you think the bot is wrong.
Reporter | ||
Updated•28 days ago
|
Comment 2•28 days ago
|
||
We have some reports where the unnecessary context menu items aren't hidden.
If this is still happening in your browser, can you check the Browser Console to see if there's any error reported?
In the other reports, restarting the browser made the issue disappear, so it might be something intermittent, or maybe one-time thing,
but still it's nice to figure out the underlying issue and we'd like to fix it.
Reporter | ||
Comment 3•28 days ago
|
||
Reporter | ||
Comment 4•28 days ago
|
||
I've attached a new screenshot. It appears the issue started happening on other websites as well. In this new screenshot, I'm using a private window with the console open, pointing to example.com. I'm not noticing anything that would indicate a failure.
I'll refrain from restarting Firefox for now, just in case there's another way you'd like me to debug this or provide you with more information.
Updated•28 days ago
|
Updated•28 days ago
|
Updated•28 days ago
|
Updated•28 days ago
|
Comment 6•28 days ago
|
||
(In reply to Nenad Kozul from comment #4)
I've attached a new screenshot. It appears the issue started happening on other websites as well. In this new screenshot, I'm using a private window with the console open, pointing to example.com. I'm not noticing anything that would indicate a failure.
I'll refrain from restarting Firefox for now, just in case there's another way you'd like me to debug this or provide you with more information.
The screenshot shows the regular developer tools console. Can you try the instructions linked to check the browser console to see errors that are happening in the browser code? Thanks!
Reporter | ||
Comment 7•28 days ago
|
||
Reporter | ||
Comment 8•28 days ago
|
||
Sure thing! See the new attachment (scr-browser-console.png).
This pops up upon a right click:
17:29:40.876 Uncaught TypeError: window.gBrowser.selectedBrowser is undefined
init resource:///modules/GenAI.sys.mjs:352
init resource:///modules/GenAI.sys.mjs:351
<anonymous> resource:///modules/GenAI.sys.mjs:1089
task resource:///modules/BrowserGlue.sys.mjs:3094
_scheduleStartupIdleTasks resource:///modules/BrowserGlue.sys.mjs:3219
GenAI.sys.mjs:352:23
Dismissing the menu with a left click produces:
17:29:38.933 Uncaught TypeError: gContextMenu is null
<anonymous> chrome://browser/content/browser-context.js:339
browser-context.js:339:7
Reporter | ||
Comment 9•28 days ago
|
||
Some additional errors when right clicking on this very page:
18:46:13.455 Uncaught (in promise) Error: Cannot find menu item with id open-in-this-container undefined
18:46:13.455 Uncaught (in promise) Error: Cannot find menu item with id remove-open-in-this-container undefined
18:46:13.455 Uncaught (in promise) Error: Cannot find menu item with id separator undefined
18:46:13.456 Uncaught (in promise) Error: Cannot find menu item with id hide-container undefined
18:46:13.456 Uncaught (in promise) Error: Cannot find menu item with id move-to-new-window-container undefined
18:46:13.457 Uncaught (in promise) Error: Cannot find menu item with id open-in-this-container undefined
18:46:13.457 Uncaught (in promise) Error: Cannot find menu item with id remove-open-in-this-container undefined
18:46:13.457 Uncaught (in promise) Error: Cannot find menu item with id separator undefined
18:46:13.457 Uncaught (in promise) Error: Cannot find menu item with id hide-container undefined
18:46:13.457 Uncaught (in promise) Error: Cannot find menu item with id move-to-new-window-container undefined
18:46:13.541 Uncaught TypeError: window.gBrowser.selectedBrowser is undefined
init resource:///modules/GenAI.sys.mjs:352
init resource:///modules/GenAI.sys.mjs:351
<anonymous> resource:///modules/GenAI.sys.mjs:1089
task resource:///modules/BrowserGlue.sys.mjs:3094
_scheduleStartupIdleTasks resource:///modules/BrowserGlue.sys.mjs:3219
GenAI.sys.mjs:352:23
18:46:14.732 Uncaught TypeError: gContextMenu is null
<anonymous> chrome://browser/content/browser-context.js:339
browser-context.js:339:7
18:46:14.748 Uncaught (in promise) Error: Cannot find menu item with id open-in-this-container undefined
18:46:14.748 Uncaught (in promise) Error: Cannot find menu item with id remove-open-in-this-container undefined
18:46:14.749 Uncaught (in promise) Error: Cannot find menu item with id separator undefined
18:46:14.749 Uncaught (in promise) Error: Cannot find menu item with id hide-container undefined
18:46:14.749 Uncaught (in promise) Error: Cannot find menu item with id move-to-new-window-container undefined
Comment 10•28 days ago
|
||
The errors in comment #9 point at bug 1688743. I would expect that even if extension code that tries to insert extensions fails, that doesn't break the entirety of the context menu, but let's check in with Rob.
The other error points at https://searchfox.org/mozilla-release/rev/62f34235d373482fc8c3c6a07f3a60c3e224d642/browser/components/genai/GenAI.sys.mjs#352 but really that just means that something strange has happened: the tabbrowser code started up without figuring out a selected browser (and the GenAI.init
code doesn't seem to do anything important after that, and the exception will be caught and was reported from here without breaking anything else). But there doesn't appear to be any other error that points to why that might be the case. Dão, I don't suppose you have ideas as to what might be going wrong there or how we'd find out?
Comment 11•27 days ago
|
||
Reporter (Nenad), could you open a new browser window and see if the issue is also happening there? And if yes, can you share the browser console's content again?
(In reply to :Gijs (he/him) from comment #10)
The errors in comment #9 point at bug 1688743. I would expect that even if extension code that tries to insert extensions fails, that doesn't break the entirety of the context menu, but let's check in with Rob.
This is unrelated. These extension-specific logs are independent of context menu creation themselves. I have seen them before, and just reported the issue at https://github.com/mozilla/multi-account-containers/issues/2735.
The other error points at https://searchfox.org/mozilla-release/rev/62f34235d373482fc8c3c6a07f3a60c3e224d642/browser/components/genai/GenAI.sys.mjs#352
FWIW, that code was removed in bug 1951311. The observed error here seems independent of the caller though.
The unexpected state (gBrowser.selectedBrowser
being undefined
) suggests that any of the following may be happening:
_setupInitialBrowserAndTab
never reached the point of initializing_selectedBrowser
.updateCurrentBrowser
was called whiletabContainer.selectedIndex
pointed to an invalid position.- some other state got corrupted, e.g. cache or browser artifacts, to the point that reading code to infer logic is not productive.
- If the issue is consistently reproducible, even in a new window, then this theory seems not unlikely.
Reporter | ||
Comment 12•27 days ago
|
||
Reporter | ||
Comment 13•27 days ago
|
||
See: Console log of new Window in attachments.
As soon as I focus on the new window, I get the "Cannot find menu item with id" errors. Upon a right click, the window.gBrowser.selectedBrowser is undefined
error occurs.
Also, my understanding is that I should just create a new FF window to test this (and NOT restart Firefox just yet), correct?
Reporter | ||
Comment 14•27 days ago
|
||
One additional note:
The "cannot find menu item" errors occur in the Multiprocess (Slower) browser console, as well as the "window.gBrowser.selectedBrowser is undefined" error.
In Parent process only (fast) mode, I only get "window.gBrowser.selectedBrowser is undefined" to appear.
Comment 15•27 days ago
|
||
Yes, in a new window, WITHOUT restarting Firefox (because that would most likely get rid off the issue, so that it cannot be debugged any more).
Odd, strange that you're able to reproduce this consistently. I'd like to do some sanity checks to understand the state you're in.
Since you are able to reproduce this for every window, run the following steps:
- Visit
about:config
(any privileged page would do) and open the Developer Tools (right-click, Inspect, Console). - Copy-paste the following code and run it:
windowRoot.ownerGlobal.gBrowser._notificationEnableDelay
- The result should be
500
. If it isundefined
, that could be a sign that this code has never been reached.
- The result should be
- Copy-paste the following code and run it:
windowRoot.ownerGlobal.gBrowser._selectedBrowser
- If this value is still
undefined
, then you have some really broken unexpected state. - If this value is set, then whatever that triggered the logged error via GenAI.sys.mjs got fixed in the meantime.
- If this value is still
- I would expect the
_scheduleStartupIdleTasks
part to be triggered once, at browser startup. The fact that you see it again for new browser windows is somewhat surprising. To find out what triggers it, could you:- Copy-paste the following code and run it:
Services.obs.addObserver({ observe(subject, topic){ Services.obs.removeObserver(this, topic); console.trace("Hello world"); }}, "sessionstore-windows-restored")
- Open a new browser window.
- Go back to the original console where you ran the previous code, and look at the console. What is the content (stack trace)? Given your bug, I expect to see "Hello world" there.
- Copy-paste the following code and run it:
Please share the output of each step here. If you run all steps at once, you can copy the output all at once in the end, and share it here.
Reporter | ||
Comment 16•27 days ago
|
||
- Visited and opened developer tools
- Indeed, a 500 is the result:
>> windowRoot.ownerGlobal.gBrowser._notificationEnableDelay
<< 500
- It's not undefined:
>> windowRoot.ownerGlobal.gBrowser._selectedBrowser
<< <browser contextmenu="contentAreaContextMenu" message="true" messagemanagergroup="browsers" tooltip="aHTMLTooltip" type="content" manualactiveness="true" maychangeremoteness="true" remote="false" autocompletepopup="PopupAutoComplete" initialBrowsingContextGroupId="1148" nodefaultsrc="true" primary="true">
- I am not receiving "Hello world".
>> Services.obs.addObserver({ observe(subject, topic){ Services.obs.removeObserver(this, topic); console.trace("Hello world"); }}, "sessionstore-windows-restored")
<< undefined
After the above command, at no point have I seen a "hello world" in any console. Screenshot will be attached.
Reporter | ||
Comment 17•27 days ago
|
||
Comment 18•27 days ago
|
||
Can you filter by Parent Process only? The logs of interest are in that context.
When you followed the steps to get to the output in comment 16, was the originally reported issue still present? I.e. context menu not working in that window.
The log you shared before in comment 12 suggested that the same bug was observed with the new window. I drew that conclusion because the timestamps differ from the logs shared in comment 9. I can however not see the same errors in the log in comment 17.
Reporter | ||
Comment 19•27 days ago
|
||
Yes, the originally reported issue is still present. The context menu is overflowing with non-functional elements.
Here's a video of the whole flow: https://drive.google.com/file/d/1oY-ngqY5uDOPsPy5HeJt2OkCRsGindqc/view (4K, can't fit the 10MB bugzilla limit here)
Comment 22•4 days ago
|
||
Is this still happening in the latest Firefox 137.0.2? If so, have the error messages changed? Please can you copy and paste any new/different errors as an attachment (text is generally easier to read than images).
Description
•