1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/browser/components/sessionstore/src/nsSessionStore.js Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,39 @@ 1.4 +/* This Source Code Form is subject to the terms of the Mozilla Public 1.5 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.6 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.7 + 1.8 +"use strict"; 1.9 + 1.10 +/** 1.11 + * Session Storage and Restoration 1.12 + * 1.13 + * Overview 1.14 + * This service keeps track of a user's session, storing the various bits 1.15 + * required to return the browser to its current state. The relevant data is 1.16 + * stored in memory, and is periodically saved to disk in a file in the 1.17 + * profile directory. The service is started at first window load, in 1.18 + * delayedStartup, and will restore the session from the data received from 1.19 + * the nsSessionStartup service. 1.20 + */ 1.21 + 1.22 +const Cu = Components.utils; 1.23 +const Ci = Components.interfaces; 1.24 + 1.25 +Cu.import("resource://gre/modules/XPCOMUtils.jsm"); 1.26 +Cu.import("resource:///modules/sessionstore/SessionStore.jsm"); 1.27 + 1.28 +function SessionStoreService() {} 1.29 + 1.30 +// The SessionStore module's object is frozen. We need to modify our prototype 1.31 +// and add some properties so let's just copy the SessionStore object. 1.32 +Object.keys(SessionStore).forEach(function (aName) { 1.33 + let desc = Object.getOwnPropertyDescriptor(SessionStore, aName); 1.34 + Object.defineProperty(SessionStoreService.prototype, aName, desc); 1.35 +}); 1.36 + 1.37 +SessionStoreService.prototype.classID = 1.38 + Components.ID("{5280606b-2510-4fe0-97ef-9b5a22eafe6b}"); 1.39 +SessionStoreService.prototype.QueryInterface = 1.40 + XPCOMUtils.generateQI([Ci.nsISessionStore]); 1.41 + 1.42 +this.NSGetFactory = XPCOMUtils.generateNSGetFactory([SessionStoreService]);