Changeset 223076 in webkit


Ignore:
Timestamp:
Oct 9, 2017 3:40:58 PM (7 years ago)
Author:
aestes@apple.com
Message:

[Payment Request] Implement PaymentRequest.show() and PaymentRequest.hide()
https://bugs.webkit.org/show_bug.cgi?id=178043
<rdar://problem/34076639>

Reviewed by Tim Horton.

LayoutTests/imported/w3c:

  • web-platform-tests/payment-request/payment-request-abort-method.https-expected.txt: Removed.
  • web-platform-tests/payment-request/payment-request-show-method.https-expected.txt: Removed.

Source/WebCore:

Tests: http/tests/paymentrequest/payment-request-abort-method.https.html

http/tests/paymentrequest/payment-request-show-method.https.html

  • Modules/applepay/PaymentCoordinator.h:
  • Modules/applepay/PaymentSession.h: Virtually inherited from PaymentSessionBase to

accommodate ApplePayPaymentHandler inheriting from both this and PaymentHandler.
(WebCore::PaymentSession::~PaymentSession): Deleted.

  • Modules/applepay/paymentrequest/ApplePayPaymentHandler.cpp:

(WebCore::paymentCoordinator): Virtually inherited from PaymentSessionBase to accommodate
ApplePayPaymentHandler inheriting from both this and PaymentSession.
(WebCore::ApplePayPaymentHandler::hasActiveSession): Added. Calls PaymentCoordinator::hasActiveSession().
(WebCore::ApplePayPaymentHandler::show): Added. Calls PaymentCoordinator::beginPaymentSession().
(WebCore::ApplePayPaymentHandler::hide): Added. Calls PaymentCoordinator::abortPaymentSession().

  • Modules/applepay/paymentrequest/ApplePayPaymentHandler.h: Inherited from PaymentSession in

addition to PaymentHandler so that this can be PaymentCoordinator active session.

  • Modules/paymentrequest/PaymentHandler.cpp:

(WebCore::PaymentHandler::create):
(WebCore::PaymentHandler::hasActiveSession):

  • Modules/paymentrequest/PaymentHandler.h:
  • Modules/paymentrequest/PaymentRequest.cpp:

(WebCore::PaymentRequest::~PaymentRequest):
(WebCore::PaymentRequest::show): Rejected the promise if PaymentCoordinator has an active session.
(WebCore::PaymentRequest::abort): Called stop().
(WebCore::PaymentRequest::canSuspendForDocumentSuspension const): Returned true if state is
Interactive and there is an active handler showing.
(WebCore::PaymentRequest::stop): Hid the active session if it's showing, then set state to
Closed and rejected the show promise.

  • Modules/paymentrequest/PaymentRequest.h:
  • Modules/paymentrequest/PaymentSessionBase.h: Added. Inherits from

RefCounted<PaymentSessionBase> and defines a virtual destructor. This allows subclasses to
virtually inherit a single ref-count to support multiple inheritance.

  • WebCore.xcodeproj/project.pbxproj:
  • bindings/scripts/CodeGeneratorJS.pm:

(GetGnuVTableOffsetForType): Added ApplePaySession to the list of classes that need a vtable
offset of 3.

  • page/MainFrame.cpp:

(WebCore::MainFrame::setPaymentCoordinator): Added a setter for m_paymentCoordinator.

  • page/MainFrame.h:
  • testing/Internals.cpp:

(WebCore::Internals::Internals): Set the main frame's payment coordinator to a new
PaymentCoordinator with MockPaymentCoordinator as its client.

  • testing/MockPaymentCoordinator.cpp: Added a mock PaymentCoordinatorClient for testing.

(WebCore::MockPaymentCoordinator::supportsVersion):
(WebCore::MockPaymentCoordinator::canMakePayments):
(WebCore::MockPaymentCoordinator::canMakePaymentsWithActiveCard):
(WebCore::MockPaymentCoordinator::openPaymentSetup):
(WebCore::MockPaymentCoordinator::showPaymentUI):
(WebCore::MockPaymentCoordinator::paymentCoordinatorDestroyed):

  • testing/MockPaymentCoordinator.h: Added.

LayoutTests:

Copied payment-request-abort-method.https.html and payment-request-show-method.https.html
from web-platform-tests/payment-request/ and changed the payment method from basic-card to
Apple Pay. This needs to eventually be upstreamed back to WPT.

  • TestExpectations:
  • http/tests/paymentrequest/payment-request-abort-method.https-expected.txt: Added.
  • http/tests/paymentrequest/payment-request-abort-method.https.html: Added.
  • http/tests/paymentrequest/payment-request-show-method.https-expected.txt: Added.
  • http/tests/paymentrequest/payment-request-show-method.https.html: Added.
  • platform/ios-wk2/TestExpectations:
  • platform/mac-wk2/TestExpectations:
Location:
trunk
Files:
5 added
2 deleted
19 edited
3 copied

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r223073 r223076  
     12017-10-09  Andy Estes  <aestes@apple.com>
     2
     3        [Payment Request] Implement PaymentRequest.show() and PaymentRequest.hide()
     4        https://bugs.webkit.org/show_bug.cgi?id=178043
     5        <rdar://problem/34076639>
     6
     7        Reviewed by Tim Horton.
     8
     9        Copied payment-request-abort-method.https.html and payment-request-show-method.https.html
     10        from web-platform-tests/payment-request/ and changed the payment method from basic-card to
     11        Apple Pay. This needs to eventually be upstreamed back to WPT.
     12
     13        * TestExpectations:
     14        * http/tests/paymentrequest/payment-request-abort-method.https-expected.txt: Added.
     15        * http/tests/paymentrequest/payment-request-abort-method.https.html: Added.
     16        * http/tests/paymentrequest/payment-request-show-method.https-expected.txt: Added.
     17        * http/tests/paymentrequest/payment-request-show-method.https.html: Added.
     18        * platform/ios-wk2/TestExpectations:
     19        * platform/mac-wk2/TestExpectations:
     20
    1212017-10-09  Youenn Fablet  <youenn@apple.com>
    222
  • trunk/LayoutTests/TestExpectations

    r223053 r223076  
    149149
    150150# Payment Request is only enabled on Cocoa platforms.
     151http/tests/paymentrequest [ Skip ]
    151152imported/w3c/web-platform-tests/payment-request [ Skip ]
    152153
  • trunk/LayoutTests/imported/w3c/ChangeLog

    r223064 r223076  
     12017-10-09  Andy Estes  <aestes@apple.com>
     2
     3        [Payment Request] Implement PaymentRequest.show() and PaymentRequest.hide()
     4        https://bugs.webkit.org/show_bug.cgi?id=178043
     5        <rdar://problem/34076639>
     6
     7        Reviewed by Tim Horton.
     8
     9        * web-platform-tests/payment-request/payment-request-abort-method.https-expected.txt: Removed.
     10        * web-platform-tests/payment-request/payment-request-show-method.https-expected.txt: Removed.
     11
    1122017-10-09  Youenn Fablet  <youenn@apple.com>
    213
  • trunk/LayoutTests/platform/ios-wk2/TestExpectations

    r223053 r223076  
    2929fast/viewport/ios/viewport-fit-auto.html [ Skip ]
    3030
     31http/tests/paymentrequest [ Pass ]
    3132imported/w3c/web-platform-tests/payment-request [ Pass ]
    3233webkit.org/b/175611 imported/w3c/web-platform-tests/payment-request/allowpaymentrequest/allowpaymentrequest-attribute-cross-origin-bc-containers.https.html [ Skip ]
     
    3536webkit.org/b/175611 imported/w3c/web-platform-tests/payment-request/allowpaymentrequest/setting-allowpaymentrequest-timing.https.sub.html [ Skip ]
    3637webkit.org/b/175611 imported/w3c/web-platform-tests/payment-request/allowpaymentrequest/setting-allowpaymentrequest.https.sub.html [ Skip ]
    37 webkit.org/b/177391 imported/w3c/web-platform-tests/payment-request/payment-request-show-method.https.html [ Pass Failure ]
    38 webkit.org/b/177391 imported/w3c/web-platform-tests/payment-request/payment-request-abort-method.https.html [ Pass Failure ]
     38
     39# skip in favor of tests in http/tests/paymentrequest
     40imported/w3c/web-platform-tests/payment-request/payment-request-show-method.https.html [ WontFix ]
     41imported/w3c/web-platform-tests/payment-request/payment-request-abort-method.https.html [ WontFix ]
    3942
    4043 # skip manual payment-request tests
  • trunk/LayoutTests/platform/mac-wk2/TestExpectations

    r223071 r223076  
    2626fast/visual-viewport/rubberbanding-viewport-rects-header-footer.html  [ Pass ]
    2727
    28 imported/w3c/web-platform-tests/payment-request [ Pass ]
     28[ Sierra+ ] http/tests/paymentrequest [ Pass ]
     29[ Sierra+ ] imported/w3c/web-platform-tests/payment-request [ Pass ]
    2930webkit.org/b/175611 imported/w3c/web-platform-tests/payment-request/allowpaymentrequest/allowpaymentrequest-attribute-cross-origin-bc-containers.https.html [ Skip ]
    3031webkit.org/b/175611 imported/w3c/web-platform-tests/payment-request/allowpaymentrequest/no-attribute-cross-origin-bc-containers.https.html [ Skip ]
     
    3334webkit.org/b/175611 imported/w3c/web-platform-tests/payment-request/allowpaymentrequest/setting-allowpaymentrequest.https.sub.html [ Skip ]
    3435webkit.org/b/177783 imported/w3c/web-platform-tests/payment-request/rejects_if_not_active.https.html [ Skip ]
    35 webkit.org/b/177391 imported/w3c/web-platform-tests/payment-request/payment-request-show-method.https.html [ Pass Failure ]
    36 webkit.org/b/177391 imported/w3c/web-platform-tests/payment-request/payment-request-abort-method.https.html [ Pass Failure ]
     36
     37# skip in favor of tests in http/tests/paymentrequest
     38imported/w3c/web-platform-tests/payment-request/payment-request-show-method.https.html [ WontFix ]
     39imported/w3c/web-platform-tests/payment-request/payment-request-abort-method.https.html [ WontFix ]
    3740
    3841# skip manual payment-request tests
  • trunk/Source/WebCore/ChangeLog

    r223073 r223076  
     12017-10-09  Andy Estes  <aestes@apple.com>
     2
     3        [Payment Request] Implement PaymentRequest.show() and PaymentRequest.hide()
     4        https://bugs.webkit.org/show_bug.cgi?id=178043
     5        <rdar://problem/34076639>
     6
     7        Reviewed by Tim Horton.
     8
     9        Tests: http/tests/paymentrequest/payment-request-abort-method.https.html
     10               http/tests/paymentrequest/payment-request-show-method.https.html
     11
     12        * Modules/applepay/PaymentCoordinator.h:
     13        * Modules/applepay/PaymentSession.h: Virtually inherited from PaymentSessionBase to
     14        accommodate ApplePayPaymentHandler inheriting from both this and PaymentHandler.
     15        (WebCore::PaymentSession::~PaymentSession): Deleted.
     16        * Modules/applepay/paymentrequest/ApplePayPaymentHandler.cpp:
     17        (WebCore::paymentCoordinator): Virtually inherited from PaymentSessionBase to accommodate
     18        ApplePayPaymentHandler inheriting from both this and PaymentSession.
     19        (WebCore::ApplePayPaymentHandler::hasActiveSession): Added. Calls PaymentCoordinator::hasActiveSession().
     20        (WebCore::ApplePayPaymentHandler::show): Added. Calls PaymentCoordinator::beginPaymentSession().
     21        (WebCore::ApplePayPaymentHandler::hide): Added. Calls PaymentCoordinator::abortPaymentSession().
     22        * Modules/applepay/paymentrequest/ApplePayPaymentHandler.h: Inherited from PaymentSession in
     23        addition to PaymentHandler so that this can be PaymentCoordinator active session.
     24        * Modules/paymentrequest/PaymentHandler.cpp:
     25        (WebCore::PaymentHandler::create):
     26        (WebCore::PaymentHandler::hasActiveSession):
     27        * Modules/paymentrequest/PaymentHandler.h:
     28        * Modules/paymentrequest/PaymentRequest.cpp:
     29        (WebCore::PaymentRequest::~PaymentRequest):
     30        (WebCore::PaymentRequest::show): Rejected the promise if PaymentCoordinator has an active session.
     31        (WebCore::PaymentRequest::abort): Called stop().
     32        (WebCore::PaymentRequest::canSuspendForDocumentSuspension const): Returned true if state is
     33        Interactive and there is an active handler showing.
     34        (WebCore::PaymentRequest::stop): Hid the active session if it's showing, then set state to
     35        Closed and rejected the show promise.
     36        * Modules/paymentrequest/PaymentRequest.h:
     37        * Modules/paymentrequest/PaymentSessionBase.h: Added. Inherits from
     38        RefCounted<PaymentSessionBase> and defines a virtual destructor. This allows subclasses to
     39        virtually inherit a single ref-count to support multiple inheritance.
     40        * WebCore.xcodeproj/project.pbxproj:
     41        * bindings/scripts/CodeGeneratorJS.pm:
     42        (GetGnuVTableOffsetForType): Added ApplePaySession to the list of classes that need a vtable
     43        offset of 3.
     44        * page/MainFrame.cpp:
     45        (WebCore::MainFrame::setPaymentCoordinator): Added a setter for m_paymentCoordinator.
     46        * page/MainFrame.h:
     47        * testing/Internals.cpp:
     48        (WebCore::Internals::Internals): Set the main frame's payment coordinator to a new
     49        PaymentCoordinator with MockPaymentCoordinator as its client.
     50        * testing/MockPaymentCoordinator.cpp: Added a mock PaymentCoordinatorClient for testing.
     51        (WebCore::MockPaymentCoordinator::supportsVersion):
     52        (WebCore::MockPaymentCoordinator::canMakePayments):
     53        (WebCore::MockPaymentCoordinator::canMakePaymentsWithActiveCard):
     54        (WebCore::MockPaymentCoordinator::openPaymentSetup):
     55        (WebCore::MockPaymentCoordinator::showPaymentUI):
     56        (WebCore::MockPaymentCoordinator::paymentCoordinatorDestroyed):
     57        * testing/MockPaymentCoordinator.h: Added.
     58
    1592017-10-09  Youenn Fablet  <youenn@apple.com>
    260
  • trunk/Source/WebCore/Modules/applepay/PaymentCoordinator.h

    r222915 r223076  
    11/*
    2  * Copyright (C) 2015, 2016 Apple Inc. All rights reserved.
     2 * Copyright (C) 2015-2017 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    4848class PaymentCoordinator {
    4949public:
    50     explicit PaymentCoordinator(PaymentCoordinatorClient&);
    51     ~PaymentCoordinator();
     50    WEBCORE_EXPORT explicit PaymentCoordinator(PaymentCoordinatorClient&);
     51    WEBCORE_EXPORT ~PaymentCoordinator();
    5252
    5353    bool supportsVersion(unsigned version);
  • trunk/Source/WebCore/Modules/applepay/PaymentSession.h

    r223053 r223076  
    2929
    3030#include "ApplePaySessionPaymentRequest.h"
    31 #include <wtf/RefCounted.h>
     31#include "PaymentSessionBase.h"
    3232
    3333namespace WebCore {
     
    3838class URL;
    3939
    40 class PaymentSession : public RefCounted<PaymentSession> {
     40class PaymentSession : public virtual PaymentSessionBase {
    4141public:
    42     virtual ~PaymentSession() { }
    43 
    4442    virtual void validateMerchant(const URL&) = 0;
    4543    virtual void didAuthorizePayment(const Payment&) = 0;
  • trunk/Source/WebCore/Modules/applepay/paymentrequest/ApplePayPaymentHandler.cpp

    r223053 r223076  
    3535#include "Frame.h"
    3636#include "JSApplePayRequest.h"
     37#include "LinkIconCollector.h"
    3738#include "MainFrame.h"
    3839#include "PaymentContact.h"
     
    4950    auto& url = WTF::get<URL>(identifier);
    5051    return url.host() == "apple.com" && url.path() == "/apple-pay";
     52}
     53
     54static inline PaymentCoordinator& paymentCoordinator(Document& document)
     55{
     56    return document.frame()->mainFrame().paymentCoordinator();
     57}
     58
     59bool ApplePayPaymentHandler::hasActiveSession(Document& document)
     60{
     61    return paymentCoordinator(document).hasActiveSession();
    5162}
    5263
     
    148159}
    149160
    150 void ApplePayPaymentHandler::show()
     161void ApplePayPaymentHandler::show(Document& document)
    151162{
    152     // FIXME: Call PaymentCoordinator::beginPaymentSession() with m_applePayRequest
     163    Vector<URL> linkIconURLs;
     164    for (auto& icon : LinkIconCollector { document }.iconsOfTypes({ LinkIconType::TouchIcon, LinkIconType::TouchPrecomposedIcon }))
     165        linkIconURLs.append(icon.url);
     166
     167    paymentCoordinator(document).beginPaymentSession(*this, document.url(), linkIconURLs, *m_applePayRequest);
     168}
     169
     170void ApplePayPaymentHandler::hide(Document& document)
     171{
     172    paymentCoordinator(document).abortPaymentSession();
    153173}
    154174
  • trunk/Source/WebCore/Modules/applepay/paymentrequest/ApplePayPaymentHandler.h

    r223053 r223076  
    3030#include "ApplePaySessionPaymentRequest.h"
    3131#include "PaymentHandler.h"
     32#include "PaymentSession.h"
    3233#include <wtf/Noncopyable.h>
    3334#include <wtf/Ref.h>
     
    3536namespace WebCore {
    3637
    37 class Document;
    3838class PaymentRequest;
    3939
    40 class ApplePayPaymentHandler final : public PaymentHandler {
    41     WTF_MAKE_NONCOPYABLE(ApplePayPaymentHandler);
     40class ApplePayPaymentHandler final : public PaymentHandler, public PaymentSession {
    4241public:
    4342    static bool handlesIdentifier(const PaymentRequest::MethodIdentifier&);
     43    static bool hasActiveSession(Document&);
    4444
    4545private:
    46     friend std::unique_ptr<ApplePayPaymentHandler> std::make_unique<ApplePayPaymentHandler>(PaymentRequest&);
     46    friend class PaymentHandler;
    4747    explicit ApplePayPaymentHandler(PaymentRequest&);
    4848
     49    // PaymentHandler
    4950    ExceptionOr<void> convertData(JSC::ExecState&, JSC::JSValue&&) final;
    50     void show() final;
     51    void show(Document&) final;
     52    void hide(Document&) final;
     53
     54    // PaymentSession
     55    void validateMerchant(const URL&) final { }
     56    void didAuthorizePayment(const Payment&) final { }
     57    void didSelectShippingMethod(const ApplePaySessionPaymentRequest::ShippingMethod&) final { }
     58    void didSelectShippingContact(const PaymentContact&) final { }
     59    void didSelectPaymentMethod(const PaymentMethod&) final { }
     60    void didCancelPaymentSession() final { }
    5161
    5262    Ref<PaymentRequest> m_paymentRequest;
  • trunk/Source/WebCore/Modules/paymentrequest/PaymentHandler.cpp

    r223053 r223076  
    3535namespace WebCore {
    3636
    37 std::unique_ptr<PaymentHandler> PaymentHandler::create(PaymentRequest& paymentRequest, const PaymentRequest::MethodIdentifier& identifier)
     37RefPtr<PaymentHandler> PaymentHandler::create(PaymentRequest& paymentRequest, const PaymentRequest::MethodIdentifier& identifier)
    3838{
    3939#if ENABLE(APPLE_PAY)
    4040    if (ApplePayPaymentHandler::handlesIdentifier(identifier))
    41         return std::make_unique<ApplePayPaymentHandler>(paymentRequest);
     41        return adoptRef(new ApplePayPaymentHandler(paymentRequest));
    4242#else
    4343    UNUSED_PARAM(paymentRequest);
     
    4848}
    4949
     50bool PaymentHandler::hasActiveSession(Document& document)
     51{
     52#if ENABLE(APPLE_PAY)
     53    return ApplePayPaymentHandler::hasActiveSession(document);
     54#else
     55    UNUSED_PARAM(document);
     56    return false;
     57#endif
     58}
     59
    5060} // namespace WebCore
    5161
  • trunk/Source/WebCore/Modules/paymentrequest/PaymentHandler.h

    r223053 r223076  
    2929
    3030#include "PaymentRequest.h"
     31#include "PaymentSessionBase.h"
    3132
    3233namespace JSC {
     
    3738namespace WebCore {
    3839
    39 class PaymentHandler {
     40class Document;
     41
     42class PaymentHandler : public virtual PaymentSessionBase {
    4043public:
    41     static std::unique_ptr<PaymentHandler> create(PaymentRequest&, const PaymentRequest::MethodIdentifier&);
    42     virtual ~PaymentHandler() = default;
     44    static RefPtr<PaymentHandler> create(PaymentRequest&, const PaymentRequest::MethodIdentifier&);
     45    static bool hasActiveSession(Document&);
    4346
    4447    virtual ExceptionOr<void> convertData(JSC::ExecState&, JSC::JSValue&&) = 0;
    45     virtual void show() = 0;
     48    virtual void show(Document&) = 0;
     49    virtual void hide(Document&) = 0;
    4650};
    4751
  • trunk/Source/WebCore/Modules/paymentrequest/PaymentRequest.cpp

    r223053 r223076  
    337337PaymentRequest::~PaymentRequest()
    338338{
     339    ASSERT(!hasPendingActivity());
     340    ASSERT(!m_activePaymentHandler);
    339341}
    340342
     
    350352    }
    351353
    352     // FIXME: Reject promise with AbortError if PaymentCoordinator already has an active session.
     354    auto& document = downcast<Document>(*scriptExecutionContext());
     355    if (PaymentHandler::hasActiveSession(document)) {
     356        promise.reject(Exception { AbortError });
     357        return;
     358    }
    353359
    354360    m_state = State::Interactive;
     
    356362    m_showPromise = WTFMove(promise);
    357363
    358     std::unique_ptr<PaymentHandler> selectedPaymentHandler;
     364    RefPtr<PaymentHandler> selectedPaymentHandler;
    359365    for (auto& paymentMethod : m_serializedMethodData) {
    360         auto scope = DECLARE_THROW_SCOPE(scriptExecutionContext()->vm());
    361         JSC::JSValue data = JSONParse(scriptExecutionContext()->execState(), paymentMethod.serializedData);
     366        auto scope = DECLARE_THROW_SCOPE(document.vm());
     367        JSC::JSValue data = JSONParse(document.execState(), paymentMethod.serializedData);
    362368        if (scope.exception()) {
    363369            m_showPromise->reject(Exception { ExistingExceptionError });
     
    369375            continue;
    370376
    371         auto result = handler->convertData(*scriptExecutionContext()->execState(), WTFMove(data));
     377        auto result = handler->convertData(*document.execState(), WTFMove(data));
    372378        if (result.hasException()) {
    373379            m_showPromise->reject(result.releaseException());
     
    384390    }
    385391
    386     selectedPaymentHandler->show();
     392    ASSERT(!m_activePaymentHandler);
     393    m_activePaymentHandler = WTFMove(selectedPaymentHandler);
     394
     395    m_activePaymentHandler->show(document);
     396    setPendingActivity(this);
    387397}
    388398
     
    393403        return Exception { InvalidStateError };
    394404
    395     m_state = State::Closed;
    396     ASSERT(m_showPromise);
    397     m_showPromise->reject(Exception { AbortError });
     405    stop();
    398406    promise.resolve();
    399407    return { };
     
    424432}
    425433
     434bool PaymentRequest::canSuspendForDocumentSuspension() const
     435{
     436    switch (m_state) {
     437    case State::Created:
     438    case State::Closed:
     439        ASSERT(!m_activePaymentHandler);
     440        return true;
     441    case State::Interactive:
     442        return !m_activePaymentHandler;
     443    }
     444}
     445
     446void PaymentRequest::stop()
     447{
     448    if (m_state != State::Interactive)
     449        return;
     450
     451    if (auto paymentHandler = std::exchange(m_activePaymentHandler, nullptr)) {
     452        unsetPendingActivity(this);
     453        paymentHandler->hide(downcast<Document>(*scriptExecutionContext()));
     454    }
     455
     456    ASSERT(m_state == State::Interactive);
     457    m_state = State::Closed;
     458    m_showPromise->reject(Exception { AbortError });
     459}
     460
    426461} // namespace WebCore
    427462
  • trunk/Source/WebCore/Modules/paymentrequest/PaymentRequest.h

    r223053 r223076  
    4141class Document;
    4242class PaymentAddress;
     43class PaymentHandler;
    4344class PaymentResponse;
    4445enum class PaymentShippingType;
     
    8687    // ActiveDOMObject
    8788    const char* activeDOMObjectName() const final { return "PaymentRequest"; }
    88     bool canSuspendForDocumentSuspension() const final { return true; }
    89     void stop() final { }
     89    bool canSuspendForDocumentSuspension() const final;
     90    void stop() final;
    9091
    9192    // EventTarget
     
    103104    State m_state { State::Created };
    104105    std::optional<ShowPromise> m_showPromise;
    105     std::optional<AbortPromise> m_abortPromise;
    106106    std::optional<CanMakePaymentPromise> m_canMakePaymentPromise;
     107    RefPtr<PaymentHandler> m_activePaymentHandler;
    107108};
    108109
  • trunk/Source/WebCore/Modules/paymentrequest/PaymentSessionBase.h

    r223073 r223076  
    2626#pragma once
    2727
    28 #if ENABLE(PAYMENT_REQUEST)
     28#if ENABLE(APPLE_PAY) || ENABLE(PAYMENT_REQUEST)
    2929
    30 #include "PaymentRequest.h"
    31 
    32 namespace JSC {
    33 class ExecState;
    34 class JSValue;
    35 }
     30#include <wtf/RefCounted.h>
    3631
    3732namespace WebCore {
    3833
    39 class PaymentHandler {
    40 public:
    41     static std::unique_ptr<PaymentHandler> create(PaymentRequest&, const PaymentRequest::MethodIdentifier&);
    42     virtual ~PaymentHandler() = default;
    43 
    44     virtual ExceptionOr<void> convertData(JSC::ExecState&, JSC::JSValue&&) = 0;
    45     virtual void show() = 0;
     34struct PaymentSessionBase : RefCounted<PaymentSessionBase> {
     35    virtual ~PaymentSessionBase() = default;
    4636};
    4737
    4838} // namespace WebCore
    4939
    50 #endif // ENABLE(PAYMENT_REQUEST)
     40#endif // ENABLE(APPLE_PAY) || ENABLE(PAYMENT_REQUEST)
  • trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj

    r223053 r223076  
    23482348                517A534F1F54A8BA00DCDC0A /* ServiceWorkerRegistrationData.h in Headers */ = {isa = PBXBuildFile; fileRef = 517A534C1F549D4A00DCDC0A /* ServiceWorkerRegistrationData.h */; settings = {ATTRIBUTES = (Private, ); }; };
    23492349                517A53581F5889E800DCDC0A /* FetchLoaderClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 4147E2B61C89912600A7E715 /* FetchLoaderClient.h */; settings = {ATTRIBUTES = (Private, ); }; };
    2350                 517A535A1F5889EF00DCDC0A /* FetchLoader.h in Headers */ = {isa = PBXBuildFile; fileRef = 4147E2B51C89912600A7E715 /* FetchLoader.h */; settings = {ATTRIBUTES = (Private, ); }; };
    23512350                517A535B1F588A4C00DCDC0A /* FetchBodyConsumer.h in Headers */ = {isa = PBXBuildFile; fileRef = 41CF8BE51D46222000707DC9 /* FetchBodyConsumer.h */; settings = {ATTRIBUTES = (Private, ); }; };
    23522351                517A535D1F5899FE00DCDC0A /* ServiceWorkerFetchResult.h in Headers */ = {isa = PBXBuildFile; fileRef = 517A535C1F5899F200DCDC0A /* ServiceWorkerFetchResult.h */; settings = {ATTRIBUTES = (Private, ); }; };
     
    44394438                A17C81230F2A5CF7005DAAEB /* HTMLElementFactory.h in Headers */ = {isa = PBXBuildFile; fileRef = A17C81210F2A5CF7005DAAEB /* HTMLElementFactory.h */; };
    44404439                A17D275E1EAC579800BF01E7 /* MediaSelectionOption.h in Headers */ = {isa = PBXBuildFile; fileRef = A17D275D1EAC579800BF01E7 /* MediaSelectionOption.h */; settings = {ATTRIBUTES = (Private, ); }; };
     4440                A17FEE641F8893220021E811 /* PaymentSessionBase.h in Headers */ = {isa = PBXBuildFile; fileRef = A17FEE631F8893220021E811 /* PaymentSessionBase.h */; };
    44414441                A182D5B71BE722670087A7CC /* SettingsCocoa.mm in Sources */ = {isa = PBXBuildFile; fileRef = A182D5B61BE722620087A7CC /* SettingsCocoa.mm */; };
    44424442                A185B4291E8211A100DC9118 /* PreviewLoader.mm in Sources */ = {isa = PBXBuildFile; fileRef = A185B4271E8211A100DC9118 /* PreviewLoader.mm */; };
     
    44504450                A19D934B1AA11B1E00B46C24 /* NetworkExtensionContentFilter.h in Headers */ = {isa = PBXBuildFile; fileRef = A19D93491AA11B1E00B46C24 /* NetworkExtensionContentFilter.h */; };
    44514451                A1AA9AB91D23911500FEADB3 /* ContentFilterBlockedPage.html in Resources */ = {isa = PBXBuildFile; fileRef = A1AA9AB81D23911500FEADB3 /* ContentFilterBlockedPage.html */; };
     4452                A1AFEDE61F8BFF6D0087013F /* MockPaymentCoordinator.h in Headers */ = {isa = PBXBuildFile; fileRef = A1AFEDE41F8BFF6D0087013F /* MockPaymentCoordinator.h */; };
     4453                A1AFEDE71F8BFF6D0087013F /* MockPaymentCoordinator.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A1AFEDE51F8BFF6D0087013F /* MockPaymentCoordinator.cpp */; };
    44524454                A1B5B29E1AAA846E008B6042 /* MockContentFilterSettings.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A1B5B29C1AAA846E008B6042 /* MockContentFilterSettings.cpp */; };
    44534455                A1B5B29F1AAA846F008B6042 /* MockContentFilterSettings.h in Headers */ = {isa = PBXBuildFile; fileRef = A1B5B29D1AAA846E008B6042 /* MockContentFilterSettings.h */; settings = {ATTRIBUTES = (Private, ); }; };
     
    1292312925                A17C81210F2A5CF7005DAAEB /* HTMLElementFactory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HTMLElementFactory.h; sourceTree = "<group>"; };
    1292412926                A17D275D1EAC579800BF01E7 /* MediaSelectionOption.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MediaSelectionOption.h; sourceTree = "<group>"; };
     12927                A17FEE631F8893220021E811 /* PaymentSessionBase.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = PaymentSessionBase.h; sourceTree = "<group>"; };
    1292512928                A182D5B61BE722620087A7CC /* SettingsCocoa.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = SettingsCocoa.mm; sourceTree = "<group>"; };
    1292612929                A185B4271E8211A100DC9118 /* PreviewLoader.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = PreviewLoader.mm; sourceTree = "<group>"; };
     
    1293512938                A19D93491AA11B1E00B46C24 /* NetworkExtensionContentFilter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NetworkExtensionContentFilter.h; sourceTree = "<group>"; };
    1293612939                A1AA9AB81D23911500FEADB3 /* ContentFilterBlockedPage.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = ContentFilterBlockedPage.html; sourceTree = "<group>"; };
     12940                A1AFEDE41F8BFF6D0087013F /* MockPaymentCoordinator.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MockPaymentCoordinator.h; sourceTree = "<group>"; };
     12941                A1AFEDE51F8BFF6D0087013F /* MockPaymentCoordinator.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = MockPaymentCoordinator.cpp; sourceTree = "<group>"; };
    1293712942                A1B5B29C1AAA846E008B6042 /* MockContentFilterSettings.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MockContentFilterSettings.cpp; sourceTree = "<group>"; };
    1293812943                A1B5B29D1AAA846E008B6042 /* MockContentFilterSettings.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MockContentFilterSettings.h; sourceTree = "<group>"; };
     
    1822718232                                2DAAE32C19DCAF6000E002D2 /* MockPageOverlayClient.cpp */,
    1822818233                                2DAAE32D19DCAF6000E002D2 /* MockPageOverlayClient.h */,
     18234                                A1AFEDE51F8BFF6D0087013F /* MockPaymentCoordinator.cpp */,
     18235                                A1AFEDE41F8BFF6D0087013F /* MockPaymentCoordinator.h */,
    1822918236                                A14061891E2ECA0A0032B34E /* MockPreviewLoaderClient.cpp */,
    1823018237                                A140618A1E2ECA0A0032B34E /* MockPreviewLoaderClient.h */,
     
    2176521772                                A1F76B3A1F44CF240014C318 /* PaymentResponse.h */,
    2176621773                                A1F76B3C1F44CF240014C318 /* PaymentResponse.idl */,
     21774                                A17FEE631F8893220021E811 /* PaymentSessionBase.h */,
    2176721775                                A1F76B521F44D2C70014C318 /* PaymentShippingOption.h */,
    2176821776                                A1F76B541F44D2C70014C318 /* PaymentShippingOption.idl */,
     
    2217222180                                E446140E0CD6826900FADA75 /* JSHTMLVideoElement.cpp */,
    2217322181                                E446140F0CD6826900FADA75 /* JSHTMLVideoElement.h */,
    22174                                 7C7903B71F86FDE400463A70 /* JSImageBitmapRenderingContext.cpp */,
    22175                                 7C7903B81F86FDE600463A70 /* JSImageBitmapRenderingContext.h */,
    2217622182                                31D26BC61F86D269008FF255 /* JSImageBitmap.cpp */,
    2217722183                                31D26BC31F86D265008FF255 /* JSImageBitmap.h */,
    2217822184                                31D26BC41F86D266008FF255 /* JSImageBitmapOptions.cpp */,
    2217922185                                31D26BC51F86D268008FF255 /* JSImageBitmapOptions.h */,
     22186                                7C7903B71F86FDE400463A70 /* JSImageBitmapRenderingContext.cpp */,
     22187                                7C7903B81F86FDE600463A70 /* JSImageBitmapRenderingContext.h */,
    2218022188                                A77979240D6B9E64003851B9 /* JSImageData.cpp */,
    2218122189                                A77979250D6B9E64003851B9 /* JSImageData.h */,
     
    2714327151                                2D6F3E911C1ECB2F0061DBD4 /* MockPageOverlay.h in Headers */,
    2714427152                                2D97F04819DD4140001EE9C3 /* MockPageOverlayClient.h in Headers */,
     27153                                A1AFEDE61F8BFF6D0087013F /* MockPaymentCoordinator.h in Headers */,
    2714527154                                A140618C1E2ECA0A0032B34E /* MockPreviewLoaderClient.h in Headers */,
    2714627155                                AA5F3B8D16CC33D100455EB0 /* PlatformSpeechSynthesizerMock.h in Headers */,
     
    2797227981                                84730D871248F0B300D3A9C9 /* FEOffset.h in Headers */,
    2797327982                                84730D891248F0B300D3A9C9 /* FESpecularLighting.h in Headers */,
     27983                                517A535B1F588A4C00DCDC0A /* FetchBodyConsumer.h in Headers */,
    2797427984                                4129C9971F59B963009D7403 /* FetchBodySource.h in Headers */,
    2797527985                                41D129DB1F3D143800D15E47 /* FetchHeaders.h in Headers */,
     27986                                517A53581F5889E800DCDC0A /* FetchLoaderClient.h in Headers */,
    2797627987                                41AD753A1CEF6BD100A31486 /* FetchOptions.h in Headers */,
    2797727988                                7CE1914D1F2A9AFB00272F78 /* FetchReferrerPolicy.h in Headers */,
     
    2819128202                                977B3867122883E900B81FF8 /* HTMLDocumentParser.h in Headers */,
    2819228203                                93F198E608245E59001E9ABC /* HTMLElement.h in Headers */,
    28193                                 517A53581F5889E800DCDC0A /* FetchLoaderClient.h in Headers */,
    2819428204                                A17C81230F2A5CF7005DAAEB /* HTMLElementFactory.h in Headers */,
    2819528205                                977B37241228721700B81FF8 /* HTMLElementStack.h in Headers */,
     
    2881928829                                838EF53C1DC14A7C008F0C39 /* JSIDBTransactionMode.h in Headers */,
    2882028830                                269239961505E1AA009E57FC /* JSIDBVersionChangeEvent.h in Headers */,
     28831                                7C7761AA1F878AA500F869FC /* JSImageBitmapRenderingContext.h in Headers */,
    2882128832                                A77979290D6B9E64003851B9 /* JSImageData.h in Headers */,
    2882228833                                7C193C011F5E11050088F3E6 /* JSImageSmoothingQuality.h in Headers */,
     
    2936929380                                37C738EF1EDBD71B003F2B0B /* MathMLUnknownElement.h in Headers */,
    2937029381                                439046EA12DA25E812AF80AC /* MathOperator.h in Headers */,
    29371                                 517A535B1F588A4C00DCDC0A /* FetchBodyConsumer.h in Headers */,
    2937229382                                49D5DC2C0F423A73008F20FD /* Matrix3DTransformOperation.h in Headers */,
    2937329383                                49E911C70EF86D47009D0CAF /* MatrixTransformOperation.h in Headers */,
     
    2944329453                                CDDC1E7A18A952F30027A9D4 /* MediaSourcePrivateClient.h in Headers */,
    2944429454                                CD61FE681794AADB004101EB /* MediaSourceRegistry.h in Headers */,
    29445                                 7C7761AA1F878AA500F869FC /* JSImageBitmapRenderingContext.h in Headers */,
    2944629455                                078E091517D14D1C00420AA1 /* MediaStream.h in Headers */,
    2944729456                                078E094C17D1709600420AA1 /* MediaStreamAudioDestinationNode.h in Headers */,
     
    2952629535                                A19D934B1AA11B1E00B46C24 /* NetworkExtensionContentFilter.h in Headers */,
    2952729536                                628D214C12131ED10055DCFC /* NetworkingContext.h in Headers */,
    29528                                 517A535D1F5899FE00DCDC0A /* ServiceWorkerFetchResult.h in Headers */,
    2952929537                                8A81BF8511DCFD9000DA2B98 /* NetworkLoadMetrics.h in Headers */,
    2953029538                                59C27F07138D28CF0079B7E2 /* NetworkResourcesData.h in Headers */,
     
    2965929667                                A1F76B3D1F44CF240014C318 /* PaymentResponse.h in Headers */,
    2966029668                                A1491DA31F859D870095F5D4 /* PaymentSession.h in Headers */,
     29669                                A17FEE641F8893220021E811 /* PaymentSessionBase.h in Headers */,
    2966129670                                A1F76B551F44D2C70014C318 /* PaymentShippingOption.h in Headers */,
    2966229671                                A1F76B491F44D07A0014C318 /* PaymentShippingType.h in Headers */,
     
    3014430153                                51F1755D1F3EBC8300C74950 /* ServiceWorker.h in Headers */,
    3014530154                                51F1755F1F3EBC8300C74950 /* ServiceWorkerContainer.h in Headers */,
     30155                                517A535D1F5899FE00DCDC0A /* ServiceWorkerFetchResult.h in Headers */,
    3014630156                                51F175611F3EBC8300C74950 /* ServiceWorkerGlobalScope.h in Headers */,
    3014730157                                51F175631F3EBC8300C74950 /* ServiceWorkerJob.h in Headers */,
     
    3134131351                                2D6F3E901C1ECB270061DBD4 /* MockPageOverlay.cpp in Sources */,
    3134231352                                2D97F04719DD413C001EE9C3 /* MockPageOverlayClient.cpp in Sources */,
     31353                                A1AFEDE71F8BFF6D0087013F /* MockPaymentCoordinator.cpp in Sources */,
    3134331354                                A140618B1E2ECA0A0032B34E /* MockPreviewLoaderClient.cpp in Sources */,
    3134431355                                AA5F3B8F16CC4B3900455EB0 /* PlatformSpeechSynthesizerMock.cpp in Sources */,
     
    3175031761                                BC64B4DB0CB4298A005F2B62 /* CSSFontSelector.cpp in Sources */,
    3175131762                                C2E38F011E84573500CA3ADF /* CSSFontStyleRangeValue.cpp in Sources */,
    31752                                 7C7761A81F878A8B00F869FC /* JSImageBitmapRenderingContext.cpp in Sources */,
    3175331763                                C2E38EFD1E8396FD00CA3ADF /* CSSFontStyleValue.cpp in Sources */,
    3175431764                                A80E6CF10A1989CA007FB8C5 /* CSSFontValue.cpp in Sources */,
     
    3239332403                                C3CF17A615B0063F00276D39 /* IdTargetObserverRegistry.cpp in Sources */,
    3239432404                                B275356F0B053814002CE64F /* Image.cpp in Sources */,
     32405                                31D26BCB1F87065B008FF255 /* ImageBitmap.cpp in Sources */,
    3239532406                                7C7903B41F86F95C00463A70 /* ImageBitmapRenderingContext.cpp in Sources */,
    32396                                 31D26BCB1F87065B008FF255 /* ImageBitmap.cpp in Sources */,
    3239732407                                43D2597713C816F400608559 /* ImageBuffer.cpp in Sources */,
    3239832408                                B2A10B940B3818D700099AA4 /* ImageBufferCG.cpp in Sources */,
     
    3286632876                                31D26BC81F87063D008FF255 /* JSImageBitmap.cpp in Sources */,
    3286732877                                31D26BCA1F870645008FF255 /* JSImageBitmapOptions.cpp in Sources */,
     32878                                7C7761A81F878A8B00F869FC /* JSImageBitmapRenderingContext.cpp in Sources */,
    3286832879                                A77979280D6B9E64003851B9 /* JSImageData.cpp in Sources */,
    3286932880                                A7D0318E0E93540300E24ACD /* JSImageDataCustom.cpp in Sources */,
  • trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm

    r223053 r223076  
    35233523{
    35243524    my $typename = shift;
    3525     if ($typename eq "SVGAElement"
     3525    if ($typename eq "ApplePaySession"
     3526        || $typename eq "SVGAElement"
    35263527        || $typename eq "SVGCircleElement"
    35273528        || $typename eq "SVGClipPathElement"
  • trunk/Source/WebCore/page/MainFrame.cpp

    r219595 r223076  
    11/*
    2  * Copyright (C) 2013-2016 Apple Inc. All rights reserved.
     2 * Copyright (C) 2013-2017 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    138138#endif
    139139
     140#if ENABLE(APPLE_PAY)
     141void MainFrame::setPaymentCoordinator(std::unique_ptr<PaymentCoordinator>&& paymentCoordinator)
     142{
     143    m_paymentCoordinator = WTFMove(paymentCoordinator);
    140144}
     145#endif
     146
     147}
  • trunk/Source/WebCore/page/MainFrame.h

    r219008 r223076  
    11/*
    2  * Copyright (C) 2013-2014 Apple Inc. All rights reserved.
     2 * Copyright (C) 2013-2017 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    6565#if ENABLE(APPLE_PAY)
    6666    PaymentCoordinator& paymentCoordinator() const { return *m_paymentCoordinator; }
     67    WEBCORE_EXPORT void setPaymentCoordinator(std::unique_ptr<PaymentCoordinator>&&);
    6768#endif
    6869
  • trunk/Source/WebCore/testing/Internals.cpp

    r223073 r223076  
    242242#endif
    243243
     244#if ENABLE(APPLE_PAY)
     245#include "MockPaymentCoordinator.h"
     246#include "PaymentCoordinator.h"
     247#endif
     248
    244249using JSC::CallData;
    245250using JSC::CallType;
     
    501506
    502507    setConsoleMessageListener(nullptr);
     508
     509#if ENABLE(APPLE_PAY)
     510    document.frame()->mainFrame().setPaymentCoordinator(std::make_unique<PaymentCoordinator>(*new MockPaymentCoordinator()));
     511#endif
    503512}
    504513
  • trunk/Source/WebCore/testing/MockPaymentCoordinator.cpp

    r223073 r223076  
    2525
    2626#include "config.h"
    27 #include "PaymentHandler.h"
    28 
    29 #if ENABLE(PAYMENT_REQUEST)
     27#include "MockPaymentCoordinator.h"
    3028
    3129#if ENABLE(APPLE_PAY)
    32 #include "ApplePayPaymentHandler.h"
    33 #endif
     30
     31#include <wtf/RunLoop.h>
    3432
    3533namespace WebCore {
    3634
    37 std::unique_ptr<PaymentHandler> PaymentHandler::create(PaymentRequest& paymentRequest, const PaymentRequest::MethodIdentifier& identifier)
     35bool MockPaymentCoordinator::supportsVersion(unsigned version)
    3836{
    39 #if ENABLE(APPLE_PAY)
    40     if (ApplePayPaymentHandler::handlesIdentifier(identifier))
    41         return std::make_unique<ApplePayPaymentHandler>(paymentRequest);
     37    ASSERT(version > 0);
     38
     39#if !ENABLE(APPLE_PAY_SESSION_V3)
     40    static const unsigned currentVersion = 2;
    4241#else
    43     UNUSED_PARAM(paymentRequest);
    44     UNUSED_PARAM(identifier);
     42    static const unsigned currentVersion = 3;
    4543#endif
    4644
    47     return nullptr;
     45    return version <= currentVersion;
     46}
     47
     48bool MockPaymentCoordinator::canMakePayments()
     49{
     50    return true;
     51}
     52
     53void MockPaymentCoordinator::canMakePaymentsWithActiveCard(const String&, const String&, WTF::Function<void(bool)>&& completionHandler)
     54{
     55    RunLoop::main().dispatch([completionHandler = WTFMove(completionHandler)]() {
     56        completionHandler(true);
     57    });
     58}
     59
     60void MockPaymentCoordinator::openPaymentSetup(const String&, const String&, WTF::Function<void(bool)>&& completionHandler)
     61{
     62    RunLoop::main().dispatch([completionHandler = WTFMove(completionHandler)]() {
     63        completionHandler(true);
     64    });
     65}
     66
     67bool MockPaymentCoordinator::showPaymentUI(const URL&, const Vector<URL>&, const ApplePaySessionPaymentRequest&)
     68{
     69    return true;
     70}
     71
     72void MockPaymentCoordinator::paymentCoordinatorDestroyed()
     73{
     74    delete this;
    4875}
    4976
    5077} // namespace WebCore
    5178
    52 #endif // ENABLE(PAYMENT_REQUEST)
     79#endif // ENABLE(APPLE_PAY)
  • trunk/Source/WebCore/testing/MockPaymentCoordinator.h

    r223073 r223076  
    2828#if ENABLE(APPLE_PAY)
    2929
    30 #include "ApplePaySessionPaymentRequest.h"
    31 #include <wtf/RefCounted.h>
     30#include "PaymentCoordinatorClient.h"
    3231
    3332namespace WebCore {
    3433
    35 class Payment;
    36 class PaymentContact;
    37 class PaymentMethod;
    38 class URL;
    39 
    40 class PaymentSession : public RefCounted<PaymentSession> {
    41 public:
    42     virtual ~PaymentSession() { }
    43 
    44     virtual void validateMerchant(const URL&) = 0;
    45     virtual void didAuthorizePayment(const Payment&) = 0;
    46     virtual void didSelectShippingMethod(const ApplePaySessionPaymentRequest::ShippingMethod&) = 0;
    47     virtual void didSelectShippingContact(const PaymentContact&) = 0;
    48     virtual void didSelectPaymentMethod(const PaymentMethod&) = 0;
    49     virtual void didCancelPaymentSession() = 0;
     34class MockPaymentCoordinator final : public PaymentCoordinatorClient {
     35private:
     36    bool supportsVersion(unsigned) final;
     37    bool canMakePayments() final;
     38    void canMakePaymentsWithActiveCard(const String&, const String&, WTF::Function<void(bool)>&&);
     39    void openPaymentSetup(const String&, const String&, WTF::Function<void(bool)>&&);
     40    bool showPaymentUI(const URL&, const Vector<URL>&, const ApplePaySessionPaymentRequest&) final;
     41    void completeMerchantValidation(const PaymentMerchantSession&) final { }
     42    void completeShippingMethodSelection(std::optional<ShippingMethodUpdate>&&) final { }
     43    void completeShippingContactSelection(std::optional<ShippingContactUpdate>&&) final { }
     44    void completePaymentMethodSelection(std::optional<PaymentMethodUpdate>&&) final { }
     45    void completePaymentSession(std::optional<PaymentAuthorizationResult>&&) final { }
     46    void abortPaymentSession() final { }
     47    void cancelPaymentSession() final { }
     48    void paymentCoordinatorDestroyed() final;
    5049};
    5150
Note: See TracChangeset for help on using the changeset viewer.