Firefox hard hangs on macOS when dragging a tab from a fullscreen window and triggering Mission Control / fullscreen Spaces
Categories
(Core :: Widget: Cocoa, defect)
Tracking
()
| Tracking | Status | |
|---|---|---|
| firefox155 | --- | fixed |
People
(Reporter: maarenaurich, Assigned: spohl)
References
Details
Attachments
(1 external file)
User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:152.0) Gecko/20100101 Firefox/152.0
Steps to reproduce:
Open Firefox on macOS.
Put Firefox into native macOS fullscreen using the green fullscreen button.
Open at least two tabs.
Drag one tab out of the tab bar.
While dragging, move upward enough that macOS Mission Control / fullscreen Spaces behavior is triggered.
Actual results:
Firefox becomes completely unresponsive.
The Dock says "Application Not Responding".
Firefox does not recover, and I have to force quit it.
about does not show the right report because this is a hang, not a normal crash.
Expected results:
Firefox should stay responsive.
It should either detach the tab, cancel the drag, or ignore the Mission Control/fullscreen transition without hanging.
Notes:
This does not happen every time, but it happens often enough to reproduce.
It seems related to macOS native fullscreen / Spaces / Mission Control.
System:
Firefox version: 152.0.3
macOS version: macOS 27.0 (26A5368g)
Architecture: ARM64 / Apple Silicon
Attached:
Activity Monitor sample of the frozen Firefox process.
Important part from the sample:
The sampled process shows the main Firefox thread stuck in macOS fullscreen/Dock code:
com.apple.dock.fullscreen
_NSFullScreenSpace(Transitions) startTransition
_NSEnterFullScreenTransitionController start
NSFullScreenDockConnectionSendCreateForSpace
NSDockConnection sendMessage:synchronous:replyHandler:
xpc_connection_send_message_with_reply_sync
mach_msg2_trap
The hang is not reported in about:crashes because Firefox does not crash. It becomes unresponsive and must be force quit.
Root cause theory:
The detached tab creates a new top-level browser window while the source window is in a native fullscreen Space. During initial show, AppKit attempts a fullscreen Space transition for the new window. The sampled Firefox process shows the main thread stuck in macOS Dock/fullscreen code, including NSFullScreenDockConnectionSendCreateForSpace and xpc_connection_send_message_with_reply_sync.
Patch direction:
When a tab detach creates a new browser window on macOS from a fullscreen source window, mark that window as a tab-detach window that should not enter native fullscreen during initial show.
Implementation idea:
- In browser/components/tabbrowser/content/drag-and-drop.js, when calling replaceTabsWithWindow from handle_dragend, pass a macOS-only feature if window.fullScreen is true.
- In the window creation/show path, carry that feature through to the Cocoa widget.
- In widget/cocoa/nsCocoaWindow.mm, during nsCocoaWindow::Show(true), temporarily disable native fullscreen support for this initial show, similar to the existing logic for popups, alerts, and always-on-top windows.
- Restore the previous native fullscreen support value immediately after ordering the window front.
- Scope this only to tab-detach windows, not normal new browser windows.
Expected result:
Dragging a tab out of a fullscreen Firefox window should either detach the tab into a normal window or cancel the detach, but Firefox should not enter a Dock/fullscreen deadlock and become unresponsive.
Testing:
Manual test on macOS:
- Open Firefox.
- Enter native macOS fullscreen.
- Open multiple tabs.
- Drag one tab out of the tab strip.
- Move upward enough to trigger Mission Control / fullscreen Spaces behavior.
- Firefox should remain responsive.
Regression check:
Normal tab detach should still work outside fullscreen.
Normal Cmd+N new windows should still behave normally.
Popups, alerts, and Picture-in-Picture behavior should be unchanged.
Comment 2•4 months ago
|
||
The Bugbug bot thinks this bug should belong to the 'Core::Widget: Cocoa' component, and is moving the bug to that component. Please correct in case you think the bot is wrong.
Comment 3•4 months ago
|
||
The severity field is not set for this bug.
:spohl, could you have a look please?
For more information, please visit BugBot documentation.
| Assignee | ||
Updated•4 months ago
|
| Assignee | ||
Comment 4•4 months ago
|
||
Thanks for the detailed report, and especially for capturing the sample. That was a big help in narrowing this down.
I have a build with a potential fix that I would appreciate you verifying, since I have not been able to reproduce the hang locally. Here is a signed build with the fix. To run this build you will need to follow these steps:
- Download the build: https://firefox-ci-tc.services.mozilla.com/api/queue/v1/task/P0GZqrxATw-bUBTSe1OsHw/artifacts/public/build/target.tar.gz
- Extract it by double-clicking it in Finder. This produces "Firefox Nightly.app".
- Clear the quarantine flag from Terminal so macOS will let it run (adjust the path if you extracted it elsewhere):
xattr -dr com.apple.quarantine ~/Downloads/Firefox\ Nightly.app
- Launch it by double-clicking it.
Then please run through your original steps a few times: enter native fullscreen with the green button, open a couple of tabs, drag one tab out of the tab bar, and move up enough to trigger Mission Control / Spaces. Since you mentioned it does not happen every time, trying it several times would help. Please let me know whether Firefox stays responsive, or if you still see the hang.
Thank you!
Hi, it works, doesn't crash anymore. Only thing that is kinda annoying is that you cant put the tab back in the original window if you drag it out by accident. Other than that its fixed
| Assignee | ||
Updated•4 months ago
|
| Assignee | ||
Comment 7•4 months ago
|
||
This bug isn't resolved yet. I first have to land the patch that I asked you to test. Thanks for verifying the test build.
| Assignee | ||
Comment 9•4 months ago
|
||
When a tab is dragged out of a window that is in native macOS fullscreen, the front-end opens a new top-level browser window. Because a fullscreen space is active, macOS adopts the new window into its own fullscreen space during its initial show, which goes through a synchronous XPC transition to the Dock. On recent macOS versions that transition can deadlock the main thread, leaving Firefox unresponsive until it is force quit.
This plumbs a one-shot CHROME_SUPPRESS_INITIAL_FULLSCREEN flag from the tab-detach code through to the Cocoa widget. When set, Show() temporarily marks the window as not supporting native fullscreen for its initial display, the same mechanism already used for popups, alerts, and always-on-top windows, and restores it right after. The window can still be taken into fullscreen afterwards via the green button.
Comment 10•3 months ago
|
||
There is an r+ patch which didn't land and no activity in this bug for 1 week.
:spohl, could you have a look please?
If you still have some work to do, you can add an action "Plan Changes" in Phabricator.
For more information, please visit BugBot documentation.
Comment 11•3 months ago
|
||
Comment 12•3 months ago
|
||
| bugherder | ||
Updated•3 months ago
|
| Assignee | ||
Updated•3 months ago
|
Updated•3 months ago
|
Description
•