Bug 1262312 - Don't update the device registration every time we open Sync preferences. r?markh
MozReview-Commit-ID: 1rJbD1hHOAe
--- a/services/sync/modules/engines/clients.js
+++ b/services/sync/modules/engines/clients.js
@@ -121,21 +121,29 @@ ClientEngine.prototype = {
},
get brandName() {
let brand = new StringBundle("chrome://branding/locale/brand.properties");
return brand.get("brandShortName");
},
get localName() {
- return this.localName = Utils.getDeviceName();
+ let name = Utils.getDeviceName();
+ // If `getDeviceName` returns the default name, set the pref. FxA registers
+ // the device before syncing, so we don't need to update the registration
+ // in this case.
+ Svc.Prefs.set("client.name", name);
+ return name;
},
set localName(value) {
Svc.Prefs.set("client.name", value);
- fxAccounts.updateDeviceRegistration();
+ // Update the registration in the background.
+ fxAccounts.updateDeviceRegistration().catch(error => {
+ this._log.warn("failed to update fxa device registration", error);
+ });
},
get localType() {
return Utils.getDeviceType();
},
set localType(value) {
Svc.Prefs.set("client.type", value);
},