2012-05-21 04:12:37 -07:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
2010-07-18 22:27:52 -07:00
|
|
|
|
|
|
|
#include "nsISupports.idl"
|
|
|
|
|
|
|
|
interface nsIDOMWindow;
|
|
|
|
interface nsIDOMNode;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* nsISessionStore keeps track of the current browsing state.
|
|
|
|
*
|
|
|
|
* The nsISessionStore API operates mostly on browser windows and the browser
|
|
|
|
* tabs contained in them.
|
|
|
|
*/
|
|
|
|
|
2014-06-04 19:10:05 -07:00
|
|
|
[scriptable, uuid(91eca9cf-6741-4c8f-a3a0-2e957240894d)]
|
2010-07-18 22:27:52 -07:00
|
|
|
interface nsISessionStore : nsISupports
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* Get the current browsing state.
|
|
|
|
* @returns a JSON string representing the session state.
|
|
|
|
*/
|
|
|
|
AString getBrowserState();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the number of restore-able tabs for a browser window
|
|
|
|
*/
|
|
|
|
unsigned long getClosedTabCount(in nsIDOMWindow aWindow);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get closed tab data
|
|
|
|
*
|
|
|
|
* @param aWindow is the browser window for which to get closed tab data
|
2014-06-04 19:10:05 -07:00
|
|
|
* @returns a JS array of closed tabs.
|
2010-07-18 22:27:52 -07:00
|
|
|
*/
|
2014-06-04 19:10:05 -07:00
|
|
|
jsval getClosedTabs(in nsIDOMWindow aWindow);
|
2010-07-18 22:27:52 -07:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @param aWindow is the browser window to reopen a closed tab in.
|
|
|
|
* @param aIndex is the index of the tab to be restored (FIFO ordered).
|
|
|
|
* @returns a reference to the reopened tab.
|
|
|
|
*/
|
|
|
|
nsIDOMNode undoCloseTab(in nsIDOMWindow aWindow, in unsigned long aIndex);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @param aWindow is the browser window associated with the closed tab.
|
|
|
|
* @param aIndex is the index of the closed tab to be removed (FIFO ordered).
|
|
|
|
*/
|
|
|
|
nsIDOMNode forgetClosedTab(in nsIDOMWindow aWindow, in unsigned long aIndex);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @param aTab is the browser tab to get the value for.
|
|
|
|
* @param aKey is the value's name.
|
|
|
|
*
|
|
|
|
* @returns A string value or an empty string if none is set.
|
|
|
|
*/
|
2012-03-23 13:53:40 -07:00
|
|
|
AString getTabValue(in jsval aTab, in AString aKey);
|
2010-07-18 22:27:52 -07:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @param aTab is the browser tab to set the value for.
|
|
|
|
* @param aKey is the value's name.
|
|
|
|
* @param aStringValue is the value itself (use JSON.stringify/parse before setting JS objects).
|
|
|
|
*/
|
2012-03-23 13:53:40 -07:00
|
|
|
void setTabValue(in jsval aTab, in AString aKey, in AString aStringValue);
|
2010-07-18 22:27:52 -07:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @param aTab is the browser tab to get the value for.
|
|
|
|
* @param aKey is the value's name.
|
|
|
|
*/
|
2012-03-23 13:53:40 -07:00
|
|
|
void deleteTabValue(in jsval aTab, in AString aKey);
|
2010-12-15 17:47:38 -08:00
|
|
|
|
|
|
|
/**
|
2011-05-14 14:11:44 -07:00
|
|
|
* Restores the previous browser session using a fast, lightweight strategy
|
2012-10-29 16:34:29 -07:00
|
|
|
* @param aSessionString The session string to restore from. If null, the
|
|
|
|
* backup session file is read from.
|
2010-12-15 17:47:38 -08:00
|
|
|
*/
|
2013-09-10 11:17:42 -07:00
|
|
|
void restoreLastSession(in AString aSessionString);
|
2010-07-18 22:27:52 -07:00
|
|
|
};
|