Closed Bug 1956254 Opened 1 year ago Closed 1 year ago

Restoring a Session will show Tab groups twice in the List all tabs menu

Categories

(Firefox :: Session Restore, defect, P1)

Desktop
Windows 11
defect

Tracking

()

VERIFIED FIXED
139 Branch
Tracking Status
firefox-esr128 --- disabled
firefox136 --- disabled
firefox137 --- wontfix
firefox138 --- wontfix
firefox139 --- verified

People

(Reporter: rdoghi, Assigned: sthompson)

References

(Blocks 1 open bug)

Details

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

Attachments

(4 files)

Found in

  • Nightly 138.0a1 (2023-08-25)

Affected versions

  • Nightly 139.0a1 (2025-04-17)
  • Nightly 138.0a1 (2023-08-25)
  • Beta 137.0b11

Affected platforms

  • All

Steps to reproduce

  1. Create a few Tab groups and close Firefox.
  2. Start Firefox in offline mode or normal mode.
  3. Restore the previous session.
  4. Open the list all tabs menu.

Expected result

  • There should only be 1 of each created Tab groups.

Actual result

  • Each tab group is duplicated after restoring the previous session in Offline or normal Browsing mode.

Regression range
I will update with a regression range as soon as possible.

The severity field is not set for this bug.
:mak, could you have a look please?

For more information, please visit BugBot documentation.

Flags: needinfo?(mak)
Severity: -- → S3
Flags: needinfo?(mak)
Summary: Restoring a Session while in Offline mode will show Tab groups twice in the List all tabs menu → Restoring a Session while in Online or Offline mode will show Tab groups twice in the List all tabs menu
Component: Tabbed Browser → Session Restore
Summary: Restoring a Session while in Online or Offline mode will show Tab groups twice in the List all tabs menu → Restoring a Session will show Tab groups twice in the List all tabs menu
Whiteboard: [fidefe-tabgrps-sessionstore]

I think I found a regression range for this issue but im not entirely sure its correct since the GUI stopped:

13:26.69 INFO: Last good revision: ba305ce7ad141ea641cf08868285b4372403e0b0
13:26.69 INFO: First bad revision: 4374d7fb7f40240e75f41519202eaf8127f323cc
13:26.69 INFO: Pushlog:
https://hg.mozilla.org/integration/autoland/pushloghtml?fromchange=ba305ce7ad141ea641cf08868285b4372403e0b0&tochange=4374d7fb7f40240e75f41519202eaf8127f323cc

It says its Bug 1951750 that might have caused this but I'm not sure.

(In reply to Rares Doghi, Desktop QA from comment #2)

I think I found a regression range for this issue but im not entirely sure its correct since the GUI stopped:

13:26.69 INFO: Last good revision: ba305ce7ad141ea641cf08868285b4372403e0b0
13:26.69 INFO: First bad revision: 4374d7fb7f40240e75f41519202eaf8127f323cc
13:26.69 INFO: Pushlog:
https://hg.mozilla.org/integration/autoland/pushloghtml?fromchange=ba305ce7ad141ea641cf08868285b4372403e0b0&tochange=4374d7fb7f40240e75f41519202eaf8127f323cc

It says its Bug 1951750 that might have caused this but I'm not sure.

I think this is likely not the correct range. I can't access the bug, but judging by the changesets it seems like it should be unrelated :/

I haven't been able to reproduce this in Nightly 139.0a1 (2025-04-17) (aarch64) on macOS

  1. Create tabs and 2 tab groups, close Firefox with Cmd + Q
  2. Start Firefox (and select File > Work Offline to test offline mode)
  3. Restore the previous session using Cmd + Shift + T
  4. Open the List All Tabs menu by clicking on the downward arrow button

Result:

  • the 2 tab groups are listed at the top of the List All Tabs menu with the heading "Recent Tab Groups." This is expected behavior.
  • the menu version of the tab strip with the heading "Current Window" lists all tabs and tab groups in the correct order with no duplicates

I've tried a number of variations

  • before restoring the session, open and then close the list all tabs menu
  • before restoring the session, open the list all tabs menu and leave it open
Assignee: nobody → sthompson
Attached video duplicated.mp4

Adding a Screen recording of this issue. It still occurs in our latest Nightly 139.0a1 (2025-04-21)

Attached video dupe2.mp4

Hi @Stephen can you take a look at this screen recording ? it seems that if we simply reopen those Saved groups they will all be displayed twice in the list all tabs menu, could this be caused by the same issue ? or is this related more to Bug 1961159

Flags: needinfo?(sthompson)

This is great, thank you! I think bug 1961159 may be causing the problems at the very end of dupe2.mp4, but I think the other issues might be caused by something else. I will try the repro steps on Windows to see if that helps me.

I can reproduce this on Windows 11. I can't reproduce it on macOS.

What's supposed to happen:

  • closing the window puts the tab groups on the tab strip into the list of saved tab groups
  • opening a window shows the saved tab groups in the list all tabs menu
  • restoring the session puts the saved tab groups into the tab strip and removes them from the session's list of saved tab groups

That's happening on macOS, but in Windows, restoring the session puts the saved tab groups into the tab strip but keeps the saved tab groups in the session. Since the list all tabs menu is supposed to list both saved tab groups and open tab groups, this appears as duplicate tab groups. A tab group should only be in one place at a time: 1) tab strip, 2) saved groups, 3) closed groups.

I will investigate on Windows

Flags: needinfo?(sthompson)
OS: Unspecified → Windows 11

Current behavior on Windows: if you close a window that has open tab groups, the tab groups are automatically saved. Opening Firefox into the initial deferred restore state properly shows the tab groups as saved. However, after restoring the previous session manually, the tab groups exist both in the tab strip (correct) and in the list of saved tab groups (incorrect).

Bug 1950611 and bug 1954488 dealt with several edge cases around saved groups + session restore. In Windows, it looks like on session startup, _prepDataForDeferredRestore receives a state where the open tab groups from last session are stored in both savedGroups and windows[].groups[]. _prepDataForDeferredRestore has logic to convert the open tab groups in windows[].groups[] into saved groups, but it'll skip any that are already present in the list of saved groups. This was fine until the fix for bug 1954488, which unsets removeAfterRestore from the saved group; the windows[].groups[] groups get the removeAfterRestore flag set, but that does not get put into savedGroups because the group already exists in savedGroups.

I amended the logic so that when a group is in windows[].groups[] and savedGroups, the tab group state from savedGroups will get removeAfterRestore set back to true.

Not totally sure why I could reproduce this on Windows but not on macOS. It looks like the saved groups in defaultState.savedGroups still have removeAfterRestore: true set even after the delete group.removeAfterRestore. I don't understand how that would happen.

Pushed by sthompson@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/b0a25baf9a34 fix saved tab group behavior on session restore r=dwalker,sessionstore-reviewers
Status: NEW → RESOLVED
Closed: 1 year ago
Resolution: --- → FIXED
Target Milestone: --- → 139 Branch

The patch landed in nightly and beta is affected.
:sthompson, is this bug important enough to require an uplift?

For more information, please visit BugBot documentation.

Flags: needinfo?(sthompson)

Verified as fixed in our latest Nightly 139.0a1 (2025-04-24)

Flags: needinfo?(sthompson)

Updating the main status flag.

Status: RESOLVED → VERIFIED
QA Whiteboard: [QA-2725] → [QA-2725][qa-ver-done-c140/b139]
Duplicate of this bug: 1963531
Duplicate of this bug: 1966808
See Also: → 1968716
Duplicate of this bug: 1963522
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: