Title: [242681] trunk/Source
Revision
242681
Author
[email protected]
Date
2019-03-09 21:29:42 -0800 (Sat, 09 Mar 2019)

Log Message

[Apple Pay] CanMakePaymentsWithActiveCard and OpenPaymentSetup should be async messages
https://bugs.webkit.org/show_bug.cgi?id=195526
<rdar://problem/48745636>

Reviewed by Chris Dumez.

Source/WebCore:

* Modules/applepay/PaymentCoordinatorClient.h:
* loader/EmptyClients.cpp:
* testing/MockPaymentCoordinator.cpp:
(WebCore::MockPaymentCoordinator::canMakePaymentsWithActiveCard):
(WebCore::MockPaymentCoordinator::openPaymentSetup):
* testing/MockPaymentCoordinator.h:

Source/WebKit:

* Shared/ApplePay/WebPaymentCoordinatorProxy.cpp:
(WebKit::WebPaymentCoordinatorProxy::canMakePaymentsWithActiveCard):
(WebKit::WebPaymentCoordinatorProxy::openPaymentSetup):
* Shared/ApplePay/WebPaymentCoordinatorProxy.h:
* Shared/ApplePay/WebPaymentCoordinatorProxy.messages.in:
* WebProcess/ApplePay/WebPaymentCoordinator.cpp:
(WebKit::WebPaymentCoordinator::canMakePaymentsWithActiveCard):
(WebKit::WebPaymentCoordinator::openPaymentSetup):
(WebKit::generateCanMakePaymentsWithActiveCardReplyID): Deleted.
(WebKit::generateOpenPaymentSetupReplyID): Deleted.
(WebKit::WebPaymentCoordinator::canMakePaymentsWithActiveCardReply): Deleted.
(WebKit::WebPaymentCoordinator::openPaymentSetupReply): Deleted.
* WebProcess/ApplePay/WebPaymentCoordinator.h:
* WebProcess/ApplePay/WebPaymentCoordinator.messages.in:

Source/WebKitLegacy/mac:

* WebCoreSupport/WebPaymentCoordinatorClient.h:
* WebCoreSupport/WebPaymentCoordinatorClient.mm:
(WebPaymentCoordinatorClient::canMakePaymentsWithActiveCard):
(WebPaymentCoordinatorClient::openPaymentSetup):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (242680 => 242681)


--- trunk/Source/WebCore/ChangeLog	2019-03-10 05:28:48 UTC (rev 242680)
+++ trunk/Source/WebCore/ChangeLog	2019-03-10 05:29:42 UTC (rev 242681)
@@ -1,3 +1,18 @@
+2019-03-09  Andy Estes  <[email protected]>
+
+        [Apple Pay] CanMakePaymentsWithActiveCard and OpenPaymentSetup should be async messages
+        https://bugs.webkit.org/show_bug.cgi?id=195526
+        <rdar://problem/48745636>
+
+        Reviewed by Chris Dumez.
+
+        * Modules/applepay/PaymentCoordinatorClient.h:
+        * loader/EmptyClients.cpp:
+        * testing/MockPaymentCoordinator.cpp:
+        (WebCore::MockPaymentCoordinator::canMakePaymentsWithActiveCard):
+        (WebCore::MockPaymentCoordinator::openPaymentSetup):
+        * testing/MockPaymentCoordinator.h:
+
 2019-03-09  Zalan Bujtas  <[email protected]>
 
         [ContentChangeObserver] Click event fires immediately on hover menu at seriouseats.com

Modified: trunk/Source/WebCore/Modules/applepay/PaymentCoordinator.cpp (242680 => 242681)


--- trunk/Source/WebCore/Modules/applepay/PaymentCoordinator.cpp	2019-03-10 05:28:48 UTC (rev 242680)
+++ trunk/Source/WebCore/Modules/applepay/PaymentCoordinator.cpp	2019-03-10 05:29:42 UTC (rev 242681)
@@ -31,6 +31,7 @@
 #include "PaymentAuthorizationStatus.h"
 #include "PaymentCoordinatorClient.h"
 #include "PaymentSession.h"
+#include <wtf/CompletionHandler.h>
 #include <wtf/URL.h>
 
 namespace WebCore {

Modified: trunk/Source/WebCore/Modules/applepay/PaymentCoordinatorClient.h (242680 => 242681)


--- trunk/Source/WebCore/Modules/applepay/PaymentCoordinatorClient.h	2019-03-10 05:28:48 UTC (rev 242680)
+++ trunk/Source/WebCore/Modules/applepay/PaymentCoordinatorClient.h	2019-03-10 05:29:42 UTC (rev 242681)
@@ -49,8 +49,8 @@
 
     virtual Optional<String> validatedPaymentNetwork(const String&) = 0;
     virtual bool canMakePayments() = 0;
-    virtual void canMakePaymentsWithActiveCard(const String& merchantIdentifier, const String& domainName, WTF::Function<void (bool)>&& completionHandler) = 0;
-    virtual void openPaymentSetup(const String& merchantIdentifier, const String& domainName, WTF::Function<void (bool)>&& completionHandler) = 0;
+    virtual void canMakePaymentsWithActiveCard(const String& merchantIdentifier, const String& domainName, CompletionHandler<void(bool)>&&) = 0;
+    virtual void openPaymentSetup(const String& merchantIdentifier, const String& domainName, CompletionHandler<void(bool)>&&) = 0;
 
     virtual bool showPaymentUI(const URL& originatingURL, const Vector<URL>& linkIconURLs, const ApplePaySessionPaymentRequest&) = 0;
     virtual void completeMerchantValidation(const PaymentMerchantSession&) = 0;

Modified: trunk/Source/WebCore/loader/EmptyClients.cpp (242680 => 242681)


--- trunk/Source/WebCore/loader/EmptyClients.cpp	2019-03-10 05:28:48 UTC (rev 242680)
+++ trunk/Source/WebCore/loader/EmptyClients.cpp	2019-03-10 05:29:42 UTC (rev 242681)
@@ -316,8 +316,8 @@
 class EmptyPaymentCoordinatorClient final : public PaymentCoordinatorClient {
     Optional<String> validatedPaymentNetwork(const String&) final { return WTF::nullopt; }
     bool canMakePayments() final { return false; }
-    void canMakePaymentsWithActiveCard(const String&, const String&, WTF::Function<void(bool)>&& completionHandler) final { callOnMainThread([completionHandler = WTFMove(completionHandler)] { completionHandler(false); }); }
-    void openPaymentSetup(const String&, const String&, WTF::Function<void(bool)>&& completionHandler) final { callOnMainThread([completionHandler = WTFMove(completionHandler)] { completionHandler(false); }); }
+    void canMakePaymentsWithActiveCard(const String&, const String&, CompletionHandler<void(bool)>&& completionHandler) final { callOnMainThread([completionHandler = WTFMove(completionHandler)]() mutable { completionHandler(false); }); }
+    void openPaymentSetup(const String&, const String&, CompletionHandler<void(bool)>&& completionHandler) final { callOnMainThread([completionHandler = WTFMove(completionHandler)]() mutable { completionHandler(false); }); }
     bool showPaymentUI(const URL&, const Vector<URL>&, const ApplePaySessionPaymentRequest&) final { return false; }
     void completeMerchantValidation(const PaymentMerchantSession&) final { }
     void completeShippingMethodSelection(Optional<ShippingMethodUpdate>&&) final { }

Modified: trunk/Source/WebCore/testing/MockPaymentCoordinator.cpp (242680 => 242681)


--- trunk/Source/WebCore/testing/MockPaymentCoordinator.cpp	2019-03-10 05:28:48 UTC (rev 242680)
+++ trunk/Source/WebCore/testing/MockPaymentCoordinator.cpp	2019-03-10 05:29:42 UTC (rev 242681)
@@ -34,6 +34,7 @@
 #include "MockPaymentMethod.h"
 #include "Page.h"
 #include "PaymentCoordinator.h"
+#include <wtf/CompletionHandler.h>
 #include <wtf/RunLoop.h>
 #include <wtf/URL.h>
 
@@ -66,16 +67,16 @@
     return m_canMakePayments;
 }
 
-void MockPaymentCoordinator::canMakePaymentsWithActiveCard(const String&, const String&, Function<void(bool)>&& completionHandler)
+void MockPaymentCoordinator::canMakePaymentsWithActiveCard(const String&, const String&, CompletionHandler<void(bool)>&& completionHandler)
 {
-    RunLoop::main().dispatch([completionHandler = WTFMove(completionHandler), canMakePaymentsWithActiveCard = m_canMakePaymentsWithActiveCard] {
+    RunLoop::main().dispatch([completionHandler = WTFMove(completionHandler), canMakePaymentsWithActiveCard = m_canMakePaymentsWithActiveCard]() mutable {
         completionHandler(canMakePaymentsWithActiveCard);
     });
 }
 
-void MockPaymentCoordinator::openPaymentSetup(const String&, const String&, Function<void(bool)>&& completionHandler)
+void MockPaymentCoordinator::openPaymentSetup(const String&, const String&, CompletionHandler<void(bool)>&& completionHandler)
 {
-    RunLoop::main().dispatch([completionHandler = WTFMove(completionHandler)] {
+    RunLoop::main().dispatch([completionHandler = WTFMove(completionHandler)]() mutable {
         completionHandler(true);
     });
 }

Modified: trunk/Source/WebCore/testing/MockPaymentCoordinator.h (242680 => 242681)


--- trunk/Source/WebCore/testing/MockPaymentCoordinator.h	2019-03-10 05:28:48 UTC (rev 242680)
+++ trunk/Source/WebCore/testing/MockPaymentCoordinator.h	2019-03-10 05:29:42 UTC (rev 242681)
@@ -66,8 +66,8 @@
 private:
     Optional<String> validatedPaymentNetwork(const String&) final;
     bool canMakePayments() final;
-    void canMakePaymentsWithActiveCard(const String&, const String&, WTF::Function<void(bool)>&&);
-    void openPaymentSetup(const String&, const String&, WTF::Function<void(bool)>&&);
+    void canMakePaymentsWithActiveCard(const String&, const String&, CompletionHandler<void(bool)>&&);
+    void openPaymentSetup(const String&, const String&, CompletionHandler<void(bool)>&&);
     bool showPaymentUI(const URL&, const Vector<URL>&, const ApplePaySessionPaymentRequest&) final;
     void completeMerchantValidation(const PaymentMerchantSession&) final;
     void completeShippingMethodSelection(Optional<ShippingMethodUpdate>&&) final;

Modified: trunk/Source/WebKit/ChangeLog (242680 => 242681)


--- trunk/Source/WebKit/ChangeLog	2019-03-10 05:28:48 UTC (rev 242680)
+++ trunk/Source/WebKit/ChangeLog	2019-03-10 05:29:42 UTC (rev 242681)
@@ -1,5 +1,28 @@
 2019-03-09  Andy Estes  <[email protected]>
 
+        [Apple Pay] CanMakePaymentsWithActiveCard and OpenPaymentSetup should be async messages
+        https://bugs.webkit.org/show_bug.cgi?id=195526
+        <rdar://problem/48745636>
+
+        Reviewed by Chris Dumez.
+
+        * Shared/ApplePay/WebPaymentCoordinatorProxy.cpp:
+        (WebKit::WebPaymentCoordinatorProxy::canMakePaymentsWithActiveCard):
+        (WebKit::WebPaymentCoordinatorProxy::openPaymentSetup):
+        * Shared/ApplePay/WebPaymentCoordinatorProxy.h:
+        * Shared/ApplePay/WebPaymentCoordinatorProxy.messages.in:
+        * WebProcess/ApplePay/WebPaymentCoordinator.cpp:
+        (WebKit::WebPaymentCoordinator::canMakePaymentsWithActiveCard):
+        (WebKit::WebPaymentCoordinator::openPaymentSetup):
+        (WebKit::generateCanMakePaymentsWithActiveCardReplyID): Deleted.
+        (WebKit::generateOpenPaymentSetupReplyID): Deleted.
+        (WebKit::WebPaymentCoordinator::canMakePaymentsWithActiveCardReply): Deleted.
+        (WebKit::WebPaymentCoordinator::openPaymentSetupReply): Deleted.
+        * WebProcess/ApplePay/WebPaymentCoordinator.h:
+        * WebProcess/ApplePay/WebPaymentCoordinator.messages.in:
+
+2019-03-09  Andy Estes  <[email protected]>
+
         [iOS] Remove unneeded entitlements and sandbox allowances from the Networking service
         https://bugs.webkit.org/show_bug.cgi?id=195527
 

Modified: trunk/Source/WebKit/Shared/ApplePay/WebPaymentCoordinatorProxy.cpp (242680 => 242681)


--- trunk/Source/WebKit/Shared/ApplePay/WebPaymentCoordinatorProxy.cpp	2019-03-10 05:28:48 UTC (rev 242680)
+++ trunk/Source/WebKit/Shared/ApplePay/WebPaymentCoordinatorProxy.cpp	2019-03-10 05:29:42 UTC (rev 242681)
@@ -78,20 +78,14 @@
     reply(platformCanMakePayments());
 }
 
-void WebPaymentCoordinatorProxy::canMakePaymentsWithActiveCard(const String& merchantIdentifier, const String& domainName, uint64_t requestID)
+void WebPaymentCoordinatorProxy::canMakePaymentsWithActiveCard(const String& merchantIdentifier, const String& domainName, CompletionHandler<void(bool)>&& completionHandler)
 {
-    platformCanMakePaymentsWithActiveCard(merchantIdentifier, domainName, [weakThis = makeWeakPtr(*this), requestID](bool canMakePayments) {
-        if (auto paymentCoordinatorProxy = weakThis.get())
-            paymentCoordinatorProxy->send(Messages::WebPaymentCoordinator::CanMakePaymentsWithActiveCardReply(requestID, canMakePayments));
-    });
+    platformCanMakePaymentsWithActiveCard(merchantIdentifier, domainName, WTFMove(completionHandler));
 }
 
-void WebPaymentCoordinatorProxy::openPaymentSetup(const String& merchantIdentifier, const String& domainName, uint64_t requestID)
+void WebPaymentCoordinatorProxy::openPaymentSetup(const String& merchantIdentifier, const String& domainName, CompletionHandler<void(bool)>&& completionHandler)
 {
-    platformOpenPaymentSetup(merchantIdentifier, domainName, [weakThis = makeWeakPtr(*this), requestID](bool result) {
-        if (auto paymentCoordinatorProxy = weakThis.get())
-            paymentCoordinatorProxy->send(Messages::WebPaymentCoordinator::OpenPaymentSetupReply(requestID, result));
-    });
+    platformOpenPaymentSetup(merchantIdentifier, domainName, WTFMove(completionHandler));
 }
 
 void WebPaymentCoordinatorProxy::showPaymentUI(const String& originatingURLString, const Vector<String>& linkIconURLStrings, const WebCore::ApplePaySessionPaymentRequest& paymentRequest, CompletionHandler<void(bool)>&& completionHandler)

Modified: trunk/Source/WebKit/Shared/ApplePay/WebPaymentCoordinatorProxy.h (242680 => 242681)


--- trunk/Source/WebKit/Shared/ApplePay/WebPaymentCoordinatorProxy.h	2019-03-10 05:28:48 UTC (rev 242680)
+++ trunk/Source/WebKit/Shared/ApplePay/WebPaymentCoordinatorProxy.h	2019-03-10 05:29:42 UTC (rev 242681)
@@ -112,8 +112,8 @@
     // Message handlers
     void availablePaymentNetworks(CompletionHandler<void(Vector<String>&&)>&&);
     void canMakePayments(CompletionHandler<void(bool)>&&);
-    void canMakePaymentsWithActiveCard(const String& merchantIdentifier, const String& domainName, uint64_t requestID);
-    void openPaymentSetup(const String& merchantIdentifier, const String& domainName, uint64_t requestID);
+    void canMakePaymentsWithActiveCard(const String& merchantIdentifier, const String& domainName, CompletionHandler<void(bool)>&&);
+    void openPaymentSetup(const String& merchantIdentifier, const String& domainName, CompletionHandler<void(bool)>&&);
     void showPaymentUI(const String& originatingURLString, const Vector<String>& linkIconURLStrings, const WebCore::ApplePaySessionPaymentRequest&, CompletionHandler<void(bool)>&&);
     void completeMerchantValidation(const WebCore::PaymentMerchantSession&);
     void completeShippingMethodSelection(const Optional<WebCore::ShippingMethodUpdate>&);

Modified: trunk/Source/WebKit/Shared/ApplePay/WebPaymentCoordinatorProxy.messages.in (242680 => 242681)


--- trunk/Source/WebKit/Shared/ApplePay/WebPaymentCoordinatorProxy.messages.in	2019-03-10 05:28:48 UTC (rev 242680)
+++ trunk/Source/WebKit/Shared/ApplePay/WebPaymentCoordinatorProxy.messages.in	2019-03-10 05:29:42 UTC (rev 242681)
@@ -28,8 +28,8 @@
 
     AvailablePaymentNetworks() -> (Vector<String> availablePaymentNetworks) Delayed
     CanMakePayments() -> (bool result) Delayed
-    CanMakePaymentsWithActiveCard(String merchantIdentifier, String domainName, uint64_t requestID)
-    OpenPaymentSetup(String merchantIdentifier, String domainName, uint64_t requestID)
+    CanMakePaymentsWithActiveCard(String merchantIdentifier, String domainName) -> (bool canMakePayments) Async
+    OpenPaymentSetup(String merchantIdentifier, String domainName) -> (bool result) Async
 
     ShowPaymentUI(String originatingURLString, Vector<String> linkIconURLStrings, WebCore::ApplePaySessionPaymentRequest paymentRequest) -> (bool result) Delayed
     CompleteMerchantValidation(WebCore::PaymentMerchantSession paymentMerchantSession)

Modified: trunk/Source/WebKit/WebProcess/ApplePay/WebPaymentCoordinator.cpp (242680 => 242681)


--- trunk/Source/WebKit/WebProcess/ApplePay/WebPaymentCoordinator.cpp	2019-03-10 05:28:48 UTC (rev 242680)
+++ trunk/Source/WebKit/WebProcess/ApplePay/WebPaymentCoordinator.cpp	2019-03-10 05:29:42 UTC (rev 242681)
@@ -86,36 +86,16 @@
     return canMakePayments;
 }
 
-static uint64_t generateCanMakePaymentsWithActiveCardReplyID()
+void WebPaymentCoordinator::canMakePaymentsWithActiveCard(const String& merchantIdentifier, const String& domainName, CompletionHandler<void(bool)>&& completionHandler)
 {
-    static uint64_t canMakePaymentsWithActiveCardReplyID;
-
-    return ++canMakePaymentsWithActiveCardReplyID;
+    m_webPage.sendWithAsyncReply(Messages::WebPaymentCoordinatorProxy::CanMakePaymentsWithActiveCard(merchantIdentifier, domainName), WTFMove(completionHandler));
 }
 
-void WebPaymentCoordinator::canMakePaymentsWithActiveCard(const String& merchantIdentifier, const String& domainName, WTF::Function<void (bool)>&& completionHandler)
+void WebPaymentCoordinator::openPaymentSetup(const String& merchantIdentifier, const String& domainName, CompletionHandler<void(bool)>&& completionHandler)
 {
-    auto replyID = generateCanMakePaymentsWithActiveCardReplyID();
-
-    m_pendingCanMakePaymentsWithActiveCardCallbacks.add(replyID, WTFMove(completionHandler));
-    m_webPage.send(Messages::WebPaymentCoordinatorProxy::CanMakePaymentsWithActiveCard(merchantIdentifier, domainName, replyID));
+    m_webPage.sendWithAsyncReply(Messages::WebPaymentCoordinatorProxy::OpenPaymentSetup(merchantIdentifier, domainName), WTFMove(completionHandler));
 }
 
-static uint64_t generateOpenPaymentSetupReplyID()
-{
-    static uint64_t openPaymentSetupReplyID;
-
-    return ++openPaymentSetupReplyID;
-}
-
-void WebPaymentCoordinator::openPaymentSetup(const String& merchantIdentifier, const String& domainName, WTF::Function<void (bool)>&& completionHandler)
-{
-    auto replyID = generateOpenPaymentSetupReplyID();
-
-    m_pendingOpenPaymentSetupCallbacks.add(replyID, WTFMove(completionHandler));
-    m_webPage.send(Messages::WebPaymentCoordinatorProxy::OpenPaymentSetup(merchantIdentifier, domainName, replyID));
-}
-
 bool WebPaymentCoordinator::showPaymentUI(const URL& originatingURL, const Vector<URL>& linkIconURLs, const WebCore::ApplePaySessionPaymentRequest& paymentRequest)
 {
     Vector<String> linkIconURLStrings;
@@ -199,18 +179,6 @@
     paymentCoordinator().didCancelPaymentSession();
 }
 
-void WebPaymentCoordinator::canMakePaymentsWithActiveCardReply(uint64_t requestID, bool canMakePayments)
-{
-    auto callback = m_pendingCanMakePaymentsWithActiveCardCallbacks.take(requestID);
-    callback(canMakePayments);
-}
-
-void WebPaymentCoordinator::openPaymentSetupReply(uint64_t requestID, bool result)
-{
-    auto callback = m_pendingOpenPaymentSetupCallbacks.take(requestID);
-    callback(result);
-}
-
 WebCore::PaymentCoordinator& WebPaymentCoordinator::paymentCoordinator()
 {
     return m_webPage.corePage()->paymentCoordinator();

Modified: trunk/Source/WebKit/WebProcess/ApplePay/WebPaymentCoordinator.h (242680 => 242681)


--- trunk/Source/WebKit/WebProcess/ApplePay/WebPaymentCoordinator.h	2019-03-10 05:28:48 UTC (rev 242680)
+++ trunk/Source/WebKit/WebProcess/ApplePay/WebPaymentCoordinator.h	2019-03-10 05:29:42 UTC (rev 242681)
@@ -57,8 +57,8 @@
     // WebCore::PaymentCoordinatorClient.
     Optional<String> validatedPaymentNetwork(const String&) override;
     bool canMakePayments() override;
-    void canMakePaymentsWithActiveCard(const String& merchantIdentifier, const String& domainName, WTF::Function<void (bool)>&& completionHandler) override;
-    void openPaymentSetup(const String& merchantIdentifier, const String& domainName, WTF::Function<void (bool)>&& completionHandler) override;
+    void canMakePaymentsWithActiveCard(const String& merchantIdentifier, const String& domainName, CompletionHandler<void(bool)>&&) override;
+    void openPaymentSetup(const String& merchantIdentifier, const String& domainName, CompletionHandler<void(bool)>&&) override;
     bool showPaymentUI(const URL& originatingURL, const Vector<URL>& linkIconURLs, const WebCore::ApplePaySessionPaymentRequest&) override;
     void completeMerchantValidation(const WebCore::PaymentMerchantSession&) override;
     void completeShippingMethodSelection(Optional<WebCore::ShippingMethodUpdate>&&) override;
@@ -81,8 +81,6 @@
     void didSelectShippingContact(const WebCore::PaymentContact&);
     void didSelectPaymentMethod(const WebCore::PaymentMethod&);
     void didCancelPaymentSession();
-    void canMakePaymentsWithActiveCardReply(uint64_t requestID, bool canMakePayments);
-    void openPaymentSetupReply(uint64_t requestID, bool result);
 
     WebCore::PaymentCoordinator& paymentCoordinator();
     
@@ -91,9 +89,6 @@
 
     WebPage& m_webPage;
 
-    HashMap<uint64_t, WTF::Function<void (bool)>> m_pendingCanMakePaymentsWithActiveCardCallbacks;
-    HashMap<uint64_t, WTF::Function<void (bool)>> m_pendingOpenPaymentSetupCallbacks;
-
     Optional<AvailablePaymentNetworksSet> m_availablePaymentNetworks;
 
 #if USE(APPLE_INTERNAL_SDK)

Modified: trunk/Source/WebKit/WebProcess/ApplePay/WebPaymentCoordinator.messages.in (242680 => 242681)


--- trunk/Source/WebKit/WebProcess/ApplePay/WebPaymentCoordinator.messages.in	2019-03-10 05:28:48 UTC (rev 242680)
+++ trunk/Source/WebKit/WebProcess/ApplePay/WebPaymentCoordinator.messages.in	2019-03-10 05:29:42 UTC (rev 242681)
@@ -32,8 +32,6 @@
     DidSelectShippingContact(WebCore::PaymentContact shippingContact)
     DidSelectPaymentMethod(WebCore::PaymentMethod paymentMethod)
     DidCancelPaymentSession()
-    CanMakePaymentsWithActiveCardReply(uint64_t requestID, bool canMakePayments)
-    OpenPaymentSetupReply(uint64_t requestID, bool result)
 }
 
 #endif

Modified: trunk/Source/WebKitLegacy/mac/ChangeLog (242680 => 242681)


--- trunk/Source/WebKitLegacy/mac/ChangeLog	2019-03-10 05:28:48 UTC (rev 242680)
+++ trunk/Source/WebKitLegacy/mac/ChangeLog	2019-03-10 05:29:42 UTC (rev 242681)
@@ -1,3 +1,16 @@
+2019-03-09  Andy Estes  <[email protected]>
+
+        [Apple Pay] CanMakePaymentsWithActiveCard and OpenPaymentSetup should be async messages
+        https://bugs.webkit.org/show_bug.cgi?id=195526
+        <rdar://problem/48745636>
+
+        Reviewed by Chris Dumez.
+
+        * WebCoreSupport/WebPaymentCoordinatorClient.h:
+        * WebCoreSupport/WebPaymentCoordinatorClient.mm:
+        (WebPaymentCoordinatorClient::canMakePaymentsWithActiveCard):
+        (WebPaymentCoordinatorClient::openPaymentSetup):
+
 2019-03-07  Said Abou-Hallawa  <[email protected]>
 
         requestAnimationFrame should execute before the next frame

Modified: trunk/Source/WebKitLegacy/mac/WebCoreSupport/WebPaymentCoordinatorClient.h (242680 => 242681)


--- trunk/Source/WebKitLegacy/mac/WebCoreSupport/WebPaymentCoordinatorClient.h	2019-03-10 05:28:48 UTC (rev 242680)
+++ trunk/Source/WebKitLegacy/mac/WebCoreSupport/WebPaymentCoordinatorClient.h	2019-03-10 05:29:42 UTC (rev 242681)
@@ -38,8 +38,8 @@
 
     Optional<String> validatedPaymentNetwork(const String&) override;
     bool canMakePayments() override;
-    void canMakePaymentsWithActiveCard(const String&, const String&, WTF::Function<void (bool)>&& completionHandler) override;
-    void openPaymentSetup(const String& merchantIdentifier, const String& domainName, WTF::Function<void (bool)>&& completionHandler) override;
+    void canMakePaymentsWithActiveCard(const String&, const String&, CompletionHandler<void(bool)>&&) override;
+    void openPaymentSetup(const String& merchantIdentifier, const String& domainName, CompletionHandler<void(bool)>&&) override;
     bool showPaymentUI(const URL&, const Vector<URL>& linkIconURLs, const WebCore::ApplePaySessionPaymentRequest&) override;
     void completeMerchantValidation(const WebCore::PaymentMerchantSession&) override;
     void completeShippingMethodSelection(Optional<WebCore::ShippingMethodUpdate>&&) override;

Modified: trunk/Source/WebKitLegacy/mac/WebCoreSupport/WebPaymentCoordinatorClient.mm (242680 => 242681)


--- trunk/Source/WebKitLegacy/mac/WebCoreSupport/WebPaymentCoordinatorClient.mm	2019-03-10 05:28:48 UTC (rev 242680)
+++ trunk/Source/WebKitLegacy/mac/WebCoreSupport/WebPaymentCoordinatorClient.mm	2019-03-10 05:29:42 UTC (rev 242681)
@@ -27,6 +27,7 @@
 
 #if ENABLE(APPLE_PAY)
 
+#import <wtf/CompletionHandler.h>
 #import <wtf/MainThread.h>
 #import <wtf/URL.h>
 
@@ -48,16 +49,16 @@
     return false;
 }
 
-void WebPaymentCoordinatorClient::canMakePaymentsWithActiveCard(const String&, const String&, WTF::Function<void (bool)>&& completionHandler)
+void WebPaymentCoordinatorClient::canMakePaymentsWithActiveCard(const String&, const String&, CompletionHandler<void(bool)>&& completionHandler)
 {
-    callOnMainThread([completionHandler = WTFMove(completionHandler)] {
+    callOnMainThread([completionHandler = WTFMove(completionHandler)]() mutable {
         completionHandler(false);
     });
 }
 
-void WebPaymentCoordinatorClient::openPaymentSetup(const String&, const String&, WTF::Function<void (bool)>&& completionHandler)
+void WebPaymentCoordinatorClient::openPaymentSetup(const String&, const String&, CompletionHandler<void(bool)>&& completionHandler)
 {
-    callOnMainThread([completionHandler = WTFMove(completionHandler)] {
+    callOnMainThread([completionHandler = WTFMove(completionHandler)]() mutable {
         completionHandler(false);
     });
 }
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to