Backed out changeset be4c66d5dc65 (bug 506975) for bc1 test failures

This commit is contained in:
Carsten "Tomcat" Book 2014-10-20 13:00:24 +02:00
parent 359639d6a7
commit 7fbdf69b7f
2 changed files with 12 additions and 16 deletions

View File

@ -1044,8 +1044,6 @@ pref("browser.sessionstore.resume_session_once", false);
// minimal interval between two save operations in milliseconds
pref("browser.sessionstore.interval", 15000);
// Minimal interval between two save operations when device is unplugged
pref("browser.sessionstore.interval_battery", 60000);
// on which sites to save text data, POSTDATA and cookies
// 0 = everywhere, 1 = unencrypted sites, 2 = nowhere
pref("browser.sessionstore.privacy_level", 0);

View File

@ -17,8 +17,6 @@ Cu.import("resource://gre/modules/TelemetryStopwatch.jsm", this);
XPCOMUtils.defineLazyModuleGetter(this, "console",
"resource://gre/modules/devtools/Console.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "Battery",
"resource://gre/modules/Battery.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "PrivacyFilter",
"resource:///modules/sessionstore/PrivacyFilter.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "SessionStore",
@ -28,21 +26,22 @@ XPCOMUtils.defineLazyModuleGetter(this, "SessionFile",
XPCOMUtils.defineLazyModuleGetter(this, "PrivateBrowsingUtils",
"resource://gre/modules/PrivateBrowsingUtils.jsm");
function observeSaveIntervalPref(obj, pref, property) {
// Observer that updates the cached value when the preference changes.
Services.prefs.addObserver(pref, () => {
obj[property] = Services.prefs.getIntPref(pref);
// Minimal interval between two save operations (in milliseconds).
XPCOMUtils.defineLazyGetter(this, "gInterval", function () {
const PREF = "browser.sessionstore.interval";
// Cancel any pending runs and call runDelayed()
// to apply the newly configured interval.
// Observer that updates the cached value when the preference changes.
Services.prefs.addObserver(PREF, () => {
this.gInterval = Services.prefs.getIntPref(PREF);
// Cancel any pending runs and call runDelayed() with
// zero to apply the newly configured interval.
SessionSaverInternal.cancel();
SessionSaverInternal.runDelayed(0);
}, false);
obj[property] = Services.prefs.getIntPref(pref);
}
observeSaveIntervalPref(this, "browser.sessionstore.interval", "gInterval");
observeSaveIntervalPref(this, "browser.sessionstore.interval_battery", "gIntervalBattery");
return Services.prefs.getIntPref(PREF);
});
// Notify observers about a given topic with a given subject.
function notify(subject, topic) {
@ -146,8 +145,7 @@ let SessionSaverInternal = {
}
// Interval until the next disk operation is allowed.
let interval = Battery.charging ? gInterval : gIntervalBattery;
delay = Math.max(this._lastSaveTime + interval - Date.now(), delay, 0);
delay = Math.max(this._lastSaveTime + gInterval - Date.now(), delay, 0);
// Schedule a state save.
this._timeoutID = setTimeout(() => this._saveStateAsync(), delay);