Changeset 252057 in webkit


Ignore:
Timestamp:
Nov 5, 2019 9:13:00 AM (4 years ago)
Author:
aestes@apple.com
Message:

ApplePaySession should never prevent entering the back/forward cache
https://bugs.webkit.org/show_bug.cgi?id=203087
<rdar://problem/56744401>

Reviewed by Chris Dumez.

Source/WebCore:

Rather than prevent entering the back/forward cache when there is an active session, abort
the session on suspension and queue a task to the event loop that dispatches the cancel event.

Tests: http/tests/ssl/applepay/page-cache-active-apple-pay-session.html

http/tests/ssl/applepay/page-cache-inactive-apple-pay-session.html

  • Modules/applepay/ApplePaySession.cpp:

(WebCore::ApplePaySession::canSuspendWithoutCanceling const):
(WebCore::ApplePaySession::suspend):
(WebCore::ApplePaySession::shouldPreventEnteringBackForwardCache_DEPRECATED const): Deleted.

  • Modules/applepay/ApplePaySession.h:

LayoutTests:

  • http/tests/ssl/applepay/page-cache-active-apple-pay-session-expected.txt: Added.
  • http/tests/ssl/applepay/page-cache-active-apple-pay-session.html: Added.
  • http/tests/ssl/applepay/page-cache-inactive-apple-pay-session-expected.txt: Added.
  • http/tests/ssl/applepay/page-cache-inactive-apple-pay-session.html: Added.
Location:
trunk
Files:
4 added
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r252056 r252057  
     12019-11-05  Andy Estes  <aestes@apple.com>
     2
     3        ApplePaySession should never prevent entering the back/forward cache
     4        https://bugs.webkit.org/show_bug.cgi?id=203087
     5        <rdar://problem/56744401>
     6
     7        Reviewed by Chris Dumez.
     8
     9        * http/tests/ssl/applepay/page-cache-active-apple-pay-session-expected.txt: Added.
     10        * http/tests/ssl/applepay/page-cache-active-apple-pay-session.html: Added.
     11        * http/tests/ssl/applepay/page-cache-inactive-apple-pay-session-expected.txt: Added.
     12        * http/tests/ssl/applepay/page-cache-inactive-apple-pay-session.html: Added.
     13
    1142019-11-05  youenn fablet  <youenn@apple.com>
    215
  • trunk/Source/WebCore/ChangeLog

    r252056 r252057  
     12019-11-05  Andy Estes  <aestes@apple.com>
     2
     3        ApplePaySession should never prevent entering the back/forward cache
     4        https://bugs.webkit.org/show_bug.cgi?id=203087
     5        <rdar://problem/56744401>
     6
     7        Reviewed by Chris Dumez.
     8
     9        Rather than prevent entering the back/forward cache when there is an active session, abort
     10        the session on suspension and queue a task to the event loop that dispatches the cancel event.
     11
     12        Tests: http/tests/ssl/applepay/page-cache-active-apple-pay-session.html
     13               http/tests/ssl/applepay/page-cache-inactive-apple-pay-session.html
     14
     15        * Modules/applepay/ApplePaySession.cpp:
     16        (WebCore::ApplePaySession::canSuspendWithoutCanceling const):
     17        (WebCore::ApplePaySession::suspend):
     18        (WebCore::ApplePaySession::shouldPreventEnteringBackForwardCache_DEPRECATED const): Deleted.
     19        * Modules/applepay/ApplePaySession.h:
     20
    1212019-11-05  youenn fablet  <youenn@apple.com>
    222
  • trunk/Source/WebCore/Modules/applepay/ApplePaySession.cpp

    r251425 r252057  
    824824}
    825825
    826 bool ApplePaySession::shouldPreventEnteringBackForwardCache_DEPRECATED() const
     826bool ApplePaySession::canSuspendWithoutCanceling() const
    827827{
    828828    switch (m_state) {
     
    831831    case State::Completed:
    832832    case State::Canceled:
    833         return false;
     833        return true;
    834834
    835835    case State::Active:
     
    839839    case State::PaymentMethodSelected:
    840840    case State::CancelRequested:
    841         // FIXME: This should never prevent entering the back/forward cache.
    842         return true;
     841        return false;
    843842    }
    844843}
     
    851850    m_state = State::Aborted;
    852851    paymentCoordinator().abortPaymentSession();
     852
     853    didReachFinalState();
     854}
     855
     856void ApplePaySession::suspend(ReasonForSuspension reason)
     857{
     858    if (reason != ReasonForSuspension::BackForwardCache)
     859        return;
     860
     861    if (canSuspendWithoutCanceling())
     862        return;
     863
     864    m_state = State::Canceled;
     865    paymentCoordinator().abortPaymentSession();
     866    queueTaskToDispatchEvent(*this, TaskSource::UserInteraction, ApplePayCancelEvent::create(eventNames().cancelEvent, { }));
    853867
    854868    didReachFinalState();
  • trunk/Source/WebCore/Modules/applepay/ApplePaySession.h

    r251425 r252057  
    103103    // ActiveDOMObject.
    104104    const char* activeDOMObjectName() const override;
    105     bool shouldPreventEnteringBackForwardCache_DEPRECATED() const override;
    106105    void stop() override;
     106    void suspend(ReasonForSuspension) override;
    107107
    108108    // EventTargetWithInlineData.
     
    131131    bool canCompletePaymentMethodSelection() const;
    132132    bool canCompletePayment() const;
     133    bool canSuspendWithoutCanceling() const;
    133134
    134135    bool isFinalState() const;
Note: See TracChangeset for help on using the changeset viewer.