Changeset 223962 in webkit
- Timestamp:
- Oct 25, 2017 11:00:28 AM (7 years ago)
- Location:
- trunk
- Files:
-
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r223959 r223962 1 2017-10-25 Andy Estes <aestes@apple.com> 2 3 [Payment Request] Implement the "user aborts the payment request" algorithm 4 https://bugs.webkit.org/show_bug.cgi?id=178810 5 6 Reviewed by Tim Horton. 7 8 * http/tests/paymentrequest/payment-request-show-method.https-expected.txt: 9 * http/tests/paymentrequest/payment-request-show-method.https.html: 10 1 11 2017-10-25 Daniel Bates <dabates@apple.com> 2 12 -
trunk/LayoutTests/http/tests/paymentrequest/payment-request-show-method.https-expected.txt
r223076 r223962 4 4 PASS If the user agent's "payment request is showing" boolean is true, then return a promise rejected with an "AbortError" DOMException. 5 5 PASS If payment method consultation produces no supported method of payment, then return a promise rejected with a "NotSupportedError" DOMException. 6 PASS If the user aborts the payment request algorithm, then return a promise rejected with an "AbortError" DOMException. 6 7 -
trunk/LayoutTests/http/tests/paymentrequest/payment-request-show-method.https.html
r223163 r223962 66 66 await promise_rejects(t, "NotSupportedError", acceptPromise); 67 67 }, `If payment method consultation produces no supported method of payment, then return a promise rejected with a "NotSupportedError" DOMException.`); 68 69 promise_test(async t => { 70 const request = new PaymentRequest(defaultMethods, defaultDetails); 71 const acceptPromise = request.show(); // Sets state to "interactive" 72 internals.mockPaymentCoordinator.cancelPayment(); 73 await promise_rejects(t, "AbortError", acceptPromise); 74 }, `If the user aborts the payment request algorithm, then return a promise rejected with an "AbortError" DOMException.`); 68 75 </script> -
trunk/Source/WebCore/ChangeLog
r223960 r223962 1 2017-10-25 Andy Estes <aestes@apple.com> 2 3 [Payment Request] Implement the "user aborts the payment request" algorithm 4 https://bugs.webkit.org/show_bug.cgi?id=178810 5 6 Reviewed by Tim Horton. 7 8 * Modules/applepay/paymentrequest/ApplePayPaymentHandler.cpp: 9 (WebCore::ApplePayPaymentHandler::didCancelPaymentSession): 10 * Modules/applepay/paymentrequest/ApplePayPaymentHandler.h: 11 * Modules/paymentrequest/PaymentRequest.cpp: 12 (WebCore::PaymentRequest::cancel): 13 * Modules/paymentrequest/PaymentRequest.h: 14 * testing/MockPaymentCoordinator.cpp: 15 (WebCore::MockPaymentCoordinator::cancelPayment): 16 * testing/MockPaymentCoordinator.h: 17 * testing/MockPaymentCoordinator.idl: 18 1 19 2017-10-25 Jer Noble <jer.noble@apple.com> 2 20 -
trunk/Source/WebCore/Modules/applepay/paymentrequest/ApplePayPaymentHandler.cpp
r223945 r223962 390 390 } 391 391 392 void ApplePayPaymentHandler::didCancelPaymentSession() 393 { 394 m_paymentRequest->cancel(); 395 } 396 392 397 } // namespace WebCore 393 398 -
trunk/Source/WebCore/Modules/applepay/paymentrequest/ApplePayPaymentHandler.h
r223945 r223962 70 70 void didSelectShippingContact(const PaymentContact&) final; 71 71 void didSelectPaymentMethod(const PaymentMethod&) final; 72 void didCancelPaymentSession() final { }72 void didCancelPaymentSession() final; 73 73 74 74 PaymentRequest::MethodIdentifier m_identifier; -
trunk/Source/WebCore/Modules/paymentrequest/PaymentRequest.cpp
r223945 r223962 657 657 } 658 658 659 void PaymentRequest::cancel() 660 { 661 if (m_state != State::Interactive) 662 return; 663 664 if (m_isUpdating) 665 return; 666 667 m_activePaymentHandler = nullptr; 668 stop(); 669 } 670 659 671 } // namespace WebCore 660 672 -
trunk/Source/WebCore/Modules/paymentrequest/PaymentRequest.h
r223945 r223962 74 74 void accept(const String& methodName, JSC::Strong<JSC::JSObject>&& details, Ref<PaymentAddress>&& shippingAddress, const String& payerName, const String& payerEmail, const String& payerPhone); 75 75 void complete(std::optional<PaymentComplete>&&); 76 void cancel(); 76 77 77 78 // EventTarget -
trunk/Source/WebCore/testing/MockPaymentCoordinator.cpp
r223945 r223962 131 131 } 132 132 133 void MockPaymentCoordinator::cancelPayment() 134 { 135 dispatchIfShowing([mainFrame = makeRef(m_mainFrame)] { 136 mainFrame->paymentCoordinator().didCancelPaymentSession(); 137 ++hideCount; 138 ASSERT(showCount == hideCount); 139 }); 140 } 141 133 142 void MockPaymentCoordinator::completePaymentSession(std::optional<PaymentAuthorizationResult>&&) 134 143 { -
trunk/Source/WebCore/testing/MockPaymentCoordinator.h
r223945 r223962 44 44 void changePaymentMethod(ApplePayPaymentMethod&&); 45 45 void acceptPayment(); 46 void cancelPayment(); 46 47 47 48 void ref() const { } -
trunk/Source/WebCore/testing/MockPaymentCoordinator.idl
r223945 r223962 32 32 void changePaymentMethod(ApplePayPaymentMethod paymentMethod); 33 33 void acceptPayment(); 34 void cancelPayment(); 34 35 };
Note: See TracChangeset
for help on using the changeset viewer.