зеркало из 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.section.enabled", true);
|
||||||
pref("extensions.formautofill.loglevel", "Warn");
|
pref("extensions.formautofill.loglevel", "Warn");
|
||||||
|
|
||||||
|
pref("browser.osKeyStore.loglevel", "Warn");
|
||||||
|
|
||||||
#ifdef NIGHTLY_BUILD
|
#ifdef NIGHTLY_BUILD
|
||||||
// Comma separated list of countries Form Autofill is available in.
|
// Comma separated list of countries Form Autofill is available in.
|
||||||
pref("extensions.formautofill.supportedCountries", "US,CA,DE");
|
pref("extensions.formautofill.supportedCountries", "US,CA,DE");
|
||||||
|
|
|
@ -341,7 +341,7 @@ class FormAutofillParent extends JSWindowActorParent {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case "FormAutofill:SaveCreditCard": {
|
case "FormAutofill:SaveCreditCard": {
|
||||||
if (!(await OSKeyStore.ensureLoggedIn())) {
|
if (!(await FormAutofillUtils.ensureLoggedIn())) {
|
||||||
log.warn("User canceled encryption login");
|
log.warn("User canceled encryption login");
|
||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
|
@ -690,7 +690,7 @@ class FormAutofillParent extends JSWindowActorParent {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(await OSKeyStore.ensureLoggedIn())) {
|
if (!(await FormAutofillUtils.ensureLoggedIn())) {
|
||||||
log.warn("User canceled encryption login");
|
log.warn("User canceled encryption login");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -63,11 +63,10 @@ const { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
|
||||||
const { FormAutofill } = ChromeUtils.import(
|
const { FormAutofill } = ChromeUtils.import(
|
||||||
"resource://formautofill/FormAutofill.jsm"
|
"resource://formautofill/FormAutofill.jsm"
|
||||||
);
|
);
|
||||||
ChromeUtils.defineModuleGetter(
|
XPCOMUtils.defineLazyModuleGetters(this, {
|
||||||
this,
|
CreditCard: "resource://gre/modules/CreditCard.jsm",
|
||||||
"CreditCard",
|
OSKeyStore: "resource:///modules/OSKeyStore.jsm",
|
||||||
"resource://gre/modules/CreditCard.jsm"
|
});
|
||||||
);
|
|
||||||
|
|
||||||
let AddressDataLoader = {
|
let AddressDataLoader = {
|
||||||
// Status of address data loading. We'll load all the countries with basic level 1
|
// 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);
|
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
|
* 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"
|
"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.
|
// Ask for reauth if user is trying to edit an existing credit card.
|
||||||
if (
|
if (
|
||||||
!creditCard ||
|
!creditCard ||
|
||||||
(await OSKeyStore.ensureLoggedIn(reauthPasswordPromptMessage))
|
(await FormAutofillUtils.ensureLoggedIn(reauthPasswordPromptMessage))
|
||||||
) {
|
) {
|
||||||
let decryptedCCNumObj = {};
|
let decryptedCCNumObj = {};
|
||||||
if (creditCard && creditCard["cc-number-encrypted"]) {
|
if (creditCard && creditCard["cc-number-encrypted"]) {
|
||||||
|
|
|
@ -34,8 +34,7 @@ XPCOMUtils.defineLazyServiceGetter(
|
||||||
);
|
);
|
||||||
|
|
||||||
// Skip reauth during tests, only works in non-official builds.
|
// Skip reauth during tests, only works in non-official builds.
|
||||||
const TEST_ONLY_REAUTH =
|
const TEST_ONLY_REAUTH = "browser.osKeyStore.unofficialBuildOnlyLogin";
|
||||||
"extensions.formautofill.osKeyStore.unofficialBuildOnlyLogin";
|
|
||||||
|
|
||||||
var OSKeyStore = {
|
var OSKeyStore = {
|
||||||
/**
|
/**
|
||||||
|
@ -139,7 +138,7 @@ var OSKeyStore = {
|
||||||
let unlockPromise;
|
let unlockPromise;
|
||||||
|
|
||||||
// Decides who should handle reauth
|
// Decides who should handle reauth
|
||||||
if (!this._reauthEnabledByUser || (typeof reauth == "boolean" && !reauth)) {
|
if (typeof reauth == "boolean" && !reauth) {
|
||||||
unlockPromise = Promise.resolve();
|
unlockPromise = Promise.resolve();
|
||||||
} else if (!AppConstants.MOZILLA_OFFICIAL && this._testReauth) {
|
} else if (!AppConstants.MOZILLA_OFFICIAL && this._testReauth) {
|
||||||
unlockPromise = this._reauthInTests();
|
unlockPromise = this._reauthInTests();
|
||||||
|
@ -293,7 +292,7 @@ XPCOMUtils.defineLazyGetter(this, "log", () => {
|
||||||
let ConsoleAPI = ChromeUtils.import("resource://gre/modules/Console.jsm", {})
|
let ConsoleAPI = ChromeUtils.import("resource://gre/modules/Console.jsm", {})
|
||||||
.ConsoleAPI;
|
.ConsoleAPI;
|
||||||
return new ConsoleAPI({
|
return new ConsoleAPI({
|
||||||
maxLogLevelPref: "extensions.formautofill.loglevel",
|
maxLogLevelPref: "browser.osKeyStore.loglevel",
|
||||||
prefix: "OSKeyStore",
|
prefix: "OSKeyStore",
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -304,9 +303,3 @@ XPCOMUtils.defineLazyPreferenceGetter(
|
||||||
TEST_ONLY_REAUTH,
|
TEST_ONLY_REAUTH,
|
||||||
""
|
""
|
||||||
);
|
);
|
||||||
XPCOMUtils.defineLazyPreferenceGetter(
|
|
||||||
OSKeyStore,
|
|
||||||
"_reauthEnabledByUser",
|
|
||||||
"extensions.formautofill.reauth.enabled",
|
|
||||||
false
|
|
||||||
);
|
|
||||||
|
|
|
@ -15,8 +15,7 @@ const { TestUtils } = ChromeUtils.import(
|
||||||
);
|
);
|
||||||
|
|
||||||
var OSKeyStoreTestUtils = {
|
var OSKeyStoreTestUtils = {
|
||||||
TEST_ONLY_REAUTH:
|
TEST_ONLY_REAUTH: "browser.osKeyStore.unofficialBuildOnlyLogin",
|
||||||
"extensions.formautofill.osKeyStore.unofficialBuildOnlyLogin",
|
|
||||||
|
|
||||||
setup() {
|
setup() {
|
||||||
this.ORIGINAL_STORE_LABEL = OSKeyStore.STORE_LABEL;
|
this.ORIGINAL_STORE_LABEL = OSKeyStore.STORE_LABEL;
|
||||||
|
|
|
@ -22,8 +22,6 @@ add_task(async function os_key_store_setup() {
|
||||||
|
|
||||||
let OSKeyStore;
|
let OSKeyStore;
|
||||||
add_task(async function setup() {
|
add_task(async function setup() {
|
||||||
Services.prefs.setBoolPref("extensions.formautofill.reauth.enabled", true);
|
|
||||||
|
|
||||||
({ OSKeyStore } = ChromeUtils.import("resource:///modules/OSKeyStore.jsm"));
|
({ OSKeyStore } = ChromeUtils.import("resource:///modules/OSKeyStore.jsm"));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -87,14 +85,6 @@ add_task(async function test_reauth() {
|
||||||
"Reauth logged in."
|
"Reauth logged in."
|
||||||
);
|
);
|
||||||
await reauthObserved;
|
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() {
|
add_task(async function test_decryption_failure() {
|
||||||
|
|
Загрузка…
Ссылка в новой задаче