зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1194529 - Update OSKeyStore pref names now that the module is moved. r=MattN
Differential Revision: https://phabricator.services.mozilla.com/D61745 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
2642cc0cdb
Коммит
dfde50fb60
|
@ -1788,6 +1788,8 @@ pref("extensions.formautofill.reauth.enabled", false);
|
|||
pref("extensions.formautofill.section.enabled", true);
|
||||
pref("extensions.formautofill.loglevel", "Warn");
|
||||
|
||||
pref("browser.osKeyStore.loglevel", "Warn");
|
||||
|
||||
#ifdef NIGHTLY_BUILD
|
||||
// Comma separated list of countries Form Autofill is available in.
|
||||
pref("extensions.formautofill.supportedCountries", "US,CA,DE");
|
||||
|
|
|
@ -341,7 +341,7 @@ class FormAutofillParent extends JSWindowActorParent {
|
|||
break;
|
||||
}
|
||||
case "FormAutofill:SaveCreditCard": {
|
||||
if (!(await OSKeyStore.ensureLoggedIn())) {
|
||||
if (!(await FormAutofillUtils.ensureLoggedIn())) {
|
||||
log.warn("User canceled encryption login");
|
||||
return undefined;
|
||||
}
|
||||
|
@ -690,7 +690,7 @@ class FormAutofillParent extends JSWindowActorParent {
|
|||
return;
|
||||
}
|
||||
|
||||
if (!(await OSKeyStore.ensureLoggedIn())) {
|
||||
if (!(await FormAutofillUtils.ensureLoggedIn())) {
|
||||
log.warn("User canceled encryption login");
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -63,11 +63,10 @@ const { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
|
|||
const { FormAutofill } = ChromeUtils.import(
|
||||
"resource://formautofill/FormAutofill.jsm"
|
||||
);
|
||||
ChromeUtils.defineModuleGetter(
|
||||
this,
|
||||
"CreditCard",
|
||||
"resource://gre/modules/CreditCard.jsm"
|
||||
);
|
||||
XPCOMUtils.defineLazyModuleGetters(this, {
|
||||
CreditCard: "resource://gre/modules/CreditCard.jsm",
|
||||
OSKeyStore: "resource:///modules/OSKeyStore.jsm",
|
||||
});
|
||||
|
||||
let AddressDataLoader = {
|
||||
// Status of address data loading. We'll load all the countries with basic level 1
|
||||
|
@ -275,6 +274,12 @@ this.FormAutofillUtils = {
|
|||
return CreditCard.isValidNumber(ccNumber);
|
||||
},
|
||||
|
||||
ensureLoggedIn(promptMessage) {
|
||||
return OSKeyStore.ensureLoggedIn(
|
||||
this._reauthEnabledByUser && promptMessage ? promptMessage : false
|
||||
);
|
||||
},
|
||||
|
||||
/**
|
||||
* Get the array of credit card network ids ("types") we expect and offer as valid choices
|
||||
*
|
||||
|
@ -1111,3 +1116,10 @@ XPCOMUtils.defineLazyGetter(FormAutofillUtils, "brandBundle", function() {
|
|||
"chrome://branding/locale/brand.properties"
|
||||
);
|
||||
});
|
||||
|
||||
XPCOMUtils.defineLazyPreferenceGetter(
|
||||
FormAutofillUtils,
|
||||
"_reauthEnabledByUser",
|
||||
"extensions.formautofill.reauth.enabled",
|
||||
false
|
||||
);
|
||||
|
|
|
@ -371,7 +371,7 @@ class ManageCreditCards extends ManageRecords {
|
|||
// Ask for reauth if user is trying to edit an existing credit card.
|
||||
if (
|
||||
!creditCard ||
|
||||
(await OSKeyStore.ensureLoggedIn(reauthPasswordPromptMessage))
|
||||
(await FormAutofillUtils.ensureLoggedIn(reauthPasswordPromptMessage))
|
||||
) {
|
||||
let decryptedCCNumObj = {};
|
||||
if (creditCard && creditCard["cc-number-encrypted"]) {
|
||||
|
|
|
@ -34,8 +34,7 @@ XPCOMUtils.defineLazyServiceGetter(
|
|||
);
|
||||
|
||||
// Skip reauth during tests, only works in non-official builds.
|
||||
const TEST_ONLY_REAUTH =
|
||||
"extensions.formautofill.osKeyStore.unofficialBuildOnlyLogin";
|
||||
const TEST_ONLY_REAUTH = "browser.osKeyStore.unofficialBuildOnlyLogin";
|
||||
|
||||
var OSKeyStore = {
|
||||
/**
|
||||
|
@ -139,7 +138,7 @@ var OSKeyStore = {
|
|||
let unlockPromise;
|
||||
|
||||
// Decides who should handle reauth
|
||||
if (!this._reauthEnabledByUser || (typeof reauth == "boolean" && !reauth)) {
|
||||
if (typeof reauth == "boolean" && !reauth) {
|
||||
unlockPromise = Promise.resolve();
|
||||
} else if (!AppConstants.MOZILLA_OFFICIAL && this._testReauth) {
|
||||
unlockPromise = this._reauthInTests();
|
||||
|
@ -293,7 +292,7 @@ XPCOMUtils.defineLazyGetter(this, "log", () => {
|
|||
let ConsoleAPI = ChromeUtils.import("resource://gre/modules/Console.jsm", {})
|
||||
.ConsoleAPI;
|
||||
return new ConsoleAPI({
|
||||
maxLogLevelPref: "extensions.formautofill.loglevel",
|
||||
maxLogLevelPref: "browser.osKeyStore.loglevel",
|
||||
prefix: "OSKeyStore",
|
||||
});
|
||||
});
|
||||
|
@ -304,9 +303,3 @@ XPCOMUtils.defineLazyPreferenceGetter(
|
|||
TEST_ONLY_REAUTH,
|
||||
""
|
||||
);
|
||||
XPCOMUtils.defineLazyPreferenceGetter(
|
||||
OSKeyStore,
|
||||
"_reauthEnabledByUser",
|
||||
"extensions.formautofill.reauth.enabled",
|
||||
false
|
||||
);
|
||||
|
|
|
@ -15,8 +15,7 @@ const { TestUtils } = ChromeUtils.import(
|
|||
);
|
||||
|
||||
var OSKeyStoreTestUtils = {
|
||||
TEST_ONLY_REAUTH:
|
||||
"extensions.formautofill.osKeyStore.unofficialBuildOnlyLogin",
|
||||
TEST_ONLY_REAUTH: "browser.osKeyStore.unofficialBuildOnlyLogin",
|
||||
|
||||
setup() {
|
||||
this.ORIGINAL_STORE_LABEL = OSKeyStore.STORE_LABEL;
|
||||
|
|
|
@ -22,8 +22,6 @@ add_task(async function os_key_store_setup() {
|
|||
|
||||
let OSKeyStore;
|
||||
add_task(async function setup() {
|
||||
Services.prefs.setBoolPref("extensions.formautofill.reauth.enabled", true);
|
||||
|
||||
({ OSKeyStore } = ChromeUtils.import("resource:///modules/OSKeyStore.jsm"));
|
||||
});
|
||||
|
||||
|
@ -87,14 +85,6 @@ add_task(async function test_reauth() {
|
|||
"Reauth logged in."
|
||||
);
|
||||
await reauthObserved;
|
||||
|
||||
Services.prefs.setBoolPref("extensions.formautofill.reauth.enabled", false);
|
||||
Assert.equal(
|
||||
await OSKeyStore.ensureLoggedIn(true),
|
||||
true,
|
||||
"Reauth disabled so logged in without prompt"
|
||||
);
|
||||
Services.prefs.setBoolPref("extensions.formautofill.reauth.enabled", true);
|
||||
});
|
||||
|
||||
add_task(async function test_decryption_failure() {
|
||||
|
|
Загрузка…
Ссылка в новой задаче