Index: components/autofill/core/browser/address_field.cc |
diff --git a/components/autofill/core/browser/address_field.cc b/components/autofill/core/browser/address_field.cc |
index 0791eb3c9daf45029ad4f08f51c8f09ee7df2ba5..dffba7d4ea6a5a2cf52c906ee53858702bf319a5 100644 |
--- a/components/autofill/core/browser/address_field.cc |
+++ b/components/autofill/core/browser/address_field.cc |
@@ -71,18 +71,18 @@ scoped_ptr<FormField> AddressField::Parse(AutofillScanner* scanner) { |
} |
} |
- // If we have identified any address fields in this field then it should be |
- // added to the list of fields. |
- if (address_field->company_ || |
- address_field->address1_ || |
- address_field->address2_ || |
- address_field->address3_ || |
- address_field->street_address_ || |
- address_field->city_ || |
- address_field->state_ || |
- address_field->zip_ || |
- address_field->zip4_ || |
- address_field->country_) { |
+ // If we have identified any non-street address fields in this field then it |
+ // should be added to the list of fields. We skip over the case of just having |
+ // the street address by itself, because it is way too easy to have a field |
+ // with the word "address" in it getting parsed as a street address. |
+ // See http://crbug.com/447332 |
+ bool has_valid_non_street_address_field = (address_field->company_ || |
Evan Stade
2015/01/15 04:11:37
nit: I think we should require at least three reco
Evan Stade
2015/01/15 04:12:23
also, as this code is written, wouldn't the bug st
|
+ address_field->city_ || |
+ address_field->state_ || |
+ address_field->zip_ || |
+ address_field->zip4_ || |
+ address_field->country_); |
+ if (has_valid_non_street_address_field) { |
// Don't slurp non-labeled fields at the end into the address. |
if (has_trailing_non_labeled_fields) |
scanner->RewindTo(begin_trailing_non_labeled_fields); |