mobile/android/components/SessionStore.idl
author Ryan VanderMeulen <ryanvm@gmail.com>
Thu, 25 Jun 2015 19:52:40 -0400
changeset 282646 531f100d2bd8861ee165e3e585f08c325ad0948f
parent 223737 176ee3cee1ca9b27b85de8a350133779e51508c5
child 379036 a70aec4e81ce3ca5fd1a5303b6aa1251fc9bb1a1
child 379680 2f8704c48e61a54b8464ccc116c6b38a5ab7b8f2
permissions -rw-r--r--
Backed out 11 changesets (bug 916893, bug 1114554) for various mochitest and Gij failures. Backed out changeset 247ca4bf258e (bug 1114554) Backed out changeset 5578d5c280a6 (bug 1114554) Backed out changeset 404830c1ecf7 (bug 1114554) Backed out changeset 15bdf9c78e6e (bug 1114554) Backed out changeset f92abe5ec784 (bug 1114554) Backed out changeset 75324b6862a8 (bug 1114554) Backed out changeset ce8a768782f2 (bug 1114554) Backed out changeset 0d860fd12534 (bug 1114554) Backed out changeset 7dc2448065a9 (bug 916893) Backed out changeset c3b07f0d1a60 (bug 916893) Backed out changeset 61c3f24cc908 (bug 916893) CLOSED TREE

/* 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 previous browser session using a fast, lightweight strategy
   * @param aSessionString The session string to restore from. If null, the
   *                       backup session file is read from.
   */
  void restoreLastSession(in AString aSessionString);

  /**
   * 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);
};