diff --git a/services/sync/modules/engines/clients.js b/services/sync/modules/engines/clients.js index f423242c9ac..7d55cded58f 100644 --- a/services/sync/modules/engines/clients.js +++ b/services/sync/modules/engines/clients.js @@ -49,7 +49,9 @@ ClientEngine.prototype = { _trackerObj: ClientsTracker, // Always sync client data as it controls other sync behavior - get enabled() true, + get enabled() { + return true; + }, get lastRecordUpload() { return Svc.Prefs.get(this.name + ".lastRecordUpload", 0); @@ -102,7 +104,9 @@ ClientEngine.prototype = { let localID = Svc.Prefs.get("client.GUID", ""); return localID == "" ? this.localID = Utils.makeGUID() : localID; }, - set localID(value) Svc.Prefs.set("client.GUID", value), + set localID(value) { + Svc.Prefs.set("client.GUID", value); + }, get brandName() { let brand = new StringBundle("chrome://branding/locale/brand.properties"); @@ -116,10 +120,16 @@ ClientEngine.prototype = { return this.localName = Utils.getDefaultDeviceName(); }, - set localName(value) Svc.Prefs.set("client.name", value), + set localName(value) { + Svc.Prefs.set("client.name", value); + }, - get localType() Svc.Prefs.get("client.type", "desktop"), - set localType(value) Svc.Prefs.set("client.type", value), + get localType() { + return Svc.Prefs.get("client.type", "desktop"); + }, + set localType(value) { + Svc.Prefs.set("client.type", value); + }, isMobile: function isMobile(id) { if (this._store._remoteClients[id]) diff --git a/services/sync/modules/engines/forms.js b/services/sync/modules/engines/forms.js index a139280b31e..84e46de622c 100644 --- a/services/sync/modules/engines/forms.js +++ b/services/sync/modules/engines/forms.js @@ -109,7 +109,9 @@ FormEngine.prototype = { syncPriority: 6, - get prefName() "history", + get prefName() { + return "history"; + }, _findDupe: function _findDupe(item) { return FormWrapper.getGUID(item.name, item.value); diff --git a/services/sync/modules/main.js b/services/sync/modules/main.js index f59beb184d7..e8e705e726a 100644 --- a/services/sync/modules/main.js +++ b/services/sync/modules/main.js @@ -15,12 +15,14 @@ var lazies = { }; function lazyImport(module, dest, props) { - function getter(prop) function() { - let ns = {}; - Components.utils.import(module, ns); - delete dest[prop]; - return dest[prop] = ns[prop]; - }; + function getter(prop) { + return function() { + let ns = {}; + Components.utils.import(module, ns); + delete dest[prop]; + return dest[prop] = ns[prop]; + }; + } props.forEach(function (prop) { dest.__defineGetter__(prop, getter(prop)); }); } diff --git a/services/sync/modules/policies.js b/services/sync/modules/policies.js index fbc547d1073..e940f3febb3 100644 --- a/services/sync/modules/policies.js +++ b/services/sync/modules/policies.js @@ -61,20 +61,40 @@ 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() { + return Svc.Prefs.get("nextSync", 0) * 1000; + }, + set nextSync(value) { + 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() { + return Svc.Prefs.get("syncInterval", this.singleDeviceInterval); + }, + set syncInterval(value) { + Svc.Prefs.set("syncInterval", value); + }, - get syncThreshold() Svc.Prefs.get("syncThreshold", SINGLE_USER_THRESHOLD), - set syncThreshold(value) Svc.Prefs.set("syncThreshold", value), + get syncThreshold() { + return Svc.Prefs.get("syncThreshold", SINGLE_USER_THRESHOLD); + }, + set syncThreshold(value) { + Svc.Prefs.set("syncThreshold", value); + }, - get globalScore() Svc.Prefs.get("globalScore", 0), - set globalScore(value) Svc.Prefs.set("globalScore", value), + get globalScore() { + return Svc.Prefs.get("globalScore", 0); + }, + set globalScore(value) { + Svc.Prefs.set("globalScore", value); + }, - get numClients() Svc.Prefs.get("numClients", 0), - set numClients(value) Svc.Prefs.set("numClients", value), + get numClients() { + return Svc.Prefs.get("numClients", 0); + }, + set numClients(value) { + Svc.Prefs.set("numClients", value); + }, init: function init() { this._log.level = Log.Level[Svc.Prefs.get("log.logger.service.main")]; diff --git a/services/sync/modules/record.js b/services/sync/modules/record.js index 71a6b4083f6..43e452a4100 100644 --- a/services/sync/modules/record.js +++ b/services/sync/modules/record.js @@ -196,7 +196,9 @@ CryptoWrapper.prototype = { }, // The custom setter below masks the parent's getter, so explicitly call it :( - get id() WBORecord.prototype.__lookupGetter__("id").call(this), + get id() { + return WBORecord.prototype.__lookupGetter__("id").call(this); + }, // Keep both plaintext and encrypted versions of the id to verify integrity set id(val) { @@ -356,8 +358,9 @@ CollectionKeyManager.prototype = { /** * Create a WBO for the current keys. */ - asWBO: function(collection, id) - this._makeWBO(this._collections, this._default), + asWBO: function(collection, id) { + return this._makeWBO(this._collections, this._default); + }, /** * Compute a new default key, and new keys for any specified collections. @@ -560,14 +563,14 @@ Collection.prototype = { }, // Apply the action to a certain set of ids - get ids() this._ids, + get ids() { return this._ids; }, set ids(value) { this._ids = value; this._rebuildURL(); }, // Limit how many records to get - get limit() this._limit, + get limit() { return this._limit; }, set limit(value) { this._limit = value; this._rebuildURL(); diff --git a/services/sync/modules/resource.js b/services/sync/modules/resource.js index 9bacb3491a9..84cc99f8d71 100644 --- a/services/sync/modules/resource.js +++ b/services/sync/modules/resource.js @@ -134,7 +134,9 @@ AsyncResource.prototype = { // // Get and set the data encapulated in the resource. _data: null, - get data() this._data, + get data() { + return this._data; + }, set data(value) { this._data = value; }, diff --git a/services/sync/modules/service.js b/services/sync/modules/service.js index 43b1d979c9f..9c7dd0321a7 100644 --- a/services/sync/modules/service.js +++ b/services/sync/modules/service.js @@ -79,7 +79,9 @@ Sync11Service.prototype = { metaURL: null, cryptoKeyURL: null, - get serverURL() Svc.Prefs.get("serverURL"), + get serverURL() { + return Svc.Prefs.get("serverURL"); + }, set serverURL(value) { if (!value.endsWith("/")) { value += "/"; @@ -94,7 +96,9 @@ Sync11Service.prototype = { Svc.Prefs.reset("clusterURL"); }, - get clusterURL() Svc.Prefs.get("clusterURL", ""), + get clusterURL() { + return Svc.Prefs.get("clusterURL", ""); + }, set clusterURL(value) { Svc.Prefs.set("clusterURL", value); this._updateCachedURLs(); diff --git a/services/sync/modules/util.js b/services/sync/modules/util.js index 85f67d78ae2..a43d506884e 100644 --- a/services/sync/modules/util.js +++ b/services/sync/modules/util.js @@ -477,7 +477,7 @@ this.Utils = { // 20-char sync key. if (pp.length == 23 && - [5, 11, 17].every(function(i) pp[i] == '-')) { + [5, 11, 17].every(i => pp[i] == '-')) { return pp.slice(0, 5) + pp.slice(6, 11) + pp.slice(12, 17) + pp.slice(18, 23); @@ -485,7 +485,7 @@ this.Utils = { // "Modern" 26-char key. if (pp.length == 31 && - [1, 7, 13, 19, 25].every(function(i) pp[i] == '-')) { + [1, 7, 13, 19, 25].every(i => pp[i] == '-')) { return pp.slice(0, 1) + pp.slice(2, 7) + pp.slice(8, 13) + pp.slice(14, 19) diff --git a/services/sync/tests/unit/test_bookmark_legacy_microsummaries_support.js b/services/sync/tests/unit/test_bookmark_legacy_microsummaries_support.js index a7e3a46477f..207372ed68c 100644 --- a/services/sync/tests/unit/test_bookmark_legacy_microsummaries_support.js +++ b/services/sync/tests/unit/test_bookmark_legacy_microsummaries_support.js @@ -85,12 +85,12 @@ function run_test() { do_check_eq(PlacesUtils.bookmarks.getKeywordForBookmark(id), null); do_check_throws( - function () PlacesUtils.annotations.getItemAnnotation(id, GENERATORURI_ANNO), + () => PlacesUtils.annotations.getItemAnnotation(id, GENERATORURI_ANNO), Cr.NS_ERROR_NOT_AVAILABLE ); do_check_throws( - function () PlacesUtils.annotations.getItemAnnotation(id, STATICTITLE_ANNO), + () => PlacesUtils.annotations.getItemAnnotation(id, STATICTITLE_ANNO), Cr.NS_ERROR_NOT_AVAILABLE ); diff --git a/services/sync/tests/unit/test_corrupt_keys.js b/services/sync/tests/unit/test_corrupt_keys.js index 2db080a8f80..cce01636170 100644 --- a/services/sync/tests/unit/test_corrupt_keys.js +++ b/services/sync/tests/unit/test_corrupt_keys.js @@ -51,7 +51,7 @@ add_task(function test_locally_changed_keys() { }]}]}; delete Svc.Session; Svc.Session = { - getBrowserState: function () JSON.stringify(myTabs) + getBrowserState: () => JSON.stringify(myTabs) }; setBasicCredentials("johndoe", "password", passphrase); diff --git a/services/sync/tests/unit/test_service_detect_upgrade.js b/services/sync/tests/unit/test_service_detect_upgrade.js index 528bd751b13..0f46832d983 100644 --- a/services/sync/tests/unit/test_service_detect_upgrade.js +++ b/services/sync/tests/unit/test_service_detect_upgrade.js @@ -60,7 +60,7 @@ add_test(function v4_upgrade() { }]}]}; delete Svc.Session; Svc.Session = { - getBrowserState: function () JSON.stringify(myTabs) + getBrowserState: () => JSON.stringify(myTabs) }; Service.status.resetSync(); @@ -229,7 +229,7 @@ add_test(function v5_upgrade() { }]}]}; delete Svc.Session; Svc.Session = { - getBrowserState: function () JSON.stringify(myTabs) + getBrowserState: () => JSON.stringify(myTabs) }; Service.status.resetSync(); diff --git a/services/sync/tests/unit/test_service_sync_updateEnabledEngines.js b/services/sync/tests/unit/test_service_sync_updateEnabledEngines.js index ffc631dd5f8..5192e694d07 100644 --- a/services/sync/tests/unit/test_service_sync_updateEnabledEngines.js +++ b/services/sync/tests/unit/test_service_sync_updateEnabledEngines.js @@ -41,7 +41,9 @@ function StirlingEngine() { StirlingEngine.prototype = { __proto__: SteamEngine.prototype, // This engine's enabled state is the same as the SteamEngine's. - get prefName() "steam" + get prefName() { + return "steam"; + } }; Service.engineManager.register(StirlingEngine); diff --git a/services/sync/tests/unit/test_tab_tracker.js b/services/sync/tests/unit/test_tab_tracker.js index 620ea07e58a..f0bff3cc91d 100644 --- a/services/sync/tests/unit/test_tab_tracker.js +++ b/services/sync/tests/unit/test_tab_tracker.js @@ -15,7 +15,9 @@ function fakeSvcWinMediator() { getEnumerator: function() { return { cnt: 2, - hasMoreElements: function() this.cnt-- > 0, + hasMoreElements: function() { + return this.cnt-- > 0; + }, getNext: function() { let elt = {addTopics: [], remTopics: []}; logs.push(elt); diff --git a/services/sync/tests/unit/test_utils_catch.js b/services/sync/tests/unit/test_utils_catch.js index a10e5eb0d80..302e20e2c31 100644 --- a/services/sync/tests/unit/test_utils_catch.js +++ b/services/sync/tests/unit/test_utils_catch.js @@ -15,31 +15,39 @@ function run_test() { } }, - func: function() this.catch(function() { - rightThis = this == obj; - didCall = true; - return 5; - })(), + func: function() { + return this.catch(function() { + rightThis = this == obj; + didCall = true; + return 5; + })(); + }, - throwy: function() this.catch(function() { - rightThis = this == obj; - didCall = true; - throw 10; - })(), + throwy: function() { + return this.catch(function() { + rightThis = this == obj; + didCall = true; + throw 10; + })(); + }, - callbacky: function() this.catch(function() { - rightThis = this == obj; - didCall = true; - throw 10; - }, function(ex) { - wasTen = (ex == 10) - })(), + callbacky: function() { + return this.catch(function() { + rightThis = this == obj; + didCall = true; + throw 10; + }, function(ex) { + wasTen = (ex == 10) + })(); + }, - lockedy: function() this.catch(function() { - rightThis = this == obj; - didCall = true; - throw("Could not acquire lock."); - })() + lockedy: function() { + return this.catch(function() { + rightThis = this == obj; + didCall = true; + throw("Could not acquire lock."); + })(); + } }; _("Make sure a normal call will call and return"); diff --git a/services/sync/tests/unit/test_utils_deferGetSet.js b/services/sync/tests/unit/test_utils_deferGetSet.js index 55c0fcb0e67..9d58a9873e3 100644 --- a/services/sync/tests/unit/test_utils_deferGetSet.js +++ b/services/sync/tests/unit/test_utils_deferGetSet.js @@ -6,8 +6,12 @@ function run_test() { base.prototype = { dst: {}, - get a() "a", - set b(val) this.dst.b = val + "!!!" + get a() { + return "a"; + }, + set b(val) { + this.dst.b = val + "!!!"; + } }; let src = new base(); diff --git a/services/sync/tests/unit/test_utils_lock.js b/services/sync/tests/unit/test_utils_lock.js index fd8a4b1f522..d1830787e63 100644 --- a/services/sync/tests/unit/test_utils_lock.js +++ b/services/sync/tests/unit/test_utils_lock.js @@ -27,19 +27,23 @@ function run_test() { this._locked = false; }, - func: function() this._lock("Test utils lock", - function() { - rightThis = this == obj; - didCall = true; - return 5; - })(), + func: function() { + return this._lock("Test utils lock", + function() { + rightThis = this == obj; + didCall = true; + return 5; + })(); + }, - throwy: function() this._lock("Test utils lock throwy", - function() { - rightThis = this == obj; - didCall = true; - this.throwy(); - })() + throwy: function() { + return this._lock("Test utils lock throwy", + function() { + rightThis = this == obj; + didCall = true; + this.throwy(); + })(); + } }; _("Make sure a normal call will call and return"); diff --git a/services/sync/tests/unit/test_utils_notify.js b/services/sync/tests/unit/test_utils_notify.js index c191bbfef67..5bd38da5f27 100644 --- a/services/sync/tests/unit/test_utils_notify.js +++ b/services/sync/tests/unit/test_utils_notify.js @@ -9,17 +9,21 @@ function run_test() { trace: function() {} }, - func: function() this.notify("bar", "baz", function() { - rightThis = this == obj; - didCall = true; - return 5; - })(), + func: function() { + return this.notify("bar", "baz", function() { + rightThis = this == obj; + didCall = true; + return 5; + })(); + }, - throwy: function() this.notify("bad", "one", function() { - rightThis = this == obj; - didCall = true; - throw 10; - })() + throwy: function() { + return this.notify("bad", "one", function() { + rightThis = this == obj; + didCall = true; + throw 10; + })(); + } }; let state = 0;