Session restore API
From MDC
Firefox 2 introduces session restore, a new feature that makes it possible for extensions to easily save and restore data across Firefox sessions. There is a simple API that lets extensions access the session restore feature.
Contents |
The nsISessionStore interface
The nsISessionStore interface provides six methods that let extensions read and write values to the session store.
getWindowValue()
The getWindowValue() method retrieves a value that's been saved in the session store in association with a given window.
string getWindowValue(in nsIDOMWindow aWindow, in string aKey)
aWindow is the window for which the extension wishes to retrieve a saved value, and aKey is the name of the value to retrieve. The value is returned as a string.
setWindowValue()
Sets the value associated with a specific window and key string within the session store.
void setWindowValue(in nsIDOMWindow aWindow, in string aKey, in string aStringValue)
aWindow is the window for which the extension wishes to save a value, aKey is the key whose value is to be set, and aStringValue is the value to set the key to.
deleteWindowValue()
Deletes a key/value pair from the session store for a specified window.
void deleteWindowValue(in nsIDOMWindow aWindow, in string aKey)
aWindow is the window for which the key/value pair specified by the key aKey should be deleted.
getTabValue()
Returns the value associated with a particular key for a given tab's saved session.
string getTabValue(in nsIDOMNode aTab, in string aKey)
aTab is the tab whose saved session is to be read. aKey is the key whose value is to be fetched.
setTabValue()
Sets the value for a specified key in a given tab's saved session.
void setTabValue(in nsIDOMNode aTab, in string aKey, in string aStringValue)
aTab is the tab into which to save the value aStringValue for the key specified by aKey.
deleteTabValue()
Deletes a key/value pair from the session store for a specified tab.
void deleteTabValue(in nsIDOMNode aTab, in string aKey)
aTab is the tab for which the key/value pair corresponding to the key aKey should be deleted.
Using the session restore API
An example is coming soon.