| Index: chrome/browser/autofill/credit_card_field.cc
|
| diff --git a/chrome/browser/autofill/credit_card_field.cc b/chrome/browser/autofill/credit_card_field.cc
|
| index 8d504f4bf667f52ddc7c0492ef6f48519ef6ca32..908c2424123e6a909482c568fb8e84e338d794f4 100644
|
| --- a/chrome/browser/autofill/credit_card_field.cc
|
| +++ b/chrome/browser/autofill/credit_card_field.cc
|
| @@ -157,11 +157,21 @@ FormField* CreditCardField::Parse(AutofillScanner* scanner,
|
| break;
|
| }
|
|
|
| + bool has_expiration_year_month = credit_card_field->expiration_month_ &&
|
| + (credit_card_field->expiration_year_ ||
|
| + LowerCaseEqualsASCII(
|
| + credit_card_field->expiration_month_->form_control_type, "month"));
|
| +
|
| // Some pages have a billing address field after the cardholder name field.
|
| // For that case, allow only just the cardholder name field. The remaining
|
| // CC fields will be picked up in a following CreditCardField.
|
| - if (credit_card_field->cardholder_)
|
| + // But credit card number is strongly tied with expiration year/month, so
|
| + // we should eliminate the case when we found only card number without
|
| + // expiration year/month.
|
| + if (credit_card_field->cardholder_ &&
|
| + !(credit_card_field->number_ && !has_expiration_year_month)) {
|
| return credit_card_field.release();
|
| + }
|
|
|
| // On some pages, the user selects a card type using radio buttons
|
| // (e.g. test page Apple Store Billing.html). We can't handle that yet,
|
| @@ -171,11 +181,7 @@ FormField* CreditCardField::Parse(AutofillScanner* scanner,
|
| // the number and name were parsed in a separate part of the form. So if
|
| // the cvc and date were found independently they are returned.
|
| if ((credit_card_field->number_ || credit_card_field->verification_) &&
|
| - credit_card_field->expiration_month_ &&
|
| - (credit_card_field->expiration_year_ ||
|
| - (LowerCaseEqualsASCII(
|
| - credit_card_field->expiration_month_->form_control_type,
|
| - "month")))) {
|
| + has_expiration_year_month) {
|
| return credit_card_field.release();
|
| }
|
|
|
|
|