Skip to content

Commit

Permalink
PaymentRequest: Fix a bug that an email gets lost when saving an address
Browse files Browse the repository at this point in the history
Before this patch, there is a bug which overwrites the email data with
an empty value when the address saved from the setting's editor is
modified on the payment sheet's address editor. This issue occurs when
clearing the existing address fields before saving modified data. Other
fields are set to new values but email field isn't. Because there is no
email field on payment address. So, this patch makes the email data
retained instead of clearing the data.

Bug: 972071
Change-Id: Ic326f881685042b0752a522611bfe92d651df54d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1652393
Reviewed-by: Rouslan Solomakhin <rouslan@chromium.org>
Commit-Queue: Jinho Bang <jinho.bang@samsung.com>
Cr-Commit-Position: refs/heads/master@{#667971}
  • Loading branch information
romandev authored and Commit Bot committed Jun 11, 2019
1 parent 654ed17 commit 07e50f1
Showing 1 changed file with 10 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -100,13 +100,16 @@ bool ShippingAddressEditorViewController::ValidateModelAndSave() {
} else {
autofill::ServerFieldTypeSet all_fields;
profile_to_edit_->GetSupportedTypes(&all_fields);
// Clear all the address data in |profile_to_edit_|, in anticipation of
// adding only the fields present in the editor. Prefer this method to
// copying |profile| into |profile_to_edit_|, because the latter object
// needs to retain other properties (use count, use date, guid,
// etc.).
for (autofill::ServerFieldType type : all_fields)
profile_to_edit_->SetRawInfo(type, base::string16());
// Clear all the address data in |profile_to_edit_| except the email field,
// in anticipation of adding only the fields present in the editor. Prefer
// this method to copying |profile| into |profile_to_edit_|, because the
// latter object needs to retain other properties (use count, use date,
// guid, etc.).
for (autofill::ServerFieldType type : all_fields) {
if (type != autofill::ServerFieldType::EMAIL_ADDRESS) {
profile_to_edit_->SetRawInfo(type, base::string16());
}
}

bool success = SaveFieldsToProfile(profile_to_edit_,
/*ignore_errors=*/false);
Expand Down

0 comments on commit 07e50f1

Please sign in to comment.