зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1858025 - Correctly clear pref in SyncDisconnect module. r=skhamis,sync-reviewers
Differential Revision: https://phabricator.services.mozilla.com/D190517
This commit is contained in:
Родитель
f41dc04dfd
Коммит
86a99b8f1b
|
@ -9,8 +9,8 @@ const lazy = {};
|
|||
|
||||
ChromeUtils.defineESModuleGetters(lazy, {
|
||||
AsyncShutdown: "resource://gre/modules/AsyncShutdown.sys.mjs",
|
||||
FxAccountsCommon: "resource://gre/modules/FxAccountsCommon.sys.mjs",
|
||||
Log: "resource://gre/modules/Log.sys.mjs",
|
||||
PREF_LAST_FXA_USER: "resource://gre/modules/FxAccountsCommon.sys.mjs",
|
||||
Sanitizer: "resource:///modules/Sanitizer.sys.mjs",
|
||||
Utils: "resource://services-sync/util.sys.mjs",
|
||||
setTimeout: "resource://gre/modules/Timer.sys.mjs",
|
||||
|
@ -100,7 +100,7 @@ export const SyncDisconnectInternal = {
|
|||
// Reset the pref which is used to show a warning when a different user
|
||||
// signs in - this is no longer a concern now that we've removed the
|
||||
// data from the profile.
|
||||
Services.prefs.clearUserPref(lazy.FxAccountsCommon.PREF_LAST_FXA_USER);
|
||||
Services.prefs.clearUserPref(lazy.PREF_LAST_FXA_USER);
|
||||
|
||||
log.info("Finished wiping sync data");
|
||||
} catch (ex) {
|
||||
|
|
|
@ -9,6 +9,9 @@ const { SyncDisconnect, SyncDisconnectInternal } = ChromeUtils.importESModule(
|
|||
const { AsyncShutdown } = ChromeUtils.importESModule(
|
||||
"resource://gre/modules/AsyncShutdown.sys.mjs"
|
||||
);
|
||||
const { PREF_LAST_FXA_USER } = ChromeUtils.importESModule(
|
||||
"resource://gre/modules/FxAccountsCommon.sys.mjs"
|
||||
);
|
||||
|
||||
add_task(async function test_shutdown_blocker() {
|
||||
let spySignout = sinon.stub(
|
||||
|
@ -55,6 +58,8 @@ add_task(async function test_shutdown_blocker() {
|
|||
let weaveStub = sinon.stub(SyncDisconnectInternal, "getWeave");
|
||||
weaveStub.returns(Weave);
|
||||
|
||||
Services.prefs.setStringPref(PREF_LAST_FXA_USER, "dGVzdEBleGFtcGxlLmNvbQ==");
|
||||
|
||||
let promiseDisconnected = SyncDisconnect.disconnect(true);
|
||||
|
||||
// Pretend we hit the shutdown blocker.
|
||||
|
@ -66,6 +71,10 @@ add_task(async function test_shutdown_blocker() {
|
|||
info("waiting for disconnect to complete");
|
||||
await promiseDisconnected;
|
||||
|
||||
Assert.ok(
|
||||
!Services.prefs.prefHasUserValue(PREF_LAST_FXA_USER),
|
||||
"Should have reset different user warning pref"
|
||||
);
|
||||
Assert.equal(
|
||||
Weave.Service.unlock.callCount,
|
||||
0,
|
||||
|
|
Загрузка…
Ссылка в новой задаче