Closed Bug 1701085 Opened 4 years ago Closed 4 years ago

With native context menus enabled you can't remove buttons from the toolbar

Categories

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

All
macOS
defect

Tracking

()

VERIFIED FIXED
89 Branch
Tracking Status
firefox89 --- verified

People

(Reporter: soeren.hentzschel, Assigned: mstange)

References

Details

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

Attachments

(1 file)

STR:

  1. set widget.macos.native-context-menus to true
  2. try to remove a toolbar button via context menu

Expected:

The toolbar button is removed.

Actual:

Nothing happens. There is an error in the browser console:

TypeError: can't access property "ownerDocument", aNode is null (CustomizeMode.jsm:638:22)

It's the following line:

let areaNode = aNode.ownerDocument.getElementById(area);

in this code block:

_getCustomizableChildForNode(aNode) {
    // NB: adjusted from _getCustomizableParent to keep that method fast
    // (it's used during drags), and avoid multiple DOM loops
    let areas = CustomizableUI.areas;
    // Caching this length is important because otherwise we'll also iterate
    // over items we add to the end from within the loop.
    let numberOfAreas = areas.length;
    for (let i = 0; i < numberOfAreas; i++) {
      let area = areas[i];
      let areaNode = aNode.ownerDocument.getElementById(area);
      let customizationTarget = CustomizableUI.getCustomizationTarget(areaNode);
      if (customizationTarget && customizationTarget != areaNode) {
        areas.push(customizationTarget.id);
      }
      let overflowTarget = areaNode && areaNode.getAttribute("overflowtarget");
      if (overflowTarget) {
        areas.push(overflowTarget);
      }
    }
    areas.push(kPaletteId);

    while (aNode && aNode.parentNode) {
      let parent = aNode.parentNode;
      if (areas.includes(parent.id)) {
        return aNode;
      }
      aNode = parent;
    }
    return null;
  },
Blocks: 1700679
OS: Unspecified → macOS
Priority: -- → P1
Hardware: Unspecified → All
Whiteboard: [proton-context-menus][mac:mr1]

Similar for the "Pin to overflow menu" item. Error:

NS_ERROR_NOT_AVAILABLE: Component returned failure code: 0x80040111 (NS_ERROR_NOT_AVAILABLE) [nsIDocShell.domWindow] 2 browsing-context.js:402
TypeError: can't access property "ownerDocument", aNode is null

I'm working on making document.popupNode work as expected for native context menus.

Assignee: nobody → mstange.moz
Status: NEW → ASSIGNED
Keywords: helpwanted
Pushed by mstange@themasta.com: https://hg.mozilla.org/integration/autoland/rev/d62954a6ed51 Return the native menu's trigger node from nsXULPopupManager::GetLastTriggerNode while the native menu is open. r=tnikkel
Status: ASSIGNED → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → 89 Branch

Reproduce 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: