SessionStore API reference

Generated from the JSDoc in SessionStore.sys.mjs, so it covers the members that carry a doc comment.

SessionStore

class SessionStore()

Keeps track of the state of open and closed windows, tabs and tab groups, and restores them across sessions.

SessionStore.canRestoreLastSession

type: boolean

Whether the previous session can still be restored. Assigning false discards it; assigning true has no effect.

SessionStore.lastClosedActions

type: Array.<CloseAction>

An in-order stack of close actions for tabs and windows.

SessionStore.lastClosedObjectType

Returns a string describing the last closed object, either “tab” or “window”.

This was added to support the sessions.restore WebExtensions API.

SessionStore.logger

type: Log.Logger|null

The session store’s logger, or null before initialization.

SessionStore.promiseAllWindowsRestored

type: Promise.<void>

A promise fulfilled once all windows have been restored.

SessionStore.promiseInitialized

A promise fulfilled once initialization is complete.

SessionStore.savedGroups

type: Array.<SavedTabGroupStateData>

States for all saved and closed tab groups.

SessionStore.shouldRestoreLastSession

type: boolean

Whether the previous session should be restored the next time a browser window that is neither private nor a taskbar tab opens. Set when the last such window closes while a taskbar tab keeps Firefox running and the user’s startup setting asks for the session to come back.

SessionStore.willAutoRestore

Returns a boolean that determines whether the session will be automatically restored upon the _next_ startup or a restart.

SessionStore.addSavedTabGroup(tabGroup)

Add a tab group to the session’s saved group list.

Arguments:
  • tabGroup (MozTabbrowserTabGroup) – The group to save

SessionStore.addTabsToSavedGroup(tabGroupId, tabs, metricsContext)

Add tabs to an existing saved tab group.

Arguments:
  • tabGroupId (string) – The ID of the group to save to

  • tabs (Array.<MozTabbrowserTab>) – The list of tabs to add to the group

  • metricsContext (TabMetricsContext) – Optional context to record for metrics purposes.

Returns:

SavedTabGroupStateData

SessionStore.deleteCustomGlobalValue(aKey)

Removes a value from the session’s global state.

Arguments:
  • aKey (string) – The key the value is stored under.

SessionStore.deleteCustomTabValue(aTab, aKey)

Removes a value stored on a tab.

Arguments:
  • aTab (MozTabbrowserTab) – Tab reference

  • aKey (string) – The key the value is stored under.

SessionStore.deleteCustomWindowValue(aWindow, aKey)

Removes a value stored on a window.

Arguments:
  • aWindow (Window) – Window reference

  • aKey (string) – The key the value is stored under.

SessionStore.duplicateTab(aWindow, aTab, aDelta=0, aRestoreImmediately=true, options)

Duplicates a tab, including its session history, into a window.

Arguments:
  • aWindow (Window) – The window to open the duplicate in.

  • aTab (MozTabbrowserTab) – The tab to duplicate.

  • aDelta (number) – How far to move within the duplicated session history, relative to the original tab’s current entry.

  • aRestoreImmediately (boolean) – Whether to restore the duplicate’s content right away.

  • options (object) – Options for the new tab.

  • options.inBackground (boolean) – Whether to leave the duplicate unselected.

  • options.tabIndex (number) – Where to insert the duplicate in the tab strip.

Throws:

Components.Exception – If the tab is invalid, its window is not tracked, or the target window has no gBrowser.

Returns:

MozTabbrowserTab – The duplicated tab.

SessionStore.ensureInitialized(window)

Ensures that session store has registered and started tracking a given window.

Arguments:
  • window (Window) – Window reference

SessionStore.forgetClosedTab(aSource, aIndex=0)

Forget a closed tab associated with a given window Removes the record at the given index so it cannot be un-closed or appear in a list of recently-closed tabs

Arguments:
  • aSource (Window|object) – Either a DOMWindow or an object with properties to resolve to the window the tab was previously open in.

  • aSource.sourceWindowId (string) – A SessionStore window id used to look up the window where the tab was closed

  • aSource.sourceClosedId (number) – The closedId used to look up the closed window where the tab was closed

  • aIndex (Integer) – The index into the window’s list of closed tabs

Throws:

InvalidArgumentError – if the window is not tracked by SessionStore, or index is out of bounds

SessionStore.forgetClosedTabById(aClosedId, aSourceOptions)

Forget a closed tab that corresponds to the closedId Removes the record with this closedId so it cannot be un-closed or appear in a list of recently-closed tabs

Arguments:
  • aClosedId (integer) – The closedId of the tab

  • aSourceOptions (Window|object) – Either a DOMWindow or an object with properties to resolve to the window the tab was previously open in.

  • aSourceOptions.includePrivate (boolean) – If no other means of resolving a source window is given, this flag is used to constrain a search across all open window’s closed tabs.

  • aSourceOptions.sourceWindowId (string) – A SessionStore window id used to look up the window where the tab was closed

  • aSourceOptions.sourceClosedId (number) – The closedId used to look up the closed window where the tab was closed

Throws:

InvalidArgumentError – if the closedId doesnt match a closed tab in any window

SessionStore.forgetClosedTabGroup(aSource, tabGroupId)

Forget a closed tab group associated with a given window Removes the record at the given index so it cannot be un-closed or appear in a list of recently-closed tabs

Arguments:
  • aSource (Window|object) – Either a DOMWindow or an object with properties to resolve to the window the tab was previously open in.

  • aSource.sourceWindowId (string) – A SessionStore window id used to look up the window where the tab group was closed

  • aSource.sourceClosedId (number) – The closedId used to look up the closed window where the tab group was closed

  • tabGroupId (string) – The tab group ID of the closed tab group

Throws:

InvalidArgumentError – if the window or tab group is not tracked by SessionStore

SessionStore.forgetClosedWindow(aIndex)

Drops a closed window from the list of windows that can be reopened.

Arguments:
  • aIndex (number) – The index of the window in the closed windows list. Defaults to the most recently closed one.

Throws:

Components.Exception – If the index doesn’t match a closed window.

SessionStore.forgetClosedWindowById(aClosedId)

Forget a closed window. Removes the record with this closedId so it cannot be un-closed or appear in a list of recently-closed windows

Arguments:
  • aClosedId (integer) – The closedId of the window

Throws:

InvalidArgumentError – if the closedId doesnt match a closed window

SessionStore.forgetSavedTabGroup(savedTabGroupId)

Remove a tab group from the session’s saved tab group list.

Arguments:
  • savedTabGroupId (string) – The ID of the tab group to remove

SessionStore.formatTabStateForSavedGroup(tabState)

Convert tab state into a saved group tab state. Used to convert a closed tab group into a saved tab group.

Arguments:
  • tabState (TabState) – closed tab state

SessionStore.getBrowserState()
Returns:

string – The current session state as a JSON string, without the previous session’s state and without any deferred initial state.

SessionStore.getClosedTabCount(aOptions)

Get the number of closed tabs associated with all matching windows

Arguments:
  • aOptions (Window|object) – Either a DOMWindow (see aOptions.sourceWindow) or an object with properties to identify which closed tabs to include in the count.

  • aOptions.sourceWindow (Window) – A browser window used to identity privateness. When closedTabsFromAllWindows is false, we only count closed tabs assocated with this window.

  • aOptions.private (boolean) – Explicit indicator to constrain tab count to only private or non-private windows,

  • aOptions.closedTabsFromAllWindows (boolean) – Override the value of the closedTabsFromAllWindows preference.

  • aOptions.closedTabsFromClosedWindows (boolean) – Override the value of the closedTabsFromClosedWindows preference.

SessionStore.getClosedTabCountForWindow(aWindow)

Get the number of closed tabs associated with a specific window

Arguments:
  • aWindow (Window)

SessionStore.getClosedTabCountFromClosedWindows()

Get the number of closed tabs from recently closed window

This is normally only relevant in a non-private window context, as we don’t keep data from closed private windows.

SessionStore.getClosedTabData(aOptions)

Get the closed tab data associated with all matching windows

Arguments:
  • aOptions (Window|object) – Either a DOMWindow (see aOptions.sourceWindow) or an object with properties to identify which closed tabs to get data from

  • aOptions.sourceWindow (Window) – A browser window used to identity privateness. When closedTabsFromAllWindows is false, we only include closed tabs assocated with this window.

  • aOptions.private (boolean) – Explicit indicator to constrain tab data to only private or non-private windows,

  • aOptions.closedTabsFromAllWindows (boolean) – Override the value of the closedTabsFromAllWindows preference.

  • aOptions.closedTabsFromClosedWindows (boolean) – Override the value of the closedTabsFromClosedWindows preference.

SessionStore.getClosedTabDataForWindow(aWindow)

Get the closed tab data associated with this window

Arguments:
  • aWindow (Window)

SessionStore.getClosedTabDataFromClosedWindows()

Get the closed tab data associated with all closed windows

Returns:

Array.<ClosedTabStateData> – An un-sorted array of tabData for closed tabs from closed windows

SessionStore.getClosedTabGroups(aOptions)

Get the closed tab group data associated with all matching windows

Arguments:
  • aOptions (Window|object) – Either a DOMWindow (see aOptions.sourceWindow) or an object with properties to identify the window source of the closed tab groups

  • aOptions.sourceWindow (Window) – A browser window used to identity privateness. When closedTabsFromAllWindows is false, we only include closed tab groups assocated with this window.

  • aOptions.private (boolean) – Explicit indicator to constrain tab group data to only private or non-private windows,

  • aOptions.closedTabsFromAllWindows (boolean) – Override the value of the closedTabsFromAllWindows preference.

  • aOptions.closedTabsFromClosedWindows (boolean) – Override the value of the closedTabsFromClosedWindows preference.

Returns:

Array.<ClosedTabGroupStateData>

SessionStore.getClosedWindowCount()
Returns:

number – The number of closed windows that can be reopened.

SessionStore.getClosedWindowData()
Returns:

Array.<WindowStateData>

SessionStore.getCurrentState(aUpdateAll)

gather session data as object

Arguments:
  • aUpdateAll (boolean) – Update all windows

Returns:

object – The current session state

SessionStore.getCustomGlobalValue(aKey)
Arguments:
  • aKey (string) – The key the value is stored under.

Returns:

string – The stored value, or the empty string if there is none.

SessionStore.getCustomTabValue(aTab, aKey)
Arguments:
  • aTab (MozTabbrowserTab) – Tab reference

  • aKey (string) – The key the value is stored under.

Returns:

string – The stored value, or the empty string if there is none.

SessionStore.getCustomWindowValue(aWindow, aKey)
Arguments:
  • aWindow (Window) – A tracked or recently closed window.

  • aKey (string) – The key the value is stored under.

Throws:

Components.Exception – If the window is not tracked.

Returns:

string – The stored value, or the empty string if there is none.

SessionStore.getInternalObjectState(obj)
Arguments:
  • obj (Window|MozBrowser|MozTabbrowserTab) – A tracked window, a browser, or a tab.

Returns:

object|undefined – The window’s session data, the browser’s restoring state, or the tab’s custom values.

SessionStore.getLastClosedTabCount(aWindow)

How many tabs were last closed. If multiple tabs were selected and closed together, we’ll return that number. Normally the count is 1, or 0 if no tabs have been recently closed in this window.

Arguments:
  • aWindow (Window) – Window reference

Returns:

number – The number of tabs that were last closed.

SessionStore.getLastClosedTabGroupId(aWindow)

Get the last closed tab ID associated with a specific window

Arguments:
  • aWindow (Window)

SessionStore.getLazyTabValue(aTab, aKey)

Retrieves data specific to lazy-browser tabs. If tab is not lazy, will return undefined.

Arguments:
  • aTab (MozTabbrowserTab) – The tabbrowser-tab the data is for.

  • aKey (string) – The key which maps to the desired data.

SessionStore.getNextSplitViewId()

Returns the next available split view ID and increments the counter.

Returns:

number – A unique integer ID for a split view.

SessionStore.getObjectTypeForClosedId(aClosedId)

Look up the object type (“tab” or “window”) for a given closedId

Arguments:
  • aClosedId (integer)

SessionStore.getSavedTabGroup(tabGroupId)

Retrieve the tab group state of a saved tab group by ID.

Arguments:
  • tabGroupId (string)

Returns:

SavedTabGroupStateData|undefined

SessionStore.getSavedTabGroups()

Returns all tab groups that were saved in this session.

Returns:

Array.<SavedTabGroupStateData>

SessionStore.getSessionHistory(tab, updatedCallback)

Retrieves the latest session history information for a tab. The cached data is returned immediately, but a callback may be provided that supplies up-to-date data when or if it is available. The callback is passed a single argument with data in the same format as the return value.

Arguments:
  • tab (MozTabbrowserTab) – Tab to retrieve the session history for.

  • updatedCallback (function) – Function to call with updated data as the single argument.

Returns:

object – An object containing ‘index’ specifying the current index, and an array ‘entries’ containing an object for each history item.

SessionStore.getTabState(aTab)

Collects the current state of a tab.

Arguments:
  • aTab (MozTabbrowserTab) – The tab to collect.

Throws:

Components.Exception – If the tab is invalid or its window is not tracked.

Returns:

string – The tab state as a JSON string.

SessionStore.getWindowById(aSessionStoreId)

Look up a window tracked by SessionStore by its id

Arguments:
  • aSessionStoreId (string)

SessionStore.getWindowForTabClosedId(aClosedId, aIncludePrivate)

Get window a given closed tab belongs to

Arguments:
  • aClosedId (integer) – The closedId of the tab whose window we want to find

  • aIncludePrivate (boolean) – Optionally include private windows when searching for the closed tab

SessionStore.getWindowId(aWindow)

Get the SessionStore-assigned identifier for a chrome window.

The identifier is stable for the lifetime of a window (including across a session restore that re-opens the same window) but is regenerated when a closed window is reopened from the Recently Closed list.

Arguments:
  • aWindow (Window) – A chrome window to look up.

Returns:

string|null – The window’s SessionStore id, or null if the window has not been registered with SessionStore yet.

SessionStore.getWindowState(aWindow)
Arguments:
  • aWindow (Window) – Window reference

Returns:

Object

SessionStore.getWindows(aWindowOrOptions)

Get the collection of all matching windows tracked by SessionStore

Arguments:
  • aWindowOrOptions (Window|object) – Optionally an options object or a window to used to determine if we’re filtering for private or non-private windows

  • aWindowOrOptions.private (boolean) – Determine if we should filter for private or non-private windows

SessionStore.handleEvent(aEvent)

Implement EventListener for handling various window and tab events

Arguments:
  • aEvent (Event) – The event to handle.

SessionStore.historyIndex(tabData)

The index into tabData.entries of the history entry a saved tab was showing. tabData.index is one-based and absent for a tab that never navigated, in which case the tab was showing its last entry.

Arguments:
  • tabData (TabStateData)

Returns:

number – A zero-based index.

SessionStore.init()

Initialize the sessionstore service.

SessionStore.isBrowserInCrashedSet(aBrowser)

A debugging-only function to check if a browser is in #crashedBrowsers.

Arguments:
  • aBrowser (MozBrowser) – Browser reference

SessionStore.isFormatVersionCompatible(version)

Determines whether the passed version number is compatible with the current version number of the SessionStore.

Arguments:
  • version (Array) – The format and version of the file, e.g. [“sessionrestore”, 1]

SessionStore.isTabRestoring(aTab)
Arguments:
  • aTab (MozTabbrowserTab) – The tab to check.

Returns:

boolean – Whether the tab is restoring.

SessionStore.keepOnlyWorthSavingTabs(aState)

Filters out not worth-saving tabs from a given browser state object.

Arguments:
  • aState (object) – The browser state for which we remove worth-saving tabs. The given object will be modified.

SessionStore.maybeDontRestoreTabs(aWindow)

Marks a window so that its tabs are left out when the previous session is restored at startup.

Arguments:
  • aWindow (Window) – Window reference

SessionStore.maybeExitCrashedState(aBrowser)

Check if we are dealing with a crashed browser. If so, then the corresponding crashed tab was revived by navigating to a different page. Remove the browser from the list of crashed browsers to stop ignoring its messages.

Arguments:
  • aBrowser (MozBrowser) – Browser reference

SessionStore.observe(aSubject, aTopic, aData)

Handle notifications

Arguments:
  • aSubject (nsISupports) – Subject of the notification.

  • aTopic (string) – Topic of the notification.

  • aData (string) – Data of the notification.

SessionStore.openSavedTabGroup(tabGroupId, targetWindow, options)

Re-open a saved tab group. Note that this method does not require passing a window source, as saved tab groups are independent of windows. Attempting to open a saved tab group in a private window will raise an error.

Arguments:
  • tabGroupId (string) – The unique ID of the group to restore.

  • targetWindow (Window) – defaults to the top window if not specified.

  • options (object)

  • options.source (string) – Where the group was reopened from, for metrics purposes.

Returns:

MozTabbrowserTabGroup – a reference to the restored tab group in a browser window.

SessionStore.popLastClosedAction()

Removes and returns the most recent close action. This should only be used by one caller (currently restoreLastClosedTabOrWindowOrSession in browser.js).

Returns:

CloseAction|undefined – The most recent close action, if there is one.

SessionStore.purgeDataForPrivateWindow(win)

Clear session store data for a given private browsing window.

Arguments:
  • win (ChromeWindow) – Open private browsing window to clear data for.

SessionStore.resetBrowserToLazyState(aTab)

Remove listeners which were added when browser was inserted and reset restoring state. Also re-instate lazy data and basically revert tab to its lazy browser state.

Arguments:
  • aTab (MozTabbrowserTab) – Tab reference

SessionStore.resetLastClosedActions()

Empties the list of close actions. Only for testing purposes.

SessionStore.resetLastClosedTabCount(aWindow)

Resets the count of tabs that were last closed together in a window.

Arguments:
  • aWindow (Window) – Window reference

Throws:

nsresult – NS_ERROR_INVALID_ARG if the window is not tracked.

SessionStore.resetNextClosedId()

Resets the counter used to hand out closed tab and window IDs. Only for testing purposes.

SessionStore.restoreLastSession()

Restores the session state stored in LastSession. This will attempt to merge data into the current session. If a window was opened at startup with pinned tab(s), then the remaining data from the previous session for that window will be opened into that window. Otherwise new windows will be opened.

SessionStore.reviveAllCrashedTabs()

Revive all crashed tabs and reset the crashed tabs count to 0.

SessionStore.reviveCrashedTab(aTab)

Revive a crashed tab and restore its state from before it crashed.

Arguments:
  • aTab (MozTabbrowserTab) – A <xul:tab> linked to a crashed browser. This is a no-op if the browser hasn’t actually crashed, or is not associated with a tab. This function will also throw if the browser happens to be remote.

SessionStore.setBrowserState(aState)

Restore the browser to a given state.

This is exclusively used for manual and automated testing purposes. It: - Parses the state JSON string - Initializes session-level counters (split view IDs, etc.) from given values - Migrates legacy data formats in closed windows - Closes all windows except the top window - Restores windows, tabs, cookies, and global state

Arguments:
  • aState (string) – A JSON-serialized session state string

Throws:

Components.Exception – If state is invalid or missing required properties

SessionStore.setCustomGlobalValue(aKey, aStringValue)

Stores a value in the session’s global state.

Arguments:
  • aKey (string) – The key to store the value under.

  • aStringValue (string) – The value to store.

Throws:

TypeError – If the value is not a string.

SessionStore.setCustomTabValue(aTab, aKey, aStringValue)

Stores a value on a tab, to be saved with the session.

Arguments:
  • aTab (MozTabbrowserTab) – Tab reference

  • aKey (string) – The key to store the value under.

  • aStringValue (string) – The value to store.

Throws:

TypeError – If the value is not a string.

SessionStore.setCustomWindowValue(aWindow, aKey, aStringValue)

Stores a value on a window, to be saved with the session.

Arguments:
  • aWindow (Window) – Window reference

  • aKey (string) – The key to store the value under.

  • aStringValue (string) – The value to store.

Throws:
  • TypeError – If the value is not a string.

  • Components.Exception – If the window is not tracked.

SessionStore.setTabState(aTab, aState)

Restores the given state into a tab.

Arguments:
  • aTab (MozTabbrowserTab) – The tab to restore into.

  • aState (TabStateData|string) – The tab state, as an object or a JSON string. It may be incomplete, in which case the rest is filled in while restoring.

Throws:

Components.Exception – If the state is invalid or the tab’s window is not tracked.

SessionStore.setWindowState(aWindow, aState, aOverwrite)

Restores the given state into a window.

Arguments:
  • aWindow (Window) – The window to restore into.

  • aState (object|string) – The window state, as an object or a JSON string.

  • aOverwrite (boolean) – Whether to overwrite the window’s existing tabs.

Throws:

Components.Exception – If the window is not tracked.

SessionStore.shouldSaveTabsToGroup(tabs)

Determine whether a list of tabs should be considered saveable. A list of tabs is considered saveable if any of the tabs in the list are worth saving.

This is used to determine if a tab group should be saved, or if any active tabs in a selection are eligible to be added to an existing saved group.

Arguments:
  • tabs (Array.<MozTabbrowserTab>) – the list of tabs to check

Returns:

boolean – true if any of the tabs are saveable.

SessionStore.speculativeConnectOnTabHover(tab)

Make a connection to a host when users hover mouse on a tab. This will also set a flag in the tab to prevent us from speculatively connecting a second time.

Arguments:
  • tab (MozTabbrowserTab) – a tab to speculatively connect on mouse hover.

SessionStore.undoCloseById(aClosedId, aIncludePrivate=true, aTargetWindow)

Undoes the closing of a tab or window which corresponds to the closedId passed in.

Arguments:
  • aClosedId (integer) – The closedId of the tab or window

  • aIncludePrivate (boolean) – Whether to restore private tabs or windows. Defaults to true

  • aTargetWindow (Window) – When aClosedId is for a closed tab, which window to re-open the tab into. Defaults to current (topWindow).

Returns:

MozTabbrowserTab|Window – The reopened tab or window

SessionStore.undoCloseTab(aSource, aIndex=0, aTargetWindow=aWindow)

Re-open a closed tab

Arguments:
  • aSource (Window|object) – Either a DOMWindow or an object with properties to resolve to the window the tab was previously open in.

  • aSource.sourceWindowId (string) – A SessionStore window id used to look up the window where the tab was closed

  • aSource.sourceClosedId (number) – The closedId used to look up the closed window where the tab was closed

  • aIndex (Integer) – The index of the tab in the closedTabs array (via SessionStore.getClosedTabData), where 0 is most recent.

  • aTargetWindow (Window) – Optional window to open the tab into, defaults to current (topWindow).

Returns:

MozTabbrowserTab – A reference to the reopened tab.

SessionStore.undoCloseTabGroup(source, tabGroupId, targetWindow)

Re-open a closed tab group

Arguments:
  • source (Window|object) – Either a DOMWindow or an object with properties to resolve to the window the tab was previously open in.

  • source.sourceWindowId (string) – A SessionStore window id used to look up the window where the tab was closed.

  • source.sourceClosedId (number) – The closedId used to look up the closed window where the tab was closed.

  • tabGroupId (string) – The unique ID of the group to restore.

  • targetWindow (Window) – defaults to the top window if not specified.

Returns:

MozTabbrowserTabGroup – a reference to the restored tab group in a browser window.

SessionStore.undoCloseWindow(aIndex)

Reopens a closed window. Any saved tab groups it contains are turned back into open tab groups.

Arguments:
  • aIndex (number) – The index of the window in the closed windows list, where 0 is the most recently closed one.

Throws:

Components.Exception – If the index doesn’t match a closed window.

Returns:

Window – The reopened window.

SessionStore.undoClosedTabFromClosedWindow(aSource, aClosedId, aTargetWindow=aWindow)

Re-open a tab from a closed window, which corresponds to the closedId

Arguments:
  • aSource (Window|object) – Either a DOMWindow or an object with properties to resolve to the window the tab was previously open in.

  • aSource.sourceWindowId (string) – A SessionStore window id used to look up the window where the tab was closed

  • aSource.sourceClosedId (number) – The closedId used to look up the closed window where the tab was closed

  • aClosedId (integer) – The closedId of the tab or window

  • aTargetWindow (Window) – Optional window to open the tab into, defaults to current (topWindow).

Returns:

MozTabbrowserTab – A reference to the reopened tab.

SessionStore.updateSessionStoreFromTablistener(browser, browsingContext, permanentKey, update, forStorage=false)

Applies a tab data update reported by a tab listener.

Arguments:
  • browser (MozBrowser|null) – The browser the update is for, if it is still around.

  • browsingContext (BrowsingContext) – The browsing context the update was collected from.

  • permanentKey (object) – The permanent key of the browser, used when browser is null.

  • update (object) – The collected tab data, tagged with the epoch it belongs to.

  • forStorage (boolean) – Whether the update is collected in order to save the session, in which case a non-web-controlled page that is still loading is collected as well.

SessionStore.validateState(state)

Validates that a state object matches the schema defined in browser/components/sessionstore/session.schema.json

Arguments:
  • state (object) – State object to validate. If not provided, will validate the current session state.

Returns:

Promise – A promise which resolves to a validation result object