Session Restore
Session restore keeps track of the windows, tabs and tab groups a user has open or recently closed, along with state information for each tab (history, scroll position, form data, etc.). It persists that state to disk, and puts it back when Firefox starts again or when the user reopens something they closed.
SessionStore is the component’s entry point. It observes browser windows and
their tabs, holds the collected state in memory, and exposes the API that the
rest of the front-end uses to read state, to reopen closed tabs, windows and tab
groups, and to save and restore whole sessions. The remaining modules in
browser/components/sessionstore support it:
SessionStartupReads the session file at startup and decides whether the previous session should be restored.
SessionSaver,SessionFileandSessionWriterSchedule and perform the disk I/O that persists the session state.
TabState,TabStateCacheandTabStateFlusherCollect per-tab state, cache it, and let callers wait for a tab’s latest data.
RunStateTracks whether session restore is stopped, running or quitting.
GlobalState,SessionCookies,TabAttributesandTabGroupStateHold the parts of the session state that aren’t per-tab.