|
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/. */ |
|
4 |
|
5 "use strict"; |
|
6 |
|
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 */ |
|
18 |
|
19 const Cu = Components.utils; |
|
20 const Ci = Components.interfaces; |
|
21 |
|
22 Cu.import("resource://gre/modules/XPCOMUtils.jsm"); |
|
23 Cu.import("resource:///modules/sessionstore/SessionStore.jsm"); |
|
24 |
|
25 function SessionStoreService() {} |
|
26 |
|
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 }); |
|
33 |
|
34 SessionStoreService.prototype.classID = |
|
35 Components.ID("{5280606b-2510-4fe0-97ef-9b5a22eafe6b}"); |
|
36 SessionStoreService.prototype.QueryInterface = |
|
37 XPCOMUtils.generateQI([Ci.nsISessionStore]); |
|
38 |
|
39 this.NSGetFactory = XPCOMUtils.generateNSGetFactory([SessionStoreService]); |