Closed Bug 1969164 Opened 1 year ago Closed 1 year ago

When a tab group is in the only thing in a window, dragging it to another window leaves an empty window

Categories

(Firefox :: Tabbed Browser, defect, P3)

Firefox 140
defect

Tracking

()

VERIFIED FIXED
141 Branch
Tracking Status
firefox141 --- verified
firefox142 --- verified

People

(Reporter: sthompson, Assigned: sthompson)

References

(Blocks 1 open bug)

Details

(Keywords: regressionwindow-wanted, Whiteboard: [fidefe-tabgrps-dnd])

Attachments

(2 files)

Nightly 141.0a1 (2025-05-28) (aarch64)
User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:141.0) Gecko/20100101 Firefox/141.0

Steps to reproduce:

  • Open two tabs, A and B
  • Create a tab group for tab B
  • Drag the tab group label outside of the browser window and drop it -- this should trigger the behavior to create a new window containing only the dragged tab group
  • In the new window, drag the tab group label and drop it back into the original window

Actual results:

The tab group correctly moves back to the original window. The new window remains in place, but there is nothing in the tab strip. The URL bar contains the URL of the previously active tab, but the browser panel has no content.

Expected results:

The tab group correctly moves back to the original window. The new window automatically closes because there is no longer anything in that window.

I can reproduce this in the following scenarios:

  • tab group was moved to a new window using drag-drop
  • tab group was created manually in a new window using the tab context menu

The new window automatically closes as expected in the following scenarios:

  • tab group was moved to new window from tab group context menu
  • tab group was moved to new window from list all tabs menu context menu
  • tab group was created in a new window in a previous session that was restored manually

Not sure exactly what to make of it. It seems like the aCloseWindow from _endRemoveArgs is false for the last tab to be adopted when things go wrong, whereas that value is true when things go correctly.

I haven't dug much further. This logic in Tabbrowser caught my eye https://searchfox.org/mozilla-central/rev/932e5cded30452c4f009b4f9254021f8b9895217/browser/components/tabbrowser/content/tabbrowser.js#4829-4833 and I wondered if perhaps the collapsed-during-drag state of the tab group could interfere with window closing behavior, but I don't see why that behavior would vary based on the different scenarios I listed above.

This is just a guess, but could this be a regression from bug 966594?

Aha, I didn't notice that the code I linked had just changed in bug 1966594. Yeah, I'll test that, but it looks this is a regression.

I can reproduce with the original code in place

When a window consists only of a tab group and its tabs, dragging the tab group into the tab strip of another window can leave the starting window in a broken, empty state.

The normal behavior when dragging a tab group is to temporarily collapse the tab group, but this seems to have an unintended interaction with the Tabbrowser logic that decides whether to close a window when the last tab is removed. At the time of the last tab being removed, it is in a temporarily collapsed group and therefore not visible.

This patch hardens the logic for calculating whether a tab is the last tab in a window. It ensures that the window will close if the last tab in the window is in a collapsed tab group.

Assignee: nobody → sthompson
Status: NEW → ASSIGNED
Pushed by sthompson@mozilla.com: https://github.com/mozilla-firefox/firefox/commit/bec968241787 https://hg.mozilla.org/integration/autoland/rev/367bc904b4fd close window when dragging tab group out of window r=jswinarton,tabbrowser-reviewers,dao
Pushed by abutkovits@mozilla.com: https://github.com/mozilla-firefox/firefox/commit/9318e6027de8 https://hg.mozilla.org/integration/autoland/rev/740dab811f0b Revert "Bug 1969164 - close window when dragging tab group out of window r=jswinarton,tabbrowser-reviewers,dao" for causing failures complaining about tabs.
Pushed by sthompson@mozilla.com: https://github.com/mozilla-firefox/firefox/commit/cd0c95e428c4 https://hg.mozilla.org/integration/autoland/rev/0f12899d99ae close window when dragging tab group out of window r=jswinarton,tabbrowser-reviewers,dao
Status: ASSIGNED → RESOLVED
Closed: 1 year ago
Resolution: --- → FIXED
Target Milestone: --- → 141 Branch
QA Whiteboard: [qa-triage-done-c142/b141][qa-ver-needed-c142/b141]
Flags: qe-verify+
QA Contact: dlucaci

Reproduced with Firefox 141.0a1 (2025-05-28) on macOS 15.
Verified as fixed with Firefox 142.0a1 (20250626214351) and Firefox 141.0b3 (20250627042037) on macOS 14, Windows 10 and Ubuntu 22.

Status: RESOLVED → VERIFIED
Has STR: --- → yes
QA Whiteboard: [qa-triage-done-c142/b141][qa-ver-needed-c142/b141] → [qa-triage-done-c142/b141][qa-ver-done-c142/b141]
Flags: qe-verify+
Duplicate of this bug: 1977640
Flags: needinfo?(sthompson)
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: