[Apple Pay] Payment authorization results with ApplePayErrors should never be conside...
authoraestes@apple.com <aestes@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 15 Oct 2018 19:40:32 +0000 (19:40 +0000)
committeraestes@apple.com <aestes@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 15 Oct 2018 19:40:32 +0000 (19:40 +0000)
commitc321e1be9e08e3bcfbac1387b17d9a84eb5cb82b
tree6f53b87b8a9792bf7a7d0b66220522da3879215a
parentb2bdfcb0b36e77092b1fa13245146c7f309e390f
[Apple Pay] Payment authorization results with ApplePayErrors should never be considered final
https://bugs.webkit.org/show_bug.cgi?id=190559
<rdar://problem/37250908>

Reviewed by Anders Carlsson.

Source/WebCore:

When PaymentCoordinator thinks a payment authorization result is final it releases the
active ApplePaySession. The Apple Pay UI is dismissed after a receiving a final result.

However, WebCore::isFinalStateResult had the wrong idea about what was a final state,
in some cases causing PaymentCoordinator to release the active session even when the UI is
still presented. If the user authorizes payment again, the website will not receive another
paymentauthorized event, and the Apple Pay UI will eventually time out waiting for a result.

Specifically, isFinalStateResult thought that:

(1) results with STATUS_SUCCESS were always final, even if they had errors
(2) errors with code "unknown" were final

Both of these assumptions are wrong. PassKit considers any result with errors to be
non-final, even if an error has code "unknown."

Fixed WebCore::isFinalStateResult to agree with what PassKit considers to be final results.

Test: http/tests/ssl/applepay/ApplePaySessionFinalState.https.html

* Modules/applepay/ApplePaySessionPaymentRequest.cpp:
(WebCore::isFinalStateResult):
* testing/MockPaymentCoordinator.cpp:
(WebCore::MockPaymentCoordinator::completePaymentSession):

LayoutTests:

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

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@237134 268f45cc-cd09-0410-ab3c-d52691b4dbfc
LayoutTests/ChangeLog
LayoutTests/http/tests/ssl/applepay/ApplePaySessionFinalState.https-expected.txt [new file with mode: 0644]
LayoutTests/http/tests/ssl/applepay/ApplePaySessionFinalState.https.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/Modules/applepay/ApplePaySessionPaymentRequest.cpp
Source/WebCore/testing/MockPaymentCoordinator.cpp