Closed Bug 1700710 Opened 3 years ago Closed 3 years ago

With native context menus enabled, right-clicking a bookmark in a bookmarks panel (bookmarks toolbar folder popup or library panel) does not work

Categories

(Core :: Widget: Cocoa, defect, P1)

defect

Tracking

()

VERIFIED FIXED
89 Branch
Tracking Status
firefox89 --- verified

People

(Reporter: mstange, Assigned: mstange)

References

Details

(Whiteboard: [proton-context-menus][mac:mr1])

Attachments

(2 files)

Steps to reproduce:

  1. Be on macOS, and set widget.macos.native-context-menus and browser.proton.contextmenus.enabled to true.
  2. Open the bookmarks menu from its toolbar button. Alternatively, open a bookmarks folder panel in the bookmarks toolbar.
  3. Right click on one of the bookmarks.

Expected results:
A context menu should appear on top of the other menu/panel.

Actual results:
The open menu/panel is dismissed and no context menu opens.

Whiteboard: [proton-context-menus][mac:mr1]

When this happens, an NS_ERROR_ILLEGAL_VALUE exception is shown on the error console:

"Component returned failure code: 0x80070057 (NS_ERROR_ILLEGAL_VALUE) [nsIXPCComponents_Utils.isDeadWrapper]"

Stack:

PUIU_getViewForNode@resource:///modules/PlacesUIUtils.jsm:393:12
placesContextShowing@resource:///modules/PlacesUIUtils.jsm:1340:28
onpopupshowing@chrome://browser/content/browser.xhtml:1:22

This code accesses document.popupNode). Setting mOpeningPopup to the menupopup nsIContent during the popupshowing event fixes the console error, but it doesn't fix this bug.
However, it does fix most of bug 1700715.

Assignee: nobody → mstange.moz
Status: NEW → ASSIGNED

The purpose of this code is to close non-native context menus when clicking the
menubar. However, menuWillOpen is also called when opening a native context menu.
And when opening a context menu on top of a non-native menu (e.g. the Downloads
panel or a bookmarks toolbar folder), this code backfires and closes the panel.
Restricting it to the menubar fixes that scenario.

Depends on D110304

We have at least four different pieces of code that try to make sure our
non-native menus get closed in all the scenarios where a native menu would close.
This is one them.

It covers the following case:

  1. Open a non-native menu, for example a bookmarks toolbar folder.
  2. Right-click somewhere outside of Firefox to open a native menu from another app.

Now the non-native menu should close.

However, this code doesn't seem to be needed; the same scenario is also covered
by the call to RollUpPopups in [WindowDelegate windowDidResignKey:] (when Firefox
has focus) and by nsCocoaWindow::CaptureRollupEvents (when Firefox does not have
focus - it even installs a global mouse event monitor for this scenario).

So I think we can just remove this code. It causes trouble when opening a native
context menu on top of (inside of) a non-native panel like the Downloads panel or
a bookmarks toolbar folder dropdown.

Depends on D110305

Blocks: 1701243
Pushed by mstange@themasta.com:
https://hg.mozilla.org/integration/autoland/rev/457aff295ba2
Restrict the cancelTracking code in menuWillOpen to menus opened from the menubar. r=harry
https://hg.mozilla.org/integration/autoland/rev/84d1c8eb104e
Stop watching for "com.apple.HIToolbox.beginMenuTrackingNotification" notifications. r=harry
Status: ASSIGNED → RESOLVED
Closed: 3 years ago
Resolution: --- → FIXED
Target Milestone: --- → 89 Branch

Reproduced the issue mentioned in comment 0 using Firefox 89.0a1 (build form 2021-03-24).

This issue is verified fixed using Firefox 89.0a1 (BuildId:20210414160838) on macOS 10.15 with native menus enabled.

Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: