Closed Bug 2066123 Opened 3 months ago Closed 2 months ago

Document the events and notifications Session Restore broadcasts

Categories

(Firefox :: Session Restore, task)

task

Tracking

()

RESOLVED FIXED
158 Branch
Tracking Status
firefox158 --- fixed

People

(Reporter: dao, Assigned: dao)

References

(Blocks 1 open bug)

Details

Attachments

(1 external file)

Add a page to the Session Restore docs covering the DOM events and observer notifications the component broadcasts. The generated API reference documents none of them, since they are dispatchEvent and notifyObservers calls rather than class members, so the only way to learn the vocabulary today is to grep.

SessionStore.sys.mjs dispatches seven events -- SSWindowClosing, SSWindowStateBusy, SSWindowStateReady, SSWindowRestoring, SSWindowRestored, SSTabRestoring and SSTabRestored -- and the component notifies nineteen observer topics across it, SessionStartup, SessionSaver, SessionFile and StartupPerformance. Part of the page's job is sorting what a consumer should listen to from what is internal or test-only.

What the page should answer:

  • which event and which topic fires when, for a session restored at startup, a single window restored later, and a window being closed
  • SSTabRestoring vs SSTabRestored: the first is the tab's chrome (label, icon, session history), the second its content
  • sessionstore-closed-objects-changed and sessionstore-saved-tab-groups-changed fire a tick after the change, and the first is coalesced behind a dirty flag, so a consumer that closes a tab and reads getClosedTabCount synchronously sees the list from before the change
  • sessionstore-state-read is an extension point rather than a signal: its subject is a mutable nsISupportsString holding the session JSON, and an observer that rewrites it changes what gets parsed
  • which topics are test-only: sessionstore-debug-tab-restored and sessionstore-domwindowclosed-handled are behind gDebuggingEnabled, and sessionstore-browser-state-restored is the twin of sessionstore-windows-restored that setBrowserState notifies so a test restoring a session does not re-trigger the startup observers
  • what the component listens for that is API rather than lifecycle: browser:purge-session-history, browser:purge-session-history-for-domain and clear-origin-attributes-data

sessionstore-windows-restored is the exception: browser/docs/BrowserStartup.md already covers its role as the tree's startup milestone and the races around it, so the page should say what Session Restore means by it and link there.

Assignee: nobody → dao+bmo
Status: NEW → ASSIGNED
Attachment #9635283 - Attachment description: Bug 2066123 - Document the events and notifications Session Restore broadcasts. r?jswinarton! → Bug 2066123 - Document the events and notifications Session Restore broadcasts. r?sthompson!
Depends on: 2074358
Blocks: 2074358
No longer depends on: 2074358
Status: ASSIGNED → RESOLVED
Closed: 2 months ago
Resolution: --- → FIXED
Target Milestone: --- → 158 Branch
QA Whiteboard: [qa-triage-done-c159/b158]
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: