michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: "use strict"; michael@0: michael@0: /** michael@0: * Session Storage and Restoration michael@0: * michael@0: * Overview michael@0: * This service keeps track of a user's session, storing the various bits michael@0: * required to return the browser to its current state. The relevant data is michael@0: * stored in memory, and is periodically saved to disk in a file in the michael@0: * profile directory. The service is started at first window load, in michael@0: * delayedStartup, and will restore the session from the data received from michael@0: * the nsSessionStartup service. michael@0: */ michael@0: michael@0: const Cu = Components.utils; michael@0: const Ci = Components.interfaces; michael@0: michael@0: Cu.import("resource://gre/modules/XPCOMUtils.jsm"); michael@0: Cu.import("resource:///modules/sessionstore/SessionStore.jsm"); michael@0: michael@0: function SessionStoreService() {} michael@0: michael@0: // The SessionStore module's object is frozen. We need to modify our prototype michael@0: // and add some properties so let's just copy the SessionStore object. michael@0: Object.keys(SessionStore).forEach(function (aName) { michael@0: let desc = Object.getOwnPropertyDescriptor(SessionStore, aName); michael@0: Object.defineProperty(SessionStoreService.prototype, aName, desc); michael@0: }); michael@0: michael@0: SessionStoreService.prototype.classID = michael@0: Components.ID("{5280606b-2510-4fe0-97ef-9b5a22eafe6b}"); michael@0: SessionStoreService.prototype.QueryInterface = michael@0: XPCOMUtils.generateQI([Ci.nsISessionStore]); michael@0: michael@0: this.NSGetFactory = XPCOMUtils.generateNSGetFactory([SessionStoreService]);