Bug 470455 - test_database_sync_embed_visits.js leaks, r=sdwilsh
[wine-gecko.git] / browser / components / sessionstore / nsISessionStore.idl
blob438dbfbc6bb7d5754cfedd890df58ea48cd43c59
1 /* ***** BEGIN LICENSE BLOCK *****
2 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
4 * The contents of this file are subject to the Mozilla Public License Version
5 * 1.1 (the "License"); you may not use this file except in compliance with
6 * the License. You may obtain a copy of the License at
7 * http://www.mozilla.org/MPL/
9 * Software distributed under the License is distributed on an "AS IS" basis,
10 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
11 * for the specific language governing rights and limitations under the
12 * License.
14 * The Original Code is the Session Restore component.
16 * The Initial Developer of the Original Code is
17 * Simon Bünzli <zeniko@gmail.com>
18 * Portions created by the Initial Developer are Copyright (C) 2006
19 * the Initial Developer. All Rights Reserved.
21 * Contributor(s):
22 * Dietrich Ayala <dietrich@mozilla.com>
24 * Alternatively, the contents of this file may be used under the terms of
25 * either the GNU General Public License Version 2 or later (the "GPL"), or
26 * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
27 * in which case the provisions of the GPL or the LGPL are applicable instead
28 * of those above. If you wish to allow use of your version of this file only
29 * under the terms of either the GPL or the LGPL, and not to allow others to
30 * use your version of this file under the terms of the MPL, indicate your
31 * decision by deleting the provisions above and replace them with the notice
32 * and other provisions required by the GPL or the LGPL. If you do not delete
33 * the provisions above, a recipient may use your version of this file under
34 * the terms of any one of the MPL, the GPL or the LGPL.
36 * ***** END LICENSE BLOCK ***** */
38 #include "nsISupports.idl"
40 interface nsIDOMWindow;
41 interface nsIDOMNode;
43 /**
44 * nsISessionStore keeps track of the current browsing state - i.e.
45 * tab history, cookies, scroll state, form data, POSTDATA and window features
46 * - and allows to restore everything into one browser window.
48 * The nsISessionStore API operates mostly on browser windows and the tabbrowser
49 * tabs contained in them:
51 * * "Browser windows" are those DOM windows having loaded
52 * chrome://browser/content/browser.xul . From overlays you can just pass the
53 * global |window| object to the API, though (or |top| from a sidebar).
54 * From elsewhere you can get browser windows through the nsIWindowMediator
55 * by looking for "navigator:browser" windows.
57 * * "Tabbrowser tabs" are all the child nodes of a browser window's
58 * |getBrowser().tabContainer| such as e.g. |getBrowser().selectedTab|.
61 [scriptable, uuid(91f6d650-898d-11dd-ad8b-0800200c9a66)]
62 interface nsISessionStore : nsISupports
64 /**
65 * Initialize the service
67 void init(in nsIDOMWindow aWindow);
69 /**
70 * Get the current browsing state.
71 * @returns a JSON string representing the session state.
73 AString getBrowserState();
75 /**
76 * Set the browsing state.
77 * This will immediately restore the state of the whole application to the state
78 * passed in, *replacing* the current session.
80 * @param aState is a JSON string representing the session state.
82 void setBrowserState(in AString aState);
84 /**
85 * @param aWindow is the browser window whose state is to be returned.
87 * @returns a JSON string representing a session state with only one window.
89 AString getWindowState(in nsIDOMWindow aWindow);
91 /**
92 * @param aWindow is the browser window whose state is to be set.
93 * @param aState is a JSON string representing a session state.
94 * @param aOverwrite boolean overwrite existing tabs
96 void setWindowState(in nsIDOMWindow aWindow, in AString aState, in boolean aOverwrite);
98 /**
99 * @param aTab is the tabbrowser tab whose state is to be returned.
101 * @returns a JSON string representing the state of the tab
102 * (note: doesn't contain cookies - if you need them, use getWindowState instead).
104 AString getTabState(in nsIDOMNode aTab);
107 * @param aTab is the tabbrowser tab whose state is to be set.
108 * @param aState is a JSON string representing a session state.
110 void setTabState(in nsIDOMNode aTab, in AString aState);
113 * Duplicates a given tab as thoroughly as possible.
115 * @param aWindow is the browser window into which the tab will be duplicated.
116 * @param aTab is the tabbrowser tab to duplicate (can be from a different window).
117 * @returns a reference to the newly created tab.
119 nsIDOMNode duplicateTab(in nsIDOMWindow aWindow, in nsIDOMNode aTab);
122 * Get the number of restore-able tabs for a browser window
124 unsigned long getClosedTabCount(in nsIDOMWindow aWindow);
127 * Get closed tab data
129 * @param aWindow is the browser window for which to get closed tab data
130 * @returns a JSON string representing the list of closed tabs.
132 AString getClosedTabData(in nsIDOMWindow aWindow);
135 * @param aWindow is the browser window to reopen a closed tab in.
136 * @param aIndex is the index of the tab to be restored (FIFO ordered).
137 * @returns a reference to the reopened tab.
139 nsIDOMNode undoCloseTab(in nsIDOMWindow aWindow, in unsigned long aIndex);
142 * @param aWindow is the window to get the value for.
143 * @param aKey is the value's name.
145 * @returns A string value or an empty string if none is set.
147 AString getWindowValue(in nsIDOMWindow aWindow, in AString aKey);
150 * @param aWindow is the browser window to set the value for.
151 * @param aKey is the value's name.
152 * @param aStringValue is the value itself (use toSource/eval before setting JS objects).
154 void setWindowValue(in nsIDOMWindow aWindow, in AString aKey, in AString aStringValue);
157 * @param aWindow is the browser window to get the value for.
158 * @param aKey is the value's name.
160 void deleteWindowValue(in nsIDOMWindow aWindow, in AString aKey);
163 * @param aTab is the tabbrowser tab to get the value for.
164 * @param aKey is the value's name.
166 * @returns A string value or an empty string if none is set.
168 AString getTabValue(in nsIDOMNode aTab, in AString aKey);
171 * @param aTab is the tabbrowser tab to set the value for.
172 * @param aKey is the value's name.
173 * @param aStringValue is the value itself (use toSource/eval before setting JS objects).
175 void setTabValue(in nsIDOMNode aTab, in AString aKey, in AString aStringValue);
178 * @param aTab is the tabbrowser tab to get the value for.
179 * @param aKey is the value's name.
181 void deleteTabValue(in nsIDOMNode aTab, in AString aKey);
184 * @param aName is the name of the attribute to save/restore for all tabbrowser tabs.
186 void persistTabAttribute(in AString aName);