[Apple Pay] Tell websites why a session was cancelled
authoraestes@apple.com <aestes@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 18 Sep 2019 19:13:33 +0000 (19:13 +0000)
committeraestes@apple.com <aestes@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 18 Sep 2019 19:13:33 +0000 (19:13 +0000)
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.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@250048 268f45cc-cd09-0410-ab3c-d52691b4dbfc

44 files changed:
LayoutTests/ChangeLog
LayoutTests/http/tests/ssl/applepay/ApplePayCancelEvent.https-expected.txt [new file with mode: 0644]
LayoutTests/http/tests/ssl/applepay/ApplePayCancelEvent.https.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/DerivedSources-input.xcfilelist
Source/WebCore/DerivedSources-output.xcfilelist
Source/WebCore/DerivedSources.make
Source/WebCore/Modules/applepay/ApplePayCancelEvent.cpp [new file with mode: 0644]
Source/WebCore/Modules/applepay/ApplePayCancelEvent.h [new file with mode: 0644]
Source/WebCore/Modules/applepay/ApplePayCancelEvent.idl [new file with mode: 0644]
Source/WebCore/Modules/applepay/ApplePaySession.cpp
Source/WebCore/Modules/applepay/ApplePaySession.h
Source/WebCore/Modules/applepay/ApplePaySessionError.h [new file with mode: 0644]
Source/WebCore/Modules/applepay/ApplePaySessionError.idl [new file with mode: 0644]
Source/WebCore/Modules/applepay/PaymentCoordinator.cpp
Source/WebCore/Modules/applepay/PaymentCoordinator.h
Source/WebCore/Modules/applepay/PaymentHeaders.h
Source/WebCore/Modules/applepay/PaymentSession.cpp
Source/WebCore/Modules/applepay/PaymentSession.h
Source/WebCore/Modules/applepay/PaymentSessionError.h [new file with mode: 0644]
Source/WebCore/Modules/applepay/cocoa/PaymentSessionErrorCocoa.mm [new file with mode: 0644]
Source/WebCore/Modules/applepay/paymentrequest/ApplePayPaymentHandler.cpp
Source/WebCore/Modules/applepay/paymentrequest/ApplePayPaymentHandler.h
Source/WebCore/Modules/webgpu/WHLSL/WHLSLCheckTextureReferences.cpp
Source/WebCore/Modules/webgpu/WHLSL/WHLSLPropertyResolver.cpp
Source/WebCore/PAL/ChangeLog
Source/WebCore/PAL/pal/cocoa/PassKitSoftLink.h
Source/WebCore/PAL/pal/cocoa/PassKitSoftLink.mm
Source/WebCore/PAL/pal/spi/cocoa/PassKitSPI.h
Source/WebCore/SourcesCocoa.txt
Source/WebCore/WebCore.xcodeproj/project.pbxproj
Source/WebCore/dom/EventNames.in
Source/WebCore/testing/MockPaymentCoordinator.cpp
Source/WebKit/ChangeLog
Source/WebKit/Platform/cocoa/PaymentAuthorizationPresenter.h
Source/WebKit/Platform/cocoa/WKPaymentAuthorizationDelegate.mm
Source/WebKit/Shared/ApplePay/WebPaymentCoordinatorProxy.cpp
Source/WebKit/Shared/ApplePay/WebPaymentCoordinatorProxy.h
Source/WebKit/Shared/ApplePay/ios/WebPaymentCoordinatorProxyIOS.mm
Source/WebKit/Shared/Cocoa/WebCoreArgumentCodersCocoa.mm
Source/WebKit/Shared/WebCoreArgumentCoders.h
Source/WebKit/WebProcess/ApplePay/WebPaymentCoordinator.cpp
Source/WebKit/WebProcess/ApplePay/WebPaymentCoordinator.h
Source/WebKit/WebProcess/ApplePay/WebPaymentCoordinator.messages.in

index 66670eb..f8787fd 100644 (file)
@@ -1,3 +1,13 @@
+2019-09-18  Andy Estes  <aestes@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-18  Russell Epstein  <repstein@apple.com>
 
         REGRESSION: (Catalina) fast/images/async-image-multiple-clients-repaint.html is a flakey failure.
diff --git a/LayoutTests/http/tests/ssl/applepay/ApplePayCancelEvent.https-expected.txt b/LayoutTests/http/tests/ssl/applepay/ApplePayCancelEvent.https-expected.txt
new file mode 100644 (file)
index 0000000..7cbcdad
--- /dev/null
@@ -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
+
diff --git a/LayoutTests/http/tests/ssl/applepay/ApplePayCancelEvent.https.html b/LayoutTests/http/tests/ssl/applepay/ApplePayCancelEvent.https.html
new file mode 100644 (file)
index 0000000..9e7221a
--- /dev/null
@@ -0,0 +1,47 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<script src="/js-test-resources/ui-helper.js"></script>
+<script src="/resources/js-test-pre.js"></script>
+<script src="/resources/payment-request.js"></script>
+</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="/resources/js-test-post.js"></script>
+</body>
+</html>
index 0462122..477f74b 100644 (file)
@@ -1,3 +1,56 @@
+2019-09-18  Andy Estes  <aestes@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-18  Chris Dumez  <cdumez@apple.com>
 
         WebSWContextManagerConnection::installServiceWorker IPC no longer need a sessionID
index beac9f5..2f98f9e 100644 (file)
@@ -19,6 +19,7 @@ $(JAVASCRIPTCORE_PRIVATE_HEADERS_DIR)/xxd.pl
 $(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/ApplePayPaymentPass.idl
 $(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
index c79a245..93c5c86 100644 (file)
@@ -66,6 +66,8 @@ $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSAnimationPlaybackEventInit.cpp
 $(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.cpp
 $(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
index 9705f77..2840efd 100644 (file)
@@ -94,6 +94,7 @@ VPATH = \
 
 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 \
@@ -112,6 +113,7 @@ JS_BINDING_IDLS = \
     $(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 \
diff --git a/Source/WebCore/Modules/applepay/ApplePayCancelEvent.cpp b/Source/WebCore/Modules/applepay/ApplePayCancelEvent.cpp
new file mode 100644 (file)
index 0000000..4e479c5
--- /dev/null
@@ -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)
diff --git a/Source/WebCore/Modules/applepay/ApplePayCancelEvent.h b/Source/WebCore/Modules/applepay/ApplePayCancelEvent.h
new file mode 100644 (file)
index 0000000..428823b
--- /dev/null
@@ -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)
diff --git a/Source/WebCore/Modules/applepay/ApplePayCancelEvent.idl b/Source/WebCore/Modules/applepay/ApplePayCancelEvent.idl
new file mode 100644 (file)
index 0000000..61cf640
--- /dev/null
@@ -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;
+};
index 375509e..85a02be 100644 (file)
@@ -28,6 +28,7 @@
 
 #if ENABLE(APPLE_PAY)
 
+#include "ApplePayCancelEvent.h"
 #include "ApplePayLineItem.h"
 #include "ApplePayPaymentAuthorizationResult.h"
 #include "ApplePayPaymentAuthorizedEvent.h"
@@ -812,13 +813,13 @@ void ApplePaySession::didSelectPaymentMethod(const PaymentMethod& paymentMethod)
     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();
index c09eb29..b68ad90 100644 (file)
@@ -117,7 +117,7 @@ private:
     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;
 
diff --git a/Source/WebCore/Modules/applepay/ApplePaySessionError.h b/Source/WebCore/Modules/applepay/ApplePaySessionError.h
new file mode 100644 (file)
index 0000000..1d64e85
--- /dev/null
@@ -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)
diff --git a/Source/WebCore/Modules/applepay/ApplePaySessionError.idl b/Source/WebCore/Modules/applepay/ApplePaySessionError.idl
new file mode 100644 (file)
index 0000000..b306bc9
--- /dev/null
@@ -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;
+};
index ed8b912..1e2b23b 100644 (file)
@@ -233,7 +233,7 @@ void PaymentCoordinator::didSelectShippingContact(const PaymentContact& shipping
     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 @@ void PaymentCoordinator::didCancelPaymentSession()
     }
 
     RELEASE_LOG_IF_ALLOWED("didCancelPaymentSession()");
-    m_activeSession->didCancelPaymentSession();
+    m_activeSession->didCancelPaymentSession(WTFMove(error));
     m_activeSession = nullptr;
 }
 
index edda854..1a4af3b 100644 (file)
@@ -40,6 +40,7 @@ class PaymentContact;
 class PaymentMerchantSession;
 class PaymentMethod;
 class PaymentSession;
+class PaymentSessionError;
 enum class PaymentAuthorizationStatus;
 struct PaymentAuthorizationResult;
 struct PaymentMethodUpdate;
@@ -75,7 +76,7 @@ public:
     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;
 
index f1e7e09..3f1b04e 100644 (file)
@@ -30,4 +30,4 @@
 #include "PaymentContact.h"
 #include "PaymentMerchantSession.h"
 #include "PaymentMethod.h"
-
+#include "PaymentSessionError.h"
index 15255f0..1bee562 100644 (file)
@@ -32,6 +32,7 @@
 #include "Document.h"
 #include "DocumentLoader.h"
 #include "Page.h"
+#include "PaymentCoordinator.h"
 #include "SecurityOrigin.h"
 
 namespace WebCore {
index 3222f59..ce5cf53 100644 (file)
@@ -37,6 +37,8 @@ class Document;
 class Payment;
 class PaymentContact;
 class PaymentMethod;
+class PaymentSessionError;
+class ScriptExecutionContext;
 
 class PaymentSession : public virtual PaymentSessionBase {
 public:
@@ -49,7 +51,7 @@ public:
     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
diff --git a/Source/WebCore/Modules/applepay/PaymentSessionError.h b/Source/WebCore/Modules/applepay/PaymentSessionError.h
new file mode 100644 (file)
index 0000000..ac63cc6
--- /dev/null
@@ -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)
diff --git a/Source/WebCore/Modules/applepay/cocoa/PaymentSessionErrorCocoa.mm b/Source/WebCore/Modules/applepay/cocoa/PaymentSessionErrorCocoa.mm
new file mode 100644 (file)
index 0000000..8e13be8
--- /dev/null
@@ -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)
index d97b5d8..d34d7cd 100644 (file)
@@ -592,7 +592,7 @@ void ApplePayPaymentHandler::didSelectPaymentMethod(const PaymentMethod& payment
     });
 }
 
-void ApplePayPaymentHandler::didCancelPaymentSession()
+void ApplePayPaymentHandler::didCancelPaymentSession(PaymentSessionError&&)
 {
     m_paymentRequest->cancel();
 }
index 803b54f..82b91b6 100644 (file)
@@ -80,7 +80,7 @@ private:
     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;
index 3b3a692..d65bdd6 100644 (file)
@@ -30,6 +30,7 @@
 
 #include "WHLSLArrayReferenceType.h"
 #include "WHLSLArrayType.h"
+#include "WHLSLFunctionDefinition.h"
 #include "WHLSLInferTypes.h"
 #include "WHLSLNativeTypeDeclaration.h"
 #include "WHLSLPointerType.h"
index 3ba1cd6..fc59959 100644 (file)
@@ -29,6 +29,8 @@
 #if ENABLE(WEBGPU)
 
 #include "WHLSLAST.h"
+#include "WHLSLProgram.h"
+#include "WHLSLReplaceWith.h"
 #include "WHLSLVisitor.h"
 
 namespace WebCore {
index 7294c6a..a0caa4f 100644 (file)
@@ -1,3 +1,17 @@
+2019-09-18  Andy Estes  <aestes@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  Keith Rollin  <krollin@apple.com>
 
         Remove some support for < iOS 12
index 49a5ada..98d2095 100644 (file)
@@ -60,6 +60,7 @@ SOFT_LINK_CONSTANT_FOR_HEADER(PAL, PassKit, PKContactFieldPhoneNumber, PKContact
 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)
 
index 34ee8e5..4df5255 100644 (file)
@@ -64,6 +64,7 @@ SOFT_LINK_CONSTANT_FOR_SOURCE_WITH_EXPORT(PAL, PassKit, PKContactFieldPhoneNumbe
 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)
 
index c23a98c..a5bb5c0 100644 (file)
@@ -39,9 +39,14 @@ WTF_EXTERN_C_END
 
 #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/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)
index ec01b82..525bafc 100644 (file)
@@ -571,6 +571,7 @@ WHLSLStandardLibraryFunctionMap.cpp
 
 #if ENABLE_APPLE_PAY
 
+    Modules/applepay/ApplePayCancelEvent.cpp
     Modules/applepay/ApplePayContactField.cpp
     Modules/applepay/ApplePayError.cpp
     Modules/applepay/ApplePayMerchantCapability.cpp
@@ -591,9 +592,11 @@ WHLSLStandardLibraryFunctionMap.cpp
     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
@@ -614,6 +617,7 @@ WHLSLStandardLibraryFunctionMap.cpp
     JSApplePayRequest.cpp
     JSApplePayRequestBase.cpp
     JSApplePaySession.cpp
+    JSApplePaySessionError.cpp
     JSApplePayShippingContactSelectedEvent.cpp
     JSApplePayShippingContactUpdate.cpp
     JSApplePayShippingMethod.cpp
index deeddb5..72dc12b 100644 (file)
                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 */; };
                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 */; };
                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 */; };
                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>"; };
                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>"; };
                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>"; };
                        children = (
                                1A58E8691D19D8C000C0EA73 /* cocoa */,
                                A1DF5A9F1F7EE0F10058A477 /* paymentrequest */,
+                               A113E02C2331A0E4009C33A0 /* ApplePayCancelEvent.cpp */,
+                               A113E02B2331A0E4009C33A0 /* ApplePayCancelEvent.h */,
+                               A1956F182331A4680057E9D2 /* ApplePayCancelEvent.idl */,
                                A1DF5AB41F8078F30058A477 /* ApplePayContactField.cpp */,
                                A1DF5A911F7EC4320058A477 /* ApplePayContactField.h */,
                                A1DF5A931F7EC4320058A477 /* ApplePayContactField.idl */,
                                1A8A64441D19FCFB00D0E00F /* ApplePaySession.cpp */,
                                1A8A64451D19FCFB00D0E00F /* ApplePaySession.h */,
                                1A8A64461D19FCFB00D0E00F /* ApplePaySession.idl */,
+                               A1956F1D2331A8C70057E9D2 /* ApplePaySessionError.h */,
+                               A1956F1F2331A8C70057E9D2 /* ApplePaySessionError.idl */,
                                1A58E8631D19D4DF00C0EA73 /* ApplePaySessionPaymentRequest.cpp */,
                                1A58E8641D19D4DF00C0EA73 /* ApplePaySessionPaymentRequest.h */,
                                1A8A64471D19FCFB00D0E00F /* ApplePayShippingContactSelectedEvent.cpp */,
                                1A8A64651D19FDFF00D0E00F /* PaymentRequestValidator.mm */,
                                A1C2C5751FA2851600BA46FA /* PaymentSession.cpp */,
                                A1491DA21F859D870095F5D4 /* PaymentSession.h */,
+                               A113E02723318293009C33A0 /* PaymentSessionError.h */,
                        );
                        path = applepay;
                        sourceTree = "<group>";
                                1A8A646A1D19FF8700D0E00F /* PaymentContactCocoa.mm */,
                                1ADA4A1B1D22F2C0005A9A15 /* PaymentMerchantSessionCocoa.mm */,
                                1A8A646B1D19FF8700D0E00F /* PaymentMethodCocoa.mm */,
+                               A113E02A23318EBC009C33A0 /* PaymentSessionErrorCocoa.mm */,
                        );
                        path = cocoa;
                        sourceTree = "<group>";
                1AE96A791D1A0A5C00B86768 /* ApplePay */ = {
                        isa = PBXGroup;
                        children = (
+                               A1956F1A2331A6460057E9D2 /* JSApplePayCancelEvent.cpp */,
+                               A1956F1B2331A6460057E9D2 /* JSApplePayCancelEvent.h */,
                                A1DF5A981F7EC8C00058A477 /* JSApplePayContactField.cpp */,
                                A1DF5A971F7EC8BF0058A477 /* JSApplePayContactField.h */,
                                1ADFDFE11E71DCA0008F5D34 /* JSApplePayError.cpp */,
                                A1DF5AB11F8077520058A477 /* JSApplePayRequestBase.h */,
                                1AE96A7E1D1A0A8000B86768 /* JSApplePaySession.cpp */,
                                1AE96A7F1D1A0A8000B86768 /* JSApplePaySession.h */,
+                               A1D506132331ED970014EE4E /* JSApplePaySessionError.cpp */,
+                               A1D506112331ED960014EE4E /* JSApplePaySessionError.h */,
                                1AE96A801D1A0A8000B86768 /* JSApplePayShippingContactSelectedEvent.cpp */,
                                1AE96A811D1A0A8000B86768 /* JSApplePayShippingContactSelectedEvent.h */,
                                1ADFDFE71E71DCA0008F5D34 /* JSApplePayShippingContactUpdate.cpp */,
                                D03C849E21FFCF000002227F /* GPUCompareFunction.idl */,
                                D03C84A221FFD7230002227F /* GPUDepthStencilStateDescriptor.idl */,
                                D09AFB0622D417B300C4538C /* GPUErrorFilter.idl */,
-                               D03586B222D7F2EA00DA0284 /* GPUErrorScopes.cpp */,
-                               D03586B122D7F2EA00DA0284 /* GPUErrorScopes.h */,
                                D026F480220A2B7000AC5F49 /* GPUExtent3D.idl */,
                                D08AA02D220D0B9C0058C502 /* GPULoadOp.idl */,
                                D0CCA94922299F97006979B6 /* GPUOrigin3D.h */,
                                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 */,
                                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 */,
                                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 */,
                                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 */,
                                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 */,
                                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 */,
index ebc2425..752ffd3 100644 (file)
@@ -41,6 +41,7 @@ WebKitAnimationEvent
 WebKitTransitionEvent
 WheelEvent
 XMLHttpRequestProgressEvent
+ApplePayCancelEvent conditional=APPLE_PAY
 ApplePayPaymentAuthorizedEvent conditional=APPLE_PAY
 ApplePayPaymentMethodSelectedEvent conditional=APPLE_PAY
 ApplePayShippingContactSelectedEvent conditional=APPLE_PAY
index fa40bc0..03605d5 100644 (file)
@@ -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::acceptPayment()
 void MockPaymentCoordinator::cancelPayment()
 {
     dispatchIfShowing([page = &m_page] {
-        page->paymentCoordinator().didCancelPaymentSession();
+        page->paymentCoordinator().didCancelPaymentSession({ });
         ++hideCount;
         ASSERT(showCount == hideCount);
     });
index 1f01b76..10a7057 100644 (file)
@@ -1,3 +1,34 @@
+2019-09-18  Andy Estes  <aestes@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-18  Chris Dumez  <cdumez@apple.com>
 
         WebSWContextManagerConnection::installServiceWorker IPC no longer need a sessionID
index 3db120c..cb64af9 100644 (file)
@@ -41,6 +41,7 @@ class Payment;
 class PaymentContact;
 class PaymentMerchantSession;
 class PaymentMethod;
+class PaymentSessionError;
 }
 
 namespace WebKit {
@@ -53,7 +54,7 @@ public:
         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;
index 8bfc00e..fa3e8bb 100644 (file)
 
 #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;
 - (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
@@ -207,6 +209,10 @@ static WebCore::ApplePaySessionPaymentRequest::ShippingMethod toShippingMethod(P
 
 - (void)_willFinishWithError:(NSError *)error
 {
+    if (![error.domain isEqualToString:PAL::get_PassKit_PKPassKitErrorDomain()])
+        return;
+
+    _sessionError = error;
 }
 
 @end
index 59d1ca6..2b23178 100644 (file)
@@ -216,10 +216,10 @@ void WebPaymentCoordinatorProxy::cancelPaymentSession()
     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 @@ void WebPaymentCoordinatorProxy::presenterDidAuthorizePayment(PaymentAuthorizati
     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();
 }
index 5177c7a..6b36773 100644 (file)
@@ -108,7 +108,7 @@ private:
     
     // 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;
@@ -132,7 +132,7 @@ private:
     bool canCompletePayment() const;
     bool canAbort() const;
 
-    void didCancelPaymentSession();
+    void didCancelPaymentSession(WebCore::PaymentSessionError&& = { });
     void didReachFinalState();
     void hidePaymentUI();
 
index e13d768..c1a6478 100644 (file)
@@ -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>
index 9f41854..ee00377 100644 (file)
@@ -430,6 +430,20 @@ Optional<WebCore::ShippingMethodUpdate> ArgumentCoder<WebCore::ShippingMethodUpd
     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)
index 3163417..9d6cd34 100644 (file)
@@ -697,6 +697,11 @@ template<> struct ArgumentCoder<WebCore::ShippingMethodUpdate> {
     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)
index eadc345..710a920 100644 (file)
@@ -55,7 +55,7 @@ void WebPaymentCoordinator::networkProcessConnectionClosed()
 {
 #if ENABLE(APPLE_PAY_REMOTE_UI)
     if (remoteUIEnabled())
-        didCancelPaymentSession();
+        didCancelPaymentSession({ });
 #endif
 }
 
@@ -196,9 +196,9 @@ void WebPaymentCoordinator::didSelectPaymentMethod(const WebCore::PaymentMethod&
     paymentCoordinator().didSelectPaymentMethod(paymentMethod);
 }
 
-void WebPaymentCoordinator::didCancelPaymentSession()
+void WebPaymentCoordinator::didCancelPaymentSession(WebCore::PaymentSessionError&& sessionError)
 {
-    paymentCoordinator().didCancelPaymentSession();
+    paymentCoordinator().didCancelPaymentSession(WTFMove(sessionError));
 }
 
 WebCore::PaymentCoordinator& WebPaymentCoordinator::paymentCoordinator()
index f2d62ea..dd82d5d 100644 (file)
@@ -43,6 +43,7 @@ class DataReference;
 namespace WebCore {
 class PaymentCoordinator;
 class PaymentContact;
+class PaymentSessionError;
 }
 
 namespace WebKit {
@@ -95,7 +96,7 @@ private:
     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();
 
index 701f83a..4d4a6f3 100644 (file)
@@ -31,7 +31,7 @@ messages -> WebPaymentCoordinator {
     DidSelectShippingMethod(WebCore::ApplePaySessionPaymentRequest::ShippingMethod shippingMethod)
     DidSelectShippingContact(WebCore::PaymentContact shippingContact)
     DidSelectPaymentMethod(WebCore::PaymentMethod paymentMethod)
-    DidCancelPaymentSession()
+    DidCancelPaymentSession(WebCore::PaymentSessionError sessionError)
 }
 
 #endif