Closed Bug 1700715 Opened 4 years ago Closed 4 years ago

With native context menus enabled, the context menu of the bookmarks toolbar has strange contents (too many items, or duplicate items, or empty items, or all items disabled)

Categories

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

All
macOS
defect

Tracking

()

VERIFIED FIXED
89 Branch
Tracking Status
firefox89 --- verified

People

(Reporter: mstange, Assigned: mstange)

References

Details

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

Attachments

(3 files)

Attached image example screenshot (deleted) —

Steps to reproduce:

  1. Be on macOS, and set widget.macos.native-context-menus and browser.proton.contextmenus.enabled to true.
  2. Make sure the bookmarks toolbar is shown.
  3. Right-click on a bookmark or a bookmarks folder in the bookmarks toolbar.

Expected results:
The context menu should contain the items you would expect, and the right items should be enabled.

Actual results:
The menu has odd contents.

Note: If you set one of the prefs to false, open the non-native context menu, and then set them to true again, the native context menu will now contain the correct contents. In that case you can open a new window to reproduce this bug again.

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

With document.popupNode returning something sensible during popupshowing, this is mostly fixed. There's one remaining issue with add-on items being re-added at the end of the popup repeatedly, but I'll file a new bug about that.

FYI: The same happens in the bookmarks sidebar. Not sure if there will be one fix for both or if it will need a own fix so I wanted to leave a comment here.

This scenario is encountered when the same menu is opened again while it's already open:
nsMenuPopupFrame::InitializePopupAsNativeContextMenu overwrites mNativeMenu with a newly-created
NativeMenu, destroying the old one before it had a chance to fire its popuphiding/popuphidden events.
One place where we do this is if you right-click in the bookmarks bar and then, while the menu is
open, right-click again on the bookmarks bar in a different place.

Since we weren't dispatching popuphiding/popuphidden events for the first menu in this scenario
before this patch, some menu items would be duplicated because their old versions were never removed.

Depends on D110141

Pushed by mstange@themasta.com: https://hg.mozilla.org/integration/autoland/rev/e238ae1076b5 Make document.popupNode work during the popupshowing event for native menus. r=tnikkel https://hg.mozilla.org/integration/autoland/rev/35ad58e648ac Make sure popuphiding / popuphidden are fired even when a NativeMenu is destroyed while it's open. r=harry
Pushed by dluca@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/d81d522f8b5e Make document.popupNode work during the popupshowing event for native menus. r=tnikkel https://hg.mozilla.org/integration/autoland/rev/80d0a471b517 Make sure popuphiding / popuphidden are fired even when a NativeMenu is destroyed while it's open. r=harry
Backout by dluca@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/6612df1d6fcd Backed out 2 changesets as per dev's request
Status: ASSIGNED → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → 89 Branch

Reproduced the issue mentioned in comment 0 using Firefox 89.0a1 (build from 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: