Title: [246345] trunk/Source/WebKit
Revision
246345
Author
[email protected]
Date
2019-06-11 20:18:25 -0700 (Tue, 11 Jun 2019)

Log Message

[Apple Pay] ASSERTION FAILED: m_state == State::Activating under WebPaymentCoordinatorProxy::showPaymentUI
https://bugs.webkit.org/show_bug.cgi?id=198776
<rdar://problem/49123795>

Reviewed by Brian Weinstein.

It's possible that an active session is aborted before the completion handler passed to
platformShowPaymentUI() has executed. When that happens, m_state will be Idle even though we
assert that it is Activating. Fix this by returning early in the platformShowPaymentUI()
completion handler when m_state is Idle.

It's not possible to write a layout test for this because MockPaymentCoordinator handles
showing payment UI directly in the web process, so this code is not executed in layout
tests. The assertion can be reproduced manually by loading
https://w3c-test.org/payment-request/payment-is-showing.https.html and clicking the button.

* Shared/ApplePay/WebPaymentCoordinatorProxy.cpp:
(WebKit::WebPaymentCoordinatorProxy::showPaymentUI):

Modified Paths

Diff

Modified: trunk/Source/WebKit/ChangeLog (246344 => 246345)


--- trunk/Source/WebKit/ChangeLog	2019-06-12 02:50:48 UTC (rev 246344)
+++ trunk/Source/WebKit/ChangeLog	2019-06-12 03:18:25 UTC (rev 246345)
@@ -1,3 +1,24 @@
+2019-06-11  Andy Estes  <[email protected]>
+
+        [Apple Pay] ASSERTION FAILED: m_state == State::Activating under WebPaymentCoordinatorProxy::showPaymentUI
+        https://bugs.webkit.org/show_bug.cgi?id=198776
+        <rdar://problem/49123795>
+
+        Reviewed by Brian Weinstein.
+
+        It's possible that an active session is aborted before the completion handler passed to
+        platformShowPaymentUI() has executed. When that happens, m_state will be Idle even though we
+        assert that it is Activating. Fix this by returning early in the platformShowPaymentUI()
+        completion handler when m_state is Idle.
+
+        It's not possible to write a layout test for this because MockPaymentCoordinator handles
+        showing payment UI directly in the web process, so this code is not executed in layout
+        tests. The assertion can be reproduced manually by loading
+        https://w3c-test.org/payment-request/payment-is-showing.https.html and clicking the button.
+
+        * Shared/ApplePay/WebPaymentCoordinatorProxy.cpp:
+        (WebKit::WebPaymentCoordinatorProxy::showPaymentUI):
+
 2019-06-11  Patrick Griffis  <[email protected]>
 
         [GTK] Fix a11y support in bubblewrap sandbox

Modified: trunk/Source/WebKit/Shared/ApplePay/WebPaymentCoordinatorProxy.cpp (246344 => 246345)


--- trunk/Source/WebKit/Shared/ApplePay/WebPaymentCoordinatorProxy.cpp	2019-06-12 02:50:48 UTC (rev 246344)
+++ trunk/Source/WebKit/Shared/ApplePay/WebPaymentCoordinatorProxy.cpp	2019-06-12 03:18:25 UTC (rev 246345)
@@ -104,17 +104,24 @@
     for (const auto& linkIconURLString : linkIconURLStrings)
         linkIconURLs.append(URL(URL(), linkIconURLString));
 
-    platformShowPaymentUI(originatingURL, linkIconURLs, sessionID, paymentRequest, [weakThis = makeWeakPtr(*this)](bool result) {
+    platformShowPaymentUI(originatingURL, linkIconURLs, sessionID, paymentRequest, [this, weakThis = makeWeakPtr(*this)](bool result) {
         if (!weakThis)
             return;
 
-        ASSERT(weakThis->m_state == State::Activating);
+        if (m_state == State::Idle) {
+            ASSERT(!activePaymentCoordinatorProxy());
+            ASSERT(!m_destinationID);
+            ASSERT(m_merchantValidationState == MerchantValidationState::Idle);
+            return;
+        }
+
+        ASSERT(m_state == State::Activating);
         if (!result) {
-            weakThis->didCancelPaymentSession();
+            didCancelPaymentSession();
             return;
         }
 
-        weakThis->m_state = State::Active;
+        m_state = State::Active;
     });
 
     completionHandler(true);
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to