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

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

Issue 2077663002: Reduce redundant code in PaymentRequest::OnPaymentComplete(). (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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 eebbcc9a4750fd2d8b7f67a9ab52d3cb6d2148a9..de2c800083870b1cb7267b49f6a50978e9329054 100644
--- a/third_party/WebKit/Source/modules/payments/PaymentRequest.cpp
+++ b/third_party/WebKit/Source/modules/payments/PaymentRequest.cpp
@@ -480,25 +480,10 @@ void PaymentRequest::OnPaymentResponse(mojom::blink::PaymentResponsePtr response
}
}
- if (m_options.requestPayerEmail() && response->payer_email.isEmpty()) {
- m_showResolver->reject(DOMException::create(SyntaxError));
- clearResolversAndCloseMojoConnection();
- return;
- }
-
- if (!m_options.requestPayerEmail() && !response->payer_email.isNull()) {
- m_showResolver->reject(DOMException::create(SyntaxError));
- clearResolversAndCloseMojoConnection();
- return;
- }
-
- if (m_options.requestPayerPhone() && response->payer_phone.isEmpty()) {
- m_showResolver->reject(DOMException::create(SyntaxError));
- clearResolversAndCloseMojoConnection();
- return;
- }
-
- if (!m_options.requestPayerPhone() && !response->payer_phone.isNull()) {
+ if ((m_options.requestPayerEmail() && response->payer_email.isEmpty())
+ || (m_options.requestPayerPhone() && response->payer_phone.isEmpty())
+ || (!m_options.requestPayerEmail() && !response->payer_email.isNull())
+ || (!m_options.requestPayerPhone() && !response->payer_phone.isNull())) {
m_showResolver->reject(DOMException::create(SyntaxError));
clearResolversAndCloseMojoConnection();
return;
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698