Open Bug 2089797 Opened 20 days ago Updated 12 hours ago

SessionStore.restoreLastSession forgets flagged saved tab groups that the last session does not reopen

Categories

(Firefox :: Session Restore, defect, P2)

defect

Tracking

()

People

(Reporter: mhynson, Assigned: mhynson)

References

(Blocks 1 open bug)

Details

(Whiteboard: [fidefe-session-restore])

On a deferred startup, #prepDataForDeferredRestore turns open tab groups into saved groups and flags them removeAfterRestore. Then, if the user restores the last session, restoreLastSession reopens those groups and removes the saved copies by calling forgetSavedTabGroup on every group with the flag.

It does not check that lastSessionState actually contains an open group with that id. That is only safe while LastSession is still the deferred session that set the flags. The flags are only cleared on the next deferred startup.

LastSession can be replaced in between. In the taskbar-tab branch of #onClose, when the last regular window closes while a taskbar tab (web app) stays open, LastSession is set to getCurrentState(true). In that state, the flagged group is a saved group, not an open one.

Steps:

  1. Deferred startup turns open group G into a saved group with removeAfterRestore.
  2. Close the last regular window while a web app window stays open.
  3. Open a new window and choose "Restore Previous Session".
  4. G is not reopened, and it is deleted from saved groups for good.
Summary: `SessionStore.restoreLastSession` forgets flagged saved tab groups that the last session does not reopen → SessionStore.restoreLastSession forgets flagged saved tab groups that the last session does not reopen
Assignee: nobody → mhynson
See Also: → 2089794

Proposed fix: only forget flagged groups whose ids appear in lastSessionState.windows[*].groups. Alternatively, clear the flags whenever LastSession is replaced or cleared. The first is narrower and easier to test.

Test plan (Marionette): use setup_taskbartab_restore_scenario and restore_last_session from session_store_test_case.py. Check that G is still in SessionStore.savedGroups after step 3. The test should fail on current code.

Whiteboard: [fidefe-session-restore]
See Also: → 2092154
Priority: -- → P2
You need to log in before you can comment on or make changes to this bug.