|
1 /* This Source Code Form is subject to the terms of the Mozilla Public |
|
2 * License, v. 2.0. If a copy of the MPL was not distributed with this |
|
3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
|
4 |
|
5 #include "nsISupports.idl" |
|
6 |
|
7 interface nsIDOMWindow; |
|
8 interface nsIDOMNode; |
|
9 |
|
10 /** |
|
11 * nsISessionStore keeps track of the current browsing state. |
|
12 * |
|
13 * The nsISessionStore API operates mostly on browser windows and the browser |
|
14 * tabs contained in them. |
|
15 */ |
|
16 |
|
17 [scriptable, uuid(fe116b56-0226-4562-b52a-a623dad07ead)] |
|
18 interface nsISessionStore : nsISupports |
|
19 { |
|
20 /** |
|
21 * Get the current browsing state. |
|
22 * @returns a JSON string representing the session state. |
|
23 */ |
|
24 AString getBrowserState(); |
|
25 |
|
26 /** |
|
27 * Get the number of restore-able tabs for a browser window |
|
28 */ |
|
29 unsigned long getClosedTabCount(in nsIDOMWindow aWindow); |
|
30 |
|
31 /** |
|
32 * Get closed tab data |
|
33 * |
|
34 * @param aWindow is the browser window for which to get closed tab data |
|
35 * @returns a JSON string representing the list of closed tabs. |
|
36 */ |
|
37 AString getClosedTabData(in nsIDOMWindow aWindow); |
|
38 |
|
39 /** |
|
40 * @param aWindow is the browser window to reopen a closed tab in. |
|
41 * @param aIndex is the index of the tab to be restored (FIFO ordered). |
|
42 * @returns a reference to the reopened tab. |
|
43 */ |
|
44 nsIDOMNode undoCloseTab(in nsIDOMWindow aWindow, in unsigned long aIndex); |
|
45 |
|
46 /** |
|
47 * @param aWindow is the browser window associated with the closed tab. |
|
48 * @param aIndex is the index of the closed tab to be removed (FIFO ordered). |
|
49 */ |
|
50 nsIDOMNode forgetClosedTab(in nsIDOMWindow aWindow, in unsigned long aIndex); |
|
51 |
|
52 /** |
|
53 * @param aTab is the browser tab to get the value for. |
|
54 * @param aKey is the value's name. |
|
55 * |
|
56 * @returns A string value or an empty string if none is set. |
|
57 */ |
|
58 AString getTabValue(in jsval aTab, in AString aKey); |
|
59 |
|
60 /** |
|
61 * @param aTab is the browser tab to set the value for. |
|
62 * @param aKey is the value's name. |
|
63 * @param aStringValue is the value itself (use JSON.stringify/parse before setting JS objects). |
|
64 */ |
|
65 void setTabValue(in jsval aTab, in AString aKey, in AString aStringValue); |
|
66 |
|
67 /** |
|
68 * @param aTab is the browser tab to get the value for. |
|
69 * @param aKey is the value's name. |
|
70 */ |
|
71 void deleteTabValue(in jsval aTab, in AString aKey); |
|
72 |
|
73 /** |
|
74 * Restores the previous browser session using a fast, lightweight strategy |
|
75 * @param aSessionString The session string to restore from. If null, the |
|
76 * backup session file is read from. |
|
77 */ |
|
78 void restoreLastSession(in AString aSessionString); |
|
79 }; |