From 3b7304a1f7e7eb7c6eccd55048e5ece583ec0c28 Mon Sep 17 00:00:00 2001 From: Kyle Huey Date: Sat, 23 Jan 2010 09:36:18 -0500 Subject: [PATCH] Backed out changeset 6f48ddc83ea7 --- .../sessionstore/src/nsSessionStore.js | 37 +++++++++---------- 1 file changed, 18 insertions(+), 19 deletions(-) diff --git a/browser/components/sessionstore/src/nsSessionStore.js b/browser/components/sessionstore/src/nsSessionStore.js index 70c9f7ca23e..d13431a355b 100644 --- a/browser/components/sessionstore/src/nsSessionStore.js +++ b/browser/components/sessionstore/src/nsSessionStore.js @@ -155,25 +155,6 @@ function debug(aMsg) { /* :::::::: The Service ::::::::::::::: */ function SessionStoreService() { - XPCOMUtils.defineLazyGetter(this, "_prefBranch", function () { - return Cc["@mozilla.org/preferences-service;1"]. - getService(Ci.nsIPrefService).getBranch("browser."). - QueryInterface(Ci.nsIPrefBranch2); - }); - - // minimal interval between two save operations (in milliseconds) - XPCOMUtils.defineLazyGetter(this, "_interval", function () { - // used often, so caching/observing instead of fetching on-demand - this._prefBranch.addObserver("sessionstore.interval", this, true); - return this._prefBranch.getIntPref("sessionstore.interval"); - }); - - // when crash recovery is disabled, session data is not written to disk - XPCOMUtils.defineLazyGetter(this, "_resume_from_crash", function () { - // get crash recovery state from prefs and allow for proper reaction to state changes - this._prefBranch.addObserver("sessionstore.resume_from_crash", this, true); - return this._prefBranch.getBoolPref("sessionstore.resume_from_crash"); - }); } SessionStoreService.prototype = { @@ -192,6 +173,12 @@ SessionStoreService.prototype = { // set default load state _loadState: STATE_STOPPED, + // minimal interval between two save operations (in milliseconds) + _interval: 15000, + + // when crash recovery is disabled, session data is not written to disk + _resume_from_crash: true, + // During the initial restore and setBrowserState calls tracks the number of // windows yet to be restored _restoreCount: 0, @@ -242,6 +229,10 @@ SessionStoreService.prototype = { return; } + this._prefBranch = Cc["@mozilla.org/preferences-service;1"]. + getService(Ci.nsIPrefService).getBranch("browser."); + this._prefBranch.QueryInterface(Ci.nsIPrefBranch2); + OBSERVING.forEach(function(aTopic) { ObserverSvc.addObserver(this, aTopic, true); }, this); @@ -249,6 +240,14 @@ SessionStoreService.prototype = { var pbs = Cc["@mozilla.org/privatebrowsing;1"]. getService(Ci.nsIPrivateBrowsingService); this._inPrivateBrowsing = pbs.privateBrowsingEnabled; + + // get interval from prefs - used often, so caching/observing instead of fetching on-demand + this._interval = this._prefBranch.getIntPref("sessionstore.interval"); + this._prefBranch.addObserver("sessionstore.interval", this, true); + + // get crash recovery state from prefs and allow for proper reaction to state changes + this._resume_from_crash = this._prefBranch.getBoolPref("sessionstore.resume_from_crash"); + this._prefBranch.addObserver("sessionstore.resume_from_crash", this, true); // observe prefs changes so we can modify stored data to match this._prefBranch.addObserver("sessionstore.max_tabs_undo", this, true);