Pinned tabs disappears when closing Firefox
Categories
(Firefox :: Session Restore, defect)
Tracking
()
People
(Reporter: fahad.at94, Unassigned)
References
Details
User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:94.0) Gecko/20100101 Firefox/94.0
Steps to reproduce:
when two Firefox windows are opened (one contains all the pinned tabs and the other one contains at least on regular tab), if i close the main window (which contains all the pinned tabs) and then close the other window, the pinned tabs will disappears if i run Firefox again.
Actual results:
pinned tabs disappears
Expected results:
the pinned tabs should not disappears
Comment 1•5 years ago
|
||
The Bugbug bot thinks this bug should belong to the 'Firefox::Tabbed Browser' component, and is moving the bug to that component. Please revert this change in case you think the bot is wrong.
Comment 2•5 years ago
|
||
Hello! I have managed to reproduce the issue with firefox 95.0a1 (2021-11-01), 94.0 and 93.0 on Ubuntu 20 and MacOS 10.15 and Windows 10
Marking this issue as NEW and setting a component in order for our developers to look more into it.
If it's not the right component please feel free to change it to an appropriate one.
Thank you
Comment 3•4 years ago
|
||
This is a recurring problem for me. I wish it would get fixed.
Just now, I forgot that I still had a Customer Support chat open. When I had clicked to open that chat, it had opened itself in a new window. I went along my way, and sometime later, I decided to close Firefox, forgetting that, buried on one of my multiple displays, the chat windows was still there. Of course, I closed the initial (main?) window, with all my pinned tabs, and BOOM! All my pinned tabs were permanently gone!
I have read several things, and they make me think this is a design choice. Something about each window having it's own "session" and pinned tabs are stored in that "session." The end user has to be careful which windows they close, in which order, or they will the pinned tabs. Why put this burden on the end user??? It is just NOT a good user experience
Losing stuff, important information, like that found in pinned tabs... I would suggest that the design should be looked at again.
I looked into why this happens. It reproduces on Firefox 160.0 (Windows 11, new profile, no add-ons, default browser.startup.page = 1), and it depends on how long you wait between closing the two windows.
Steps (no add-ons):
- New profile. Pin a few tabs in the first window, then restart Firefox. The pinned tabs come back.
- Open a second window (Ctrl+N).
- Close the window with the pinned tabs.
- Wait about 20 seconds.
- Close the remaining window (Firefox exits).
- Start Firefox: the pinned tabs are gone.
With about 2.5 s at step 4, the pinned tabs survived (4/4 runs). With 20 s they were lost (2/2 runs). They aren't deleted: they end up in _closedWindows, and in my test History > Restore Previous Session followed by History > Recently Closed Windows brought the window back.
Cause. On Windows/Linux, windows closed one after another before quitting are meant to be reopened via _shouldRestore. The first regular session save after a window closes wipes that flag:
SessionStore.#onClose()setswinData._shouldRestore = trueand storeswinDatain#closedWindows.SessionStore.getCurrentState()returns_closedWindows: this.#closedWindows.slice(), a shallow copy whose items are the livewinDataobjects.SessionSaver.#saveState()runs the "restore closed windows that are marked with_shouldRestore" loop on every save, not only at shutdown, and doesdelete state._closedWindows[i]._shouldRestore. That deletes the flag on SessionStore's live object.- That save is scheduled by
#saveStateDelayed()right after the window closes.SessionSaver.runDelayed()waits at least 2 s, or untilbrowser.sessionstore.interval(15 s) has passed since the previous save. - When the last window is closed after that,
#isLastRestorableWindow()returns true because no closed window has_shouldRestoreany more. At shutdowngetCurrentState()moves only that last window back intowindows, and theSessionSaverloop stops at the pinned window because its flag is gone. Withbrowser.startup.page != 3,#prepDataForDeferredRestore()takes pinned tabs only fromwindows, so they are not restored.
I traced _shouldRestore on the closed window: it went from true to unset about 2 s after the close in one setup and about 14 s after it in another. In neither case did any tab event or browser:purge-session-history* notification fire in between, so none of the #clearRestoringWindows() callers were involved.
Possible fix. Don't mutate SessionStore's objects in SessionSaver.#saveState():
let winData = { ...state._closedWindows.pop() };
delete winData._shouldRestore;
state.windows.unshift(winData);
I checked the idea at runtime by wrapping SessionStore.getCurrentState() so that _closedWindows holds shallow copies. With that change:
- the 20 s case above kept the pinned tabs (1/1);
- a setup where the bug otherwise hit in 8 of 9 runs at a 2.5 s gap also kept them (2/2). That setup uses a new-tab add-on, see below.
I haven't built Firefox with the exact change above.
For context, this came up in https://github.com/victrme/Bonjourr/issues/916 (a new-tab extension, seen on LibreWolf). The extension isn't the cause, it only makes the bug easier to hit. Its page triggers no session saves, so in my tests the next save came 2 s after the close instead of about 14 s.
Description
•