Bug 1213094 - Removed services.sync.enabled preference. r=markh

This commit is contained in:
sakshi 2016-02-03 06:07:00 +01:00
parent 916126da96
commit 3d4782ad41
5 changed files with 4 additions and 40 deletions

View File

@ -425,19 +425,6 @@ var gSyncPane = {
}
},
// Called whenever one of the sync engine preferences is changed.
onPreferenceChanged: function() {
let prefElts = document.querySelectorAll("#syncEnginePrefs > preference");
let syncEnabled = false;
for (let elt of prefElts) {
if (elt.name.startsWith("services.sync.") && elt.value) {
syncEnabled = true;
break;
}
}
Services.prefs.setBoolPref("services.sync.enabled", syncEnabled);
},
startOver: function (showDialog) {
if (showDialog) {
let flags = Services.prompt.BUTTON_POS_0 * Services.prompt.BUTTON_TITLE_IS_STRING +

View File

@ -4,8 +4,7 @@
<!-- Sync panel -->
<preferences id="syncEnginePrefs" hidden="true" data-category="paneSync"
onchange="gSyncPane.onPreferenceChanged();">
<preferences id="syncEnginePrefs" hidden="true" data-category="paneSync">
<preference id="engine.addons"
name="services.sync.engine.addons"
type="bool"/>

View File

@ -299,21 +299,6 @@ Sync11Service.prototype = {
return false;
},
// The global "enabled" state comes from prefs, and will be set to false
// whenever the UI that exposes what to sync finds all Sync engines disabled.
get enabled() {
return Svc.Prefs.get("enabled");
},
set enabled(val) {
// There's no real reason to impose this other than to catch someone doing
// something we don't expect with bad consequences - all setting of this
// pref are in the UI code and external to this module.
if (val) {
throw new Error("Only disabling via this setter is supported");
}
Svc.Prefs.set("enabled", val);
},
/**
* Prepare to initialize the rest of Weave after waiting a little bit
*/
@ -343,6 +328,8 @@ Sync11Service.prototype = {
this._clusterManager = this.identity.createClusterManager(this);
this.recordManager = new RecordManager(this);
this.enabled = true;
this._registerEngines();
let ua = Cc["@mozilla.org/network/protocol;1?name=http"].
@ -1239,10 +1226,6 @@ Sync11Service.prototype = {
},
sync: function sync(engineNamesToSync) {
if (!this.enabled) {
this._log.debug("Not syncing as Sync is disabled.");
return;
}
let dateStr = new Date().toLocaleFormat(LOG_DATE_FORMAT);
this._log.debug("User-Agent: " + SyncStorageRequest.prototype.userAgent);
this._log.info("Starting sync at " + dateStr);

View File

@ -24,11 +24,6 @@ pref("services.sync.scheduler.sync11.singleDeviceInterval", 86400); // 1 day
pref("services.sync.errorhandler.networkFailureReportTimeout", 1209600); // 2 weeks
// A "master" pref for Sync being enabled. Will be set to false if the sync
// customization UI finds all our builtin engines disabled (and addons are
// free to force this to true if they have their own engine)
pref("services.sync.enabled", true);
// Our engines.
pref("services.sync.engine.addons", true);
pref("services.sync.engine.bookmarks", true);
pref("services.sync.engine.history", true);

View File

@ -183,7 +183,7 @@ add_test(function test_login_on_sync() {
// This test exercises these two branches.
_("We're ready to sync if locked.");
Svc.Prefs.set("enabled", true);
Service.enabled = true;
Services.io.offline = false;
Service.scheduler.checkSyncStatus();
do_check_true(scheduleCalled);