Index: components/autofill/browser/personal_data_manager.cc |
diff --git a/components/autofill/browser/personal_data_manager.cc b/components/autofill/browser/personal_data_manager.cc |
index 4eb595621e675d060baf83a0407c6a9fe03cb70a..6fa3c45c598648ce1341a2b9d491dc2c851fff55 100644 |
--- a/components/autofill/browser/personal_data_manager.cc |
+++ b/components/autofill/browser/personal_data_manager.cc |
@@ -114,8 +114,10 @@ bool IsValidFieldTypeAndValue(const std::set<AutofillFieldType>& types_seen, |
// Abandon the import if two fields of the same type are encountered. |
// This indicates ambiguous data or miscategorization of types. |
// Make an exception for PHONE_HOME_NUMBER however as both prefix and |
- // suffix are stored against this type. |
- if (types_seen.count(field_type) && field_type != PHONE_HOME_NUMBER) |
+ // suffix are stored against this type, and for EMAIL_ADDRESS because it is |
+ // common to see second 'confirm email address' fields on forms. |
+ if (types_seen.count(field_type) && field_type != PHONE_HOME_NUMBER && |
+ field_type != EMAIL_ADDRESS) |
return false; |
// Abandon the import if an email address value shows up in a field that is |
@@ -249,6 +251,17 @@ bool PersonalDataManager::ImportFormData( |
AutofillFieldType field_type = field->type(); |
FieldTypeGroup group(AutofillType(field_type).group()); |
+ // There can be multiple email fields (e.g. in the case of 'confirm email' |
+ // fields) but they must all contain the same value, else the profile is |
+ // invalid. |
+ if (field_type == EMAIL_ADDRESS) { |
+ if (types_seen.count(field_type) && |
+ imported_profile->GetRawInfo(field_type) != value) { |
+ imported_profile.reset(); |
+ break; |
+ } |
+ } |
+ |
// If the |field_type| and |value| don't pass basic validity checks then |
// abandon the import. |
if (!IsValidFieldTypeAndValue(types_seen, field_type, value)) { |