browser/components/sessionstore/src/nsSessionStore.js

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

     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/. */
     5 "use strict";
     7 /**
     8  * Session Storage and Restoration
     9  *
    10  * Overview
    11  * This service keeps track of a user's session, storing the various bits
    12  * required to return the browser to its current state. The relevant data is
    13  * stored in memory, and is periodically saved to disk in a file in the
    14  * profile directory. The service is started at first window load, in
    15  * delayedStartup, and will restore the session from the data received from
    16  * the nsSessionStartup service.
    17  */
    19 const Cu = Components.utils;
    20 const Ci = Components.interfaces;
    22 Cu.import("resource://gre/modules/XPCOMUtils.jsm");
    23 Cu.import("resource:///modules/sessionstore/SessionStore.jsm");
    25 function SessionStoreService() {}
    27 // The SessionStore module's object is frozen. We need to modify our prototype
    28 // and add some properties so let's just copy the SessionStore object.
    29 Object.keys(SessionStore).forEach(function (aName) {
    30   let desc = Object.getOwnPropertyDescriptor(SessionStore, aName);
    31   Object.defineProperty(SessionStoreService.prototype, aName, desc);
    32 });
    34 SessionStoreService.prototype.classID =
    35   Components.ID("{5280606b-2510-4fe0-97ef-9b5a22eafe6b}");
    36 SessionStoreService.prototype.QueryInterface =
    37   XPCOMUtils.generateQI([Ci.nsISessionStore]);
    39 this.NSGetFactory = XPCOMUtils.generateNSGetFactory([SessionStoreService]);

mercurial