Title: [250266] branches/safari-608-branch
Revision
250266
Author
alanc...@apple.com
Date
2019-09-23 16:50:11 -0700 (Mon, 23 Sep 2019)

Log Message

Apply patch. rdar://problem/55608028

    Tell websites why a session was cancelled https://bugs.webkit.org/show_bug.cgi?id=201912 Source/WebCore:

    Reviewed by Brady Eidson.

    Added ApplePayCancelEvent as the interface for ApplePaySession's cancel event. This event
    object includes a `sessionError` attribute that exposes a Web-safe version of the PassKit
    domain error we received from PKPaymentAuthorization(View)Controller. Currently, we report
    all errors with code "unknown", but more codes will be added in future patches.

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

    * DerivedSources-input.xcfilelist:
    * DerivedSources-output.xcfilelist:
    * DerivedSources.make:
    * Modules/applepay/ApplePayCancelEvent.cpp: Copied from Source/WebCore/Modules/applepay/PaymentHeaders.h.
    (WebCore::ApplePayCancelEvent::ApplePayCancelEvent):
    (WebCore::ApplePayCancelEvent::sessionError const):
    (WebCore::ApplePayCancelEvent::eventInterface const):
    * Modules/applepay/ApplePayCancelEvent.h: Copied from Source/WebCore/Modules/applepay/PaymentHeaders.h.
    (WebCore::ApplePayCancelEvent::create):
    * Modules/applepay/ApplePayCancelEvent.idl: Copied from Source/WebCore/Modules/applepay/PaymentHeaders.h.
    * Modules/applepay/ApplePaySession.cpp:
    (WebCore::ApplePaySession::didCancelPaymentSession):
    * Modules/applepay/ApplePaySession.h:
    * Modules/applepay/ApplePaySessionError.h: Copied from Source/WebCore/Modules/applepay/PaymentHeaders.h.
    * Modules/applepay/ApplePaySessionError.idl: Copied from Source/WebCore/Modules/applepay/PaymentHeaders.h.
    * Modules/applepay/PaymentCoordinator.cpp:
    (WebCore::PaymentCoordinator::didCancelPaymentSession):
    * Modules/applepay/PaymentCoordinator.h:
    * Modules/applepay/PaymentHeaders.h:
    * Modules/applepay/PaymentSession.cpp:
    * Modules/applepay/PaymentSession.h:
    * Modules/applepay/PaymentSessionError.h: Copied from Source/WebCore/Modules/applepay/PaymentHeaders.h.
    * Modules/applepay/cocoa/PaymentSessionErrorCocoa.mm: Copied from Source/WebCore/Modules/applepay/PaymentSession.h.
    (WebCore::additionalError):
    (WebCore::PaymentSessionError::PaymentSessionError):
    (WebCore::PaymentSessionError::sessionError const):
    (WebCore::PaymentSessionError::platformError const):
    (WebCore::PaymentSessionError::unknownError const):
    * Modules/applepay/paymentrequest/ApplePayPaymentHandler.cpp:
    (WebCore::ApplePayPaymentHandler::didCancelPaymentSession):
    * Modules/applepay/paymentrequest/ApplePayPaymentHandler.h:
    * Modules/webgpu/WHLSL/WHLSLCheckTextureReferences.cpp:
    * Modules/webgpu/WHLSL/WHLSLPropertyResolver.cpp:
    * SourcesCocoa.txt:
    * WebCore.xcodeproj/project.pbxproj:
    * dom/EventNames.in:
    * testing/MockPaymentCoordinator.cpp:
    (WebCore::MockPaymentCoordinator::cancelPayment):

    Source/WebCore/PAL:

    <rdar://problem/55469706>

    Reviewed by Brady Eidson.

    Soft-linked PKPassKitErrorDomain and included PassKit headers more judiciously.

    * pal/cocoa/PassKitSoftLink.h:
    * pal/cocoa/PassKitSoftLink.mm:
    * pal/spi/cocoa/PassKitSPI.h:

    Source/WebKit:

    <rdar://problem/55469706>

    Reviewed by Brady Eidson.

    Remembered the error passed to -[WKPaymentAuthorizationDelegate _willFinishWithError:] and
    sent it to the WebContent process in Messages::WebPaymentCoordinator::DidCancelPaymentSession.

    * Platform/cocoa/PaymentAuthorizationPresenter.h:
    * Platform/cocoa/WKPaymentAuthorizationDelegate.mm:
    (-[WKPaymentAuthorizationDelegate _didFinish]):
    (-[WKPaymentAuthorizationDelegate _willFinishWithError:]):
    * Shared/ApplePay/WebPaymentCoordinatorProxy.cpp:
    (WebKit::WebPaymentCoordinatorProxy::didCancelPaymentSession):
    (WebKit::WebPaymentCoordinatorProxy::presenterDidFinish):
    * Shared/ApplePay/WebPaymentCoordinatorProxy.h:
    (WebKit::WebPaymentCoordinatorProxy::didCancelPaymentSession):
    * Shared/ApplePay/ios/WebPaymentCoordinatorProxyIOS.mm:
    * Shared/Cocoa/WebCoreArgumentCodersCocoa.mm:
    (IPC::ArgumentCoder<WebCore::PaymentSessionError>::encode):
    (IPC::ArgumentCoder<WebCore::PaymentSessionError>::decode):
    * Shared/WebCoreArgumentCoders.h:
    * WebProcess/ApplePay/WebPaymentCoordinator.cpp:
    (WebKit::WebPaymentCoordinator::networkProcessConnectionClosed):
    (WebKit::WebPaymentCoordinator::didCancelPaymentSession):
    * WebProcess/ApplePay/WebPaymentCoordinator.h:
    * WebProcess/ApplePay/WebPaymentCoordinator.messages.in:

    LayoutTests:

    Reviewed by Brady Eidson.

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

Modified Paths

Added Paths

Diff

Modified: branches/safari-608-branch/LayoutTests/ChangeLog (250265 => 250266)


--- branches/safari-608-branch/LayoutTests/ChangeLog	2019-09-23 23:49:58 UTC (rev 250265)
+++ branches/safari-608-branch/LayoutTests/ChangeLog	2019-09-23 23:50:11 UTC (rev 250266)
@@ -1,3 +1,115 @@
+2019-09-23  Alan Coon  <alanc...@apple.com>
+
+        Apply patch. rdar://problem/55608028
+
+    Tell websites why a session was cancelled https://bugs.webkit.org/show_bug.cgi?id=201912 Source/WebCore:
+    
+    Reviewed by Brady Eidson.
+    
+    Added ApplePayCancelEvent as the interface for ApplePaySession's cancel event. This event
+    object includes a `sessionError` attribute that exposes a Web-safe version of the PassKit
+    domain error we received from PKPaymentAuthorization(View)Controller. Currently, we report
+    all errors with code "unknown", but more codes will be added in future patches.
+    
+    Test: http/tests/ssl/applepay/ApplePayCancelEvent.https.html
+    
+    * DerivedSources-input.xcfilelist:
+    * DerivedSources-output.xcfilelist:
+    * DerivedSources.make:
+    * Modules/applepay/ApplePayCancelEvent.cpp: Copied from Source/WebCore/Modules/applepay/PaymentHeaders.h.
+    (WebCore::ApplePayCancelEvent::ApplePayCancelEvent):
+    (WebCore::ApplePayCancelEvent::sessionError const):
+    (WebCore::ApplePayCancelEvent::eventInterface const):
+    * Modules/applepay/ApplePayCancelEvent.h: Copied from Source/WebCore/Modules/applepay/PaymentHeaders.h.
+    (WebCore::ApplePayCancelEvent::create):
+    * Modules/applepay/ApplePayCancelEvent.idl: Copied from Source/WebCore/Modules/applepay/PaymentHeaders.h.
+    * Modules/applepay/ApplePaySession.cpp:
+    (WebCore::ApplePaySession::didCancelPaymentSession):
+    * Modules/applepay/ApplePaySession.h:
+    * Modules/applepay/ApplePaySessionError.h: Copied from Source/WebCore/Modules/applepay/PaymentHeaders.h.
+    * Modules/applepay/ApplePaySessionError.idl: Copied from Source/WebCore/Modules/applepay/PaymentHeaders.h.
+    * Modules/applepay/PaymentCoordinator.cpp:
+    (WebCore::PaymentCoordinator::didCancelPaymentSession):
+    * Modules/applepay/PaymentCoordinator.h:
+    * Modules/applepay/PaymentHeaders.h:
+    * Modules/applepay/PaymentSession.cpp:
+    * Modules/applepay/PaymentSession.h:
+    * Modules/applepay/PaymentSessionError.h: Copied from Source/WebCore/Modules/applepay/PaymentHeaders.h.
+    * Modules/applepay/cocoa/PaymentSessionErrorCocoa.mm: Copied from Source/WebCore/Modules/applepay/PaymentSession.h.
+    (WebCore::additionalError):
+    (WebCore::PaymentSessionError::PaymentSessionError):
+    (WebCore::PaymentSessionError::sessionError const):
+    (WebCore::PaymentSessionError::platformError const):
+    (WebCore::PaymentSessionError::unknownError const):
+    * Modules/applepay/paymentrequest/ApplePayPaymentHandler.cpp:
+    (WebCore::ApplePayPaymentHandler::didCancelPaymentSession):
+    * Modules/applepay/paymentrequest/ApplePayPaymentHandler.h:
+    * Modules/webgpu/WHLSL/WHLSLCheckTextureReferences.cpp:
+    * Modules/webgpu/WHLSL/WHLSLPropertyResolver.cpp:
+    * SourcesCocoa.txt:
+    * WebCore.xcodeproj/project.pbxproj:
+    * dom/EventNames.in:
+    * testing/MockPaymentCoordinator.cpp:
+    (WebCore::MockPaymentCoordinator::cancelPayment):
+    
+    Source/WebCore/PAL:
+    
+    <rdar://problem/55469706>
+    
+    Reviewed by Brady Eidson.
+    
+    Soft-linked PKPassKitErrorDomain and included PassKit headers more judiciously.
+    
+    * pal/cocoa/PassKitSoftLink.h:
+    * pal/cocoa/PassKitSoftLink.mm:
+    * pal/spi/cocoa/PassKitSPI.h:
+    
+    Source/WebKit:
+    
+    <rdar://problem/55469706>
+    
+    Reviewed by Brady Eidson.
+    
+    Remembered the error passed to -[WKPaymentAuthorizationDelegate _willFinishWithError:] and
+    sent it to the WebContent process in Messages::WebPaymentCoordinator::DidCancelPaymentSession.
+    
+    * Platform/cocoa/PaymentAuthorizationPresenter.h:
+    * Platform/cocoa/WKPaymentAuthorizationDelegate.mm:
+    (-[WKPaymentAuthorizationDelegate _didFinish]):
+    (-[WKPaymentAuthorizationDelegate _willFinishWithError:]):
+    * Shared/ApplePay/WebPaymentCoordinatorProxy.cpp:
+    (WebKit::WebPaymentCoordinatorProxy::didCancelPaymentSession):
+    (WebKit::WebPaymentCoordinatorProxy::presenterDidFinish):
+    * Shared/ApplePay/WebPaymentCoordinatorProxy.h:
+    (WebKit::WebPaymentCoordinatorProxy::didCancelPaymentSession):
+    * Shared/ApplePay/ios/WebPaymentCoordinatorProxyIOS.mm:
+    * Shared/Cocoa/WebCoreArgumentCodersCocoa.mm:
+    (IPC::ArgumentCoder<WebCore::PaymentSessionError>::encode):
+    (IPC::ArgumentCoder<WebCore::PaymentSessionError>::decode):
+    * Shared/WebCoreArgumentCoders.h:
+    * WebProcess/ApplePay/WebPaymentCoordinator.cpp:
+    (WebKit::WebPaymentCoordinator::networkProcessConnectionClosed):
+    (WebKit::WebPaymentCoordinator::didCancelPaymentSession):
+    * WebProcess/ApplePay/WebPaymentCoordinator.h:
+    * WebProcess/ApplePay/WebPaymentCoordinator.messages.in:
+    
+    LayoutTests:
+    
+    Reviewed by Brady Eidson.
+    
+    * http/tests/ssl/applepay/ApplePayCancelEvent.https-expected.txt: Added.
+    * http/tests/ssl/applepay/ApplePayCancelEvent.https.html: Added.
+
+    2019-09-18  Andy Estes  <aes...@apple.com>
+
+            [Apple Pay] Tell websites why a session was cancelled
+            https://bugs.webkit.org/show_bug.cgi?id=201912
+
+            Reviewed by Brady Eidson.
+
+            * http/tests/ssl/applepay/ApplePayCancelEvent.https-expected.txt: Added.
+            * http/tests/ssl/applepay/ApplePayCancelEvent.https.html: Added.
+
 2019-09-17  Alan Coon  <alanc...@apple.com>
 
         Cherry-pick r249954. rdar://problem/55461404

Added: branches/safari-608-branch/LayoutTests/http/tests/ssl/applepay/ApplePayCancelEvent.https-expected.txt (0 => 250266)


--- branches/safari-608-branch/LayoutTests/http/tests/ssl/applepay/ApplePayCancelEvent.https-expected.txt	                        (rev 0)
+++ branches/safari-608-branch/LayoutTests/http/tests/ssl/applepay/ApplePayCancelEvent.https-expected.txt	2019-09-23 23:50:11 UTC (rev 250266)
@@ -0,0 +1,18 @@
+Test ApplePaySession's cancel event.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS event is non-null.
+PASS typeof event is "object"
+PASS event.sessionError is non-null.
+PASS typeof event.sessionError is "object"
+PASS event.sessionError.code is "unknown"
+PASS typeof event.sessionError.code is "string"
+PASS Object.keys(event.sessionError.info).length is 0
+PASS typeof event.sessionError.info is "object"
+PASS cancel event received
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Added: branches/safari-608-branch/LayoutTests/http/tests/ssl/applepay/ApplePayCancelEvent.https.html (0 => 250266)


--- branches/safari-608-branch/LayoutTests/http/tests/ssl/applepay/ApplePayCancelEvent.https.html	                        (rev 0)
+++ branches/safari-608-branch/LayoutTests/http/tests/ssl/applepay/ApplePayCancelEvent.https.html	2019-09-23 23:50:11 UTC (rev 250266)
@@ -0,0 +1,47 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<script src=""
+<script src=""
+<script src=""
+</head>
+<body>
+<script>
+
+description("Test ApplePaySession's cancel event.");
+
+window.jsTestIsAsync = true;
+
+function validRequest()
+{
+    return {
+        countryCode: 'US',
+        currencyCode: 'USD',
+        supportedNetworks: ['visa', 'masterCard'],
+        merchantCapabilities: ['supports3DS'],
+        total: { label: 'Your Label', amount: '10.00' },
+    }
+}
+
+activateThen(() => {
+    var session = new ApplePaySession(2, validRequest());
+    session._oncancel_ = (event) => {
+        shouldBeNonNull('event');
+        shouldBe('typeof event', '"object"');
+        shouldBeNonNull('event.sessionError');
+        shouldBe('typeof event.sessionError', '"object"');
+        shouldBe('event.sessionError.code', '"unknown"');
+        shouldBe("typeof event.sessionError.code", '"string"');
+        shouldBe('Object.keys(event.sessionError.info).length', '0');
+        shouldBe('typeof event.sessionError.info', '"object"');
+        testPassed('cancel event received');
+        finishJSTest();
+    };
+    session.begin();
+    internals.mockPaymentCoordinator.cancelPayment();
+});
+</script>
+<script src=""
+</body>
+</html>

Modified: branches/safari-608-branch/Source/WebCore/ChangeLog (250265 => 250266)


--- branches/safari-608-branch/Source/WebCore/ChangeLog	2019-09-23 23:49:58 UTC (rev 250265)
+++ branches/safari-608-branch/Source/WebCore/ChangeLog	2019-09-23 23:50:11 UTC (rev 250266)
@@ -1,5 +1,160 @@
 2019-09-23  Alan Coon  <alanc...@apple.com>
 
+        Apply patch. rdar://problem/55608028
+
+    Tell websites why a session was cancelled https://bugs.webkit.org/show_bug.cgi?id=201912 Source/WebCore:
+    
+    Reviewed by Brady Eidson.
+    
+    Added ApplePayCancelEvent as the interface for ApplePaySession's cancel event. This event
+    object includes a `sessionError` attribute that exposes a Web-safe version of the PassKit
+    domain error we received from PKPaymentAuthorization(View)Controller. Currently, we report
+    all errors with code "unknown", but more codes will be added in future patches.
+    
+    Test: http/tests/ssl/applepay/ApplePayCancelEvent.https.html
+    
+    * DerivedSources-input.xcfilelist:
+    * DerivedSources-output.xcfilelist:
+    * DerivedSources.make:
+    * Modules/applepay/ApplePayCancelEvent.cpp: Copied from Source/WebCore/Modules/applepay/PaymentHeaders.h.
+    (WebCore::ApplePayCancelEvent::ApplePayCancelEvent):
+    (WebCore::ApplePayCancelEvent::sessionError const):
+    (WebCore::ApplePayCancelEvent::eventInterface const):
+    * Modules/applepay/ApplePayCancelEvent.h: Copied from Source/WebCore/Modules/applepay/PaymentHeaders.h.
+    (WebCore::ApplePayCancelEvent::create):
+    * Modules/applepay/ApplePayCancelEvent.idl: Copied from Source/WebCore/Modules/applepay/PaymentHeaders.h.
+    * Modules/applepay/ApplePaySession.cpp:
+    (WebCore::ApplePaySession::didCancelPaymentSession):
+    * Modules/applepay/ApplePaySession.h:
+    * Modules/applepay/ApplePaySessionError.h: Copied from Source/WebCore/Modules/applepay/PaymentHeaders.h.
+    * Modules/applepay/ApplePaySessionError.idl: Copied from Source/WebCore/Modules/applepay/PaymentHeaders.h.
+    * Modules/applepay/PaymentCoordinator.cpp:
+    (WebCore::PaymentCoordinator::didCancelPaymentSession):
+    * Modules/applepay/PaymentCoordinator.h:
+    * Modules/applepay/PaymentHeaders.h:
+    * Modules/applepay/PaymentSession.cpp:
+    * Modules/applepay/PaymentSession.h:
+    * Modules/applepay/PaymentSessionError.h: Copied from Source/WebCore/Modules/applepay/PaymentHeaders.h.
+    * Modules/applepay/cocoa/PaymentSessionErrorCocoa.mm: Copied from Source/WebCore/Modules/applepay/PaymentSession.h.
+    (WebCore::additionalError):
+    (WebCore::PaymentSessionError::PaymentSessionError):
+    (WebCore::PaymentSessionError::sessionError const):
+    (WebCore::PaymentSessionError::platformError const):
+    (WebCore::PaymentSessionError::unknownError const):
+    * Modules/applepay/paymentrequest/ApplePayPaymentHandler.cpp:
+    (WebCore::ApplePayPaymentHandler::didCancelPaymentSession):
+    * Modules/applepay/paymentrequest/ApplePayPaymentHandler.h:
+    * Modules/webgpu/WHLSL/WHLSLCheckTextureReferences.cpp:
+    * Modules/webgpu/WHLSL/WHLSLPropertyResolver.cpp:
+    * SourcesCocoa.txt:
+    * WebCore.xcodeproj/project.pbxproj:
+    * dom/EventNames.in:
+    * testing/MockPaymentCoordinator.cpp:
+    (WebCore::MockPaymentCoordinator::cancelPayment):
+    
+    Source/WebCore/PAL:
+    
+    <rdar://problem/55469706>
+    
+    Reviewed by Brady Eidson.
+    
+    Soft-linked PKPassKitErrorDomain and included PassKit headers more judiciously.
+    
+    * pal/cocoa/PassKitSoftLink.h:
+    * pal/cocoa/PassKitSoftLink.mm:
+    * pal/spi/cocoa/PassKitSPI.h:
+    
+    Source/WebKit:
+    
+    <rdar://problem/55469706>
+    
+    Reviewed by Brady Eidson.
+    
+    Remembered the error passed to -[WKPaymentAuthorizationDelegate _willFinishWithError:] and
+    sent it to the WebContent process in Messages::WebPaymentCoordinator::DidCancelPaymentSession.
+    
+    * Platform/cocoa/PaymentAuthorizationPresenter.h:
+    * Platform/cocoa/WKPaymentAuthorizationDelegate.mm:
+    (-[WKPaymentAuthorizationDelegate _didFinish]):
+    (-[WKPaymentAuthorizationDelegate _willFinishWithError:]):
+    * Shared/ApplePay/WebPaymentCoordinatorProxy.cpp:
+    (WebKit::WebPaymentCoordinatorProxy::didCancelPaymentSession):
+    (WebKit::WebPaymentCoordinatorProxy::presenterDidFinish):
+    * Shared/ApplePay/WebPaymentCoordinatorProxy.h:
+    (WebKit::WebPaymentCoordinatorProxy::didCancelPaymentSession):
+    * Shared/ApplePay/ios/WebPaymentCoordinatorProxyIOS.mm:
+    * Shared/Cocoa/WebCoreArgumentCodersCocoa.mm:
+    (IPC::ArgumentCoder<WebCore::PaymentSessionError>::encode):
+    (IPC::ArgumentCoder<WebCore::PaymentSessionError>::decode):
+    * Shared/WebCoreArgumentCoders.h:
+    * WebProcess/ApplePay/WebPaymentCoordinator.cpp:
+    (WebKit::WebPaymentCoordinator::networkProcessConnectionClosed):
+    (WebKit::WebPaymentCoordinator::didCancelPaymentSession):
+    * WebProcess/ApplePay/WebPaymentCoordinator.h:
+    * WebProcess/ApplePay/WebPaymentCoordinator.messages.in:
+    
+    LayoutTests:
+    
+    Reviewed by Brady Eidson.
+    
+    * http/tests/ssl/applepay/ApplePayCancelEvent.https-expected.txt: Added.
+    * http/tests/ssl/applepay/ApplePayCancelEvent.https.html: Added.
+
+    2019-09-18  Andy Estes  <aes...@apple.com>
+
+            [Apple Pay] Tell websites why a session was cancelled
+            https://bugs.webkit.org/show_bug.cgi?id=201912
+
+            Reviewed by Brady Eidson.
+
+            Added ApplePayCancelEvent as the interface for ApplePaySession's cancel event. This event
+            object includes a `sessionError` attribute that exposes a Web-safe version of the PassKit
+            domain error we received from PKPaymentAuthorization(View)Controller. Currently, we report
+            all errors with code "unknown", but more codes will be added in future patches.
+
+            Test: http/tests/ssl/applepay/ApplePayCancelEvent.https.html
+
+            * DerivedSources-input.xcfilelist:
+            * DerivedSources-output.xcfilelist:
+            * DerivedSources.make:
+            * Modules/applepay/ApplePayCancelEvent.cpp: Copied from Source/WebCore/Modules/applepay/PaymentHeaders.h.
+            (WebCore::ApplePayCancelEvent::ApplePayCancelEvent):
+            (WebCore::ApplePayCancelEvent::sessionError const):
+            (WebCore::ApplePayCancelEvent::eventInterface const):
+            * Modules/applepay/ApplePayCancelEvent.h: Copied from Source/WebCore/Modules/applepay/PaymentHeaders.h.
+            (WebCore::ApplePayCancelEvent::create):
+            * Modules/applepay/ApplePayCancelEvent.idl: Copied from Source/WebCore/Modules/applepay/PaymentHeaders.h.
+            * Modules/applepay/ApplePaySession.cpp:
+            (WebCore::ApplePaySession::didCancelPaymentSession):
+            * Modules/applepay/ApplePaySession.h:
+            * Modules/applepay/ApplePaySessionError.h: Copied from Source/WebCore/Modules/applepay/PaymentHeaders.h.
+            * Modules/applepay/ApplePaySessionError.idl: Copied from Source/WebCore/Modules/applepay/PaymentHeaders.h.
+            * Modules/applepay/PaymentCoordinator.cpp:
+            (WebCore::PaymentCoordinator::didCancelPaymentSession):
+            * Modules/applepay/PaymentCoordinator.h:
+            * Modules/applepay/PaymentHeaders.h:
+            * Modules/applepay/PaymentSession.cpp:
+            * Modules/applepay/PaymentSession.h:
+            * Modules/applepay/PaymentSessionError.h: Copied from Source/WebCore/Modules/applepay/PaymentHeaders.h.
+            * Modules/applepay/cocoa/PaymentSessionErrorCocoa.mm: Copied from Source/WebCore/Modules/applepay/PaymentSession.h.
+            (WebCore::additionalError):
+            (WebCore::PaymentSessionError::PaymentSessionError):
+            (WebCore::PaymentSessionError::sessionError const):
+            (WebCore::PaymentSessionError::platformError const):
+            (WebCore::PaymentSessionError::unknownError const):
+            * Modules/applepay/paymentrequest/ApplePayPaymentHandler.cpp:
+            (WebCore::ApplePayPaymentHandler::didCancelPaymentSession):
+            * Modules/applepay/paymentrequest/ApplePayPaymentHandler.h:
+            * Modules/webgpu/WHLSL/WHLSLCheckTextureReferences.cpp:
+            * Modules/webgpu/WHLSL/WHLSLPropertyResolver.cpp:
+            * SourcesCocoa.txt:
+            * WebCore.xcodeproj/project.pbxproj:
+            * dom/EventNames.in:
+            * testing/MockPaymentCoordinator.cpp:
+            (WebCore::MockPaymentCoordinator::cancelPayment):
+
+2019-09-23  Alan Coon  <alanc...@apple.com>
+
         Cherry-pick r250026. rdar://problem/55608017
 
     [Cocoa] Add a WKA extension point

Modified: branches/safari-608-branch/Source/WebCore/DerivedSources-input.xcfilelist (250265 => 250266)


--- branches/safari-608-branch/Source/WebCore/DerivedSources-input.xcfilelist	2019-09-23 23:49:58 UTC (rev 250265)
+++ branches/safari-608-branch/Source/WebCore/DerivedSources-input.xcfilelist	2019-09-23 23:50:11 UTC (rev 250266)
@@ -19,6 +19,7 @@
 $(PROJECT_DIR)/Configurations/FeatureDefines.xcconfig
 $(PROJECT_DIR)/DerivedSources.make
 $(PROJECT_DIR)/Modules/airplay/WebKitPlaybackTargetAvailabilityEvent.idl
+$(PROJECT_DIR)/Modules/applepay/ApplePayCancelEvent.idl
 $(PROJECT_DIR)/Modules/applepay/ApplePayContactField.idl
 $(PROJECT_DIR)/Modules/applepay/ApplePayError.idl
 $(PROJECT_DIR)/Modules/applepay/ApplePayErrorCode.idl
@@ -37,6 +38,7 @@
 $(PROJECT_DIR)/Modules/applepay/ApplePayPaymentRequest.idl
 $(PROJECT_DIR)/Modules/applepay/ApplePayRequestBase.idl
 $(PROJECT_DIR)/Modules/applepay/ApplePaySession.idl
+$(PROJECT_DIR)/Modules/applepay/ApplePaySessionError.idl
 $(PROJECT_DIR)/Modules/applepay/ApplePayShippingContactSelectedEvent.idl
 $(PROJECT_DIR)/Modules/applepay/ApplePayShippingContactUpdate.idl
 $(PROJECT_DIR)/Modules/applepay/ApplePayShippingMethod.idl

Modified: branches/safari-608-branch/Source/WebCore/DerivedSources-output.xcfilelist (250265 => 250266)


--- branches/safari-608-branch/Source/WebCore/DerivedSources-output.xcfilelist	2019-09-23 23:49:58 UTC (rev 250265)
+++ branches/safari-608-branch/Source/WebCore/DerivedSources-output.xcfilelist	2019-09-23 23:50:11 UTC (rev 250266)
@@ -66,6 +66,8 @@
 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSAnimationPlaybackEventInit.h
 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSAnimationTimeline.cpp
 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSAnimationTimeline.h
+$(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSApplePayCancelEvent.cpp
+$(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSApplePayCancelEvent.h
 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSApplePayContactField.cpp
 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSApplePayContactField.h
 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSApplePayError.cpp
@@ -106,6 +108,8 @@
 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSApplePayRequestBase.h
 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSApplePaySession.cpp
 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSApplePaySession.h
+$(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSApplePaySessionError.cpp
+$(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSApplePaySessionError.h
 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSApplePaySetup.cpp
 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSApplePaySetup.h
 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSApplePaySetupFeature.cpp

Modified: branches/safari-608-branch/Source/WebCore/DerivedSources.make (250265 => 250266)


--- branches/safari-608-branch/Source/WebCore/DerivedSources.make	2019-09-23 23:49:58 UTC (rev 250265)
+++ branches/safari-608-branch/Source/WebCore/DerivedSources.make	2019-09-23 23:50:11 UTC (rev 250266)
@@ -93,6 +93,7 @@
 
 JS_BINDING_IDLS = \
     $(WebCore)/Modules/airplay/WebKitPlaybackTargetAvailabilityEvent.idl \
+    $(WebCore)/Modules/applepay/ApplePayCancelEvent.idl \
     $(WebCore)/Modules/applepay/ApplePayContactField.idl \
     $(WebCore)/Modules/applepay/ApplePayError.idl \
     $(WebCore)/Modules/applepay/ApplePayErrorCode.idl \
@@ -111,6 +112,7 @@
     $(WebCore)/Modules/applepay/ApplePayPaymentRequest.idl \
     $(WebCore)/Modules/applepay/ApplePayRequestBase.idl \
     $(WebCore)/Modules/applepay/ApplePaySession.idl \
+    $(WebCore)/Modules/applepay/ApplePaySessionError.idl \
     $(WebCore)/Modules/applepay/ApplePayShippingContactSelectedEvent.idl \
     $(WebCore)/Modules/applepay/ApplePayShippingContactUpdate.idl \
     $(WebCore)/Modules/applepay/ApplePayShippingMethod.idl \

Copied: branches/safari-608-branch/Source/WebCore/Modules/applepay/ApplePayCancelEvent.cpp (from rev 250265, branches/safari-608-branch/Source/WebCore/Modules/applepay/PaymentHeaders.h) (0 => 250266)


--- branches/safari-608-branch/Source/WebCore/Modules/applepay/ApplePayCancelEvent.cpp	                        (rev 0)
+++ branches/safari-608-branch/Source/WebCore/Modules/applepay/ApplePayCancelEvent.cpp	2019-09-23 23:50:11 UTC (rev 250266)
@@ -0,0 +1,53 @@
+/*
+ * Copyright (C) 2019 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "ApplePayCancelEvent.h"
+
+#if ENABLE(APPLE_PAY)
+
+#include "ApplePaySessionError.h"
+
+namespace WebCore {
+
+ApplePayCancelEvent::ApplePayCancelEvent(const AtomString& type, PaymentSessionError&& sessionError)
+    : Event { type, CanBubble::No, IsCancelable::No }
+    , m_sessionError { WTFMove(sessionError) }
+{
+}
+
+ApplePaySessionError ApplePayCancelEvent::sessionError() const
+{
+    return m_sessionError.sessionError();
+}
+
+EventInterface ApplePayCancelEvent::eventInterface() const
+{
+    return ApplePayCancelEventInterfaceType;
+}
+
+} // namespace WebCore
+
+#endif // ENABLE(APPLE_PAY)

Copied: branches/safari-608-branch/Source/WebCore/Modules/applepay/ApplePayCancelEvent.h (from rev 250265, branches/safari-608-branch/Source/WebCore/Modules/applepay/PaymentHeaders.h) (0 => 250266)


--- branches/safari-608-branch/Source/WebCore/Modules/applepay/ApplePayCancelEvent.h	                        (rev 0)
+++ branches/safari-608-branch/Source/WebCore/Modules/applepay/ApplePayCancelEvent.h	2019-09-23 23:50:11 UTC (rev 250266)
@@ -0,0 +1,57 @@
+/*
+ * Copyright (C) 2019 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#if ENABLE(APPLE_PAY)
+
+#include "Event.h"
+#include "PaymentSessionError.h"
+
+namespace WebCore {
+
+class PaymentSessionError;
+
+class ApplePayCancelEvent : public Event {
+public:
+    static Ref<ApplePayCancelEvent> create(const AtomString& type, PaymentSessionError&& sessionError)
+    {
+        return adoptRef(*new ApplePayCancelEvent(type, WTFMove(sessionError)));
+    }
+
+    ApplePaySessionError sessionError() const;
+
+private:
+    explicit ApplePayCancelEvent(const AtomString&, PaymentSessionError&&);
+
+    // Event.
+    EventInterface eventInterface() const final;
+
+    PaymentSessionError m_sessionError;
+};
+
+} // namespace WebCore
+
+#endif // ENABLE(APPLE_PAY)

Copied: branches/safari-608-branch/Source/WebCore/Modules/applepay/ApplePayCancelEvent.idl (from rev 250265, branches/safari-608-branch/Source/WebCore/Modules/applepay/PaymentHeaders.h) (0 => 250266)


--- branches/safari-608-branch/Source/WebCore/Modules/applepay/ApplePayCancelEvent.idl	                        (rev 0)
+++ branches/safari-608-branch/Source/WebCore/Modules/applepay/ApplePayCancelEvent.idl	2019-09-23 23:50:11 UTC (rev 250266)
@@ -0,0 +1,31 @@
+/*
+ * Copyright (C) 2019 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+[
+    Conditional=APPLE_PAY,
+    NoInterfaceObject,
+] interface ApplePayCancelEvent : Event {
+    [CachedAttribute] readonly attribute ApplePaySessionError sessionError;
+};

Modified: branches/safari-608-branch/Source/WebCore/Modules/applepay/ApplePaySession.cpp (250265 => 250266)


--- branches/safari-608-branch/Source/WebCore/Modules/applepay/ApplePaySession.cpp	2019-09-23 23:49:58 UTC (rev 250265)
+++ branches/safari-608-branch/Source/WebCore/Modules/applepay/ApplePaySession.cpp	2019-09-23 23:50:11 UTC (rev 250266)
@@ -28,6 +28,7 @@
 
 #if ENABLE(APPLE_PAY)
 
+#include "ApplePayCancelEvent.h"
 #include "ApplePayLineItem.h"
 #include "ApplePayPaymentAuthorizationResult.h"
 #include "ApplePayPaymentAuthorizedEvent.h"
@@ -812,13 +813,13 @@
     dispatchEvent(event.get());
 }
 
-void ApplePaySession::didCancelPaymentSession()
+void ApplePaySession::didCancelPaymentSession(PaymentSessionError&& error)
 {
     ASSERT(canCancel());
 
     m_state = State::Canceled;
 
-    auto event = Event::create(eventNames().cancelEvent, Event::CanBubble::No, Event::IsCancelable::No);
+    auto event = ApplePayCancelEvent::create(eventNames().cancelEvent, WTFMove(error));
     dispatchEvent(event.get());
 
     didReachFinalState();

Modified: branches/safari-608-branch/Source/WebCore/Modules/applepay/ApplePaySession.h (250265 => 250266)


--- branches/safari-608-branch/Source/WebCore/Modules/applepay/ApplePaySession.h	2019-09-23 23:49:58 UTC (rev 250265)
+++ branches/safari-608-branch/Source/WebCore/Modules/applepay/ApplePaySession.h	2019-09-23 23:50:11 UTC (rev 250266)
@@ -117,7 +117,7 @@
     void didSelectShippingMethod(const ApplePaySessionPaymentRequest::ShippingMethod&) override;
     void didSelectShippingContact(const PaymentContact&) override;
     void didSelectPaymentMethod(const PaymentMethod&) override;
-    void didCancelPaymentSession() override;
+    void didCancelPaymentSession(PaymentSessionError&&) override;
 
     PaymentCoordinator& paymentCoordinator() const;
 

Copied: branches/safari-608-branch/Source/WebCore/Modules/applepay/ApplePaySessionError.h (from rev 250265, branches/safari-608-branch/Source/WebCore/Modules/applepay/PaymentHeaders.h) (0 => 250266)


--- branches/safari-608-branch/Source/WebCore/Modules/applepay/ApplePaySessionError.h	                        (rev 0)
+++ branches/safari-608-branch/Source/WebCore/Modules/applepay/ApplePaySessionError.h	2019-09-23 23:50:11 UTC (rev 250266)
@@ -0,0 +1,44 @@
+/*
+ * Copyright (C) 2019 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#if ENABLE(APPLE_PAY)
+
+#include <wtf/KeyValuePair.h>
+#include <wtf/Vector.h>
+#include <wtf/text/WTFString.h>
+
+namespace WebCore {
+
+struct ApplePaySessionError {
+    using InfoRecord = Vector<WTF::KeyValuePair<String, String>>;
+    String code;
+    InfoRecord info;
+};
+
+} // namespace WebCore
+
+#endif // ENABLE(APPLE_PAY)

Copied: branches/safari-608-branch/Source/WebCore/Modules/applepay/ApplePaySessionError.idl (from rev 250265, branches/safari-608-branch/Source/WebCore/Modules/applepay/PaymentHeaders.h) (0 => 250266)


--- branches/safari-608-branch/Source/WebCore/Modules/applepay/ApplePaySessionError.idl	                        (rev 0)
+++ branches/safari-608-branch/Source/WebCore/Modules/applepay/ApplePaySessionError.idl	2019-09-23 23:50:11 UTC (rev 250266)
@@ -0,0 +1,32 @@
+/*
+ * Copyright (C) 2019 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+[
+    Conditional=APPLE_PAY,
+    JSGenerateToJSObject,
+] dictionary ApplePaySessionError {
+    DOMString code; // FIXME: use an enum instead
+    record<DOMString, DOMString> info;
+};

Modified: branches/safari-608-branch/Source/WebCore/Modules/applepay/PaymentCoordinator.cpp (250265 => 250266)


--- branches/safari-608-branch/Source/WebCore/Modules/applepay/PaymentCoordinator.cpp	2019-09-23 23:49:58 UTC (rev 250265)
+++ branches/safari-608-branch/Source/WebCore/Modules/applepay/PaymentCoordinator.cpp	2019-09-23 23:50:11 UTC (rev 250266)
@@ -233,7 +233,7 @@
     m_activeSession->didSelectShippingContact(shippingContact);
 }
 
-void PaymentCoordinator::didCancelPaymentSession()
+void PaymentCoordinator::didCancelPaymentSession(PaymentSessionError&& error)
 {
     if (!m_activeSession) {
         // It's possible that the payment has been aborted already.
@@ -241,7 +241,7 @@
     }
 
     RELEASE_LOG_IF_ALLOWED("didCancelPaymentSession()");
-    m_activeSession->didCancelPaymentSession();
+    m_activeSession->didCancelPaymentSession(WTFMove(error));
     m_activeSession = nullptr;
 }
 

Modified: branches/safari-608-branch/Source/WebCore/Modules/applepay/PaymentCoordinator.h (250265 => 250266)


--- branches/safari-608-branch/Source/WebCore/Modules/applepay/PaymentCoordinator.h	2019-09-23 23:49:58 UTC (rev 250265)
+++ branches/safari-608-branch/Source/WebCore/Modules/applepay/PaymentCoordinator.h	2019-09-23 23:50:11 UTC (rev 250266)
@@ -40,6 +40,7 @@
 class PaymentMerchantSession;
 class PaymentMethod;
 class PaymentSession;
+class PaymentSessionError;
 enum class PaymentAuthorizationStatus;
 struct PaymentAuthorizationResult;
 struct PaymentMethodUpdate;
@@ -75,7 +76,7 @@
     WEBCORE_EXPORT void didSelectPaymentMethod(const PaymentMethod&);
     WEBCORE_EXPORT void didSelectShippingMethod(const ApplePaySessionPaymentRequest::ShippingMethod&);
     WEBCORE_EXPORT void didSelectShippingContact(const PaymentContact&);
-    WEBCORE_EXPORT void didCancelPaymentSession();
+    WEBCORE_EXPORT void didCancelPaymentSession(PaymentSessionError&&);
 
     Optional<String> validatedPaymentNetwork(Document&, unsigned version, const String&) const;
 

Modified: branches/safari-608-branch/Source/WebCore/Modules/applepay/PaymentHeaders.h (250265 => 250266)


--- branches/safari-608-branch/Source/WebCore/Modules/applepay/PaymentHeaders.h	2019-09-23 23:49:58 UTC (rev 250265)
+++ branches/safari-608-branch/Source/WebCore/Modules/applepay/PaymentHeaders.h	2019-09-23 23:50:11 UTC (rev 250266)
@@ -30,4 +30,4 @@
 #include "PaymentContact.h"
 #include "PaymentMerchantSession.h"
 #include "PaymentMethod.h"
-
+#include "PaymentSessionError.h"

Modified: branches/safari-608-branch/Source/WebCore/Modules/applepay/PaymentSession.cpp (250265 => 250266)


--- branches/safari-608-branch/Source/WebCore/Modules/applepay/PaymentSession.cpp	2019-09-23 23:49:58 UTC (rev 250265)
+++ branches/safari-608-branch/Source/WebCore/Modules/applepay/PaymentSession.cpp	2019-09-23 23:50:11 UTC (rev 250266)
@@ -32,6 +32,7 @@
 #include "Document.h"
 #include "DocumentLoader.h"
 #include "Page.h"
+#include "PaymentCoordinator.h"
 #include "SecurityOrigin.h"
 
 namespace WebCore {

Modified: branches/safari-608-branch/Source/WebCore/Modules/applepay/PaymentSession.h (250265 => 250266)


--- branches/safari-608-branch/Source/WebCore/Modules/applepay/PaymentSession.h	2019-09-23 23:49:58 UTC (rev 250265)
+++ branches/safari-608-branch/Source/WebCore/Modules/applepay/PaymentSession.h	2019-09-23 23:50:11 UTC (rev 250266)
@@ -37,6 +37,8 @@
 class Payment;
 class PaymentContact;
 class PaymentMethod;
+class PaymentSessionError;
+class ScriptExecutionContext;
 
 class PaymentSession : public virtual PaymentSessionBase {
 public:
@@ -49,7 +51,7 @@
     virtual void didSelectShippingMethod(const ApplePaySessionPaymentRequest::ShippingMethod&) = 0;
     virtual void didSelectShippingContact(const PaymentContact&) = 0;
     virtual void didSelectPaymentMethod(const PaymentMethod&) = 0;
-    virtual void didCancelPaymentSession() = 0;
+    virtual void didCancelPaymentSession(PaymentSessionError&&) = 0;
 };
 
 } // namespace WebCore

Copied: branches/safari-608-branch/Source/WebCore/Modules/applepay/PaymentSessionError.h (from rev 250265, branches/safari-608-branch/Source/WebCore/Modules/applepay/PaymentHeaders.h) (0 => 250266)


--- branches/safari-608-branch/Source/WebCore/Modules/applepay/PaymentSessionError.h	                        (rev 0)
+++ branches/safari-608-branch/Source/WebCore/Modules/applepay/PaymentSessionError.h	2019-09-23 23:50:11 UTC (rev 250266)
@@ -0,0 +1,54 @@
+/*
+ * Copyright (C) 2019 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#if ENABLE(APPLE_PAY)
+
+#include <wtf/RetainPtr.h>
+
+OBJC_CLASS NSError;
+
+namespace WebCore {
+
+struct ApplePaySessionError;
+
+class WEBCORE_EXPORT PaymentSessionError {
+public:
+    PaymentSessionError() = default;
+    PaymentSessionError(RetainPtr<NSError>&&);
+
+    ApplePaySessionError sessionError() const;
+    NSError *platformError() const;
+
+private:
+    ApplePaySessionError unknownError() const;
+
+    RetainPtr<NSError> m_platformError;
+};
+
+} // namespace WebCore
+
+#endif // ENABLE(APPLE_PAY)

Copied: branches/safari-608-branch/Source/WebCore/Modules/applepay/cocoa/PaymentSessionErrorCocoa.mm (from rev 250265, branches/safari-608-branch/Source/WebCore/Modules/applepay/PaymentSession.h) (0 => 250266)


--- branches/safari-608-branch/Source/WebCore/Modules/applepay/cocoa/PaymentSessionErrorCocoa.mm	                        (rev 0)
+++ branches/safari-608-branch/Source/WebCore/Modules/applepay/cocoa/PaymentSessionErrorCocoa.mm	2019-09-23 23:50:11 UTC (rev 250266)
@@ -0,0 +1,71 @@
+/*
+ * Copyright (C) 2019 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#import "config.h"
+#import "PaymentSessionError.h"
+
+#if ENABLE(APPLE_PAY)
+
+#import "ApplePaySessionError.h"
+#import <pal/cocoa/PassKitSoftLink.h>
+
+#if USE(APPLE_INTERNAL_SDK)
+#import <WebKitAdditions/PaymentSessionErrorCocoaAdditions.mm>
+#else
+namespace WebCore {
+static Optional<ApplePaySessionError> additionalError(NSError *) { return WTF::nullopt; }
+}
+#endif
+
+namespace WebCore {
+
+PaymentSessionError::PaymentSessionError(RetainPtr<NSError>&& error)
+    : m_platformError { WTFMove(error) }
+{
+}
+
+ApplePaySessionError PaymentSessionError::sessionError() const
+{
+    ASSERT(!m_platformError || [[m_platformError domain] isEqualToString:PAL::get_PassKit_PKPassKitErrorDomain()]);
+
+    if (auto error = additionalError(m_platformError.get()))
+        return *error;
+
+    return unknownError();
+}
+
+NSError *PaymentSessionError::platformError() const
+{
+    return m_platformError.get();
+}
+
+ApplePaySessionError PaymentSessionError::unknownError() const
+{
+    return { "unknown"_s, { } };
+}
+
+} // namespace WebCore
+
+#endif // ENABLE(APPLE_PAY)

Modified: branches/safari-608-branch/Source/WebCore/Modules/applepay/paymentrequest/ApplePayPaymentHandler.cpp (250265 => 250266)


--- branches/safari-608-branch/Source/WebCore/Modules/applepay/paymentrequest/ApplePayPaymentHandler.cpp	2019-09-23 23:49:58 UTC (rev 250265)
+++ branches/safari-608-branch/Source/WebCore/Modules/applepay/paymentrequest/ApplePayPaymentHandler.cpp	2019-09-23 23:50:11 UTC (rev 250266)
@@ -592,7 +592,7 @@
     });
 }
 
-void ApplePayPaymentHandler::didCancelPaymentSession()
+void ApplePayPaymentHandler::didCancelPaymentSession(PaymentSessionError&&)
 {
     m_paymentRequest->cancel();
 }

Modified: branches/safari-608-branch/Source/WebCore/Modules/applepay/paymentrequest/ApplePayPaymentHandler.h (250265 => 250266)


--- branches/safari-608-branch/Source/WebCore/Modules/applepay/paymentrequest/ApplePayPaymentHandler.h	2019-09-23 23:49:58 UTC (rev 250265)
+++ branches/safari-608-branch/Source/WebCore/Modules/applepay/paymentrequest/ApplePayPaymentHandler.h	2019-09-23 23:50:11 UTC (rev 250266)
@@ -80,7 +80,7 @@
     void didSelectShippingMethod(const ApplePaySessionPaymentRequest::ShippingMethod&) final;
     void didSelectShippingContact(const PaymentContact&) final;
     void didSelectPaymentMethod(const PaymentMethod&) final;
-    void didCancelPaymentSession() final;
+    void didCancelPaymentSession(PaymentSessionError&&) final;
 
     PaymentRequest::MethodIdentifier m_identifier;
     Ref<PaymentRequest> m_paymentRequest;

Modified: branches/safari-608-branch/Source/WebCore/PAL/ChangeLog (250265 => 250266)


--- branches/safari-608-branch/Source/WebCore/PAL/ChangeLog	2019-09-23 23:49:58 UTC (rev 250265)
+++ branches/safari-608-branch/Source/WebCore/PAL/ChangeLog	2019-09-23 23:50:11 UTC (rev 250266)
@@ -1,3 +1,119 @@
+2019-09-23  Alan Coon  <alanc...@apple.com>
+
+        Apply patch. rdar://problem/55608028
+
+    Tell websites why a session was cancelled https://bugs.webkit.org/show_bug.cgi?id=201912 Source/WebCore:
+    
+    Reviewed by Brady Eidson.
+    
+    Added ApplePayCancelEvent as the interface for ApplePaySession's cancel event. This event
+    object includes a `sessionError` attribute that exposes a Web-safe version of the PassKit
+    domain error we received from PKPaymentAuthorization(View)Controller. Currently, we report
+    all errors with code "unknown", but more codes will be added in future patches.
+    
+    Test: http/tests/ssl/applepay/ApplePayCancelEvent.https.html
+    
+    * DerivedSources-input.xcfilelist:
+    * DerivedSources-output.xcfilelist:
+    * DerivedSources.make:
+    * Modules/applepay/ApplePayCancelEvent.cpp: Copied from Source/WebCore/Modules/applepay/PaymentHeaders.h.
+    (WebCore::ApplePayCancelEvent::ApplePayCancelEvent):
+    (WebCore::ApplePayCancelEvent::sessionError const):
+    (WebCore::ApplePayCancelEvent::eventInterface const):
+    * Modules/applepay/ApplePayCancelEvent.h: Copied from Source/WebCore/Modules/applepay/PaymentHeaders.h.
+    (WebCore::ApplePayCancelEvent::create):
+    * Modules/applepay/ApplePayCancelEvent.idl: Copied from Source/WebCore/Modules/applepay/PaymentHeaders.h.
+    * Modules/applepay/ApplePaySession.cpp:
+    (WebCore::ApplePaySession::didCancelPaymentSession):
+    * Modules/applepay/ApplePaySession.h:
+    * Modules/applepay/ApplePaySessionError.h: Copied from Source/WebCore/Modules/applepay/PaymentHeaders.h.
+    * Modules/applepay/ApplePaySessionError.idl: Copied from Source/WebCore/Modules/applepay/PaymentHeaders.h.
+    * Modules/applepay/PaymentCoordinator.cpp:
+    (WebCore::PaymentCoordinator::didCancelPaymentSession):
+    * Modules/applepay/PaymentCoordinator.h:
+    * Modules/applepay/PaymentHeaders.h:
+    * Modules/applepay/PaymentSession.cpp:
+    * Modules/applepay/PaymentSession.h:
+    * Modules/applepay/PaymentSessionError.h: Copied from Source/WebCore/Modules/applepay/PaymentHeaders.h.
+    * Modules/applepay/cocoa/PaymentSessionErrorCocoa.mm: Copied from Source/WebCore/Modules/applepay/PaymentSession.h.
+    (WebCore::additionalError):
+    (WebCore::PaymentSessionError::PaymentSessionError):
+    (WebCore::PaymentSessionError::sessionError const):
+    (WebCore::PaymentSessionError::platformError const):
+    (WebCore::PaymentSessionError::unknownError const):
+    * Modules/applepay/paymentrequest/ApplePayPaymentHandler.cpp:
+    (WebCore::ApplePayPaymentHandler::didCancelPaymentSession):
+    * Modules/applepay/paymentrequest/ApplePayPaymentHandler.h:
+    * Modules/webgpu/WHLSL/WHLSLCheckTextureReferences.cpp:
+    * Modules/webgpu/WHLSL/WHLSLPropertyResolver.cpp:
+    * SourcesCocoa.txt:
+    * WebCore.xcodeproj/project.pbxproj:
+    * dom/EventNames.in:
+    * testing/MockPaymentCoordinator.cpp:
+    (WebCore::MockPaymentCoordinator::cancelPayment):
+    
+    Source/WebCore/PAL:
+    
+    <rdar://problem/55469706>
+    
+    Reviewed by Brady Eidson.
+    
+    Soft-linked PKPassKitErrorDomain and included PassKit headers more judiciously.
+    
+    * pal/cocoa/PassKitSoftLink.h:
+    * pal/cocoa/PassKitSoftLink.mm:
+    * pal/spi/cocoa/PassKitSPI.h:
+    
+    Source/WebKit:
+    
+    <rdar://problem/55469706>
+    
+    Reviewed by Brady Eidson.
+    
+    Remembered the error passed to -[WKPaymentAuthorizationDelegate _willFinishWithError:] and
+    sent it to the WebContent process in Messages::WebPaymentCoordinator::DidCancelPaymentSession.
+    
+    * Platform/cocoa/PaymentAuthorizationPresenter.h:
+    * Platform/cocoa/WKPaymentAuthorizationDelegate.mm:
+    (-[WKPaymentAuthorizationDelegate _didFinish]):
+    (-[WKPaymentAuthorizationDelegate _willFinishWithError:]):
+    * Shared/ApplePay/WebPaymentCoordinatorProxy.cpp:
+    (WebKit::WebPaymentCoordinatorProxy::didCancelPaymentSession):
+    (WebKit::WebPaymentCoordinatorProxy::presenterDidFinish):
+    * Shared/ApplePay/WebPaymentCoordinatorProxy.h:
+    (WebKit::WebPaymentCoordinatorProxy::didCancelPaymentSession):
+    * Shared/ApplePay/ios/WebPaymentCoordinatorProxyIOS.mm:
+    * Shared/Cocoa/WebCoreArgumentCodersCocoa.mm:
+    (IPC::ArgumentCoder<WebCore::PaymentSessionError>::encode):
+    (IPC::ArgumentCoder<WebCore::PaymentSessionError>::decode):
+    * Shared/WebCoreArgumentCoders.h:
+    * WebProcess/ApplePay/WebPaymentCoordinator.cpp:
+    (WebKit::WebPaymentCoordinator::networkProcessConnectionClosed):
+    (WebKit::WebPaymentCoordinator::didCancelPaymentSession):
+    * WebProcess/ApplePay/WebPaymentCoordinator.h:
+    * WebProcess/ApplePay/WebPaymentCoordinator.messages.in:
+    
+    LayoutTests:
+    
+    Reviewed by Brady Eidson.
+    
+    * http/tests/ssl/applepay/ApplePayCancelEvent.https-expected.txt: Added.
+    * http/tests/ssl/applepay/ApplePayCancelEvent.https.html: Added.
+
+    2019-09-18  Andy Estes  <aes...@apple.com>
+
+            [Apple Pay] Tell websites why a session was cancelled
+            https://bugs.webkit.org/show_bug.cgi?id=201912
+            <rdar://problem/55469706>
+
+            Reviewed by Brady Eidson.
+
+            Soft-linked PKPassKitErrorDomain and included PassKit headers more judiciously.
+
+            * pal/cocoa/PassKitSoftLink.h:
+            * pal/cocoa/PassKitSoftLink.mm:
+            * pal/spi/cocoa/PassKitSPI.h:
+
 2019-09-17  Alan Coon  <alanc...@apple.com>
 
         Cherry-pick r249936. rdar://problem/55461414

Modified: branches/safari-608-branch/Source/WebCore/PAL/pal/cocoa/PassKitSoftLink.h (250265 => 250266)


--- branches/safari-608-branch/Source/WebCore/PAL/pal/cocoa/PassKitSoftLink.h	2019-09-23 23:49:58 UTC (rev 250265)
+++ branches/safari-608-branch/Source/WebCore/PAL/pal/cocoa/PassKitSoftLink.h	2019-09-23 23:50:11 UTC (rev 250266)
@@ -61,6 +61,7 @@
 SOFT_LINK_CONSTANT_FOR_HEADER(PAL, PassKit, PKContactFieldPhoneticName, PKContactField)
 SOFT_LINK_CONSTANT_FOR_HEADER(PAL, PassKit, PKContactFieldPostalAddress, PKContactField)
 SOFT_LINK_CONSTANT_FOR_HEADER(PAL, PassKit, PKPaymentErrorContactFieldUserInfoKey, PKPaymentErrorKey)
+SOFT_LINK_CONSTANT_FOR_HEADER(PAL, PassKit, PKPassKitErrorDomain, NSString *)
 SOFT_LINK_CONSTANT_FOR_HEADER(PAL, PassKit, PKPaymentErrorDomain, NSString *)
 SOFT_LINK_CONSTANT_FOR_HEADER(PAL, PassKit, PKPaymentErrorPostalAddressUserInfoKey, PKPaymentErrorKey)
 

Modified: branches/safari-608-branch/Source/WebCore/PAL/pal/cocoa/PassKitSoftLink.mm (250265 => 250266)


--- branches/safari-608-branch/Source/WebCore/PAL/pal/cocoa/PassKitSoftLink.mm	2019-09-23 23:49:58 UTC (rev 250265)
+++ branches/safari-608-branch/Source/WebCore/PAL/pal/cocoa/PassKitSoftLink.mm	2019-09-23 23:50:11 UTC (rev 250266)
@@ -65,6 +65,7 @@
 SOFT_LINK_CONSTANT_FOR_SOURCE_WITH_EXPORT(PAL, PassKit, PKContactFieldPhoneticName, PKContactField, PAL_EXPORT)
 SOFT_LINK_CONSTANT_FOR_SOURCE_WITH_EXPORT(PAL, PassKit, PKContactFieldPostalAddress, PKContactField, PAL_EXPORT)
 SOFT_LINK_CONSTANT_FOR_SOURCE_WITH_EXPORT(PAL, PassKit, PKPaymentErrorContactFieldUserInfoKey, PKPaymentErrorKey, PAL_EXPORT)
+SOFT_LINK_CONSTANT_FOR_SOURCE_WITH_EXPORT(PAL, PassKit, PKPassKitErrorDomain, NSString *, PAL_EXPORT)
 SOFT_LINK_CONSTANT_FOR_SOURCE_WITH_EXPORT(PAL, PassKit, PKPaymentErrorDomain, NSString *, PAL_EXPORT)
 SOFT_LINK_CONSTANT_FOR_SOURCE_WITH_EXPORT(PAL, PassKit, PKPaymentErrorPostalAddressUserInfoKey, PKPaymentErrorKey, PAL_EXPORT)
 

Modified: branches/safari-608-branch/Source/WebCore/PAL/pal/spi/cocoa/PassKitSPI.h (250265 => 250266)


--- branches/safari-608-branch/Source/WebCore/PAL/pal/spi/cocoa/PassKitSPI.h	2019-09-23 23:49:58 UTC (rev 250265)
+++ branches/safari-608-branch/Source/WebCore/PAL/pal/spi/cocoa/PassKitSPI.h	2019-09-23 23:50:11 UTC (rev 250266)
@@ -39,9 +39,15 @@
 
 #if USE(APPLE_INTERNAL_SDK)
 
-#import <PassKit/PassKit.h>
+#import <PassKit/PKContact.h>
+#import <PassKit/PKError_Private.h>
+#import <PassKit/PKPassLibrary.h>
+#import <PassKit/PKPayment.h>
+#import <PassKit/PKPaymentPass.h>
 #import <PassKit/PKPaymentAuthorizationViewController_Private.h>
+#import <PassKit/PKPaymentMethod.h>
 #import <PassKit/PKPaymentRequest_Private.h>
+#import <PassKitCore/PKPaymentRequestStatus_Private.h>
 #import <PassKitCore/PKPaymentRequest_WebKit.h>
 
 #if PLATFORM(IOS_FAMILY)

Modified: branches/safari-608-branch/Source/WebCore/SourcesCocoa.txt (250265 => 250266)


--- branches/safari-608-branch/Source/WebCore/SourcesCocoa.txt	2019-09-23 23:49:58 UTC (rev 250265)
+++ branches/safari-608-branch/Source/WebCore/SourcesCocoa.txt	2019-09-23 23:50:11 UTC (rev 250266)
@@ -570,6 +570,7 @@
 
 #if ENABLE_APPLE_PAY
 
+    Modules/applepay/ApplePayCancelEvent.cpp
     Modules/applepay/ApplePayContactField.cpp
     Modules/applepay/ApplePayError.cpp
     Modules/applepay/ApplePayMerchantCapability.cpp
@@ -590,9 +591,11 @@
     Modules/applepay/cocoa/PaymentContactCocoa.mm
     Modules/applepay/cocoa/PaymentMerchantSessionCocoa.mm
     Modules/applepay/cocoa/PaymentMethodCocoa.mm
+    Modules/applepay/cocoa/PaymentSessionErrorCocoa.mm
 
     Modules/applepay/paymentrequest/ApplePayPaymentHandler.cpp
 
+    JSApplePayCancelEvent.cpp
     JSApplePayContactField.cpp
     JSApplePayError.cpp
     JSApplePayErrorCode.cpp
@@ -613,6 +616,7 @@
     JSApplePayRequest.cpp
     JSApplePayRequestBase.cpp
     JSApplePaySession.cpp
+    JSApplePaySessionError.cpp
     JSApplePayShippingContactSelectedEvent.cpp
     JSApplePayShippingContactUpdate.cpp
     JSApplePayShippingMethod.cpp

Modified: branches/safari-608-branch/Source/WebCore/WebCore.xcodeproj/project.pbxproj (250265 => 250266)


--- branches/safari-608-branch/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2019-09-23 23:49:58 UTC (rev 250265)
+++ branches/safari-608-branch/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2019-09-23 23:50:11 UTC (rev 250266)
@@ -2922,6 +2922,8 @@
 		A10DBF4718F92317000D70C6 /* PreviewLoaderClient.h in Headers */ = {isa = PBXBuildFile; fileRef = A10DBF4618F92317000D70C6 /* PreviewLoaderClient.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		A10DC76B14747BAB005E2471 /* StyleGridData.h in Headers */ = {isa = PBXBuildFile; fileRef = A10DC76914747BAB005E2471 /* StyleGridData.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		A110DB9B14F5DF7700A03B93 /* StyleGridItemData.h in Headers */ = {isa = PBXBuildFile; fileRef = A110DB9A14F5DF7700A03B93 /* StyleGridItemData.h */; settings = {ATTRIBUTES = (Private, ); }; };
+		A113E02823318293009C33A0 /* PaymentSessionError.h in Headers */ = {isa = PBXBuildFile; fileRef = A113E02723318293009C33A0 /* PaymentSessionError.h */; settings = {ATTRIBUTES = (Private, ); }; };
+		A113E02E2331A134009C33A0 /* ApplePayCancelEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = A113E02B2331A0E4009C33A0 /* ApplePayCancelEvent.h */; };
 		A11AE0CC1FFD60530047348B /* MerchantValidationEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = A11AE0C91FFD60530047348B /* MerchantValidationEvent.h */; };
 		A11AE0D31FFD61DF0047348B /* JSMerchantValidationEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = A11AE0D11FFD61DF0047348B /* JSMerchantValidationEvent.h */; };
 		A11E8C051B1E28F40003A7C7 /* copyCursor.png in Resources */ = {isa = PBXBuildFile; fileRef = A11E8C001B1E28BE0003A7C7 /* copyCursor.png */; };
@@ -2999,6 +3001,11 @@
 		A180AD5B219F81B000DC039A /* WebCoreAdditions.mm in Sources */ = {isa = PBXBuildFile; fileRef = A17E4F26219BC01600E1C7EE /* WebCoreAdditions.mm */; };
 		A185B42A1E8211A100DC9118 /* PreviewLoader.h in Headers */ = {isa = PBXBuildFile; fileRef = A185B4281E8211A100DC9118 /* PreviewLoader.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		A18890AF1AA13F250026C301 /* ParentalControlsContentFilter.h in Headers */ = {isa = PBXBuildFile; fileRef = A18890AD1AA13F250026C301 /* ParentalControlsContentFilter.h */; };
+		A1956F1C2331A6770057E9D2 /* JSApplePayCancelEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = A1956F1B2331A6460057E9D2 /* JSApplePayCancelEvent.h */; };
+		A1956F202331A8C70057E9D2 /* ApplePaySessionError.h in Headers */ = {isa = PBXBuildFile; fileRef = A1956F1D2331A8C70057E9D2 /* ApplePaySessionError.h */; };
+		A1956F232331ACF20057E9D2 /* WHLSLReplaceWith.h in Headers */ = {isa = PBXBuildFile; fileRef = 3351F70B22CAD8DA0015B40D /* WHLSLReplaceWith.h */; };
+		A1956F242331AD210057E9D2 /* WHLSLProgram.h in Headers */ = {isa = PBXBuildFile; fileRef = C21BF73A21CD8D7000227979 /* WHLSLProgram.h */; };
+		A1956F252331AD530057E9D2 /* WHLSLFunctionDefinition.h in Headers */ = {isa = PBXBuildFile; fileRef = C21BF6F421CD89B300227979 /* WHLSLFunctionDefinition.h */; };
 		A19AEA211AAA808600B52B25 /* JSMockContentFilterSettings.h in Headers */ = {isa = PBXBuildFile; fileRef = A19AEA1E1AAA806E00B52B25 /* JSMockContentFilterSettings.h */; };
 		A19AEA221AAA808A00B52B25 /* JSMockContentFilterSettings.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A19AEA1D1AAA806E00B52B25 /* JSMockContentFilterSettings.cpp */; };
 		A19D934B1AA11B1E00B46C24 /* NetworkExtensionContentFilter.h in Headers */ = {isa = PBXBuildFile; fileRef = A19D93491AA11B1E00B46C24 /* NetworkExtensionContentFilter.h */; };
@@ -3031,6 +3038,7 @@
 		A1CC567B1F4614AD00A4555B /* JSPaymentResponse.h in Headers */ = {isa = PBXBuildFile; fileRef = A1CC56641F46146700A4555B /* JSPaymentResponse.h */; };
 		A1CC567D1F4614B200A4555B /* JSPaymentShippingOption.h in Headers */ = {isa = PBXBuildFile; fileRef = A1CC56591F46145C00A4555B /* JSPaymentShippingOption.h */; };
 		A1CC567F1F4614B700A4555B /* JSPaymentShippingType.h in Headers */ = {isa = PBXBuildFile; fileRef = A1CC56501F46145300A4555B /* JSPaymentShippingType.h */; };
+		A1D506142331EDD40014EE4E /* JSApplePaySessionError.h in Headers */ = {isa = PBXBuildFile; fileRef = A1D506112331ED960014EE4E /* JSApplePaySessionError.h */; };
 		A1DF5A7F1F7EBD0B0058A477 /* ApplePayRequest.h in Headers */ = {isa = PBXBuildFile; fileRef = A1DF5A7C1F7EBD0B0058A477 /* ApplePayRequest.h */; };
 		A1DF5A861F7EBDF20058A477 /* ApplePayMerchantCapability.h in Headers */ = {isa = PBXBuildFile; fileRef = A1DF5A831F7EBDF20058A477 /* ApplePayMerchantCapability.h */; };
 		A1DF5A8E1F7EC0020058A477 /* JSApplePayMerchantCapability.h in Headers */ = {isa = PBXBuildFile; fileRef = A1DF5A8A1F7EC0000058A477 /* JSApplePayMerchantCapability.h */; };
@@ -11124,6 +11132,10 @@
 		A10DC76914747BAB005E2471 /* StyleGridData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StyleGridData.h; sourceTree = "<group>"; };
 		A110DB9A14F5DF7700A03B93 /* StyleGridItemData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StyleGridItemData.h; sourceTree = "<group>"; };
 		A110DB9C14F5DF8700A03B93 /* StyleGridItemData.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = StyleGridItemData.cpp; sourceTree = "<group>"; };
+		A113E02723318293009C33A0 /* PaymentSessionError.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = PaymentSessionError.h; sourceTree = "<group>"; };
+		A113E02A23318EBC009C33A0 /* PaymentSessionErrorCocoa.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = PaymentSessionErrorCocoa.mm; sourceTree = "<group>"; };
+		A113E02B2331A0E4009C33A0 /* ApplePayCancelEvent.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ApplePayCancelEvent.h; sourceTree = "<group>"; };
+		A113E02C2331A0E4009C33A0 /* ApplePayCancelEvent.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = ApplePayCancelEvent.cpp; sourceTree = "<group>"; };
 		A11AE0C91FFD60530047348B /* MerchantValidationEvent.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MerchantValidationEvent.h; sourceTree = "<group>"; };
 		A11AE0CA1FFD60530047348B /* MerchantValidationEvent.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = MerchantValidationEvent.cpp; sourceTree = "<group>"; };
 		A11AE0CB1FFD60530047348B /* MerchantValidationEvent.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = MerchantValidationEvent.idl; sourceTree = "<group>"; };
@@ -11226,6 +11238,11 @@
 		A18890AC1AA13F250026C301 /* ParentalControlsContentFilter.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ParentalControlsContentFilter.mm; sourceTree = "<group>"; };
 		A18890AD1AA13F250026C301 /* ParentalControlsContentFilter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ParentalControlsContentFilter.h; sourceTree = "<group>"; };
 		A18F7A351ECA73640059E1E1 /* RuntimeApplicationChecks.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = RuntimeApplicationChecks.cpp; sourceTree = "<group>"; };
+		A1956F182331A4680057E9D2 /* ApplePayCancelEvent.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = ApplePayCancelEvent.idl; sourceTree = "<group>"; };
+		A1956F1A2331A6460057E9D2 /* JSApplePayCancelEvent.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = JSApplePayCancelEvent.cpp; sourceTree = "<group>"; };
+		A1956F1B2331A6460057E9D2 /* JSApplePayCancelEvent.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = JSApplePayCancelEvent.h; sourceTree = "<group>"; };
+		A1956F1D2331A8C70057E9D2 /* ApplePaySessionError.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ApplePaySessionError.h; sourceTree = "<group>"; };
+		A1956F1F2331A8C70057E9D2 /* ApplePaySessionError.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = ApplePaySessionError.idl; sourceTree = "<group>"; };
 		A19AEA1C1AAA7C4900B52B25 /* MockContentFilterSettings.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = MockContentFilterSettings.idl; sourceTree = "<group>"; };
 		A19AEA1D1AAA806E00B52B25 /* JSMockContentFilterSettings.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSMockContentFilterSettings.cpp; sourceTree = "<group>"; };
 		A19AEA1E1AAA806E00B52B25 /* JSMockContentFilterSettings.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSMockContentFilterSettings.h; sourceTree = "<group>"; };
@@ -11283,6 +11300,8 @@
 		A1CC56641F46146700A4555B /* JSPaymentResponse.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSPaymentResponse.h; sourceTree = "<group>"; };
 		A1CC56651F46146800A4555B /* JSPaymentAddress.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSPaymentAddress.h; sourceTree = "<group>"; };
 		A1CFE0311F9E71290065C345 /* PaymentAddress.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = PaymentAddress.cpp; sourceTree = "<group>"; };
+		A1D506112331ED960014EE4E /* JSApplePaySessionError.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSApplePaySessionError.h; sourceTree = "<group>"; };
+		A1D506132331ED970014EE4E /* JSApplePaySessionError.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSApplePaySessionError.cpp; sourceTree = "<group>"; };
 		A1DE712B18612AC100734192 /* TouchEvents.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TouchEvents.cpp; sourceTree = "<group>"; };
 		A1DF5A7C1F7EBD0B0058A477 /* ApplePayRequest.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ApplePayRequest.h; sourceTree = "<group>"; };
 		A1DF5A7E1F7EBD0B0058A477 /* ApplePayRequest.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = ApplePayRequest.idl; sourceTree = "<group>"; };
@@ -16680,6 +16699,9 @@
 			children = (
 				1A58E8691D19D8C000C0EA73 /* cocoa */,
 				A1DF5A9F1F7EE0F10058A477 /* paymentrequest */,
+				A113E02C2331A0E4009C33A0 /* ApplePayCancelEvent.cpp */,
+				A113E02B2331A0E4009C33A0 /* ApplePayCancelEvent.h */,
+				A1956F182331A4680057E9D2 /* ApplePayCancelEvent.idl */,
 				A1DF5AB41F8078F30058A477 /* ApplePayContactField.cpp */,
 				A1DF5A911F7EC4320058A477 /* ApplePayContactField.h */,
 				A1DF5A931F7EC4320058A477 /* ApplePayContactField.idl */,
@@ -16723,6 +16745,8 @@
 				1A8A64441D19FCFB00D0E00F /* ApplePaySession.cpp */,
 				1A8A64451D19FCFB00D0E00F /* ApplePaySession.h */,
 				1A8A64461D19FCFB00D0E00F /* ApplePaySession.idl */,
+				A1956F1D2331A8C70057E9D2 /* ApplePaySessionError.h */,
+				A1956F1F2331A8C70057E9D2 /* ApplePaySessionError.idl */,
 				1A58E8631D19D4DF00C0EA73 /* ApplePaySessionPaymentRequest.cpp */,
 				1A58E8641D19D4DF00C0EA73 /* ApplePaySessionPaymentRequest.h */,
 				1A8A64471D19FCFB00D0E00F /* ApplePayShippingContactSelectedEvent.cpp */,
@@ -16754,6 +16778,7 @@
 				1A8A64651D19FDFF00D0E00F /* PaymentRequestValidator.mm */,
 				A1C2C5751FA2851600BA46FA /* PaymentSession.cpp */,
 				A1491DA21F859D870095F5D4 /* PaymentSession.h */,
+				A113E02723318293009C33A0 /* PaymentSessionError.h */,
 			);
 			path = applepay;
 			sourceTree = "<group>";
@@ -16765,6 +16790,7 @@
 				1A8A646A1D19FF8700D0E00F /* PaymentContactCocoa.mm */,
 				1ADA4A1B1D22F2C0005A9A15 /* PaymentMerchantSessionCocoa.mm */,
 				1A8A646B1D19FF8700D0E00F /* PaymentMethodCocoa.mm */,
+				A113E02A23318EBC009C33A0 /* PaymentSessionErrorCocoa.mm */,
 			);
 			path = cocoa;
 			sourceTree = "<group>";
@@ -16859,6 +16885,8 @@
 		1AE96A791D1A0A5C00B86768 /* ApplePay */ = {
 			isa = PBXGroup;
 			children = (
+				A1956F1A2331A6460057E9D2 /* JSApplePayCancelEvent.cpp */,
+				A1956F1B2331A6460057E9D2 /* JSApplePayCancelEvent.h */,
 				A1DF5A981F7EC8C00058A477 /* JSApplePayContactField.cpp */,
 				A1DF5A971F7EC8BF0058A477 /* JSApplePayContactField.h */,
 				1ADFDFE11E71DCA0008F5D34 /* JSApplePayError.cpp */,
@@ -16899,6 +16927,8 @@
 				A1DF5AB11F8077520058A477 /* JSApplePayRequestBase.h */,
 				1AE96A7E1D1A0A8000B86768 /* JSApplePaySession.cpp */,
 				1AE96A7F1D1A0A8000B86768 /* JSApplePaySession.h */,
+				A1D506132331ED970014EE4E /* JSApplePaySessionError.cpp */,
+				A1D506112331ED960014EE4E /* JSApplePaySessionError.h */,
 				1AE96A801D1A0A8000B86768 /* JSApplePayShippingContactSelectedEvent.cpp */,
 				1AE96A811D1A0A8000B86768 /* JSApplePayShippingContactSelectedEvent.h */,
 				1ADFDFE71E71DCA0008F5D34 /* JSApplePayShippingContactUpdate.cpp */,
@@ -28289,6 +28319,7 @@
 				57152B5A21CB3E88000C37CA /* ApduCommand.h in Headers */,
 				57152B5C21CC1902000C37CA /* ApduResponse.h in Headers */,
 				93309DD7099E64920056E581 /* AppendNodeCommand.h in Headers */,
+				A113E02E2331A134009C33A0 /* ApplePayCancelEvent.h in Headers */,
 				A1DF5A941F7EC4320058A477 /* ApplePayContactField.h in Headers */,
 				A12C59EE2035FC9B0012236B /* ApplePayError.h in Headers */,
 				A1BB859C2159AEA10067E07D /* ApplePayErrorCode.h in Headers */,
@@ -28310,6 +28341,7 @@
 				A1DF5A7F1F7EBD0B0058A477 /* ApplePayRequest.h in Headers */,
 				A1DF5AAD1F8075F00058A477 /* ApplePayRequestBase.h in Headers */,
 				1A8A64591D19FCFC00D0E00F /* ApplePaySession.h in Headers */,
+				A1956F202331A8C70057E9D2 /* ApplePaySessionError.h in Headers */,
 				1A58E8651D19D4EB00C0EA73 /* ApplePaySessionPaymentRequest.h in Headers */,
 				1A8A645C1D19FCFC00D0E00F /* ApplePayShippingContactSelectedEvent.h in Headers */,
 				A12C59F22035FCD60012236B /* ApplePayShippingContactUpdate.h in Headers */,
@@ -29681,6 +29713,7 @@
 				714C7C6C1FDADAF300F2BEE1 /* JSAnimationPlaybackEvent.h in Headers */,
 				714C7C6D1FDADAF600F2BEE1 /* JSAnimationPlaybackEventInit.h in Headers */,
 				71025EDE1F99F1EC004A250C /* JSAnimationTimeline.h in Headers */,
+				A1956F1C2331A6770057E9D2 /* JSApplePayCancelEvent.h in Headers */,
 				A1DF5A991F7EC8C00058A477 /* JSApplePayContactField.h in Headers */,
 				A12C59F920360ACB0012236B /* JSApplePayError.h in Headers */,
 				A1BB85B22159B1A10067E07D /* JSApplePayErrorCode.h in Headers */,
@@ -29701,6 +29734,7 @@
 				A1DF5A8F1F7EC0020058A477 /* JSApplePayRequest.h in Headers */,
 				A1DF5AB31F8077530058A477 /* JSApplePayRequestBase.h in Headers */,
 				1AE96A8F1D1A0DDD00B86768 /* JSApplePaySession.h in Headers */,
+				A1D506142331EDD40014EE4E /* JSApplePaySessionError.h in Headers */,
 				1AE96A911D1A0DDD00B86768 /* JSApplePayShippingContactSelectedEvent.h in Headers */,
 				A12C59FD20360B3E0012236B /* JSApplePayShippingContactUpdate.h in Headers */,
 				7C6579F41E00856600E3A27A /* JSApplePayShippingMethod.h in Headers */,
@@ -30955,6 +30989,7 @@
 				A1F76B3D1F44CF240014C318 /* PaymentResponse.h in Headers */,
 				A1491DA31F859D870095F5D4 /* PaymentSession.h in Headers */,
 				A17FEE641F8893220021E811 /* PaymentSessionBase.h in Headers */,
+				A113E02823318293009C33A0 /* PaymentSessionError.h in Headers */,
 				A1F76B551F44D2C70014C318 /* PaymentShippingOption.h in Headers */,
 				A1F76B491F44D07A0014C318 /* PaymentShippingType.h in Headers */,
 				A1677DFD213E006600A08C34 /* PaymentValidationErrors.h in Headers */,
@@ -32248,6 +32283,9 @@
 				2EBBC3D81B65988300F5253D /* WheelEventDeltaFilter.h in Headers */,
 				2E9B5D8F1B66A94E008C6A24 /* WheelEventDeltaFilterMac.h in Headers */,
 				7AE335F21ACB09E200E401EF /* WheelEventTestTrigger.h in Headers */,
+				A1956F252331AD530057E9D2 /* WHLSLFunctionDefinition.h in Headers */,
+				A1956F242331AD210057E9D2 /* WHLSLProgram.h in Headers */,
+				A1956F232331ACF20057E9D2 /* WHLSLReplaceWith.h in Headers */,
 				9380F47409A11AB4001FDB34 /* Widget.h in Headers */,
 				1411DCB1164C39A800D49BC1 /* WidthCache.h in Headers */,
 				939B02EF0EA2DBC400C54570 /* WidthIterator.h in Headers */,

Modified: branches/safari-608-branch/Source/WebCore/dom/EventNames.in (250265 => 250266)


--- branches/safari-608-branch/Source/WebCore/dom/EventNames.in	2019-09-23 23:49:58 UTC (rev 250265)
+++ branches/safari-608-branch/Source/WebCore/dom/EventNames.in	2019-09-23 23:50:11 UTC (rev 250266)
@@ -41,6 +41,7 @@
 WebKitTransitionEvent
 WheelEvent
 XMLHttpRequestProgressEvent
+ApplePayCancelEvent conditional=APPLE_PAY
 ApplePayPaymentAuthorizedEvent conditional=APPLE_PAY
 ApplePayPaymentMethodSelectedEvent conditional=APPLE_PAY
 ApplePayShippingContactSelectedEvent conditional=APPLE_PAY

Modified: branches/safari-608-branch/Source/WebCore/testing/MockPaymentCoordinator.cpp (250265 => 250266)


--- branches/safari-608-branch/Source/WebCore/testing/MockPaymentCoordinator.cpp	2019-09-23 23:49:58 UTC (rev 250265)
+++ branches/safari-608-branch/Source/WebCore/testing/MockPaymentCoordinator.cpp	2019-09-23 23:50:11 UTC (rev 250266)
@@ -34,6 +34,7 @@
 #include "MockPaymentMethod.h"
 #include "Page.h"
 #include "PaymentCoordinator.h"
+#include "PaymentSessionError.h"
 #include <wtf/CompletionHandler.h>
 #include <wtf/RunLoop.h>
 #include <wtf/URL.h>
@@ -190,7 +191,7 @@
 void MockPaymentCoordinator::cancelPayment()
 {
     dispatchIfShowing([page = &m_page] {
-        page->paymentCoordinator().didCancelPaymentSession();
+        page->paymentCoordinator().didCancelPaymentSession({ });
         ++hideCount;
         ASSERT(showCount == hideCount);
     });

Modified: branches/safari-608-branch/Source/WebKit/ChangeLog (250265 => 250266)


--- branches/safari-608-branch/Source/WebKit/ChangeLog	2019-09-23 23:49:58 UTC (rev 250265)
+++ branches/safari-608-branch/Source/WebKit/ChangeLog	2019-09-23 23:50:11 UTC (rev 250266)
@@ -1,5 +1,138 @@
 2019-09-23  Alan Coon  <alanc...@apple.com>
 
+        Apply patch. rdar://problem/55608028
+
+    Tell websites why a session was cancelled https://bugs.webkit.org/show_bug.cgi?id=201912 Source/WebCore:
+    
+    Reviewed by Brady Eidson.
+    
+    Added ApplePayCancelEvent as the interface for ApplePaySession's cancel event. This event
+    object includes a `sessionError` attribute that exposes a Web-safe version of the PassKit
+    domain error we received from PKPaymentAuthorization(View)Controller. Currently, we report
+    all errors with code "unknown", but more codes will be added in future patches.
+    
+    Test: http/tests/ssl/applepay/ApplePayCancelEvent.https.html
+    
+    * DerivedSources-input.xcfilelist:
+    * DerivedSources-output.xcfilelist:
+    * DerivedSources.make:
+    * Modules/applepay/ApplePayCancelEvent.cpp: Copied from Source/WebCore/Modules/applepay/PaymentHeaders.h.
+    (WebCore::ApplePayCancelEvent::ApplePayCancelEvent):
+    (WebCore::ApplePayCancelEvent::sessionError const):
+    (WebCore::ApplePayCancelEvent::eventInterface const):
+    * Modules/applepay/ApplePayCancelEvent.h: Copied from Source/WebCore/Modules/applepay/PaymentHeaders.h.
+    (WebCore::ApplePayCancelEvent::create):
+    * Modules/applepay/ApplePayCancelEvent.idl: Copied from Source/WebCore/Modules/applepay/PaymentHeaders.h.
+    * Modules/applepay/ApplePaySession.cpp:
+    (WebCore::ApplePaySession::didCancelPaymentSession):
+    * Modules/applepay/ApplePaySession.h:
+    * Modules/applepay/ApplePaySessionError.h: Copied from Source/WebCore/Modules/applepay/PaymentHeaders.h.
+    * Modules/applepay/ApplePaySessionError.idl: Copied from Source/WebCore/Modules/applepay/PaymentHeaders.h.
+    * Modules/applepay/PaymentCoordinator.cpp:
+    (WebCore::PaymentCoordinator::didCancelPaymentSession):
+    * Modules/applepay/PaymentCoordinator.h:
+    * Modules/applepay/PaymentHeaders.h:
+    * Modules/applepay/PaymentSession.cpp:
+    * Modules/applepay/PaymentSession.h:
+    * Modules/applepay/PaymentSessionError.h: Copied from Source/WebCore/Modules/applepay/PaymentHeaders.h.
+    * Modules/applepay/cocoa/PaymentSessionErrorCocoa.mm: Copied from Source/WebCore/Modules/applepay/PaymentSession.h.
+    (WebCore::additionalError):
+    (WebCore::PaymentSessionError::PaymentSessionError):
+    (WebCore::PaymentSessionError::sessionError const):
+    (WebCore::PaymentSessionError::platformError const):
+    (WebCore::PaymentSessionError::unknownError const):
+    * Modules/applepay/paymentrequest/ApplePayPaymentHandler.cpp:
+    (WebCore::ApplePayPaymentHandler::didCancelPaymentSession):
+    * Modules/applepay/paymentrequest/ApplePayPaymentHandler.h:
+    * Modules/webgpu/WHLSL/WHLSLCheckTextureReferences.cpp:
+    * Modules/webgpu/WHLSL/WHLSLPropertyResolver.cpp:
+    * SourcesCocoa.txt:
+    * WebCore.xcodeproj/project.pbxproj:
+    * dom/EventNames.in:
+    * testing/MockPaymentCoordinator.cpp:
+    (WebCore::MockPaymentCoordinator::cancelPayment):
+    
+    Source/WebCore/PAL:
+    
+    <rdar://problem/55469706>
+    
+    Reviewed by Brady Eidson.
+    
+    Soft-linked PKPassKitErrorDomain and included PassKit headers more judiciously.
+    
+    * pal/cocoa/PassKitSoftLink.h:
+    * pal/cocoa/PassKitSoftLink.mm:
+    * pal/spi/cocoa/PassKitSPI.h:
+    
+    Source/WebKit:
+    
+    <rdar://problem/55469706>
+    
+    Reviewed by Brady Eidson.
+    
+    Remembered the error passed to -[WKPaymentAuthorizationDelegate _willFinishWithError:] and
+    sent it to the WebContent process in Messages::WebPaymentCoordinator::DidCancelPaymentSession.
+    
+    * Platform/cocoa/PaymentAuthorizationPresenter.h:
+    * Platform/cocoa/WKPaymentAuthorizationDelegate.mm:
+    (-[WKPaymentAuthorizationDelegate _didFinish]):
+    (-[WKPaymentAuthorizationDelegate _willFinishWithError:]):
+    * Shared/ApplePay/WebPaymentCoordinatorProxy.cpp:
+    (WebKit::WebPaymentCoordinatorProxy::didCancelPaymentSession):
+    (WebKit::WebPaymentCoordinatorProxy::presenterDidFinish):
+    * Shared/ApplePay/WebPaymentCoordinatorProxy.h:
+    (WebKit::WebPaymentCoordinatorProxy::didCancelPaymentSession):
+    * Shared/ApplePay/ios/WebPaymentCoordinatorProxyIOS.mm:
+    * Shared/Cocoa/WebCoreArgumentCodersCocoa.mm:
+    (IPC::ArgumentCoder<WebCore::PaymentSessionError>::encode):
+    (IPC::ArgumentCoder<WebCore::PaymentSessionError>::decode):
+    * Shared/WebCoreArgumentCoders.h:
+    * WebProcess/ApplePay/WebPaymentCoordinator.cpp:
+    (WebKit::WebPaymentCoordinator::networkProcessConnectionClosed):
+    (WebKit::WebPaymentCoordinator::didCancelPaymentSession):
+    * WebProcess/ApplePay/WebPaymentCoordinator.h:
+    * WebProcess/ApplePay/WebPaymentCoordinator.messages.in:
+    
+    LayoutTests:
+    
+    Reviewed by Brady Eidson.
+    
+    * http/tests/ssl/applepay/ApplePayCancelEvent.https-expected.txt: Added.
+    * http/tests/ssl/applepay/ApplePayCancelEvent.https.html: Added.
+
+    2019-09-18  Andy Estes  <aes...@apple.com>
+
+            [Apple Pay] Tell websites why a session was cancelled
+            https://bugs.webkit.org/show_bug.cgi?id=201912
+            <rdar://problem/55469706>
+
+            Reviewed by Brady Eidson.
+
+            Remembered the error passed to -[WKPaymentAuthorizationDelegate _willFinishWithError:] and
+            sent it to the WebContent process in Messages::WebPaymentCoordinator::DidCancelPaymentSession.
+
+            * Platform/cocoa/PaymentAuthorizationPresenter.h:
+            * Platform/cocoa/WKPaymentAuthorizationDelegate.mm:
+            (-[WKPaymentAuthorizationDelegate _didFinish]):
+            (-[WKPaymentAuthorizationDelegate _willFinishWithError:]):
+            * Shared/ApplePay/WebPaymentCoordinatorProxy.cpp:
+            (WebKit::WebPaymentCoordinatorProxy::didCancelPaymentSession):
+            (WebKit::WebPaymentCoordinatorProxy::presenterDidFinish):
+            * Shared/ApplePay/WebPaymentCoordinatorProxy.h:
+            (WebKit::WebPaymentCoordinatorProxy::didCancelPaymentSession):
+            * Shared/ApplePay/ios/WebPaymentCoordinatorProxyIOS.mm:
+            * Shared/Cocoa/WebCoreArgumentCodersCocoa.mm:
+            (IPC::ArgumentCoder<WebCore::PaymentSessionError>::encode):
+            (IPC::ArgumentCoder<WebCore::PaymentSessionError>::decode):
+            * Shared/WebCoreArgumentCoders.h:
+            * WebProcess/ApplePay/WebPaymentCoordinator.cpp:
+            (WebKit::WebPaymentCoordinator::networkProcessConnectionClosed):
+            (WebKit::WebPaymentCoordinator::didCancelPaymentSession):
+            * WebProcess/ApplePay/WebPaymentCoordinator.h:
+            * WebProcess/ApplePay/WebPaymentCoordinator.messages.in:
+
+2019-09-23  Alan Coon  <alanc...@apple.com>
+
         Apply patch. rdar://problem/55608007
 
     2019-09-23  Chris Dumez  <cdu...@apple.com>

Modified: branches/safari-608-branch/Source/WebKit/Platform/cocoa/PaymentAuthorizationPresenter.h (250265 => 250266)


--- branches/safari-608-branch/Source/WebKit/Platform/cocoa/PaymentAuthorizationPresenter.h	2019-09-23 23:49:58 UTC (rev 250265)
+++ branches/safari-608-branch/Source/WebKit/Platform/cocoa/PaymentAuthorizationPresenter.h	2019-09-23 23:50:11 UTC (rev 250266)
@@ -41,6 +41,7 @@
 class PaymentContact;
 class PaymentMerchantSession;
 class PaymentMethod;
+class PaymentSessionError;
 }
 
 namespace WebKit {
@@ -53,7 +54,7 @@
         virtual ~Client() = default;
 
         virtual void presenterDidAuthorizePayment(PaymentAuthorizationPresenter&, const WebCore::Payment&) = 0;
-        virtual void presenterDidFinish(PaymentAuthorizationPresenter&, bool didReachFinalState) = 0;
+        virtual void presenterDidFinish(PaymentAuthorizationPresenter&, WebCore::PaymentSessionError&&, bool didReachFinalState) = 0;
         virtual void presenterDidSelectPaymentMethod(PaymentAuthorizationPresenter&, const WebCore::PaymentMethod&) = 0;
         virtual void presenterDidSelectShippingContact(PaymentAuthorizationPresenter&, const WebCore::PaymentContact&) = 0;
         virtual void presenterDidSelectShippingMethod(PaymentAuthorizationPresenter&, const WebCore::ApplePaySessionPaymentRequest::ShippingMethod&) = 0;

Modified: branches/safari-608-branch/Source/WebKit/Platform/cocoa/WKPaymentAuthorizationDelegate.mm (250265 => 250266)


--- branches/safari-608-branch/Source/WebKit/Platform/cocoa/WKPaymentAuthorizationDelegate.mm	2019-09-23 23:49:58 UTC (rev 250265)
+++ branches/safari-608-branch/Source/WebKit/Platform/cocoa/WKPaymentAuthorizationDelegate.mm	2019-09-23 23:50:11 UTC (rev 250266)
@@ -30,10 +30,12 @@
 
 #import <WebCore/Payment.h>
 #import <WebCore/PaymentMethod.h>
+#import <WebCore/PaymentSessionError.h>
 
 @implementation WKPaymentAuthorizationDelegate {
     RetainPtr<NSArray<PKPaymentSummaryItem *>> _summaryItems;
     RetainPtr<NSArray<PKShippingMethod *>> _shippingMethods;
+    RetainPtr<NSError> _sessionError;
     WeakPtr<WebKit::PaymentAuthorizationPresenter> _presenter;
     WebKit::DidAuthorizePaymentCompletion _didAuthorizePaymentCompletion;
     WebKit::DidRequestMerchantSessionCompletion _didRequestMerchantSessionCompletion;
@@ -142,7 +144,7 @@
 - (void)_didFinish
 {
     if (auto presenter = _presenter.get())
-        presenter->client().presenterDidFinish(*presenter, _didReachFinalState);
+        presenter->client().presenterDidFinish(*presenter, { std::exchange(_sessionError, nil) }, _didReachFinalState);
 }
 
 - (void)_didRequestMerchantSession:(WebKit::DidRequestMerchantSessionCompletion::BlockType)completion
@@ -225,6 +227,10 @@
 
 - (void)_willFinishWithError:(NSError *)error
 {
+    if (![error.domain isEqualToString:PAL::get_PassKit_PKPassKitErrorDomain()])
+        return;
+
+    _sessionError = error;
 }
 
 @end

Modified: branches/safari-608-branch/Source/WebKit/Shared/ApplePay/WebPaymentCoordinatorProxy.cpp (250265 => 250266)


--- branches/safari-608-branch/Source/WebKit/Shared/ApplePay/WebPaymentCoordinatorProxy.cpp	2019-09-23 23:49:58 UTC (rev 250265)
+++ branches/safari-608-branch/Source/WebKit/Shared/ApplePay/WebPaymentCoordinatorProxy.cpp	2019-09-23 23:50:11 UTC (rev 250266)
@@ -216,10 +216,10 @@
     didCancelPaymentSession();
 }
 
-void WebPaymentCoordinatorProxy::didCancelPaymentSession()
+void WebPaymentCoordinatorProxy::didCancelPaymentSession(WebCore::PaymentSessionError&& error)
 {
     ASSERT(canCancel());
-    send(Messages::WebPaymentCoordinator::DidCancelPaymentSession());
+    send(Messages::WebPaymentCoordinator::DidCancelPaymentSession(WTFMove(error)));
     hidePaymentUI();
     didReachFinalState();
 }
@@ -238,10 +238,10 @@
     send(Messages::WebPaymentCoordinator::DidAuthorizePayment(payment));
 }
 
-void WebPaymentCoordinatorProxy::presenterDidFinish(PaymentAuthorizationPresenter&, bool didReachFinalState)
+void WebPaymentCoordinatorProxy::presenterDidFinish(PaymentAuthorizationPresenter&, WebCore::PaymentSessionError&& error, bool didReachFinalState)
 {
     if (!didReachFinalState)
-        didCancelPaymentSession();
+        didCancelPaymentSession(WTFMove(error));
     else
         hidePaymentUI();
 }

Modified: branches/safari-608-branch/Source/WebKit/Shared/ApplePay/WebPaymentCoordinatorProxy.h (250265 => 250266)


--- branches/safari-608-branch/Source/WebKit/Shared/ApplePay/WebPaymentCoordinatorProxy.h	2019-09-23 23:49:58 UTC (rev 250265)
+++ branches/safari-608-branch/Source/WebKit/Shared/ApplePay/WebPaymentCoordinatorProxy.h	2019-09-23 23:50:11 UTC (rev 250266)
@@ -107,7 +107,7 @@
     
     // PaymentAuthorizationPresenter::Client
     void presenterDidAuthorizePayment(PaymentAuthorizationPresenter&, const WebCore::Payment&) final;
-    void presenterDidFinish(PaymentAuthorizationPresenter&, bool didReachFinalState) final;
+    void presenterDidFinish(PaymentAuthorizationPresenter&, WebCore::PaymentSessionError&&, bool didReachFinalState) final;
     void presenterDidSelectPaymentMethod(PaymentAuthorizationPresenter&, const WebCore::PaymentMethod&) final;
     void presenterDidSelectShippingContact(PaymentAuthorizationPresenter&, const WebCore::PaymentContact&) final;
     void presenterDidSelectShippingMethod(PaymentAuthorizationPresenter&, const WebCore::ApplePaySessionPaymentRequest::ShippingMethod&) final;
@@ -131,7 +131,7 @@
     bool canCompletePayment() const;
     bool canAbort() const;
 
-    void didCancelPaymentSession();
+    void didCancelPaymentSession(WebCore::PaymentSessionError&& = { });
     void didReachFinalState();
     void hidePaymentUI();
 

Modified: branches/safari-608-branch/Source/WebKit/Shared/ApplePay/ios/WebPaymentCoordinatorProxyIOS.mm (250265 => 250266)


--- branches/safari-608-branch/Source/WebKit/Shared/ApplePay/ios/WebPaymentCoordinatorProxyIOS.mm	2019-09-23 23:49:58 UTC (rev 250265)
+++ branches/safari-608-branch/Source/WebKit/Shared/ApplePay/ios/WebPaymentCoordinatorProxyIOS.mm	2019-09-23 23:50:11 UTC (rev 250266)
@@ -31,7 +31,6 @@
 #import "APIUIClient.h"
 #import "PaymentAuthorizationPresenter.h"
 #import "WebPageProxy.h"
-#import <PassKit/PassKit.h>
 #import <UIKit/UIViewController.h>
 #import <WebCore/PaymentAuthorizationStatus.h>
 #import <pal/cocoa/PassKitSoftLink.h>

Modified: branches/safari-608-branch/Source/WebKit/Shared/Cocoa/WebCoreArgumentCodersCocoa.mm (250265 => 250266)


--- branches/safari-608-branch/Source/WebKit/Shared/Cocoa/WebCoreArgumentCodersCocoa.mm	2019-09-23 23:49:58 UTC (rev 250265)
+++ branches/safari-608-branch/Source/WebKit/Shared/Cocoa/WebCoreArgumentCodersCocoa.mm	2019-09-23 23:50:11 UTC (rev 250266)
@@ -430,6 +430,20 @@
     return {{ WTFMove(*newTotalAndLineItems) }};
 }
 
+void ArgumentCoder<WebCore::PaymentSessionError>::encode(Encoder& encoder, const WebCore::PaymentSessionError& error)
+{
+    encoder << error.platformError();
+}
+
+Optional<WebCore::PaymentSessionError> ArgumentCoder<WebCore::PaymentSessionError>::decode(Decoder& decoder)
+{
+    auto platformError = IPC::decode<NSError>(decoder);
+    if (!platformError)
+        return WTF::nullopt;
+
+    return { WTFMove(*platformError) };
+}
+
 #endif // ENABLE(APPLEPAY)
 
 void ArgumentCoder<WebCore::DictionaryPopupInfo>::encodePlatformData(Encoder& encoder, const WebCore::DictionaryPopupInfo& info)

Modified: branches/safari-608-branch/Source/WebKit/Shared/WebCoreArgumentCoders.h (250265 => 250266)


--- branches/safari-608-branch/Source/WebKit/Shared/WebCoreArgumentCoders.h	2019-09-23 23:49:58 UTC (rev 250265)
+++ branches/safari-608-branch/Source/WebKit/Shared/WebCoreArgumentCoders.h	2019-09-23 23:50:11 UTC (rev 250266)
@@ -697,6 +697,11 @@
     static Optional<WebCore::ShippingMethodUpdate> decode(Decoder&);
 };
 
+template<> struct ArgumentCoder<WebCore::PaymentSessionError> {
+    static void encode(Encoder&, const WebCore::PaymentSessionError&);
+    static Optional<WebCore::PaymentSessionError> decode(Decoder&);
+};
+
 #endif
 
 #if ENABLE(MEDIA_STREAM)

Modified: branches/safari-608-branch/Source/WebKit/WebProcess/ApplePay/WebPaymentCoordinator.cpp (250265 => 250266)


--- branches/safari-608-branch/Source/WebKit/WebProcess/ApplePay/WebPaymentCoordinator.cpp	2019-09-23 23:49:58 UTC (rev 250265)
+++ branches/safari-608-branch/Source/WebKit/WebProcess/ApplePay/WebPaymentCoordinator.cpp	2019-09-23 23:50:11 UTC (rev 250266)
@@ -55,7 +55,7 @@
 {
 #if ENABLE(APPLE_PAY_REMOTE_UI)
     if (remoteUIEnabled())
-        didCancelPaymentSession();
+        didCancelPaymentSession({ });
 #endif
 }
 
@@ -196,9 +196,9 @@
     paymentCoordinator().didSelectPaymentMethod(paymentMethod);
 }
 
-void WebPaymentCoordinator::didCancelPaymentSession()
+void WebPaymentCoordinator::didCancelPaymentSession(WebCore::PaymentSessionError&& sessionError)
 {
-    paymentCoordinator().didCancelPaymentSession();
+    paymentCoordinator().didCancelPaymentSession(WTFMove(sessionError));
 }
 
 WebCore::PaymentCoordinator& WebPaymentCoordinator::paymentCoordinator()

Modified: branches/safari-608-branch/Source/WebKit/WebProcess/ApplePay/WebPaymentCoordinator.h (250265 => 250266)


--- branches/safari-608-branch/Source/WebKit/WebProcess/ApplePay/WebPaymentCoordinator.h	2019-09-23 23:49:58 UTC (rev 250265)
+++ branches/safari-608-branch/Source/WebKit/WebProcess/ApplePay/WebPaymentCoordinator.h	2019-09-23 23:50:11 UTC (rev 250266)
@@ -43,6 +43,7 @@
 namespace WebCore {
 class PaymentCoordinator;
 class PaymentContact;
+class PaymentSessionError;
 }
 
 namespace WebKit {
@@ -94,7 +95,7 @@
     void didSelectShippingMethod(const WebCore::ApplePaySessionPaymentRequest::ShippingMethod&);
     void didSelectShippingContact(const WebCore::PaymentContact&);
     void didSelectPaymentMethod(const WebCore::PaymentMethod&);
-    void didCancelPaymentSession();
+    void didCancelPaymentSession(WebCore::PaymentSessionError&&);
 
     WebCore::PaymentCoordinator& paymentCoordinator();
 

Modified: branches/safari-608-branch/Source/WebKit/WebProcess/ApplePay/WebPaymentCoordinator.messages.in (250265 => 250266)


--- branches/safari-608-branch/Source/WebKit/WebProcess/ApplePay/WebPaymentCoordinator.messages.in	2019-09-23 23:49:58 UTC (rev 250265)
+++ branches/safari-608-branch/Source/WebKit/WebProcess/ApplePay/WebPaymentCoordinator.messages.in	2019-09-23 23:50:11 UTC (rev 250266)
@@ -31,7 +31,7 @@
     DidSelectShippingMethod(WebCore::ApplePaySessionPaymentRequest::ShippingMethod shippingMethod)
     DidSelectShippingContact(WebCore::PaymentContact shippingContact)
     DidSelectPaymentMethod(WebCore::PaymentMethod paymentMethod)
-    DidCancelPaymentSession()
+    DidCancelPaymentSession(WebCore::PaymentSessionError sessionError)
 }
 
 #endif
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to