Remember the order of tabs in a group after a close and then open
Categories
(Firefox :: Session Restore, defect, P1)
Tracking
()
People
(Reporter: johan.lorne, Assigned: astor)
References
(Blocks 1 open bug)
Details
(Keywords: regressionwindow-wanted, Whiteboard: [fidefe-tabgrps])
Attachments
(4 files, 2 obsolete files)
|
48 bytes,
text/x-phabricator-request
|
Details | Review | |
|
48 bytes,
text/x-phabricator-request
|
Details | Review | |
|
48 bytes,
text/x-phabricator-request
|
phab-bot
:
approval-mozilla-beta+
|
Details | Review |
|
48 bytes,
text/x-phabricator-request
|
phab-bot
:
approval-mozilla-beta+
|
Details | Review |
User Agent: Mozilla/5.0 (X11; Linux x86_64; rv:140.0) Gecko/20100101 Firefox/140.0
Steps to reproduce:
Save and close a group. Then reopen the group. The tabs are not in the order you left them.
Actual results:
The tabs are not in the order you left them.
Expected results:
The tabs should be in the order you left them.
| Comment hidden (obsolete) |
Comment 2•6 months ago
|
||
I have the same problem on Linux 140.0.2
Comment 3•6 months ago
|
||
I have the same issue on Firefox 140.0.4 (64 bit) Mozilla Firefox Snap for Ubuntu
canonical-002 -1.0
| Assignee | ||
Comment 4•6 months ago
|
||
Updated•6 months ago
|
Comment 5•6 months ago
|
||
Moving to the Session Restore component since saved tab groups are handled in there.
I thought that saving + closing tab groups saved the tabs in tab strip order, and I thought that restoring a saved tab group restores them in the same order. If that is not happening, that's a bug.
Updated•6 months ago
|
Comment 6•6 months ago
|
||
I could not reproduce with a quick check on macOS 142.0a1. Based on the reports, I'm going to mark this as being specific to Linux for now.
| Assignee | ||
Comment 7•6 months ago
|
||
Updated•6 months ago
|
Comment 10•5 months ago
|
||
Comment 11•5 months ago
|
||
Backed out for causing bc fails @ browser_tab_groups_restore_closed_many_tabs
| Assignee | ||
Comment 12•5 months ago
|
||
:amarc I can't seem reproduce the bug locally on linux.
The fail is related to the expanded tests that checks if the reported bug is fixed. Clearly I missed something.
Without the patch D257776 the bug is easy to reproduce and fails in both of the expanded tests. They test the tab order of a group after undoing a delete and when restoring a saved group. Treeherder is reporting an intermittent fail in the former on linux asan.
I'll see if I can reproduce the new issue and patch it.
Updated•5 months ago
|
Comment 13•5 months ago
|
||
:astor Please let me know if you'd like any support in debugging an intermittent test failure in Linux ASan builds. The linked test failure shows two pairs of adjacent tabs have their positions swapped. That's a failure mode I really wouldn't expect... There are some suggestions in https://firefox-source-docs.mozilla.org/testing/debugging-intermittents/index.html that might be helpful.
| Assignee | ||
Comment 14•5 months ago
|
||
:sthompson Thanks for the link. Using --run-until-failure on headless mode I could reproduce the issue after a while. Now I just need to figure out the issue
Comment 15•5 months ago
|
||
on Windows 11 v24H2 Build 26100.4652
Firefox 141.0 (64-bit
I've found the tabs within a group do not re-open in the same order, the group opens tabs in seemingly random order.
"save and close group" doesn't retain tab order.
Comment 16•5 months ago
|
||
See on two computers:
Windows 11 Pro 24H2 10.0.26100 Build 26100
Firefox 141.0 (64-bit)
Tabs in a tab group does not always open in the same order as when saved.
- The reopened order often matches.
- Sometimes it seems to be somewhat random.
- A common pattern is that a number of tabs in the beginning is moved last (ABCED -> CEDAB).
Comment 17•5 months ago
|
||
Thanks for the additional reports for Windows!
A fix for this issue landed for Firefox 143 (release date September 16, 2025). I'll request that this fix be uplifted to Firefox 142 (release date August 19, 2025) so that it's available sooner.
The automated test for this fix failed to land. I'm taking a look at the tests to see if there's anything I can do to shore them up.
Comment 18•5 months ago
|
||
Original Revision: https://phabricator.services.mozilla.com/D257776
Updated•5 months ago
|
Comment 19•5 months ago
|
||
Are we still trying to land the test patch?
Comment 20•5 months ago
|
||
firefox-beta Uplift Approval Request
- User impact if declined: Low/Medium. Tab groups would continue to be restored in some cases with the tabs in a different order than they originally appeared in the tab strip.
- Code covered by automated testing: yes
- Fix verified in Nightly: yes
- Needs manual QE test: no
- Steps to reproduce for manual QE testing: Create a tab group with many tabs, "save and close" the tab group, then reopen it from the "list all tabs" menu. If fixed, the order of the tabs in the group should be the same before "save and close" and after reopening.
- Risk associated with taking this patch: Low
- Explanation of risk level: Simple logic change that only applies for tab groups. The tab group-specific code added is more explicitly correct.
- String changes made/needed: No
- Is Android affected?: no
Comment 21•5 months ago
|
||
If we only plan on uplifting the patch and not landing the test patch (https://phabricator.services.mozilla.com/D257916), can we abandon that revision?
| Assignee | ||
Comment 22•5 months ago
|
||
The test patch aims to check that restoring closed tabs preserves the tab group order. It intermittent fails on those checks, generally on a pair of tabs. I haven't been able to fix this. I would need help on it.
I think we need the test and solve this issue. Otherwise people could run into the problem with some of their tabs shuffling and then it would be harder to reproduce without someone making a test again.
Comment 23•5 months ago
|
||
Comment 24•5 months ago
|
||
I tried out the tests today in a local Linux ASan build. I also experience the intermittent failure after many test re-runs.
It's much easier to trigger the issue when running the closed group test in chaos mode (MOZ_CHAOSMODE=1 environment variable). It looks to me like the issue is triggered by a missing session state flush before closing the tab group. When the tab group wants to close, SessionStore calls maybeSaveClosedTab on each of the group's tabs; if any of those tabs' session state haven't received the URL that they loaded, then they will not be inserted into the closed tabs array immediately. When those tabs' browsers shut down a moment later, the SessionStore observes them shutting down and basically reruns the maybeSaveClosedTab, which will append the tab at that time. That asynchronicity can lead to incorrect ordering in the test. Flushing the session state before closing the tab group ensures that all of the tabs have their content reflected in session state so that they all get their data added synchronously to the closed group tabs list.
In actual user practice, the session is flushed every 15 seconds at most, so it's unlikely that this behavior manifested this bug. The root cause of this bug was most likely the use of the tab closing time from Date.now() to order the tabs. All of the tabs in a group are effectively closed at the same time, so there is room for problems. The fix that :astor already landed should have solved that issue. From my test runs, I've only encountered anomalous behavior from session state staleness in the test harness, and I'm reasonably confident that I have a fix for the test.
I published a WIP patch with proposed fixes for the tests on top of :astor's patch https://phabricator.services.mozilla.com/D260089. I also started a try run of the test changes. https://treeherder.mozilla.org/jobs?repo=try&revision=008dd9025bdaac00ce2e2d5a7f69b7be247123b1
Comment 25•5 months ago
|
||
Should we not uplift this to beta and wait for this change? Might be better to have these go together
Comment 26•5 months ago
|
||
A patch has been attached on this bug, which was already closed. Filing a separate bug will ensure better tracking. If this was not by mistake and further action is needed, please alert the appropriate party. (Or: if the patch doesn't change behavior -- e.g. landing a test case, or fixing a typo -- then feel free to disregard this message)
Comment 27•5 months ago
|
||
:astor My patch appears to result in a clean try build. Would you be able to apply my fixes in https://phabricator.services.mozilla.com/D260089 onto your patch https://phabricator.services.mozilla.com/D257916? If you're able to update your patch soon, then I can queue your patch to land in Nightly and then request Beta uplift for both your fix patch and the test patch.
| Assignee | ||
Comment 28•5 months ago
|
||
Thanks :sthompson for the help! I'll get to it
Comment 29•5 months ago
|
||
Thank you so much :astor for taking the time! I queued your patch to land.
Comment 30•5 months ago
|
||
Comment 31•5 months ago
|
||
| bugherder | ||
Comment 32•5 months ago
|
||
Original Revision: https://phabricator.services.mozilla.com/D257776
Updated•5 months ago
|
Comment 33•5 months ago
|
||
Original Revision: https://phabricator.services.mozilla.com/D257916
Updated•5 months ago
|
Comment 34•5 months ago
|
||
Beta uplift request for the fix patch: https://phabricator.services.mozilla.com/D260041
Beta uplift request for the associated automated test: https://phabricator.services.mozilla.com/D260335
Comment 35•5 months ago
|
||
firefox-beta Uplift Approval Request
- User impact if declined: None
- Code covered by automated testing: yes
- Fix verified in Nightly: yes
- Needs manual QE test: no
- Steps to reproduce for manual QE testing: This is a test-only change.
- Risk associated with taking this patch: Low
- Explanation of risk level: Test-only patch to protect against regressions from the associated fix in bug 1974652
- String changes made/needed: No
- Is Android affected?: no
Updated•5 months ago
|
Updated•5 months ago
|
Updated•5 months ago
|
Updated•5 months ago
|
Comment 36•5 months ago
|
||
| uplift | ||
Updated•4 months ago
|
Description
•