From d744ff76dd7e278745171ec4967afb335f2ad95f Mon Sep 17 00:00:00 2001 From: Marco Castelluccio Date: Wed, 14 Jun 2023 23:15:37 +0000 Subject: [PATCH] Bug 1406475 - Convert tps sync module to using Services.prefs. r=sync-reviewers,skhamis Depends on D180808 Differential Revision: https://phabricator.services.mozilla.com/D180809 --- .../sync/tps/extensions/tps/resource/tps.jsm | 22 ++++++++++++------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/services/sync/tps/extensions/tps/resource/tps.jsm b/services/sync/tps/extensions/tps/resource/tps.jsm index 40fc5085816e..c154b40aa91e 100644 --- a/services/sync/tps/extensions/tps/resource/tps.jsm +++ b/services/sync/tps/extensions/tps/resource/tps.jsm @@ -215,7 +215,10 @@ var TPS = { this._setupComplete = true; if (this._syncWipeAction) { - lazy.Weave.Svc.Prefs.set("firstSync", this._syncWipeAction); + lazy.Weave.Svc.PrefBranch.setCharPref( + "firstSync", + this._syncWipeAction + ); this._syncWipeAction = null; } @@ -292,10 +295,10 @@ var TPS = { * directly called via TPS.Sync()! */ delayAutoSync: function TPS_delayAutoSync() { - lazy.Weave.Svc.Prefs.set("scheduler.immediateInterval", 7200); - lazy.Weave.Svc.Prefs.set("scheduler.idleInterval", 7200); - lazy.Weave.Svc.Prefs.set("scheduler.activeInterval", 7200); - lazy.Weave.Svc.Prefs.set("syncThreshold", 10000000); + lazy.Weave.Svc.PrefBranch.setIntPref("scheduler.immediateInterval", 7200); + lazy.Weave.Svc.PrefBranch.setIntPref("scheduler.idleInterval", 7200); + lazy.Weave.Svc.PrefBranch.setIntPref("scheduler.activeInterval", 7200); + lazy.Weave.Svc.PrefBranch.setIntPref("syncThreshold", 10000000); }, quit: function TPS__quit() { @@ -1170,7 +1173,10 @@ var TPS = { lazy.Logger.logInfo( "setting client.name to " + this.phases[this._currentPhase] ); - lazy.Weave.Svc.Prefs.set("client.name", this.phases[this._currentPhase]); + lazy.Weave.Svc.PrefBranch.setStringPref( + "client.name", + this.phases[this._currentPhase] + ); this._interceptSyncTelemetry(); @@ -1395,9 +1401,9 @@ var TPS = { // also handle it via the "weave:service:setup-complete" notification. if (wipeAction) { this._syncWipeAction = wipeAction; - lazy.Weave.Svc.Prefs.set("firstSync", wipeAction); + lazy.Weave.Svc.PrefBranch.setCharPref("firstSync", wipeAction); } else { - lazy.Weave.Svc.Prefs.reset("firstSync"); + lazy.Weave.Svc.PrefBranch.clearUserPref("firstSync"); } if (!(await lazy.Weave.Service.login())) { // We need to complete verification.