зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1587769 - update the pref we watch to ensure we sync immediately after device name change. r=eoger
Differential Revision: https://phabricator.services.mozilla.com/D49102 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
5d6e6dc693
Коммит
c7296e7825
|
@ -16,16 +16,13 @@ const {
|
|||
ON_NEW_DEVICE_ID,
|
||||
ON_DEVICE_CONNECTED_NOTIFICATION,
|
||||
ON_DEVICE_DISCONNECTED_NOTIFICATION,
|
||||
PREF_ACCOUNT_ROOT,
|
||||
} = ChromeUtils.import("resource://gre/modules/FxAccountsCommon.js");
|
||||
|
||||
const { DEVICE_TYPE_DESKTOP } = ChromeUtils.import(
|
||||
"resource://services-sync/constants.js"
|
||||
);
|
||||
|
||||
const { PREF_ACCOUNT_ROOT } = ChromeUtils.import(
|
||||
"resource://gre/modules/FxAccountsCommon.js"
|
||||
);
|
||||
|
||||
ChromeUtils.defineModuleGetter(
|
||||
this,
|
||||
"CommonUtils",
|
||||
|
|
|
@ -46,6 +46,10 @@ ChromeUtils.defineModuleGetter(
|
|||
"resource://gre/modules/FxAccounts.jsm"
|
||||
);
|
||||
|
||||
const { PREF_ACCOUNT_ROOT } = ChromeUtils.import(
|
||||
"resource://gre/modules/FxAccountsCommon.js"
|
||||
);
|
||||
|
||||
ChromeUtils.defineModuleGetter(
|
||||
this,
|
||||
"getRepairRequestor",
|
||||
|
@ -1215,10 +1219,16 @@ ClientsTracker.prototype = {
|
|||
|
||||
onStart() {
|
||||
Svc.Obs.add("fxaccounts:new_device_id", this.asyncObserver);
|
||||
Svc.Prefs.observe("client.name", this.asyncObserver);
|
||||
Services.prefs.addObserver(
|
||||
PREF_ACCOUNT_ROOT + "device.name",
|
||||
this.asyncObserver
|
||||
);
|
||||
},
|
||||
onStop() {
|
||||
Svc.Prefs.ignore("client.name", this.asyncObserver);
|
||||
Services.prefs.removeObserver(
|
||||
PREF_ACCOUNT_ROOT + "device.name",
|
||||
this.asyncObserver
|
||||
);
|
||||
Svc.Obs.remove("fxaccounts:new_device_id", this.asyncObserver);
|
||||
},
|
||||
|
||||
|
|
|
@ -379,7 +379,10 @@ add_task(async function test_client_name_change() {
|
|||
let changedIDs = await tracker.getChangedIDs();
|
||||
equal(Object.keys(changedIDs).length, 0);
|
||||
|
||||
Svc.Prefs.set("client.name", "new name");
|
||||
Services.prefs.setStringPref(
|
||||
"identity.fxaccounts.account.device.name",
|
||||
"new name"
|
||||
);
|
||||
await tracker.asyncObserver.promiseObserversComplete();
|
||||
|
||||
_("new name: " + engine.localName);
|
||||
|
|
Загрузка…
Ссылка в новой задаче