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

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

Issue 2083883003: Reject PaymentResponse.complete() promise on error. (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 | third_party/WebKit/Source/modules/payments/PaymentRequestTest.cpp » ('j') | 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 8e6e3691072eb920671ba1936f791eba2e4ad105..5660628384c046f4e1bb6780fb3a0699765bc16a 100644
--- a/third_party/WebKit/Source/modules/payments/PaymentRequest.cpp
+++ b/third_party/WebKit/Source/modules/payments/PaymentRequest.cpp
@@ -325,6 +325,10 @@ ScriptPromise PaymentRequest::complete(ScriptState* scriptState, PaymentComplete
if (m_completeResolver)
return ScriptPromise::rejectWithDOMException(scriptState, DOMException::create(InvalidStateError, "Already called complete() once"));
+ // User has cancelled the transaction while the website was processing it.
+ if (!m_paymentProvider)
+ return ScriptPromise::rejectWithDOMException(scriptState, DOMException::create(InvalidStateError, "Request cancelled"));
Marijn Kruisselbrink 2016/06/21 20:45:50 It seems a bit odd that this throws a different ex
please use gerrit instead 2016/06/21 21:03:01 User cancelling the payment request does not appea
+
// The payment provider should respond in PaymentRequest::OnComplete().
m_paymentProvider->Complete(mojom::blink::PaymentComplete(result));
« no previous file with comments | « no previous file | third_party/WebKit/Source/modules/payments/PaymentRequestTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698