Bug 1626055 - Disable address autofill auto-saving until we deal with duplicate addresses. r=MattN

Tie address capture to a new temporary pref, and update some tests to enable it so the test keep running.

Differential Revision: https://phabricator.services.mozilla.com/D83961
This commit is contained in:
Jim Mathies 2020-07-21 05:58:30 +00:00
parent a8f027f4ff
commit 2cb953ef94
8 changed files with 36 additions and 14 deletions

View File

@ -1839,13 +1839,10 @@ pref("browser.crashReports.unsubmittedCheck.autoSubmit2", false);
// The truthy values of "extensions.formautofill.available" are "on" and "detect",
// any other value means autofill isn't available.
// "detect" means it's enabled if conditions defined in the extension are met.
#ifdef NIGHTLY_BUILD
pref("extensions.formautofill.available", "on");
#else
pref("extensions.formautofill.available", "detect");
#endif
pref("extensions.formautofill.available", "detect");
pref("extensions.formautofill.creditCards.available", false);
pref("extensions.formautofill.addresses.enabled", true);
pref("extensions.formautofill.addresses.capture.enabled", false);
pref("extensions.formautofill.creditCards.enabled", true);
// Pref for shield/heartbeat to recognize users who have used Credit Card
// Autofill. The valid values can be:
@ -1864,14 +1861,8 @@ pref("extensions.formautofill.loglevel", "Warn");
pref("toolkit.osKeyStore.loglevel", "Warn");
#ifdef NIGHTLY_BUILD
// Comma separated list of countries Form Autofill is available in.
pref("extensions.formautofill.supportedCountries", "US,CA,DE");
pref("extensions.formautofill.supportRTL", true);
#else
pref("extensions.formautofill.supportedCountries", "US");
pref("extensions.formautofill.supportRTL", false);
#endif
pref("extensions.formautofill.supportedCountries", "US");
pref("extensions.formautofill.supportRTL", false);
// Whether or not to restore a session with lazy-browser tabs.
pref("browser.sessionstore.restore_tabs_lazily", true);

View File

@ -21,6 +21,8 @@ const AUTOFILL_CREDITCARDS_AVAILABLE_PREF =
const CREDITCARDS_USED_STATUS_PREF = "extensions.formautofill.creditCards.used";
const ENABLED_AUTOFILL_ADDRESSES_PREF =
"extensions.formautofill.addresses.enabled";
const ENABLED_AUTOFILL_ADDRESSES_CAPTURE_PREF =
"extensions.formautofill.addresses.capture.enabled";
const ENABLED_AUTOFILL_CREDITCARDS_PREF =
"extensions.formautofill.creditCards.enabled";
const ENABLED_AUTOFILL_CREDITCARDS_REAUTH_PREF =
@ -53,6 +55,7 @@ function debug() {
var FormAutofill = {
ENABLED_AUTOFILL_ADDRESSES_PREF,
ENABLED_AUTOFILL_ADDRESSES_CAPTURE_PREF,
ENABLED_AUTOFILL_CREDITCARDS_PREF,
ENABLED_AUTOFILL_CREDITCARDS_REAUTH_PREF,
ADDRESSES_FIRST_TIME_USE_PREF,
@ -95,6 +98,11 @@ XPCOMUtils.defineLazyPreferenceGetter(
"isAutofillAddressesEnabled",
ENABLED_AUTOFILL_ADDRESSES_PREF
);
XPCOMUtils.defineLazyPreferenceGetter(
FormAutofill,
"isAutofillAddressesCaptureEnabled",
ENABLED_AUTOFILL_ADDRESSES_CAPTURE_PREF
);
XPCOMUtils.defineLazyPreferenceGetter(
FormAutofill,
"isAutofillCreditCardsAvailable",

View File

@ -453,6 +453,9 @@ class FormAutofillParent extends JSWindowActorParent {
async _onAddressSubmit(address, browser, timeStartedFillingMS) {
let showDoorhanger = null;
if (!FormAutofill.isAutofillAddressesCaptureEnabled) {
return showDoorhanger;
}
if (address.guid) {
// Avoid updating the fields that users don't modify.
let originalAddress = await gFormAutofillStorage.addresses.get(

View File

@ -8,6 +8,7 @@ add_task(async function test_first_time_save() {
set: [
[FTU_PREF, true],
[ENABLED_AUTOFILL_ADDRESSES_PREF, true],
[ENABLED_AUTOFILL_ADDRESSES_CAPTURE_PREF, true],
],
});

View File

@ -6,6 +6,12 @@ const PRIVACY_PREF_URL = "about:preferences#privacy";
// Start by adding a few addresses to storage.
add_task(async function setup_storage() {
await SpecialPowers.pushPrefEnv({
set: [
[ENABLED_AUTOFILL_ADDRESSES_PREF, true],
[ENABLED_AUTOFILL_ADDRESSES_CAPTURE_PREF, true],
],
});
await saveAddress(TEST_ADDRESS_2);
await saveAddress(TEST_ADDRESS_4);
await saveAddress(TEST_ADDRESS_5);

View File

@ -3,7 +3,7 @@
TEST_ADDRESS_IE_1,
TEST_CREDIT_CARD_1, TEST_CREDIT_CARD_2, TEST_CREDIT_CARD_3, TEST_CREDIT_CARD_4, TEST_CREDIT_CARD_5,
FORM_URL, CREDITCARD_FORM_URL, CREDITCARD_FORM_IFRAME_URL
FTU_PREF, ENABLED_AUTOFILL_ADDRESSES_PREF, AUTOFILL_CREDITCARDS_AVAILABLE_PREF, ENABLED_AUTOFILL_CREDITCARDS_PREF,
FTU_PREF, ENABLED_AUTOFILL_ADDRESSES_PREF, ENABLED_AUTOFILL_ADDRESSES_CAPTURE_PREF, AUTOFILL_CREDITCARDS_AVAILABLE_PREF, ENABLED_AUTOFILL_CREDITCARDS_PREF,
SUPPORTED_COUNTRIES_PREF,
SYNC_USERNAME_PREF, SYNC_ADDRESSES_PREF, SYNC_CREDITCARDS_PREF, SYNC_CREDITCARDS_AVAILABLE_PREF, CREDITCARDS_USED_STATUS_PREF,
sleep, expectPopupOpen, openPopupOn, openPopupForSubframe, expectPopupClose, closePopup, closePopupForSubframe,
@ -41,6 +41,8 @@ const FTU_PREF = "extensions.formautofill.firstTimeUse";
const CREDITCARDS_USED_STATUS_PREF = "extensions.formautofill.creditCards.used";
const ENABLED_AUTOFILL_ADDRESSES_PREF =
"extensions.formautofill.addresses.enabled";
const ENABLED_AUTOFILL_ADDRESSES_CAPTURE_PREF =
"extensions.formautofill.addresses.capture.enabled";
const AUTOFILL_CREDITCARDS_AVAILABLE_PREF =
"extensions.formautofill.creditCards.available";
const ENABLED_AUTOFILL_CREDITCARDS_PREF =

View File

@ -28,6 +28,8 @@ const TEST_ADDRESSES = [{
add_task(async function test_DE_is_valid_testcase() {
await SpecialPowers.pushPrefEnv({
set: [
["extensions.formautofill.addresses.enabled", true],
["extensions.formautofill.addresses.capture.enabled", true],
["extensions.formautofill.supportedCountries", "US,CA,DE"],
],
});

View File

@ -27,6 +27,15 @@ let TEST_ADDRESSES = [{
tel: "+16509030800",
}];
add_task(async function setup_prefs() {
await SpecialPowers.pushPrefEnv({
set: [
["extensions.formautofill.addresses.enabled", true],
["extensions.formautofill.addresses.capture.enabled", true],
],
});
});
initPopupListener();
// Submit first address for saving.