Backed out changeset 6f48ddc83ea7

This commit is contained in:
Kyle Huey 2010-01-23 09:36:18 -05:00
parent 13aaf152eb
commit 3b7304a1f7

View File

@ -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);
@ -250,6 +241,14 @@ SessionStoreService.prototype = {
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);
this._prefBranch.addObserver("sessionstore.max_windows_undo", this, true);