[Apple Pay] PaymentRequest.show() should reject when an unsupported ApplePayRequest...
authoraestes@apple.com <aestes@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 27 Aug 2018 01:39:49 +0000 (01:39 +0000)
committeraestes@apple.com <aestes@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 27 Aug 2018 01:39:49 +0000 (01:39 +0000)
commitf5b3e440baacafac5375ee7c11ab4bd3fb521fec
treec2028d5ffbef78c7769ed8f853de097458ecc17a
parentdf94986e9fb2d35f8988e935a8f91fc9f5f8ba6d
[Apple Pay] PaymentRequest.show() should reject when an unsupported ApplePayRequest version is specified
https://bugs.webkit.org/show_bug.cgi?id=188954

Reviewed by Darin Adler.

Source/WebCore:

In Apple Pay JS, calling the ApplePaySession constructor with an unsupported version results
in an exception being thrown. We need to do something similar for Payment Request.

This patch moves the logic for validating the version from ApplePaySession to a common
routine in ApplePayRequestBase that both APIs call to convert requests into a common format.

In Apple Pay JS, an exception will still be thrown when constructing an ApplePaySession. In
Payment Request, the promise returned by show() will be rejected.

Added test cases to http/tests/ssl/applepay/PaymentRequest.https.html.

* Modules/applepay/ApplePayRequestBase.cpp:
(WebCore::convertAndValidate):
* Modules/applepay/ApplePaySession.cpp:
(WebCore::ApplePaySession::create):

LayoutTests:

* http/tests/ssl/applepay/PaymentRequest.https-expected.txt:
* http/tests/ssl/applepay/PaymentRequest.https.html:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@235342 268f45cc-cd09-0410-ab3c-d52691b4dbfc
LayoutTests/ChangeLog
LayoutTests/http/tests/ssl/applepay/PaymentRequest.https-expected.txt
LayoutTests/http/tests/ssl/applepay/PaymentRequest.https.html
Source/WebCore/ChangeLog
Source/WebCore/Modules/applepay/ApplePayRequestBase.cpp
Source/WebCore/Modules/applepay/ApplePaySession.cpp