Index: components/autofill/core/browser/credit_card_field.cc |
diff --git a/components/autofill/core/browser/credit_card_field.cc b/components/autofill/core/browser/credit_card_field.cc |
index d0b0e28e549ef87aec4462efc2802734a41b21fd..c11545222c31d81680471694329c67fb068719fc 100644 |
--- a/components/autofill/core/browser/credit_card_field.cc |
+++ b/components/autofill/core/browser/credit_card_field.cc |
@@ -374,6 +374,10 @@ bool CreditCardField::ParseExpirationDate(AutofillScanner* scanner) { |
if (ParseFieldSpecifics(scanner, |
base::UTF8ToUTF16(kExpirationDate2DigitYearRe), |
kMatchTelAndSelect, |
+ &expiration_date_) || |
+ ParseFieldSpecifics(scanner, |
+ base::ASCIIToUTF16("^mm\\s*[-/]\\syy$"), |
Evan Stade
2015/04/01 23:11:29
can you add comment explaining why this isn't just
Lei Zhang
2015/04/03 02:02:01
Sure.
|
+ kMatchTelAndSelect, |
&expiration_date_)) { |
exp_year_type_ = CREDIT_CARD_EXP_DATE_2_DIGIT_YEAR; |
expiration_month_ = nullptr; |
@@ -393,6 +397,20 @@ bool CreditCardField::ParseExpirationDate(AutofillScanner* scanner) { |
return true; |
} |
+ if (current_field_max_length > 0 && |
+ current_field_max_length < kMinimum4YearCcExpLength) { |
+ return false; |
+ } |
+ |
+ |
+ if (ParseFieldSpecifics(scanner, |
+ base::ASCIIToUTF16("^mm\\s*[-/]\\syyyy$"), |
Evan Stade
2015/04/01 23:11:30
ditto. Why isn't this part of the other regex, and
Lei Zhang
2015/04/03 02:02:01
I reworked the code a little and added more commen
|
+ kMatchTelAndSelect, |
+ &expiration_date_)) { |
+ expiration_month_ = nullptr; |
+ return true; |
+ } |
+ |
return false; |
} |