[Payment Request] Implement error checking for show(), abort(), and canMakePayment()
https://bugs.webkit.org/show_bug.cgi?id=175789
Reviewed by Brady Eidson.
LayoutTests/imported/w3c:
* web-platform-tests/payment-request/payment-request-abort-method.https-expected.txt:
* web-platform-tests/payment-request/payment-request-show-method.https-expected.txt:
Source/WebCore:
Implement many of the exceptions and promise rejections specified for PaymentRequest's
show(), abort(), and canMakePayment() methods. Also implement basic state tracking.
* Modules/paymentrequest/PaymentRequest.cpp:
(WebCore::PaymentRequest::create): Changed serializedMethodData from a
HashMap<String, String> to a Vector<PaymentRequest::Method>.
(WebCore::PaymentRequest::PaymentRequest):
(WebCore::PaymentRequest::show): Added promise rejection for invalid state, updated the
state to Interactive, stored the promise in m_showPromise, and dispatched finishShowing().
(WebCore::PaymentRequest::finishShowing): Added JSON parsing of payment method serialized
data and exception propagation. If there are no exceptions, rejected m_showPromise with
NotSupportedError since we don't yet support any payment methods.
(WebCore::PaymentRequest::abort): Added promise rejection for invalid state and stored the
promise in m_abortPromise. Dispatched a lambda to update the state to Closed, reject
m_showPromise, and resolve m_abortPromise.
(WebCore::PaymentRequest::canMakePayment): Added promise rejection for invalid state and
stored the promise in m_canMakePaymentPromise. Dispatched a lambda to resolve
m_canMakePaymentPromise with false since we don't yet support any payment methods.
* Modules/paymentrequest/PaymentRequest.h:
* Modules/paymentrequest/PaymentRequest.idl: Annotated abort() with MayThrowException.
LayoutTests:
Stopped marking payment-request-abort-method.https.html and payment-request-show-method.https.html as flaky.
* platform/ios-wk2/TestExpectations:
* platform/mac-wk2/TestExpectations:
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@221020
268f45cc-cd09-0410-ab3c-
d52691b4dbfc