summaryrefslogtreecommitdiffstats
path: root/services
diff options
context:
space:
mode:
authorwolfbeast <mcwerewolf@wolfbeast.com>2019-08-15 10:40:06 +0200
committerwolfbeast <mcwerewolf@wolfbeast.com>2019-08-15 10:40:06 +0200
commit1e8e5563d8a7809ecf5d421b04fc8e1afa0469c4 (patch)
treeef5282b43046d4a51f04b16af5c94cc0ebd72216 /services
parent2925fdc3ee9acf17c4aa5494afb7cc18c8dc10bd (diff)
downloadUXP-1e8e5563d8a7809ecf5d421b04fc8e1afa0469c4.tar
UXP-1e8e5563d8a7809ecf5d421b04fc8e1afa0469c4.tar.gz
UXP-1e8e5563d8a7809ecf5d421b04fc8e1afa0469c4.tar.lz
UXP-1e8e5563d8a7809ecf5d421b04fc8e1afa0469c4.tar.xz
UXP-1e8e5563d8a7809ecf5d421b04fc8e1afa0469c4.zip
Issue #1208: Update Sync policies.js getters/setters to prevent race.
Diffstat (limited to 'services')
-rw-r--r--services/sync/modules/policies.js70
1 files changed, 55 insertions, 15 deletions
diff --git a/services/sync/modules/policies.js b/services/sync/modules/policies.js
index 2d85b1428..48acbe2e6 100644
--- a/services/sync/modules/policies.js
+++ b/services/sync/modules/policies.js
@@ -60,20 +60,60 @@ SyncScheduler.prototype = {
},
// nextSync is in milliseconds, but prefs can't hold that much
- get nextSync() Svc.Prefs.get("nextSync", 0) * 1000,
- set nextSync(value) Svc.Prefs.set("nextSync", Math.floor(value / 1000)),
+ get nextSync() {
+ if (Svc.Prefs) {
+ return Svc.Prefs.get("nextSync", 0) * 1000
+ }
+ },
+ set nextSync(value) {
+ if (Svc.Prefs) {
+ Svc.Prefs.set("nextSync", Math.floor(value / 1000))
+ }
+ },
- get syncInterval() Svc.Prefs.get("syncInterval", this.singleDeviceInterval),
- set syncInterval(value) Svc.Prefs.set("syncInterval", value),
+ get syncInterval() {
+ if (Svc.Prefs) {
+ return Svc.Prefs.get("syncInterval", this.singleDeviceInterval)
+ }
+ },
+ set syncInterval(value) {
+ if (Svc.Prefs) {
+ Svc.Prefs.set("syncInterval", value)
+ }
+ },
- get syncThreshold() Svc.Prefs.get("syncThreshold", SINGLE_USER_THRESHOLD),
- set syncThreshold(value) Svc.Prefs.set("syncThreshold", value),
+ get syncThreshold() {
+ if (Svc.Prefs) {
+ return Svc.Prefs.get("syncThreshold", SINGLE_USER_THRESHOLD)
+ }
+ },
+ set syncThreshold(value) {
+ if (Svc.Prefs) {
+ Svc.Prefs.set("syncThreshold", value)
+ }
+ },
- get globalScore() Svc.Prefs.get("globalScore", 0),
- set globalScore(value) Svc.Prefs.set("globalScore", value),
+ get globalScore() {
+ if (Svc.Prefs) {
+ return Svc.Prefs.get("globalScore", 0)
+ }
+ },
+ set globalScore(value) {
+ if (Svc.Prefs) {
+ Svc.Prefs.set("globalScore", value)
+ }
+ },
- get numClients() Svc.Prefs.get("numClients", 0),
- set numClients(value) Svc.Prefs.set("numClients", value),
+ get numClients() {
+ if (Svc.Prefs) {
+ return Svc.Prefs.get("numClients", 0)
+ }
+ },
+ set numClients(value) {
+ if (Svc.Prefs) {
+ Svc.Prefs.set("numClients", value)
+ }
+ },
init: function init() {
this._log.level = Log.Level[Svc.Prefs.get("log.logger.service.main")];
@@ -523,7 +563,7 @@ SyncScheduler.prototype = {
},
get isBlocked() {
- let until = Svc.Prefs.get("scheduler.blocked-until");
+ let until = Svc.Prefs ? Svc.Prefs.get("scheduler.blocked-until") : undefined;
if (until === undefined) {
return false;
}
@@ -770,19 +810,19 @@ ErrorHandler.prototype = {
},
get currentAlertMode() {
- return Svc.Prefs.get("errorhandler.alert.mode");
+ return Svc.Prefs ? Svc.Prefs.get("errorhandler.alert.mode") : undefined;
},
set currentAlertMode(str) {
- return Svc.Prefs.set("errorhandler.alert.mode", str);
+ return Svc.Prefs ? Svc.Prefs.set("errorhandler.alert.mode", str) : undefined;
},
get earliestNextAlert() {
- return Svc.Prefs.get("errorhandler.alert.earliestNext", 0) * 1000;
+ return Svc.Prefs ? Svc.Prefs.get("errorhandler.alert.earliestNext", 0) * 1000 : undefined;
},
set earliestNextAlert(msec) {
- return Svc.Prefs.set("errorhandler.alert.earliestNext", msec / 1000);
+ return Svc.Prefs ? Svc.Prefs.set("errorhandler.alert.earliestNext", msec / 1000) : undefined;
},
clearServerAlerts: function () {