Bug 1539784 - ensure the master-password is unlocked before disconnecting from sync. r=eoger

Differential Revision: https://phabricator.services.mozilla.com/D26870

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Mark Hammond 2019-04-10 15:41:28 +00:00
Родитель 8ae5a0f189
Коммит 8cbf8ef8e2
1 изменённых файлов: 10 добавлений и 0 удалений

Просмотреть файл

@ -14,6 +14,7 @@ XPCOMUtils.defineLazyModuleGetters(this, {
AsyncShutdown: "resource://gre/modules/AsyncShutdown.jsm",
fxAccounts: "resource://gre/modules/FxAccounts.jsm",
setTimeout: "resource://gre/modules/Timer.jsm",
Utils: "resource://services-sync/util.js",
});
XPCOMUtils.defineLazyGetter(this, "FxAccountsCommon", function() {
@ -157,6 +158,15 @@ this.SyncDisconnectInternal = {
// function that waits for the sync lock - it will immediately resolve
// if the abort controller is aborted.
let log = Log.repository.getLogger("Sync.Service");
// If the master-password is locked then we will fail to fully sanitize,
// so prompt for that now. If canceled, we just abort now.
log.info("checking master-password state");
if (!Utils.ensureMPUnlocked()) {
log.warn("The master-password needs to be unlocked to fully disconnect from sync");
return;
}
log.info("waiting for any existing syncs to complete");
let locked = await this.promiseNotSyncing(abortController);