Bug 1805838 - Remove 'extensions.formautofill.creditCards.hideui' preference r=sgalich
Differential Revision: https://phabricator.services.mozilla.com/D164787
This commit is contained in:
@@ -218,37 +218,6 @@ add_task(async function test_creditCardNotAvailable() {
|
||||
);
|
||||
});
|
||||
|
||||
add_task(async function test_creditCardHiddenUI() {
|
||||
const AUTOFILL_CREDITCARDS_HIDE_UI_PREF =
|
||||
"extensions.formautofill.creditCards.hideui";
|
||||
|
||||
await SpecialPowers.pushPrefEnv({
|
||||
set: [[AUTOFILL_CREDITCARDS_HIDE_UI_PREF, true]],
|
||||
});
|
||||
let finalPrefPaneLoaded = TestUtils.topicObserved(
|
||||
"sync-pane-loaded",
|
||||
() => true
|
||||
);
|
||||
await BrowserTestUtils.withNewTab(
|
||||
{ gBrowser, url: PAGE_PRIVACY },
|
||||
async function(browser) {
|
||||
await finalPrefPaneLoaded;
|
||||
await SpecialPowers.spawn(browser, [SELECTORS], selectors => {
|
||||
is(
|
||||
content.document.querySelector(selectors.group).hidden,
|
||||
false,
|
||||
"Form Autofill group should be visible"
|
||||
);
|
||||
ok(
|
||||
!content.document.querySelector(selectors.creditCardAutofillCheckbox),
|
||||
"Autofill credit cards checkbox should not exist"
|
||||
);
|
||||
});
|
||||
}
|
||||
);
|
||||
SpecialPowers.clearUserPref(AUTOFILL_CREDITCARDS_HIDE_UI_PREF);
|
||||
});
|
||||
|
||||
add_task(async function test_reauth() {
|
||||
await SpecialPowers.pushPrefEnv({
|
||||
set: [[AUTOFILL_CREDITCARDS_AVAILABLE_PREF, "on"]],
|
||||
|
||||
@@ -771,96 +771,6 @@ add_task(async function test_histogram() {
|
||||
|
||||
assertHistogram(CC_NUM_USES_HISTOGRAM, {});
|
||||
});
|
||||
add_task(async function test_submit_creditCard_new_with_hidden_ui() {
|
||||
const AUTOFILL_CREDITCARDS_HIDE_UI_PREF =
|
||||
"extensions.formautofill.creditCards.hideui";
|
||||
|
||||
Services.telemetry.clearEvents();
|
||||
Services.telemetry.clearScalars();
|
||||
Services.telemetry.getHistogramById(CC_NUM_USES_HISTOGRAM).clear();
|
||||
|
||||
await SpecialPowers.pushPrefEnv({
|
||||
set: [
|
||||
[CREDITCARDS_USED_STATUS_PREF, 0],
|
||||
[ENABLED_AUTOFILL_CREDITCARDS_PREF, true],
|
||||
[AUTOFILL_CREDITCARDS_HIDE_UI_PREF, true],
|
||||
],
|
||||
});
|
||||
|
||||
await setStorage(TEST_CREDIT_CARD_1);
|
||||
|
||||
await BrowserTestUtils.withNewTab(
|
||||
{ gBrowser, url: CREDITCARD_FORM_URL },
|
||||
async function(browser) {
|
||||
let rejectPopup = () => {
|
||||
ok(false, "Popup should not be displayed");
|
||||
};
|
||||
browser.addEventListener("popupshowing", rejectPopup, true);
|
||||
|
||||
await SimpleTest.promiseFocus(browser);
|
||||
await focusAndWaitForFieldsIdentified(browser, "form #cc-number");
|
||||
await BrowserTestUtils.synthesizeKey("VK_DOWN", {}, browser);
|
||||
|
||||
is(PopupNotifications.panel.state, "closed", "Doorhanger is hidden");
|
||||
|
||||
await focusUpdateSubmitForm(browser, {
|
||||
focusSelector: "#cc-name",
|
||||
newValues: {
|
||||
"#cc-name": "User 1",
|
||||
"#cc-number": "5038146897157463",
|
||||
"#cc-exp-month": "12",
|
||||
"#cc-exp-year": "2017",
|
||||
"#cc-type": "mastercard",
|
||||
},
|
||||
});
|
||||
|
||||
await sleep(1000);
|
||||
is(
|
||||
PopupNotifications.panel.state,
|
||||
"closed",
|
||||
"Doorhanger is still hidden"
|
||||
);
|
||||
browser.removeEventListener("popupshowing", rejectPopup, true);
|
||||
}
|
||||
);
|
||||
|
||||
SpecialPowers.clearUserPref(CREDITCARDS_USED_STATUS_PREF);
|
||||
SpecialPowers.clearUserPref(ENABLED_AUTOFILL_CREDITCARDS_PREF);
|
||||
SpecialPowers.clearUserPref(AUTOFILL_CREDITCARDS_HIDE_UI_PREF);
|
||||
|
||||
assertHistogram(CC_NUM_USES_HISTOGRAM, { 0: 1 });
|
||||
|
||||
let expected_content = [
|
||||
ccFormArgsv1("detected"),
|
||||
ccFormArgsv2("detected", buildccFormv2Extra({ cc_exp: "false" }, "true")),
|
||||
ccFormArgsv1("submitted", {
|
||||
fields_not_auto: "6",
|
||||
fields_auto: "0",
|
||||
fields_modified: "0",
|
||||
}),
|
||||
ccFormArgsv2(
|
||||
"submitted",
|
||||
buildccFormv2Extra({ cc_exp: "unavailable" }, "user_filled")
|
||||
),
|
||||
];
|
||||
await assertTelemetry(expected_content, []);
|
||||
|
||||
TelemetryTestUtils.assertScalar(
|
||||
TelemetryTestUtils.getProcessScalars("content"),
|
||||
"formautofill.creditCards.detected_sections_count",
|
||||
1,
|
||||
"There should be 1 sections detected."
|
||||
);
|
||||
TelemetryTestUtils.assertScalar(
|
||||
TelemetryTestUtils.getProcessScalars("content"),
|
||||
"formautofill.creditCards.submitted_sections_count",
|
||||
1,
|
||||
"There should be 1 section submitted."
|
||||
);
|
||||
|
||||
await removeAllRecords();
|
||||
SpecialPowers.popPrefEnv();
|
||||
});
|
||||
|
||||
add_task(async function test_clear_creditCard_autofill() {
|
||||
if (!OSKeyStoreTestUtils.canTestOSKeyStoreLogin()) {
|
||||
|
||||
@@ -4156,9 +4156,6 @@ pref("extensions.formautofill.creditCards.enabled", true);
|
||||
pref("extensions.formautofill.creditCards.ignoreAutocompleteOff", true);
|
||||
// Supported countries need to follow ISO 3166-1 to align with "browser.search.region"
|
||||
pref("extensions.formautofill.creditCards.supportedCountries", "US,CA,GB,FR,DE");
|
||||
// Temporary preference to control displaying the UI elements for
|
||||
// credit card autofill used for the duration of the A/B test.
|
||||
pref("extensions.formautofill.creditCards.hideui", false);
|
||||
|
||||
// Algorithm used by formautofill while determine whether a field is a credit card field
|
||||
// 0:Heurstics based on regular expression string matching
|
||||
|
||||
@@ -169,12 +169,9 @@ AutofillProfileAutoCompleteSearch.prototype = {
|
||||
let allFieldNames = activeSection.allFieldNames;
|
||||
let filledRecordGUID = activeSection.filledRecordGUID;
|
||||
|
||||
let creditCardsEnabledAndVisible =
|
||||
lazy.FormAutofill.isAutofillCreditCardsEnabled &&
|
||||
!lazy.FormAutofill.isAutofillCreditCardsHideUI;
|
||||
let searchPermitted = isAddressField
|
||||
? lazy.FormAutofill.isAutofillAddressesEnabled
|
||||
: creditCardsEnabledAndVisible;
|
||||
: lazy.FormAutofill.isAutofillCreditCardsEnabled;
|
||||
let AutocompleteResult = isAddressField
|
||||
? lazy.AddressResult
|
||||
: lazy.CreditCardResult;
|
||||
|
||||
@@ -604,10 +604,6 @@ class FormAutofillParent extends JSWindowActorParent {
|
||||
}
|
||||
|
||||
async _onCreditCardSubmit(creditCard, browser, timeStartedFillingMS) {
|
||||
if (FormAutofill.isAutofillCreditCardsHideUI) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Updates the used status for shield/heartbeat to recognize users who have
|
||||
// used Credit Card Autofill.
|
||||
let setUsedStatus = status => {
|
||||
|
||||
@@ -105,9 +105,7 @@ FormAutofillPreferences.prototype = {
|
||||
formAutofillFragment.appendChild(formAutofillGroup);
|
||||
|
||||
let showAddressUI = FormAutofill.isAutofillAddressesAvailable;
|
||||
let showCreditCardUI =
|
||||
FormAutofill.isAutofillCreditCardsAvailable &&
|
||||
!FormAutofill.isAutofillCreditCardsHideUI;
|
||||
let showCreditCardUI = FormAutofill.isAutofillCreditCardsAvailable;
|
||||
|
||||
if (!showAddressUI && !showCreditCardUI) {
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user