nsISessionStore Interface Reference

import"nsISessionStore.idl";

Inheritance diagram for nsISessionStore:
[legend]
Collaboration diagram for nsISessionStore:
[legend]

Public Member Functions

void init (in nsIDOMWindow aWindow)
 
AString getBrowserState ()
 
void setBrowserState (in AString aState)
 
AString getWindowState (in nsIDOMWindow aWindow)
 
void setWindowState (in nsIDOMWindow aWindow, in AString aState, in boolean aOverwrite)
 
AString getTabState (in nsIDOMNode aTab)
 
void setTabState (in nsIDOMNode aTab, in AString aState)
 
nsIDOMNode duplicateTab (in nsIDOMWindow aWindow, in nsIDOMNode aTab)
 
unsigned long getClosedTabCount (in nsIDOMWindow aWindow)
 
AString getClosedTabData (in nsIDOMWindow aWindow)
 
nsIDOMNode undoCloseTab (in nsIDOMWindow aWindow, in unsigned long aIndex)
 
nsIDOMNode forgetClosedTab (in nsIDOMWindow aWindow, in unsigned long aIndex)
 
unsigned long getClosedWindowCount ()
 
AString getClosedWindowData ()
 
nsIDOMWindow undoCloseWindow (in unsigned long aIndex)
 
nsIDOMNode forgetClosedWindow (in unsigned long aIndex)
 
AString getWindowValue (in nsIDOMWindow aWindow, in AString aKey)
 
void setWindowValue (in nsIDOMWindow aWindow, in AString aKey, in AString aStringValue)
 
void deleteWindowValue (in nsIDOMWindow aWindow, in AString aKey)
 
AString getTabValue (in nsIDOMNode aTab, in AString aKey)
 
void setTabValue (in nsIDOMNode aTab, in AString aKey, in AString aStringValue)
 
void deleteTabValue (in nsIDOMNode aTab, in AString aKey)
 
void persistTabAttribute (in AString aName)
 

Detailed Description

nsISessionStore keeps track of the current browsing state - i.e. tab history, cookies, scroll state, form data, POSTDATA and window features

  • and allows to restore everything into one browser window.

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

  • "Browser windows" are those DOM windows having loaded chrome://browser/content/browser.xul . From overlays you can just pass the global |window| object to the API, though (or |top| from a sidebar). From elsewhere you can get browser windows through the nsIWindowMediator by looking for "navigator:browser" windows.
  • "Tabbrowser tabs" are all the child nodes of a browser window's |getBrowser().tabContainer| such as e.g. |getBrowser().selectedTab|.

Definition at line 63 of file nsISessionStore.idl.

Member Function Documentation

void nsISessionStore::deleteTabValue ( in nsIDOMNode  aTab,
in AString  aKey 
)
Parameters
aTabis the tabbrowser tab to get the value for.
aKeyis the value's name.
void nsISessionStore::deleteWindowValue ( in nsIDOMWindow  aWindow,
in AString  aKey 
)
Parameters
aWindowis the browser window to get the value for.
aKeyis the value's name.
nsIDOMNode nsISessionStore::duplicateTab ( in nsIDOMWindow  aWindow,
in nsIDOMNode  aTab 
)

Duplicates a given tab as thoroughly as possible.

Parameters
aWindowis the browser window into which the tab will be duplicated.
aTabis the tabbrowser tab to duplicate (can be from a different window).
Returns
a reference to the newly created tab.
nsIDOMNode nsISessionStore::forgetClosedTab ( in nsIDOMWindow  aWindow,
in unsigned long  aIndex 
)
Parameters
aWindowis the browser window associated with the closed tab.
aIndexis the index of the closed tab to be removed (FIFO ordered).
nsIDOMNode nsISessionStore::forgetClosedWindow ( in unsigned long  aIndex)
Parameters
aIndexis the index of the closed window to be removed (FIFO ordered).
Exceptions
NS_ERROR_INVALID_ARGwhen aIndex does not map to a closed window
AString nsISessionStore::getBrowserState ( )

Get the current browsing state.

Returns
a JSON string representing the session state.
unsigned long nsISessionStore::getClosedTabCount ( in nsIDOMWindow  aWindow)

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

AString nsISessionStore::getClosedTabData ( in nsIDOMWindow  aWindow)

Get closed tab data

Parameters
aWindowis the browser window for which to get closed tab data
Returns
a JSON string representing the list of closed tabs.
unsigned long nsISessionStore::getClosedWindowCount ( )

Get the number of restore-able windows

AString nsISessionStore::getClosedWindowData ( )

Get closed windows data

Returns
a JSON string representing the list of closed windows.
AString nsISessionStore::getTabState ( in nsIDOMNode  aTab)
Parameters
aTabis the tabbrowser tab whose state is to be returned.
Returns
a JSON string representing the state of the tab (note: doesn't contain cookies - if you need them, use getWindowState instead).
AString nsISessionStore::getTabValue ( in nsIDOMNode  aTab,
in AString  aKey 
)
Parameters
aTabis the tabbrowser tab to get the value for.
aKeyis the value's name.
Returns
A string value or an empty string if none is set.
AString nsISessionStore::getWindowState ( in nsIDOMWindow  aWindow)
Parameters
aWindowis the browser window whose state is to be returned.
Returns
a JSON string representing a session state with only one window.
AString nsISessionStore::getWindowValue ( in nsIDOMWindow  aWindow,
in AString  aKey 
)
Parameters
aWindowis the window to get the value for.
aKeyis the value's name.
Returns
A string value or an empty string if none is set.
void nsISessionStore::init ( in nsIDOMWindow  aWindow)

Initialize the service

void nsISessionStore::persistTabAttribute ( in AString  aName)
Parameters
aNameis the name of the attribute to save/restore for all tabbrowser tabs.
void nsISessionStore::setBrowserState ( in AString  aState)

Set the browsing state. This will immediately restore the state of the whole application to the state passed in, replacing the current session.

Parameters
aStateis a JSON string representing the session state.
void nsISessionStore::setTabState ( in nsIDOMNode  aTab,
in AString  aState 
)
Parameters
aTabis the tabbrowser tab whose state is to be set.
aStateis a JSON string representing a session state.
void nsISessionStore::setTabValue ( in nsIDOMNode  aTab,
in AString  aKey,
in AString  aStringValue 
)
Parameters
aTabis the tabbrowser tab to set the value for.
aKeyis the value's name.
aStringValueis the value itself (use toSource/eval before setting JS objects).
void nsISessionStore::setWindowState ( in nsIDOMWindow  aWindow,
in AString  aState,
in boolean  aOverwrite 
)
Parameters
aWindowis the browser window whose state is to be set.
aStateis a JSON string representing a session state.
aOverwriteboolean overwrite existing tabs
void nsISessionStore::setWindowValue ( in nsIDOMWindow  aWindow,
in AString  aKey,
in AString  aStringValue 
)
Parameters
aWindowis the browser window to set the value for.
aKeyis the value's name.
aStringValueis the value itself (use toSource/eval before setting JS objects).
nsIDOMNode nsISessionStore::undoCloseTab ( in nsIDOMWindow  aWindow,
in unsigned long  aIndex 
)
Parameters
aWindowis the browser window to reopen a closed tab in.
aIndexis the index of the tab to be restored (FIFO ordered).
Returns
a reference to the reopened tab.
nsIDOMWindow nsISessionStore::undoCloseWindow ( in unsigned long  aIndex)
Parameters
aIndexis the index of the windows to be restored (FIFO ordered).
Returns
the nsIDOMWindow object of the reopened window

The documentation for this interface was generated from the following file: