Title: [206176] trunk/Source/WebKit2
Revision
206176
Author
ander...@apple.com
Date
2016-09-20 14:43:26 -0700 (Tue, 20 Sep 2016)

Log Message

Can't present a payment sheet if a sheet is already active in another window
https://bugs.webkit.org/show_bug.cgi?id=162314
rdar://problem/27643511

Reviewed by Tim Horton.

Instead of keeping track of whether a sheet is active or not, keep track of its underlying payment coordinator proxy,
so we can hide it and send a cancel event to WebCore if another sheet is being presented.

* UIProcess/ApplePay/WebPaymentCoordinatorProxy.cpp:
(WebKit::WebPaymentCoordinatorProxy::~WebPaymentCoordinatorProxy):
(WebKit::WebPaymentCoordinatorProxy::showPaymentUI):
(WebKit::WebPaymentCoordinatorProxy::didReachFinalState):

Modified Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (206175 => 206176)


--- trunk/Source/WebKit2/ChangeLog	2016-09-20 21:19:41 UTC (rev 206175)
+++ trunk/Source/WebKit2/ChangeLog	2016-09-20 21:43:26 UTC (rev 206176)
@@ -1,3 +1,19 @@
+2016-09-20  Anders Carlsson  <ander...@apple.com>
+
+        Can't present a payment sheet if a sheet is already active in another window
+        https://bugs.webkit.org/show_bug.cgi?id=162314
+        rdar://problem/27643511
+
+        Reviewed by Tim Horton.
+
+        Instead of keeping track of whether a sheet is active or not, keep track of its underlying payment coordinator proxy,
+        so we can hide it and send a cancel event to WebCore if another sheet is being presented.
+
+        * UIProcess/ApplePay/WebPaymentCoordinatorProxy.cpp:
+        (WebKit::WebPaymentCoordinatorProxy::~WebPaymentCoordinatorProxy):
+        (WebKit::WebPaymentCoordinatorProxy::showPaymentUI):
+        (WebKit::WebPaymentCoordinatorProxy::didReachFinalState):
+
 2016-09-20  Keith Rollin  <krol...@apple.com>
 
         Adjust current networking logging

Modified: trunk/Source/WebKit2/UIProcess/ApplePay/WebPaymentCoordinatorProxy.cpp (206175 => 206176)


--- trunk/Source/WebKit2/UIProcess/ApplePay/WebPaymentCoordinatorProxy.cpp	2016-09-20 21:19:41 UTC (rev 206175)
+++ trunk/Source/WebKit2/UIProcess/ApplePay/WebPaymentCoordinatorProxy.cpp	2016-09-20 21:43:26 UTC (rev 206176)
@@ -36,7 +36,7 @@
 
 namespace WebKit {
 
-static bool isShowingPaymentUI;
+static WebPaymentCoordinatorProxy* activePaymentCoordinatorProxy;
 
 WebPaymentCoordinatorProxy::WebPaymentCoordinatorProxy(WebPageProxy& webPageProxy)
     : m_webPageProxy(webPageProxy)
@@ -49,6 +49,9 @@
 
 WebPaymentCoordinatorProxy::~WebPaymentCoordinatorProxy()
 {
+    if (activePaymentCoordinatorProxy == this)
+        activePaymentCoordinatorProxy = nullptr;
+
     if (m_state != State::Idle)
         hidePaymentUI();
 
@@ -77,12 +80,13 @@
     // FIXME: Make this a message check.
     ASSERT(canBegin());
 
-    if (isShowingPaymentUI) {
-        result = false;
-        return;
+    if (activePaymentCoordinatorProxy) {
+        activePaymentCoordinatorProxy->hidePaymentUI();
+        activePaymentCoordinatorProxy->didCancelPayment();
     }
-    isShowingPaymentUI = true;
 
+    activePaymentCoordinatorProxy = this;
+
     m_state = State::Activating;
 
     WebCore::URL originatingURL(WebCore::URL(), originatingURLString);
@@ -331,8 +335,8 @@
     m_state = State::Idle;
     m_merchantValidationState = MerchantValidationState::Idle;
 
-    ASSERT(isShowingPaymentUI);
-    isShowingPaymentUI = false;
+    ASSERT(activePaymentCoordinatorProxy == this);
+    activePaymentCoordinatorProxy = nullptr;
 }
 
 }
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to