Thu, 22 Jan 2015 13:21:57 +0100
Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6
michael@0 | 1 | /* This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 2 | * License, v. 2.0. If a copy of the MPL was not distributed with this |
michael@0 | 3 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
michael@0 | 4 | |
michael@0 | 5 | "use strict"; |
michael@0 | 6 | |
michael@0 | 7 | /** |
michael@0 | 8 | * Session Storage and Restoration |
michael@0 | 9 | * |
michael@0 | 10 | * Overview |
michael@0 | 11 | * This service keeps track of a user's session, storing the various bits |
michael@0 | 12 | * required to return the browser to its current state. The relevant data is |
michael@0 | 13 | * stored in memory, and is periodically saved to disk in a file in the |
michael@0 | 14 | * profile directory. The service is started at first window load, in |
michael@0 | 15 | * delayedStartup, and will restore the session from the data received from |
michael@0 | 16 | * the nsSessionStartup service. |
michael@0 | 17 | */ |
michael@0 | 18 | |
michael@0 | 19 | const Cu = Components.utils; |
michael@0 | 20 | const Ci = Components.interfaces; |
michael@0 | 21 | |
michael@0 | 22 | Cu.import("resource://gre/modules/XPCOMUtils.jsm"); |
michael@0 | 23 | Cu.import("resource:///modules/sessionstore/SessionStore.jsm"); |
michael@0 | 24 | |
michael@0 | 25 | function SessionStoreService() {} |
michael@0 | 26 | |
michael@0 | 27 | // The SessionStore module's object is frozen. We need to modify our prototype |
michael@0 | 28 | // and add some properties so let's just copy the SessionStore object. |
michael@0 | 29 | Object.keys(SessionStore).forEach(function (aName) { |
michael@0 | 30 | let desc = Object.getOwnPropertyDescriptor(SessionStore, aName); |
michael@0 | 31 | Object.defineProperty(SessionStoreService.prototype, aName, desc); |
michael@0 | 32 | }); |
michael@0 | 33 | |
michael@0 | 34 | SessionStoreService.prototype.classID = |
michael@0 | 35 | Components.ID("{5280606b-2510-4fe0-97ef-9b5a22eafe6b}"); |
michael@0 | 36 | SessionStoreService.prototype.QueryInterface = |
michael@0 | 37 | XPCOMUtils.generateQI([Ci.nsISessionStore]); |
michael@0 | 38 | |
michael@0 | 39 | this.NSGetFactory = XPCOMUtils.generateNSGetFactory([SessionStoreService]); |