nsISessionStore

nsISessionStore keeps track of the current browsing state.

The nsISessionStore API operates mostly on browser windows and the browser
tabs contained in them.

Methods

getBrowserState()

Get the current browsing state.

Returns

a JSON string representing the session state.

getClosedTabCount(aWindow)

Get the number of restore-able tabs for a browser window

getClosedTabs(aWindow)

Get closed tab data

Parameters

aWindow is the browser window for which to get closed tab data

Returns

a JS array of closed tabs.

undoCloseTab(aWindow, aCloseTabData)

Parameters

aWindow is the browser window to reopen a closed tab in.
aCloseTabData is the data of the tab to be restored.

Returns

a reference to the reopened tab.

forgetClosedTab(aWindow, aIndex)

Parameters

aWindow is the browser window associated with the closed tab.
aIndex is the index of the closed tab to be removed (FIFO ordered).

getTabValue(aTab, aKey)

Parameters

aTab is the browser tab to get the value for.
aKey is the value's name.

Returns

A string value or an empty string if none is set.

setTabValue(aTab, aKey, aStringValue)

Parameters

aTab is the browser tab to set the value for.
aKey is the value's name.
aStringValue is the value itself (use JSON.stringify/parse before setting JS objects).

deleteTabValue(aTab, aKey)

Parameters

aTab is the browser tab to get the value for.
aKey is the value's name.

restoreLastSession(aSessionString)

Restores the previous browser session using a fast, lightweight strategy

Parameters

aSessionString The session string to restore from. If null, the backup session file is read from.

removeWindow(aWindow)

Removes a window from the current session history. Data from this window
won’t be saved when its closed.

Parameters

aWindow The window to remove