⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 246345 in webkit


Ignore:
Timestamp:
Jun 11, 2019, 8:18:25 PM (7 years ago)
Author:
aestes@apple.com
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):

Location:
trunk/Source/WebKit
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit/ChangeLog

    r246344 r246345  
     12019-06-11  Andy Estes  <aestes@apple.com>
     2
     3        [Apple Pay] ASSERTION FAILED: m_state == State::Activating under WebPaymentCoordinatorProxy::showPaymentUI
     4        https://bugs.webkit.org/show_bug.cgi?id=198776
     5        <rdar://problem/49123795>
     6
     7        Reviewed by Brian Weinstein.
     8
     9        It's possible that an active session is aborted before the completion handler passed to
     10        platformShowPaymentUI() has executed. When that happens, m_state will be Idle even though we
     11        assert that it is Activating. Fix this by returning early in the platformShowPaymentUI()
     12        completion handler when m_state is Idle.
     13
     14        It's not possible to write a layout test for this because MockPaymentCoordinator handles
     15        showing payment UI directly in the web process, so this code is not executed in layout
     16        tests. The assertion can be reproduced manually by loading
     17        https://w3c-test.org/payment-request/payment-is-showing.https.html and clicking the button.
     18
     19        * Shared/ApplePay/WebPaymentCoordinatorProxy.cpp:
     20        (WebKit::WebPaymentCoordinatorProxy::showPaymentUI):
     21
    1222019-06-11  Patrick Griffis  <pgriffis@igalia.com>
    223
  • trunk/Source/WebKit/Shared/ApplePay/WebPaymentCoordinatorProxy.cpp

    r245796 r246345  
    105105        linkIconURLs.append(URL(URL(), linkIconURLString));
    106106
    107     platformShowPaymentUI(originatingURL, linkIconURLs, sessionID, paymentRequest, [weakThis = makeWeakPtr(*this)](bool result) {
     107    platformShowPaymentUI(originatingURL, linkIconURLs, sessionID, paymentRequest, [this, weakThis = makeWeakPtr(*this)](bool result) {
    108108        if (!weakThis)
    109109            return;
    110110
    111         ASSERT(weakThis->m_state == State::Activating);
    112         if (!result) {
    113             weakThis->didCancelPaymentSession();
     111        if (m_state == State::Idle) {
     112            ASSERT(!activePaymentCoordinatorProxy());
     113            ASSERT(!m_destinationID);
     114            ASSERT(m_merchantValidationState == MerchantValidationState::Idle);
    114115            return;
    115116        }
    116117
    117         weakThis->m_state = State::Active;
     118        ASSERT(m_state == State::Activating);
     119        if (!result) {
     120            didCancelPaymentSession();
     121            return;
     122        }
     123
     124        m_state = State::Active;
    118125    });
    119126
Note: See TracChangeset for help on using the changeset viewer.