Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(738)

Unified Diff: third_party/WebKit/Source/modules/payments/PaymentRequest.cpp

Issue 2038333002: PaymentRequest: Provide shippingAddress in PaymentResponse. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/modules/payments/PaymentRequest.cpp
diff --git a/third_party/WebKit/Source/modules/payments/PaymentRequest.cpp b/third_party/WebKit/Source/modules/payments/PaymentRequest.cpp
index b714ad694eba2cfa9da60da2279478a1c7819b21..d5b31b83a475329c0203d2d99af7cb3838baedd4 100644
--- a/third_party/WebKit/Source/modules/payments/PaymentRequest.cpp
+++ b/third_party/WebKit/Source/modules/payments/PaymentRequest.cpp
@@ -427,7 +427,13 @@ void PaymentRequest::OnPaymentResponse(mojom::blink::PaymentResponsePtr response
DCHECK(m_showResolver);
DCHECK(!m_completeResolver);
- if (response->shipping_address) {
+ if (m_options.requestShipping()) {
+ if (!response->shipping_address) {
+ m_showResolver->reject(DOMException::create(SyntaxError));
+ clearResolversAndCloseMojoConnection();
+ return;
+ }
+
String errorMessage;
if (!PaymentsValidators::isValidShippingAddress(response->shipping_address, &errorMessage)) {
m_showResolver->reject(DOMException::create(SyntaxError, errorMessage));
@@ -435,8 +441,14 @@ void PaymentRequest::OnPaymentResponse(mojom::blink::PaymentResponsePtr response
return;
}
- m_shippingAddress = new PaymentAddress(std::move(response->shipping_address));
+ m_shippingAddress = new PaymentAddress(response->shipping_address.Clone());
m_shippingOption = response->shipping_option_id;
+ } else {
+ if (response->shipping_address) {
+ m_showResolver->reject(DOMException::create(SyntaxError));
+ clearResolversAndCloseMojoConnection();
+ return;
+ }
}
m_showResolver->resolve(new PaymentResponse(std::move(response), this));

Powered by Google App Engine
This is Rietveld 408576698