зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1611690 - sending a tab now prompts for a master-password. r=eoger
Differential Revision: https://phabricator.services.mozilla.com/D63440 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
2246aa1650
Коммит
b83fb2379a
|
@ -791,6 +791,7 @@ var gSync = {
|
|||
switchToTabHavingURI(url, true, { replaceQueryString: true });
|
||||
},
|
||||
|
||||
// Returns true if we managed to send the tab to any targets, false otherwise.
|
||||
async sendTabToDevice(url, targets, title) {
|
||||
const fxaCommandsDevices = [];
|
||||
const oldSendTabClients = [];
|
||||
|
@ -803,6 +804,25 @@ var gSync = {
|
|||
console.error(`Target ${target.id} unsuitable for send tab.`);
|
||||
}
|
||||
}
|
||||
// If a master-password is enabled then it must be unlocked so FxA can get
|
||||
// the encryption keys from the login manager. (If we end up using the "sync"
|
||||
// fallback that would end up prompting by itself, but the FxA command route
|
||||
// will not) - so force that here.
|
||||
let cryptoSDR = Cc["@mozilla.org/login-manager/crypto/SDR;1"].getService(
|
||||
Ci.nsILoginManagerCrypto
|
||||
);
|
||||
if (!cryptoSDR.isLoggedIn) {
|
||||
if (cryptoSDR.uiBusy) {
|
||||
console.log("Master password UI is busy - not sending the tabs");
|
||||
return false;
|
||||
}
|
||||
try {
|
||||
cryptoSDR.encrypt("bacon"); // forces the mp prompt.
|
||||
} catch (e) {
|
||||
console.log("Master password remains unlocked - not sending the tabs");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
let numFailed = 0;
|
||||
if (fxaCommandsDevices.length) {
|
||||
console.log(
|
||||
|
|
Загрузка…
Ссылка в новой задаче