Title: [242795] trunk/Source/WebKit
- Revision
- 242795
- Author
- [email protected]
- Date
- 2019-03-12 08:07:13 -0700 (Tue, 12 Mar 2019)
Log 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):
Modified Paths
Diff
Modified: trunk/Source/WebKit/ChangeLog (242794 => 242795)
--- trunk/Source/WebKit/ChangeLog 2019-03-12 14:45:31 UTC (rev 242794)
+++ trunk/Source/WebKit/ChangeLog 2019-03-12 15:07:13 UTC (rev 242795)
@@ -1,3 +1,22 @@
+2019-03-11 Andy Estes <[email protected]>
+
+ [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):
+
2019-03-12 Antti Koivisto <[email protected]>
Compositing layer that renders two positioned elements should not hit test
Modified: trunk/Source/WebKit/Shared/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.mm (242794 => 242795)
--- trunk/Source/WebKit/Shared/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.mm 2019-03-12 14:45:31 UTC (rev 242794)
+++ trunk/Source/WebKit/Shared/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.mm 2019-03-12 15:07:13 UTC (rev 242795)
@@ -54,11 +54,21 @@
bool WebPaymentCoordinatorProxy::platformCanMakePayments()
{
+#if PLATFORM(MAC)
+ if (!PAL::isPassKitFrameworkAvailable())
+ return false;
+#endif
+
return [PAL::getPKPaymentAuthorizationViewControllerClass() canMakePayments];
}
void WebPaymentCoordinatorProxy::platformCanMakePaymentsWithActiveCard(const String& merchantIdentifier, const String& domainName, PAL::SessionID sessionID, WTF::Function<void(bool)>&& completionHandler)
{
+#if PLATFORM(MAC)
+ if (!PAL::isPassKitFrameworkAvailable())
+ return completionHandler(false);
+#endif
+
#if HAVE(PASSKIT_GRANULAR_ERRORS)
PKCanMakePaymentsWithMerchantIdentifierDomainAndSourceApplication(merchantIdentifier, domainName, m_client.paymentCoordinatorSourceApplicationSecondaryIdentifier(*this, sessionID), makeBlockPtr([completionHandler = WTFMove(completionHandler)](BOOL canMakePayments, NSError *error) mutable {
if (error)
@@ -82,6 +92,11 @@
void WebPaymentCoordinatorProxy::platformOpenPaymentSetup(const String& merchantIdentifier, const String& domainName, WTF::Function<void(bool)>&& completionHandler)
{
+#if PLATFORM(MAC)
+ if (!PAL::isPassKitFrameworkAvailable())
+ return completionHandler(false);
+#endif
+
auto passLibrary = adoptNS([PAL::allocPKPassLibraryInstance() init]);
[passLibrary openPaymentSetupForMerchantIdentifier:merchantIdentifier domain:domainName completion:makeBlockPtr([completionHandler = WTFMove(completionHandler)](BOOL result) mutable {
RunLoop::main().dispatch([completionHandler = WTFMove(completionHandler), result] {
@@ -344,6 +359,11 @@
Vector<String> WebPaymentCoordinatorProxy::platformAvailablePaymentNetworks()
{
+#if PLATFORM(MAC)
+ if (!PAL::isPassKitFrameworkAvailable())
+ return { };
+#endif
+
NSArray<PKPaymentNetwork> *availableNetworks = [PAL::getPKPaymentRequestClass() availableNetworks];
Vector<String> result;
result.reserveInitialCapacity(availableNetworks.count);
Modified: trunk/Source/WebKit/Shared/ApplePay/mac/WebPaymentCoordinatorProxyMac.mm (242794 => 242795)
--- trunk/Source/WebKit/Shared/ApplePay/mac/WebPaymentCoordinatorProxyMac.mm 2019-03-12 14:45:31 UTC (rev 242794)
+++ trunk/Source/WebKit/Shared/ApplePay/mac/WebPaymentCoordinatorProxyMac.mm 2019-03-12 15:07:13 UTC (rev 242795)
@@ -37,6 +37,9 @@
void WebPaymentCoordinatorProxy::platformShowPaymentUI(const URL& originatingURL, const Vector<URL>& linkIconURLStrings, PAL::SessionID sessionID, const WebCore::ApplePaySessionPaymentRequest& request, CompletionHandler<void(bool)>&& completionHandler)
{
+ if (!PAL::isPassKitFrameworkAvailable())
+ return completionHandler(false);
+
auto paymentRequest = platformPaymentRequest(originatingURL, linkIconURLStrings, sessionID, request);
auto showPaymentUIRequestSeed = m_showPaymentUIRequestSeed;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes