mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-31 06:05:44 +00:00
8464eb0fcf
Actors outside of the session store shouldn't have to poke around within the session store's data structure and end up reimplementing parts of the session store code (and cause data loss if the implementation is incomplete) in order to restore delay loaded zombie tabs. Therefore, we simply expose a method for this via BrowserApp's tab object. To simplify handling and make the method a little more fool-proof for external callers, the check whether the tab is actually zombified is moved into the restoreZombieTab() function. Later on, we can also hook up this method to the appropriate web extension API (see bug 1322485). MozReview-Commit-ID: 85lnbCpMcP3 --HG-- extra : rebase_source : a6f1cfa11debcb18471b49804776521c60655fce
86 lines
2.6 KiB
Plaintext
86 lines
2.6 KiB
Plaintext
/* 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/. */
|
|
|
|
#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.
|
|
*/
|
|
|
|
[scriptable, uuid(da9ffc70-d444-47d4-b4ab-df3fb0fd24d0)]
|
|
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
|
|
* @returns a JS array of closed tabs.
|
|
*/
|
|
jsval getClosedTabs(in nsIDOMWindow aWindow);
|
|
|
|
/**
|
|
* @param aWindow is the browser window to reopen a closed tab in.
|
|
* @param aCloseTabData is the data of the tab to be restored.
|
|
* @returns a reference to the reopened tab.
|
|
*/
|
|
nsIDOMNode undoCloseTab(in nsIDOMWindow aWindow, in jsval aCloseTabData);
|
|
|
|
/**
|
|
* @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.
|
|
*/
|
|
AString getTabValue(in jsval aTab, in AString aKey);
|
|
|
|
/**
|
|
* @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).
|
|
*/
|
|
void setTabValue(in jsval aTab, in AString aKey, in AString aStringValue);
|
|
|
|
/**
|
|
* @param aTab is the browser tab to get the value for.
|
|
* @param aKey is the value's name.
|
|
*/
|
|
void deleteTabValue(in jsval aTab, in AString aKey);
|
|
|
|
/**
|
|
* Restores the passed tab if it is currently zombified and set to be delay loaded.
|
|
* @param aTab The browser tab to be restored.
|
|
*/
|
|
void restoreZombieTab(in jsval aTab);
|
|
|
|
/**
|
|
* Removes a window from the current session history. Data from this window
|
|
* won't be saved when its closed.
|
|
* @param aWindow The window to remove
|
|
*/
|
|
void removeWindow(in nsIDOMWindow aWindow);
|
|
};
|