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

Changeset 242795 in webkit


Ignore:
Timestamp:
Mar 12, 2019, 8:07:13 AM (7 years ago)
Author:
aestes@apple.com
Message:

[Mac] Ensure Apple Pay is unavailable when PassKit.framework is missing
https://bugs.webkit.org/show_bug.cgi?id=195583
<rdar://problem/48420224>

Reviewed by Daniel Bates.

PassKit.framework is optionally soft-linked on Mac because it is missing from the Recovery
Partition. We need to check if the framework is available before calling into it.

  • Shared/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.mm:

(WebKit::WebPaymentCoordinatorProxy::platformCanMakePayments):
(WebKit::WebPaymentCoordinatorProxy::platformCanMakePaymentsWithActiveCard):
(WebKit::WebPaymentCoordinatorProxy::platformOpenPaymentSetup):
(WebKit::WebPaymentCoordinatorProxy::platformAvailablePaymentNetworks):

  • Shared/ApplePay/mac/WebPaymentCoordinatorProxyMac.mm:

(WebKit::WebPaymentCoordinatorProxy::platformShowPaymentUI):

Location:
trunk/Source/WebKit
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit/ChangeLog

    r242794 r242795  
     12019-03-11  Andy Estes  <aestes@apple.com>
     2
     3        [Mac] Ensure Apple Pay is unavailable when PassKit.framework is missing
     4        https://bugs.webkit.org/show_bug.cgi?id=195583
     5        <rdar://problem/48420224>
     6
     7        Reviewed by Daniel Bates.
     8
     9        PassKit.framework is optionally soft-linked on Mac because it is missing from the Recovery
     10        Partition. We need to check if the framework is available before calling into it.
     11
     12        * Shared/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.mm:
     13        (WebKit::WebPaymentCoordinatorProxy::platformCanMakePayments):
     14        (WebKit::WebPaymentCoordinatorProxy::platformCanMakePaymentsWithActiveCard):
     15        (WebKit::WebPaymentCoordinatorProxy::platformOpenPaymentSetup):
     16        (WebKit::WebPaymentCoordinatorProxy::platformAvailablePaymentNetworks):
     17        * Shared/ApplePay/mac/WebPaymentCoordinatorProxyMac.mm:
     18        (WebKit::WebPaymentCoordinatorProxy::platformShowPaymentUI):
     19
    1202019-03-12  Antti Koivisto  <antti@apple.com>
    221
  • trunk/Source/WebKit/Shared/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.mm

    r242748 r242795  
    5555bool WebPaymentCoordinatorProxy::platformCanMakePayments()
    5656{
     57#if PLATFORM(MAC)
     58    if (!PAL::isPassKitFrameworkAvailable())
     59        return false;
     60#endif
     61
    5762    return [PAL::getPKPaymentAuthorizationViewControllerClass() canMakePayments];
    5863}
     
    6065void WebPaymentCoordinatorProxy::platformCanMakePaymentsWithActiveCard(const String& merchantIdentifier, const String& domainName, PAL::SessionID sessionID, WTF::Function<void(bool)>&& completionHandler)
    6166{
     67#if PLATFORM(MAC)
     68    if (!PAL::isPassKitFrameworkAvailable())
     69        return completionHandler(false);
     70#endif
     71
    6272#if HAVE(PASSKIT_GRANULAR_ERRORS)
    6373    PKCanMakePaymentsWithMerchantIdentifierDomainAndSourceApplication(merchantIdentifier, domainName, m_client.paymentCoordinatorSourceApplicationSecondaryIdentifier(*this, sessionID), makeBlockPtr([completionHandler = WTFMove(completionHandler)](BOOL canMakePayments, NSError *error) mutable {
     
    8393void WebPaymentCoordinatorProxy::platformOpenPaymentSetup(const String& merchantIdentifier, const String& domainName, WTF::Function<void(bool)>&& completionHandler)
    8494{
     95#if PLATFORM(MAC)
     96    if (!PAL::isPassKitFrameworkAvailable())
     97        return completionHandler(false);
     98#endif
     99
    85100    auto passLibrary = adoptNS([PAL::allocPKPassLibraryInstance() init]);
    86101    [passLibrary openPaymentSetupForMerchantIdentifier:merchantIdentifier domain:domainName completion:makeBlockPtr([completionHandler = WTFMove(completionHandler)](BOOL result) mutable {
     
    345360Vector<String> WebPaymentCoordinatorProxy::platformAvailablePaymentNetworks()
    346361{
     362#if PLATFORM(MAC)
     363    if (!PAL::isPassKitFrameworkAvailable())
     364        return { };
     365#endif
     366
    347367    NSArray<PKPaymentNetwork> *availableNetworks = [PAL::getPKPaymentRequestClass() availableNetworks];
    348368    Vector<String> result;
  • trunk/Source/WebKit/Shared/ApplePay/mac/WebPaymentCoordinatorProxyMac.mm

    r242748 r242795  
    3838void WebPaymentCoordinatorProxy::platformShowPaymentUI(const URL& originatingURL, const Vector<URL>& linkIconURLStrings, PAL::SessionID sessionID, const WebCore::ApplePaySessionPaymentRequest& request, CompletionHandler<void(bool)>&& completionHandler)
    3939{
     40    if (!PAL::isPassKitFrameworkAvailable())
     41        return completionHandler(false);
     42
    4043    auto paymentRequest = platformPaymentRequest(originatingURL, linkIconURLStrings, sessionID, request);
    4144
Note: See TracChangeset for help on using the changeset viewer.