Commit 4915cb36 authored by Dimi's avatar Dimi
Browse files

Bug 1667257 - Detect credit card type by examining IIN part of credit card number r=sgalich

parent c88334fe
Loading
Loading
Loading
Loading
+0 −20
Original line number Diff line number Diff line
@@ -514,7 +514,6 @@ class EditCreditCard extends EditAutofillForm {
      ),
      month: this._elements.form.querySelector("#cc-exp-month"),
      year: this._elements.form.querySelector("#cc-exp-year"),
      ccType: this._elements.form.querySelector("#cc-type"),
      billingAddress: this._elements.form.querySelector("#billingAddressGUID"),
      billingAddressRow: this._elements.form.querySelector(
        ".billingAddressRow"
@@ -531,8 +530,6 @@ class EditCreditCard extends EditAutofillForm {
    this._addresses = addresses;
    this.generateBillingAddressOptions(preserveFieldValues);
    if (!preserveFieldValues) {
      // Re-populating the networks will reset the selected option.
      this.populateNetworks();
      // Re-generating the months will reset the selected option.
      this.generateMonths();
      // Re-generating the years will reset the selected option.
@@ -591,23 +588,6 @@ class EditCreditCard extends EditAutofillForm {
    }
  }

  populateNetworks() {
    // Clear the list
    this._elements.ccType.textContent = "";
    let frag = document.createDocumentFragment();
    // include an empty first option
    frag.appendChild(new Option("", ""));

    let supportedNetworks = FormAutofillUtils.getCreditCardNetworks();
    for (let id of supportedNetworks) {
      const option = new Option(undefined, id);
      // autofill-card-network-amex, ..., autofill-card-network-visa
      option.dataset.l10nId = `autofill-card-network-${id}`;
      frag.appendChild(option);
    }
    this._elements.ccType.appendChild(frag);
  }

  generateBillingAddressOptions(preserveFieldValues) {
    let billingAddressGUID;
    if (preserveFieldValues && this._elements.billingAddress.value) {
+0 −5
Original line number Diff line number Diff line
@@ -44,11 +44,6 @@
      <input id="cc-name" type="text" required="required"/>
      <span data-l10n-id="autofill-card-name-on-card" class="label-text"/>
    </label>
    <label id="cc-type-container" class="container">
      <select id="cc-type" required="required">
      </select>
      <span data-l10n-id="autofill-card-network" class="label-text"/>
    </label>
    <label id="cc-csc-container" class="container" hidden="hidden">
      <!-- The CSC container will get filled in by forms that need a CSC (using csc-input.js) -->
    </label>
+1 −5
Original line number Diff line number Diff line
@@ -6,7 +6,7 @@
  display: grid;
  grid-template-areas:
    "cc-number          cc-exp-month       cc-exp-year"
    "cc-name            cc-type            cc-csc"
    "cc-name            cc-csc             ."
    "billingAddressGUID billingAddressGUID billingAddressGUID";
  grid-template-columns: 4fr 2fr 2fr;
  grid-row-gap: var(--grid-column-row-gap);
@@ -40,10 +40,6 @@
  grid-area: cc-name;
}

#cc-type-container {
  grid-area: cc-type;
}

#cc-csc-container {
  grid-area: cc-csc;
}
+2 −0
Original line number Diff line number Diff line
@@ -21,6 +21,8 @@ skip-if = ((os == "mac") || (os == 'linux') || (os == 'win'))
skip-if = ((!debug && os == "mac") || (os == 'linux') || (os == 'win'))
[browser_creditCard_heuristics.js]
skip-if = apple_silicon && !debug # Bug 1714221
[browser_creditCard_submission_autodetect_type.js]
skip-if = apple_silicon && !debug
[browser_creditCard_submission_normalized.js]
skip-if = apple_silicon && !debug
[browser_editCreditCardDialog.js]
+1 −3
Original line number Diff line number Diff line
@@ -57,7 +57,7 @@ add_task(async function test_submit_creditCard_saved() {
        focusSelector: "#cc-name",
        newValues: {
          "#cc-name": "User 1",
          "#cc-number": "5038146897157463",
          "#cc-number": "5577000055770004",
          "#cc-exp-month": "12",
          "#cc-exp-year": "2017",
          "#cc-type": "mastercard",
@@ -918,7 +918,6 @@ add_task(async function test_submit_third_party_creditCard_logo() {
add_task(async function test_update_third_party_creditCard_logo() {
  const amexCard = {
    "cc-number": "374542158116607",
    "cc-type": "amex",
    "cc-name": "John Doe",
  };

@@ -1070,7 +1069,6 @@ add_task(async function test_save_panel_spaces_in_cc_number_logo() {
add_task(async function test_update_panel_with_spaces_in_cc_number_logo() {
  const amexCard = {
    "cc-number": "374 54215 8116607",
    "cc-type": "amex",
    "cc-name": "John Doe",
  };

Loading