Closed Bug 1900663 Opened 4 months ago Closed 3 months ago

Opening a new window from macOS dock should set opener from existing window

Categories

(Firefox :: General, defect, P1)

defect

Tracking

()

RESOLVED FIXED
129 Branch
Tracking Status
firefox129 --- fixed

People

(Reporter: sclements, Assigned: Gijs)

Details

Attachments

(1 file)

This came up in our sidebar work, where opener is null if you try to open a second window via the right-click menu from Firefox in the macOS dock. Since this has implications for persisting sidebar state (which relies on inheriting state from an existing window) and its inconsistent with what menubar and keyboard shortcuts do we should change this.

There was discussion in matrix #macdev channel and I'm gonna copy/paste what Gijs said:

so it looks like we construct the dock menu based on a DOM menu similar to how other menus (like the menubar menu) work, cf. https://searchfox.org/mozilla-central/rev/1d1ca77dd7ca10953c6f5f1b77b98e4eb528274e/browser/base/content/nonbrowser-mac.js#95
that points to https://searchfox.org/mozilla-central/source/browser/base/content/hiddenWindowMac.xhtml#25
which points to https://searchfox.org/mozilla-central/rev/1d1ca77dd7ca10953c6f5f1b77b98e4eb528274e/browser/base/content/nonbrowser-mac.js#14-28
which does call OpenBrowserWindow but doesn't in any way override the openerWindow, so that's going to keep being the mac hidden window (ie hiddenWindowMac.xhtml` in the earlier link) rather than a browser window

if we wanted to fix this we'd need to do 2 things:

  • create a way to give OpenBrowserWindow an optional arg to override the passed openerWindow, or make the code in nonbrowser-mac.js directly invoke BrowserWindowTracker such that it bypasses OpenBrowserWindow and passes the openerWindow directly.
  • figure out which is the "right" openerWindow to pass. In some cases (<=1 window open) it's easy. In some other cases (multiple windows across multiple desktops, some of which may be in private windows), it's less obvious. A first pass would probably to "just" use BrowserWindowTracker.getTopWindow(), which ignores popups and private state by default (so "just" the most recent window without any other filtering)
Flags: needinfo?(gijskruitbosch+bugs)
Assignee: nobody → gijskruitbosch+bugs
Status: NEW → ASSIGNED
Flags: needinfo?(gijskruitbosch+bugs)
Summary: Opening a new window from macOS docker should set opener from existing window → Opening a new window from macOS dock should set opener from existing window
Severity: -- → S4
Pushed by gijskruitbosch@gmail.com: https://hg.mozilla.org/integration/autoland/rev/d7ca9320a25c reuse existing windows as openers when opening a window from the macOS dock menu, r=sidebar-reviewers,nsharpley
Status: ASSIGNED → RESOLVED
Closed: 3 months ago
Resolution: --- → FIXED
Target Milestone: --- → 129 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: