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

Side by Side Diff: third_party/WebKit/Source/modules/payments/PaymentRequest.cpp

Issue 2163193002: Reject payment request with AbortError if web page rejects promise from updateWith. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 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 unified diff | Download patch
« no previous file with comments | « no previous file | third_party/WebKit/Source/modules/payments/PaymentRequestTest.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "modules/payments/PaymentRequest.h" 5 #include "modules/payments/PaymentRequest.h"
6 6
7 #include "bindings/core/v8/ExceptionState.h" 7 #include "bindings/core/v8/ExceptionState.h"
8 #include "bindings/core/v8/JSONValuesForV8.h" 8 #include "bindings/core/v8/JSONValuesForV8.h"
9 #include "bindings/core/v8/ScriptPromiseResolver.h" 9 #include "bindings/core/v8/ScriptPromiseResolver.h"
10 #include "bindings/core/v8/ScriptState.h" 10 #include "bindings/core/v8/ScriptState.h"
(...skipping 440 matching lines...) Expand 10 before | Expand all | Expand 10 after
451 } 451 }
452 452
453 if (m_options.requestShipping()) 453 if (m_options.requestShipping())
454 m_shippingOption = getSelectedShippingOption(details); 454 m_shippingOption = getSelectedShippingOption(details);
455 455
456 m_paymentProvider->UpdateWith(mojom::blink::PaymentDetails::From(details)); 456 m_paymentProvider->UpdateWith(mojom::blink::PaymentDetails::From(details));
457 } 457 }
458 458
459 void PaymentRequest::onUpdatePaymentDetailsFailure(const ScriptValue& error) 459 void PaymentRequest::onUpdatePaymentDetailsFailure(const ScriptValue& error)
460 { 460 {
461 String message;
462 error.toString(message);
463
461 if (m_showResolver) 464 if (m_showResolver)
462 m_showResolver->reject(error); 465 m_showResolver->reject(DOMException::create(AbortError, message));
463 if (m_completeResolver) 466 if (m_completeResolver)
464 m_completeResolver->reject(error); 467 m_completeResolver->reject(DOMException::create(AbortError, message));
465 clearResolversAndCloseMojoConnection(); 468 clearResolversAndCloseMojoConnection();
466 } 469 }
467 470
468 DEFINE_TRACE(PaymentRequest) 471 DEFINE_TRACE(PaymentRequest)
469 { 472 {
470 visitor->trace(m_details); 473 visitor->trace(m_details);
471 visitor->trace(m_options); 474 visitor->trace(m_options);
472 visitor->trace(m_shippingAddress); 475 visitor->trace(m_shippingAddress);
473 visitor->trace(m_showResolver); 476 visitor->trace(m_showResolver);
474 visitor->trace(m_completeResolver); 477 visitor->trace(m_completeResolver);
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after
670 { 673 {
671 m_completeResolver.clear(); 674 m_completeResolver.clear();
672 m_showResolver.clear(); 675 m_showResolver.clear();
673 m_abortResolver.clear(); 676 m_abortResolver.clear();
674 if (m_clientBinding.is_bound()) 677 if (m_clientBinding.is_bound())
675 m_clientBinding.Close(); 678 m_clientBinding.Close();
676 m_paymentProvider.reset(); 679 m_paymentProvider.reset();
677 } 680 }
678 681
679 } // namespace blink 682 } // namespace blink
OLDNEW
« 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