<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[242681] trunk/Source</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/242681">242681</a></dd>
<dt>Author</dt> <dd>aestes@apple.com</dd>
<dt>Date</dt> <dd>2019-03-09 21:29:42 -0800 (Sat, 09 Mar 2019)</dd>
</dl>

<h3>Log Message</h3>
<pre>[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):</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreModulesapplepayPaymentCoordinatorcpp">trunk/Source/WebCore/Modules/applepay/PaymentCoordinator.cpp</a></li>
<li><a href="#trunkSourceWebCoreModulesapplepayPaymentCoordinatorClienth">trunk/Source/WebCore/Modules/applepay/PaymentCoordinatorClient.h</a></li>
<li><a href="#trunkSourceWebCoreloaderEmptyClientscpp">trunk/Source/WebCore/loader/EmptyClients.cpp</a></li>
<li><a href="#trunkSourceWebCoretestingMockPaymentCoordinatorcpp">trunk/Source/WebCore/testing/MockPaymentCoordinator.cpp</a></li>
<li><a href="#trunkSourceWebCoretestingMockPaymentCoordinatorh">trunk/Source/WebCore/testing/MockPaymentCoordinator.h</a></li>
<li><a href="#trunkSourceWebKitChangeLog">trunk/Source/WebKit/ChangeLog</a></li>
<li><a href="#trunkSourceWebKitSharedApplePayWebPaymentCoordinatorProxycpp">trunk/Source/WebKit/Shared/ApplePay/WebPaymentCoordinatorProxy.cpp</a></li>
<li><a href="#trunkSourceWebKitSharedApplePayWebPaymentCoordinatorProxyh">trunk/Source/WebKit/Shared/ApplePay/WebPaymentCoordinatorProxy.h</a></li>
<li><a href="#trunkSourceWebKitSharedApplePayWebPaymentCoordinatorProxymessagesin">trunk/Source/WebKit/Shared/ApplePay/WebPaymentCoordinatorProxy.messages.in</a></li>
<li><a href="#trunkSourceWebKitWebProcessApplePayWebPaymentCoordinatorcpp">trunk/Source/WebKit/WebProcess/ApplePay/WebPaymentCoordinator.cpp</a></li>
<li><a href="#trunkSourceWebKitWebProcessApplePayWebPaymentCoordinatorh">trunk/Source/WebKit/WebProcess/ApplePay/WebPaymentCoordinator.h</a></li>
<li><a href="#trunkSourceWebKitWebProcessApplePayWebPaymentCoordinatormessagesin">trunk/Source/WebKit/WebProcess/ApplePay/WebPaymentCoordinator.messages.in</a></li>
<li><a href="#trunkSourceWebKitLegacymacChangeLog">trunk/Source/WebKitLegacy/mac/ChangeLog</a></li>
<li><a href="#trunkSourceWebKitLegacymacWebCoreSupportWebPaymentCoordinatorClienth">trunk/Source/WebKitLegacy/mac/WebCoreSupport/WebPaymentCoordinatorClient.h</a></li>
<li><a href="#trunkSourceWebKitLegacymacWebCoreSupportWebPaymentCoordinatorClientmm">trunk/Source/WebKitLegacy/mac/WebCoreSupport/WebPaymentCoordinatorClient.mm</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (242680 => 242681)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -1,3 +1,18 @@
</span><ins>+2019-03-09  Andy Estes  <aestes@apple.com>
+
+        [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:
+
</ins><span class="cx"> 2019-03-09  Zalan Bujtas  <zalan@apple.com>
</span><span class="cx"> 
</span><span class="cx">         [ContentChangeObserver] Click event fires immediately on hover menu at seriouseats.com
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesapplepayPaymentCoordinatorcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/applepay/PaymentCoordinator.cpp (242680 => 242681)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -31,6 +31,7 @@
</span><span class="cx"> #include "PaymentAuthorizationStatus.h"
</span><span class="cx"> #include "PaymentCoordinatorClient.h"
</span><span class="cx"> #include "PaymentSession.h"
</span><ins>+#include <wtf/CompletionHandler.h>
</ins><span class="cx"> #include <wtf/URL.h>
</span><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesapplepayPaymentCoordinatorClienth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/applepay/PaymentCoordinatorClient.h (242680 => 242681)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -49,8 +49,8 @@
</span><span class="cx"> 
</span><span class="cx">     virtual Optional<String> validatedPaymentNetwork(const String&) = 0;
</span><span class="cx">     virtual bool canMakePayments() = 0;
</span><del>-    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;
</del><ins>+    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;
</ins><span class="cx"> 
</span><span class="cx">     virtual bool showPaymentUI(const URL& originatingURL, const Vector<URL>& linkIconURLs, const ApplePaySessionPaymentRequest&) = 0;
</span><span class="cx">     virtual void completeMerchantValidation(const PaymentMerchantSession&) = 0;
</span></span></pre></div>
<a id="trunkSourceWebCoreloaderEmptyClientscpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/loader/EmptyClients.cpp (242680 => 242681)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -316,8 +316,8 @@
</span><span class="cx"> class EmptyPaymentCoordinatorClient final : public PaymentCoordinatorClient {
</span><span class="cx">     Optional<String> validatedPaymentNetwork(const String&) final { return WTF::nullopt; }
</span><span class="cx">     bool canMakePayments() final { return false; }
</span><del>-    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); }); }
</del><ins>+    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); }); }
</ins><span class="cx">     bool showPaymentUI(const URL&, const Vector<URL>&, const ApplePaySessionPaymentRequest&) final { return false; }
</span><span class="cx">     void completeMerchantValidation(const PaymentMerchantSession&) final { }
</span><span class="cx">     void completeShippingMethodSelection(Optional<ShippingMethodUpdate>&&) final { }
</span></span></pre></div>
<a id="trunkSourceWebCoretestingMockPaymentCoordinatorcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/testing/MockPaymentCoordinator.cpp (242680 => 242681)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -34,6 +34,7 @@
</span><span class="cx"> #include "MockPaymentMethod.h"
</span><span class="cx"> #include "Page.h"
</span><span class="cx"> #include "PaymentCoordinator.h"
</span><ins>+#include <wtf/CompletionHandler.h>
</ins><span class="cx"> #include <wtf/RunLoop.h>
</span><span class="cx"> #include <wtf/URL.h>
</span><span class="cx"> 
</span><span class="lines">@@ -66,16 +67,16 @@
</span><span class="cx">     return m_canMakePayments;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void MockPaymentCoordinator::canMakePaymentsWithActiveCard(const String&, const String&, Function<void(bool)>&& completionHandler)
</del><ins>+void MockPaymentCoordinator::canMakePaymentsWithActiveCard(const String&, const String&, CompletionHandler<void(bool)>&& completionHandler)
</ins><span class="cx"> {
</span><del>-    RunLoop::main().dispatch([completionHandler = WTFMove(completionHandler), canMakePaymentsWithActiveCard = m_canMakePaymentsWithActiveCard] {
</del><ins>+    RunLoop::main().dispatch([completionHandler = WTFMove(completionHandler), canMakePaymentsWithActiveCard = m_canMakePaymentsWithActiveCard]() mutable {
</ins><span class="cx">         completionHandler(canMakePaymentsWithActiveCard);
</span><span class="cx">     });
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void MockPaymentCoordinator::openPaymentSetup(const String&, const String&, Function<void(bool)>&& completionHandler)
</del><ins>+void MockPaymentCoordinator::openPaymentSetup(const String&, const String&, CompletionHandler<void(bool)>&& completionHandler)
</ins><span class="cx"> {
</span><del>-    RunLoop::main().dispatch([completionHandler = WTFMove(completionHandler)] {
</del><ins>+    RunLoop::main().dispatch([completionHandler = WTFMove(completionHandler)]() mutable {
</ins><span class="cx">         completionHandler(true);
</span><span class="cx">     });
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebCoretestingMockPaymentCoordinatorh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/testing/MockPaymentCoordinator.h (242680 => 242681)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -66,8 +66,8 @@
</span><span class="cx"> private:
</span><span class="cx">     Optional<String> validatedPaymentNetwork(const String&) final;
</span><span class="cx">     bool canMakePayments() final;
</span><del>-    void canMakePaymentsWithActiveCard(const String&, const String&, WTF::Function<void(bool)>&&);
-    void openPaymentSetup(const String&, const String&, WTF::Function<void(bool)>&&);
</del><ins>+    void canMakePaymentsWithActiveCard(const String&, const String&, CompletionHandler<void(bool)>&&);
+    void openPaymentSetup(const String&, const String&, CompletionHandler<void(bool)>&&);
</ins><span class="cx">     bool showPaymentUI(const URL&, const Vector<URL>&, const ApplePaySessionPaymentRequest&) final;
</span><span class="cx">     void completeMerchantValidation(const PaymentMerchantSession&) final;
</span><span class="cx">     void completeShippingMethodSelection(Optional<ShippingMethodUpdate>&&) final;
</span></span></pre></div>
<a id="trunkSourceWebKitChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/ChangeLog (242680 => 242681)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -1,5 +1,28 @@
</span><span class="cx"> 2019-03-09  Andy Estes  <aestes@apple.com>
</span><span class="cx"> 
</span><ins>+        [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  <aestes@apple.com>
+
</ins><span class="cx">         [iOS] Remove unneeded entitlements and sandbox allowances from the Networking service
</span><span class="cx">         https://bugs.webkit.org/show_bug.cgi?id=195527
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebKitSharedApplePayWebPaymentCoordinatorProxycpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/Shared/ApplePay/WebPaymentCoordinatorProxy.cpp (242680 => 242681)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -78,20 +78,14 @@
</span><span class="cx">     reply(platformCanMakePayments());
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void WebPaymentCoordinatorProxy::canMakePaymentsWithActiveCard(const String& merchantIdentifier, const String& domainName, uint64_t requestID)
</del><ins>+void WebPaymentCoordinatorProxy::canMakePaymentsWithActiveCard(const String& merchantIdentifier, const String& domainName, CompletionHandler<void(bool)>&& completionHandler)
</ins><span class="cx"> {
</span><del>-    platformCanMakePaymentsWithActiveCard(merchantIdentifier, domainName, [weakThis = makeWeakPtr(*this), requestID](bool canMakePayments) {
-        if (auto paymentCoordinatorProxy = weakThis.get())
-            paymentCoordinatorProxy->send(Messages::WebPaymentCoordinator::CanMakePaymentsWithActiveCardReply(requestID, canMakePayments));
-    });
</del><ins>+    platformCanMakePaymentsWithActiveCard(merchantIdentifier, domainName, WTFMove(completionHandler));
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void WebPaymentCoordinatorProxy::openPaymentSetup(const String& merchantIdentifier, const String& domainName, uint64_t requestID)
</del><ins>+void WebPaymentCoordinatorProxy::openPaymentSetup(const String& merchantIdentifier, const String& domainName, CompletionHandler<void(bool)>&& completionHandler)
</ins><span class="cx"> {
</span><del>-    platformOpenPaymentSetup(merchantIdentifier, domainName, [weakThis = makeWeakPtr(*this), requestID](bool result) {
-        if (auto paymentCoordinatorProxy = weakThis.get())
-            paymentCoordinatorProxy->send(Messages::WebPaymentCoordinator::OpenPaymentSetupReply(requestID, result));
-    });
</del><ins>+    platformOpenPaymentSetup(merchantIdentifier, domainName, WTFMove(completionHandler));
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void WebPaymentCoordinatorProxy::showPaymentUI(const String& originatingURLString, const Vector<String>& linkIconURLStrings, const WebCore::ApplePaySessionPaymentRequest& paymentRequest, CompletionHandler<void(bool)>&& completionHandler)
</span></span></pre></div>
<a id="trunkSourceWebKitSharedApplePayWebPaymentCoordinatorProxyh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/Shared/ApplePay/WebPaymentCoordinatorProxy.h (242680 => 242681)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -112,8 +112,8 @@
</span><span class="cx">     // Message handlers
</span><span class="cx">     void availablePaymentNetworks(CompletionHandler<void(Vector<String>&&)>&&);
</span><span class="cx">     void canMakePayments(CompletionHandler<void(bool)>&&);
</span><del>-    void canMakePaymentsWithActiveCard(const String& merchantIdentifier, const String& domainName, uint64_t requestID);
-    void openPaymentSetup(const String& merchantIdentifier, const String& domainName, uint64_t requestID);
</del><ins>+    void canMakePaymentsWithActiveCard(const String& merchantIdentifier, const String& domainName, CompletionHandler<void(bool)>&&);
+    void openPaymentSetup(const String& merchantIdentifier, const String& domainName, CompletionHandler<void(bool)>&&);
</ins><span class="cx">     void showPaymentUI(const String& originatingURLString, const Vector<String>& linkIconURLStrings, const WebCore::ApplePaySessionPaymentRequest&, CompletionHandler<void(bool)>&&);
</span><span class="cx">     void completeMerchantValidation(const WebCore::PaymentMerchantSession&);
</span><span class="cx">     void completeShippingMethodSelection(const Optional<WebCore::ShippingMethodUpdate>&);
</span></span></pre></div>
<a id="trunkSourceWebKitSharedApplePayWebPaymentCoordinatorProxymessagesin"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/Shared/ApplePay/WebPaymentCoordinatorProxy.messages.in (242680 => 242681)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -28,8 +28,8 @@
</span><span class="cx"> 
</span><span class="cx">     AvailablePaymentNetworks() -> (Vector<String> availablePaymentNetworks) Delayed
</span><span class="cx">     CanMakePayments() -> (bool result) Delayed
</span><del>-    CanMakePaymentsWithActiveCard(String merchantIdentifier, String domainName, uint64_t requestID)
-    OpenPaymentSetup(String merchantIdentifier, String domainName, uint64_t requestID)
</del><ins>+    CanMakePaymentsWithActiveCard(String merchantIdentifier, String domainName) -> (bool canMakePayments) Async
+    OpenPaymentSetup(String merchantIdentifier, String domainName) -> (bool result) Async
</ins><span class="cx"> 
</span><span class="cx">     ShowPaymentUI(String originatingURLString, Vector<String> linkIconURLStrings, WebCore::ApplePaySessionPaymentRequest paymentRequest) -> (bool result) Delayed
</span><span class="cx">     CompleteMerchantValidation(WebCore::PaymentMerchantSession paymentMerchantSession)
</span></span></pre></div>
<a id="trunkSourceWebKitWebProcessApplePayWebPaymentCoordinatorcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/WebProcess/ApplePay/WebPaymentCoordinator.cpp (242680 => 242681)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -86,36 +86,16 @@
</span><span class="cx">     return canMakePayments;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-static uint64_t generateCanMakePaymentsWithActiveCardReplyID()
</del><ins>+void WebPaymentCoordinator::canMakePaymentsWithActiveCard(const String& merchantIdentifier, const String& domainName, CompletionHandler<void(bool)>&& completionHandler)
</ins><span class="cx"> {
</span><del>-    static uint64_t canMakePaymentsWithActiveCardReplyID;
-
-    return ++canMakePaymentsWithActiveCardReplyID;
</del><ins>+    m_webPage.sendWithAsyncReply(Messages::WebPaymentCoordinatorProxy::CanMakePaymentsWithActiveCard(merchantIdentifier, domainName), WTFMove(completionHandler));
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void WebPaymentCoordinator::canMakePaymentsWithActiveCard(const String& merchantIdentifier, const String& domainName, WTF::Function<void (bool)>&& completionHandler)
</del><ins>+void WebPaymentCoordinator::openPaymentSetup(const String& merchantIdentifier, const String& domainName, CompletionHandler<void(bool)>&& completionHandler)
</ins><span class="cx"> {
</span><del>-    auto replyID = generateCanMakePaymentsWithActiveCardReplyID();
-
-    m_pendingCanMakePaymentsWithActiveCardCallbacks.add(replyID, WTFMove(completionHandler));
-    m_webPage.send(Messages::WebPaymentCoordinatorProxy::CanMakePaymentsWithActiveCard(merchantIdentifier, domainName, replyID));
</del><ins>+    m_webPage.sendWithAsyncReply(Messages::WebPaymentCoordinatorProxy::OpenPaymentSetup(merchantIdentifier, domainName), WTFMove(completionHandler));
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-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));
-}
-
</del><span class="cx"> bool WebPaymentCoordinator::showPaymentUI(const URL& originatingURL, const Vector<URL>& linkIconURLs, const WebCore::ApplePaySessionPaymentRequest& paymentRequest)
</span><span class="cx"> {
</span><span class="cx">     Vector<String> linkIconURLStrings;
</span><span class="lines">@@ -199,18 +179,6 @@
</span><span class="cx">     paymentCoordinator().didCancelPaymentSession();
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-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);
-}
-
</del><span class="cx"> WebCore::PaymentCoordinator& WebPaymentCoordinator::paymentCoordinator()
</span><span class="cx"> {
</span><span class="cx">     return m_webPage.corePage()->paymentCoordinator();
</span></span></pre></div>
<a id="trunkSourceWebKitWebProcessApplePayWebPaymentCoordinatorh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/WebProcess/ApplePay/WebPaymentCoordinator.h (242680 => 242681)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -57,8 +57,8 @@
</span><span class="cx">     // WebCore::PaymentCoordinatorClient.
</span><span class="cx">     Optional<String> validatedPaymentNetwork(const String&) override;
</span><span class="cx">     bool canMakePayments() override;
</span><del>-    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;
</del><ins>+    void canMakePaymentsWithActiveCard(const String& merchantIdentifier, const String& domainName, CompletionHandler<void(bool)>&&) override;
+    void openPaymentSetup(const String& merchantIdentifier, const String& domainName, CompletionHandler<void(bool)>&&) override;
</ins><span class="cx">     bool showPaymentUI(const URL& originatingURL, const Vector<URL>& linkIconURLs, const WebCore::ApplePaySessionPaymentRequest&) override;
</span><span class="cx">     void completeMerchantValidation(const WebCore::PaymentMerchantSession&) override;
</span><span class="cx">     void completeShippingMethodSelection(Optional<WebCore::ShippingMethodUpdate>&&) override;
</span><span class="lines">@@ -81,8 +81,6 @@
</span><span class="cx">     void didSelectShippingContact(const WebCore::PaymentContact&);
</span><span class="cx">     void didSelectPaymentMethod(const WebCore::PaymentMethod&);
</span><span class="cx">     void didCancelPaymentSession();
</span><del>-    void canMakePaymentsWithActiveCardReply(uint64_t requestID, bool canMakePayments);
-    void openPaymentSetupReply(uint64_t requestID, bool result);
</del><span class="cx"> 
</span><span class="cx">     WebCore::PaymentCoordinator& paymentCoordinator();
</span><span class="cx">     
</span><span class="lines">@@ -91,9 +89,6 @@
</span><span class="cx"> 
</span><span class="cx">     WebPage& m_webPage;
</span><span class="cx"> 
</span><del>-    HashMap<uint64_t, WTF::Function<void (bool)>> m_pendingCanMakePaymentsWithActiveCardCallbacks;
-    HashMap<uint64_t, WTF::Function<void (bool)>> m_pendingOpenPaymentSetupCallbacks;
-
</del><span class="cx">     Optional<AvailablePaymentNetworksSet> m_availablePaymentNetworks;
</span><span class="cx"> 
</span><span class="cx"> #if USE(APPLE_INTERNAL_SDK)
</span></span></pre></div>
<a id="trunkSourceWebKitWebProcessApplePayWebPaymentCoordinatormessagesin"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/WebProcess/ApplePay/WebPaymentCoordinator.messages.in (242680 => 242681)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -32,8 +32,6 @@
</span><span class="cx">     DidSelectShippingContact(WebCore::PaymentContact shippingContact)
</span><span class="cx">     DidSelectPaymentMethod(WebCore::PaymentMethod paymentMethod)
</span><span class="cx">     DidCancelPaymentSession()
</span><del>-    CanMakePaymentsWithActiveCardReply(uint64_t requestID, bool canMakePayments)
-    OpenPaymentSetupReply(uint64_t requestID, bool result)
</del><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> #endif
</span></span></pre></div>
<a id="trunkSourceWebKitLegacymacChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKitLegacy/mac/ChangeLog (242680 => 242681)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -1,3 +1,16 @@
</span><ins>+2019-03-09  Andy Estes  <aestes@apple.com>
+
+        [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):
+
</ins><span class="cx"> 2019-03-07  Said Abou-Hallawa  <sabouhallawa@apple.com>
</span><span class="cx"> 
</span><span class="cx">         requestAnimationFrame should execute before the next frame
</span></span></pre></div>
<a id="trunkSourceWebKitLegacymacWebCoreSupportWebPaymentCoordinatorClienth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKitLegacy/mac/WebCoreSupport/WebPaymentCoordinatorClient.h (242680 => 242681)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -38,8 +38,8 @@
</span><span class="cx"> 
</span><span class="cx">     Optional<String> validatedPaymentNetwork(const String&) override;
</span><span class="cx">     bool canMakePayments() override;
</span><del>-    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;
</del><ins>+    void canMakePaymentsWithActiveCard(const String&, const String&, CompletionHandler<void(bool)>&&) override;
+    void openPaymentSetup(const String& merchantIdentifier, const String& domainName, CompletionHandler<void(bool)>&&) override;
</ins><span class="cx">     bool showPaymentUI(const URL&, const Vector<URL>& linkIconURLs, const WebCore::ApplePaySessionPaymentRequest&) override;
</span><span class="cx">     void completeMerchantValidation(const WebCore::PaymentMerchantSession&) override;
</span><span class="cx">     void completeShippingMethodSelection(Optional<WebCore::ShippingMethodUpdate>&&) override;
</span></span></pre></div>
<a id="trunkSourceWebKitLegacymacWebCoreSupportWebPaymentCoordinatorClientmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKitLegacy/mac/WebCoreSupport/WebPaymentCoordinatorClient.mm (242680 => 242681)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -27,6 +27,7 @@
</span><span class="cx"> 
</span><span class="cx"> #if ENABLE(APPLE_PAY)
</span><span class="cx"> 
</span><ins>+#import <wtf/CompletionHandler.h>
</ins><span class="cx"> #import <wtf/MainThread.h>
</span><span class="cx"> #import <wtf/URL.h>
</span><span class="cx"> 
</span><span class="lines">@@ -48,16 +49,16 @@
</span><span class="cx">     return false;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void WebPaymentCoordinatorClient::canMakePaymentsWithActiveCard(const String&, const String&, WTF::Function<void (bool)>&& completionHandler)
</del><ins>+void WebPaymentCoordinatorClient::canMakePaymentsWithActiveCard(const String&, const String&, CompletionHandler<void(bool)>&& completionHandler)
</ins><span class="cx"> {
</span><del>-    callOnMainThread([completionHandler = WTFMove(completionHandler)] {
</del><ins>+    callOnMainThread([completionHandler = WTFMove(completionHandler)]() mutable {
</ins><span class="cx">         completionHandler(false);
</span><span class="cx">     });
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void WebPaymentCoordinatorClient::openPaymentSetup(const String&, const String&, WTF::Function<void (bool)>&& completionHandler)
</del><ins>+void WebPaymentCoordinatorClient::openPaymentSetup(const String&, const String&, CompletionHandler<void(bool)>&& completionHandler)
</ins><span class="cx"> {
</span><del>-    callOnMainThread([completionHandler = WTFMove(completionHandler)] {
</del><ins>+    callOnMainThread([completionHandler = WTFMove(completionHandler)]() mutable {
</ins><span class="cx">         completionHandler(false);
</span><span class="cx">     });
</span><span class="cx"> }
</span></span></pre>
</div>
</div>

</body>
</html>