Diff
Modified: trunk/Source/WTF/ChangeLog (242747 => 242748)
--- trunk/Source/WTF/ChangeLog 2019-03-11 22:37:43 UTC (rev 242747)
+++ trunk/Source/WTF/ChangeLog 2019-03-11 22:42:09 UTC (rev 242748)
@@ -1,3 +1,13 @@
+2019-03-11 Andy Estes <[email protected]>
+
+ [Apple Pay] Use PKPaymentAuthorizationController to present the Apple Pay UI remotely from the Networking service on iOS
+ https://bugs.webkit.org/show_bug.cgi?id=195530
+ <rdar://problem/48747164>
+
+ Reviewed by Alex Christensen.
+
+ * wtf/FeatureDefines.h: Defined ENABLE_APPLE_PAY_REMOTE_UI.
+
2019-03-11 Yusuke Suzuki <[email protected]>
[JSC] Make StaticStringImpl & StaticSymbolImpl actually static
Modified: trunk/Source/WTF/wtf/FeatureDefines.h (242747 => 242748)
--- trunk/Source/WTF/wtf/FeatureDefines.h 2019-03-11 22:37:43 UTC (rev 242747)
+++ trunk/Source/WTF/wtf/FeatureDefines.h 2019-03-11 22:42:09 UTC (rev 242748)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2006, 2007, 2008, 2009, 2013 Apple Inc. All rights reserved.
+ * Copyright (C) 2006-2019 Apple Inc. All rights reserved.
* Copyright (C) 2007-2009 Torch Mobile, Inc.
* Copyright (C) 2010, 2011 Research In Motion Limited. All rights reserved.
* Copyright (C) 2013 Samsung Electronics. All rights reserved.
@@ -59,6 +59,12 @@
#endif
#endif
+#if !defined(ENABLE_APPLE_PAY_REMOTE_UI)
+#if !PLATFORM(APPLETV) && !PLATFORM(IOSMAC) && !PLATFORM(WATCHOS)
+#define ENABLE_APPLE_PAY_REMOTE_UI 1
+#endif
+#endif
+
#if !defined(ENABLE_ASYNC_SCROLLING)
#define ENABLE_ASYNC_SCROLLING 1
#endif
Modified: trunk/Source/WebCore/ChangeLog (242747 => 242748)
--- trunk/Source/WebCore/ChangeLog 2019-03-11 22:37:43 UTC (rev 242747)
+++ trunk/Source/WebCore/ChangeLog 2019-03-11 22:42:09 UTC (rev 242748)
@@ -1,3 +1,15 @@
+2019-03-11 Andy Estes <[email protected]>
+
+ [Apple Pay] Use PKPaymentAuthorizationController to present the Apple Pay UI remotely from the Networking service on iOS
+ https://bugs.webkit.org/show_bug.cgi?id=195530
+ <rdar://problem/48747164>
+
+ Reviewed by Alex Christensen.
+
+ * Modules/applepay/PaymentCoordinatorClient.h: Defined isWebPaymentCoordinator.
+ * page/Settings.yaml: Defined the applePayRemoteUIEnabled setting and reordered the other
+ Apple Pay settings.
+
2019-03-11 Alex Christensen <[email protected]>
Soft linking to Reveal framework should be optional
Modified: trunk/Source/WebCore/Modules/applepay/PaymentCoordinatorClient.h (242747 => 242748)
--- trunk/Source/WebCore/Modules/applepay/PaymentCoordinatorClient.h 2019-03-11 22:37:43 UTC (rev 242747)
+++ trunk/Source/WebCore/Modules/applepay/PaymentCoordinatorClient.h 2019-03-11 22:42:09 UTC (rev 242748)
@@ -63,6 +63,7 @@
virtual void paymentCoordinatorDestroyed() = 0;
virtual bool isMockPaymentCoordinator() const { return false; }
+ virtual bool isWebPaymentCoordinator() const { return false; }
protected:
virtual ~PaymentCoordinatorClient() = default;
Modified: trunk/Source/WebCore/PAL/ChangeLog (242747 => 242748)
--- trunk/Source/WebCore/PAL/ChangeLog 2019-03-11 22:37:43 UTC (rev 242747)
+++ trunk/Source/WebCore/PAL/ChangeLog 2019-03-11 22:42:09 UTC (rev 242748)
@@ -1,3 +1,16 @@
+2019-03-11 Andy Estes <[email protected]>
+
+ [Apple Pay] Use PKPaymentAuthorizationController to present the Apple Pay UI remotely from the Networking service on iOS
+ https://bugs.webkit.org/show_bug.cgi?id=195530
+ <rdar://problem/48747164>
+
+ Reviewed by Alex Christensen.
+
+ * pal/cocoa/PassKitSoftLink.h: Soft-linked PKPaymentAuthorizationController on iOS.
+ * pal/cocoa/PassKitSoftLink.mm: Ditto.
+ * pal/spi/cocoa/PassKitSPI.h: Declared PKPaymentAuthorizationControllerPrivateDelegate and
+ related SPI.
+
2019-03-11 Alex Christensen <[email protected]>
Soft linking to Reveal framework should be optional
Modified: trunk/Source/WebCore/PAL/pal/cocoa/PassKitSoftLink.h (242747 => 242748)
--- trunk/Source/WebCore/PAL/pal/cocoa/PassKitSoftLink.h 2019-03-11 22:37:43 UTC (rev 242747)
+++ trunk/Source/WebCore/PAL/pal/cocoa/PassKitSoftLink.h 2019-03-11 22:42:09 UTC (rev 242748)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2018 Apple Inc. All rights reserved.
+ * Copyright (C) 2018-2019 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -42,6 +42,10 @@
SOFT_LINK_CLASS_FOR_HEADER(PAL, PKPaymentSummaryItem)
SOFT_LINK_CLASS_FOR_HEADER(PAL, PKShippingMethod)
+#if PLATFORM(IOS_FAMILY)
+SOFT_LINK_CLASS_FOR_HEADER(PAL, PKPaymentAuthorizationController)
+#endif
+
SOFT_LINK_FUNCTION_FOR_HEADER(PAL, PassKit, PKCanMakePaymentsWithMerchantIdentifierAndDomain, void, (NSString *identifier, NSString *domain, PKCanMakePaymentsCompletion completion), (identifier, domain, completion))
SOFT_LINK_FUNCTION_FOR_HEADER(PAL, PassKit, PKDrawApplePayButton, void, (CGContextRef context, CGRect drawRect, CGFloat scale, PKPaymentButtonType type, PKPaymentButtonStyle style, NSString *languageCode), (context, drawRect, scale, type, style, languageCode))
Modified: trunk/Source/WebCore/PAL/pal/cocoa/PassKitSoftLink.mm (242747 => 242748)
--- trunk/Source/WebCore/PAL/pal/cocoa/PassKitSoftLink.mm 2019-03-11 22:37:43 UTC (rev 242747)
+++ trunk/Source/WebCore/PAL/pal/cocoa/PassKitSoftLink.mm 2019-03-11 22:42:09 UTC (rev 242748)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2018 Apple Inc. All rights reserved.
+ * Copyright (C) 2018-2019 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -46,6 +46,10 @@
SOFT_LINK_CLASS_FOR_SOURCE_WITH_EXPORT(PAL, PassKit, PKPaymentSummaryItem, PAL_EXPORT)
SOFT_LINK_CLASS_FOR_SOURCE_WITH_EXPORT(PAL, PassKit, PKShippingMethod, PAL_EXPORT)
+#if PLATFORM(IOS_FAMILY)
+SOFT_LINK_CLASS_FOR_SOURCE_WITH_EXPORT(PAL, PassKit, PKPaymentAuthorizationController, PAL_EXPORT)
+#endif
+
SOFT_LINK_FUNCTION_FOR_SOURCE_WITH_EXPORT(PAL, PassKit, PKCanMakePaymentsWithMerchantIdentifierAndDomain, void, (NSString *identifier, NSString *domain, PKCanMakePaymentsCompletion completion), (identifier, domain, completion), PAL_EXPORT)
SOFT_LINK_FUNCTION_FOR_SOURCE(PAL, PassKit, PKDrawApplePayButton, void, (CGContextRef context, CGRect drawRect, CGFloat scale, PKPaymentButtonType type, PKPaymentButtonStyle style, NSString *languageCode), (context, drawRect, scale, type, style, languageCode))
Modified: trunk/Source/WebCore/PAL/pal/spi/cocoa/PassKitSPI.h (242747 => 242748)
--- trunk/Source/WebCore/PAL/pal/spi/cocoa/PassKitSPI.h 2019-03-11 22:37:43 UTC (rev 242747)
+++ trunk/Source/WebCore/PAL/pal/spi/cocoa/PassKitSPI.h 2019-03-11 22:42:09 UTC (rev 242748)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2016-2018 Apple Inc. All rights reserved.
+ * Copyright (C) 2016-2019 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -43,6 +43,10 @@
#import <PassKit/PKPaymentAuthorizationViewController_Private.h>
#import <PassKit/PKPaymentRequest_Private.h>
+#if PLATFORM(IOS_FAMILY)
+#import <PassKit/PKPaymentAuthorizationController_Private.h>
+#endif
+
#else
#if PLATFORM(IOS_FAMILY)
@@ -49,6 +53,24 @@
#import <PassKit/PassKit.h>
+@protocol PKPaymentAuthorizationControllerPrivateDelegate;
+
+NS_ASSUME_NONNULL_BEGIN
+
+@interface PKPaymentAuthorizationController ()
+@property (nonatomic, assign, nullable) id<PKPaymentAuthorizationControllerPrivateDelegate> privateDelegate;
+@end
+
+@class PKPaymentMerchantSession;
+
+@protocol PKPaymentAuthorizationControllerPrivateDelegate <NSObject>
+@optional
+- (void)paymentAuthorizationController:(PKPaymentAuthorizationController *)controller willFinishWithError:(NSError *)error;
+- (void)paymentAuthorizationController:(PKPaymentAuthorizationController *)controller didRequestMerchantSession:(void(^)(PKPaymentMerchantSession *, NSError *))sessionBlock;
+@end
+
+NS_ASSUME_NONNULL_END
+
#elif PLATFORM(MAC)
#import <AppKit/AppKit.h>
Modified: trunk/Source/WebCore/page/Settings.yaml (242747 => 242748)
--- trunk/Source/WebCore/page/Settings.yaml 2019-03-11 22:37:43 UTC (rev 242747)
+++ trunk/Source/WebCore/page/Settings.yaml 2019-03-11 22:42:09 UTC (rev 242748)
@@ -652,15 +652,18 @@
shouldIgnoreFontLoadCompletions:
initial: false
+applePayCapabilityDisclosureAllowed:
+ conditional: APPLE_PAY
+ initial: true
+applePayEnabled:
+ conditional: APPLE_PAY
+ initial: false
+applePayRemoteUIEnabled:
+ conditional: APPLE_PAY_REMOTE_UI
+ initial: true
paymentRequestEnabled:
- initial: false
conditional: PAYMENT_REQUEST
-applePayEnabled:
initial: false
- conditional: APPLE_PAY
-applePayCapabilityDisclosureAllowed:
- initial: true
- conditional: APPLE_PAY
javaEnabled:
initial: false
Modified: trunk/Source/WebKit/ChangeLog (242747 => 242748)
--- trunk/Source/WebKit/ChangeLog 2019-03-11 22:37:43 UTC (rev 242747)
+++ trunk/Source/WebKit/ChangeLog 2019-03-11 22:42:09 UTC (rev 242748)
@@ -1,3 +1,189 @@
+2019-03-11 Andy Estes <[email protected]>
+
+ [Apple Pay] Use PKPaymentAuthorizationController to present the Apple Pay UI remotely from the Networking service on iOS
+ https://bugs.webkit.org/show_bug.cgi?id=195530
+ <rdar://problem/48747164>
+
+ Reviewed by Alex Christensen.
+
+ * Configurations/Network-iOS.entitlements: Added the 'com.apple.payment.all-access'
+ entitlement and reordered the others.
+
+ * NetworkProcess/NetworkConnectionToWebProcess.cpp:
+ (WebKit::NetworkConnectionToWebProcess::didReceiveMessage): Forwarded
+ WebPaymentCoordinatorProxy messages to the payment coordinator.
+ (WebKit::NetworkConnectionToWebProcess::didReceiveSyncMessage): Ditto.
+ (WebKit::NetworkConnectionToWebProcess::didClose): Set m_paymentCoordinator to nullptr.
+ * NetworkProcess/NetworkConnectionToWebProcess.h: Inherited from
+ WebPaymentCoordinatorProxy::Client and added a unique_ptr<WebPaymentCoordinatorProxy> member.
+
+ * NetworkProcess/cocoa/NetworkSessionCocoa.h: Declared getters for source application bundle
+ and secondary identifiers, and CTDataConnectionServiceType on iOS.
+ * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
+ (WebKit::NetworkSessionCocoa::sourceApplicationBundleIdentifier const): Defined getter.
+ (WebKit::NetworkSessionCocoa::sourceApplicationSecondaryIdentifier const): Ditto.
+ (WebKit::NetworkSessionCocoa::ctDataConnectionServiceType const): Ditto.
+ (WebKit::NetworkSessionCocoa::NetworkSessionCocoa): Initialized
+ m_sourceApplicationBundleIdentifier and m_sourceApplicationSecondaryIdentifier with
+ corresponding NetworkSessionCreationParameters.
+
+ * NetworkProcess/ios/NetworkConnectionToWebProcessIOS.mm: Added.
+ (WebKit::NetworkConnectionToWebProcess::paymentCoordinator): Added. Returns
+ m_paymentCoordinator after lazily initializing it.
+ (WebKit::NetworkConnectionToWebProcess::paymentCoordinatorConnection): Added. Returns the
+ connection to the web process.
+ (WebKit::NetworkConnectionToWebProcess::paymentCoordinatorPresentingViewController): Added.
+ Returns nil.
+ (WebKit::NetworkConnectionToWebProcess::paymentCoordinatorCTDataConnectionServiceType):
+ Added. Returns the value from the network session identified by sessionID.
+ (WebKit::NetworkConnectionToWebProcess::paymentCoordinatorSourceApplicationBundleIdentifier):
+ Ditto.
+ (WebKit::NetworkConnectionToWebProcess::paymentCoordinatorSourceApplicationSecondaryIdentifier):
+ Ditto.
+ (WebKit::NetworkConnectionToWebProcess::paymentCoordinatorAuthorizationPresenter): Added.
+ Returns a new PaymentAuthorizationController.
+ (WebKit::NetworkConnectionToWebProcess::paymentCoordinatorAddMessageReceiver): Added empty
+ definition. NetworkConnectionToWebProcess explicitly forwards WebPaymentCoordinatorProxy
+ messages to its payment coordinator, so there's no need to register with a MessageReceiverMap.
+ (WebKit::NetworkConnectionToWebProcess::paymentCoordinatorRemoveMessageReceiver): Ditto.
+
+ * Platform/ios/PaymentAuthorizationController.h: Added. Declares a
+ PaymentAuthorizationPresenter subclass based on PKPaymentAuthorizationController.
+ * Platform/ios/PaymentAuthorizationController.mm: Added.
+ (-[WKPaymentAuthorizationControllerDelegate initWithRequest:presenter:]):
+ Initialized WKPaymentAuthorizationDelegate with request and presenter.
+ (-[WKPaymentAuthorizationControllerDelegate paymentAuthorizationControllerDidFinish:]):
+ Forwarded call to WKPaymentAuthorizationDelegate.
+ (-[WKPaymentAuthorizationControllerDelegate paymentAuthorizationController:didAuthorizePayment:handler:]):
+ Ditto.
+ (-[WKPaymentAuthorizationControllerDelegate paymentAuthorizationController:didSelectShippingMethod:handler:]):
+ Ditto.
+ (-[WKPaymentAuthorizationControllerDelegate paymentAuthorizationController:didSelectShippingContact:handler:]):
+ Ditto.
+ (-[WKPaymentAuthorizationControllerDelegate paymentAuthorizationController:didSelectPaymentMethod:handler:]):
+ Ditto.
+ (-[WKPaymentAuthorizationControllerDelegate paymentAuthorizationController:willFinishWithError:]):
+ Ditto.
+ (-[WKPaymentAuthorizationControllerDelegate paymentAuthorizationController:didRequestMerchantSession:]):
+ Ditto.
+ (WebKit::PaymentAuthorizationController::PaymentAuthorizationController):
+ Initialized m_controller with a new PKPaymentAuthorizationController and m_delegate with a
+ new WKPaymentAuthorizationControllerDelegate.
+ (WebKit::PaymentAuthorizationController::platformDelegate): Returned m_delegate.
+ (WebKit::PaymentAuthorizationController::dismiss): Dismissed the controller, set its
+ delegates to nil, set m_controller to nil, invalidated the delegate, and set m_delegate to
+ nil.
+ (WebKit::PaymentAuthorizationController::present): Called -presentWithCompletion: on the
+ controller, forwarding the passed-in completion handler.
+ * Resources/SandboxProfiles/ios/com.apple.WebKit.Networking.sb: Allowed PassKit to look up
+ the "com.apple.passd.in-app-payment" and "com.apple.passd.library" service endpoints.
+
+ * Shared/ApplePay/WebPaymentCoordinatorProxy.cpp:
+ (WebKit::WebPaymentCoordinatorProxy::WebPaymentCoordinatorProxy): Changed to call
+ paymentCoordinatorAddMessageReceiver.
+ (WebKit::WebPaymentCoordinatorProxy::~WebPaymentCoordinatorProxy): Changed to call
+ paymentCoordinatorRemoveMessageReceiver.
+ (WebKit::WebPaymentCoordinatorProxy::messageSenderDestinationID const): Deleted.
+ (WebKit::WebPaymentCoordinatorProxy::canMakePaymentsWithActiveCard): Passed sessionID to
+ platformCanMakePaymentsWithActiveCard.
+ (WebKit::WebPaymentCoordinatorProxy::showPaymentUI): Stored destinationID and passed
+ sessionID to platformShowPaymentUI.
+ (WebKit::WebPaymentCoordinatorProxy::cancelPaymentSession): Changed to account for new
+ behavior of didCancelPaymentSession.
+ (WebKit::WebPaymentCoordinatorProxy::didCancelPaymentSession): Changed to call hidePaymentUI.
+ (WebKit::WebPaymentCoordinatorProxy::presenterDidFinish): Changed to only call hidePaymentUI
+ when didReachFinalState is true, since didCancelPaymentSession is called otherwise.
+ (WebKit::WebPaymentCoordinatorProxy::didReachFinalState): Cleared m_destinationID.
+ * Shared/ApplePay/WebPaymentCoordinatorProxy.h: Added m_destionationID member.
+ * Shared/ApplePay/WebPaymentCoordinatorProxy.messages.in: Changed
+ CanMakePaymentsWithActiveCard and ShowPaymentUI messages to take destinationID and sessionID
+ arguments.
+
+ * Shared/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.mm:
+ (WebKit::WebPaymentCoordinatorProxy::platformCanMakePaymentsWithActiveCard): Passed
+ sessionID to paymentCoordinatorSourceApplicationSecondaryIdentifier.
+ (WebKit::WebPaymentCoordinatorProxy::platformPaymentRequest): Passed sessionID to various
+ m_client call sites.
+
+ * Shared/ApplePay/ios/WebPaymentCoordinatorProxyIOS.mm:
+ (WebKit::WebPaymentCoordinatorProxy::platformShowPaymentUI): Passed sessionID to
+ platformPaymentRequest.
+ (WebKit::WebPaymentCoordinatorProxy::hidePaymentUI): Null-checked m_authorizationPresenter
+ before calling dismiss.
+
+ * Shared/ApplePay/mac/WebPaymentCoordinatorProxyMac.mm:
+ (WebKit::WebPaymentCoordinatorProxy::platformShowPaymentUI): Passed sessionID to
+ platformPaymentRequest.
+ (WebKit::WebPaymentCoordinatorProxy::hidePaymentUI): Null-checked m_authorizationPresenter
+ before calling dismiss.
+
+ * Shared/WebPreferences.yaml: Added ApplePayRemoteUIEnabled as an internal preference.
+
+ * SourcesCocoa.txt: Added NetworkConnectionToWebProcessIOS.mm and
+ PaymentAuthorizationController.mm.
+
+ * UIProcess/AuxiliaryProcessProxy.h:
+ (WebKit::AuxiliaryProcessProxy::messageReceiverMap): Deleted.
+
+ * UIProcess/Cocoa/WebPageProxyCocoa.mm:
+ (WebKit::WebPageProxy::paymentCoordinatorConnection): Moved from WebPageProxy.cpp.
+ (WebKit::WebPageProxy::paymentCoordinatorSourceApplicationBundleIdentifier): Ditto.
+ (WebKit::WebPageProxy::paymentCoordinatorSourceApplicationSecondaryIdentifier): Ditto.
+ (WebKit::WebPageProxy::paymentCoordinatorAddMessageReceiver): Ditto.
+ (WebKit::WebPageProxy::paymentCoordinatorRemoveMessageReceiver): Ditto.
+
+ * UIProcess/WebPageProxy.cpp:
+ (WebKit::WebPageProxy::paymentCoordinatorConnection): Moved to WebPageProxyCocoa.mm.
+ (WebKit::WebPageProxy::paymentCoordinatorMessageReceiver): Ditto.
+ (WebKit::WebPageProxy::paymentCoordinatorSourceApplicationBundleIdentifier): Ditto.
+ (WebKit::WebPageProxy::paymentCoordinatorSourceApplicationSecondaryIdentifier): Ditto.
+ (WebKit::WebPageProxy::paymentCoordinatorDestinationID): Ditto.
+ * UIProcess/WebPageProxy.h:
+
+ * UIProcess/ios/WebPageProxyIOS.mm:
+ (WebKit::WebPageProxy::paymentCoordinatorCTDataConnectionServiceType): Asserted that
+ sessionID equals the website data store's sessionID.
+
+ * WebKit.xcodeproj/project.pbxproj:
+
+ * WebProcess/ApplePay/WebPaymentCoordinator.cpp:
+ (WebKit::WebPaymentCoordinator::networkProcessConnectionClosed): Added. Cancels the current
+ session if Apple Pay Remote UI is enabled and the network process connection closes.
+ (WebKit::WebPaymentCoordinator::availablePaymentNetworks): Changed to account for
+ WebPaymentCoordinator being an IPC::MessageSender.
+ (WebKit::WebPaymentCoordinator::canMakePayments): Ditto.
+ (WebKit::WebPaymentCoordinator::canMakePaymentsWithActiveCard): Ditto.
+ (WebKit::WebPaymentCoordinator::openPaymentSetup): Ditto.
+ (WebKit::WebPaymentCoordinator::showPaymentUI): Ditto.
+ (WebKit::WebPaymentCoordinator::completeMerchantValidation): Ditto.
+ (WebKit::WebPaymentCoordinator::completeShippingMethodSelection): Ditto.
+ (WebKit::WebPaymentCoordinator::completeShippingContactSelection): Ditto.
+ (WebKit::WebPaymentCoordinator::completePaymentMethodSelection): Ditto.
+ (WebKit::WebPaymentCoordinator::completePaymentSession): Ditto.
+ (WebKit::WebPaymentCoordinator::abortPaymentSession): Ditto.
+ (WebKit::WebPaymentCoordinator::cancelPaymentSession): Ditto.
+ (WebKit::WebPaymentCoordinator::messageSenderConnection const): Added. Returns a connection
+ to the network process if Apple Pay Remote UI is enabled. Otherwise, returned the web
+ process's parent connection.
+ (WebKit::WebPaymentCoordinator::messageSenderDestinationID const): Added. Returns the web
+ page's ID.
+ (WebKit::WebPaymentCoordinator::remoteUIEnabled const): Added. Calls Settings::applePayRemoteUIEnabled.
+ * WebProcess/ApplePay/WebPaymentCoordinator.h: Inherited from IPC::MessageSender.
+
+ * WebProcess/Network/NetworkProcessConnection.cpp:
+ (WebKit::NetworkProcessConnection::didReceiveMessage): Forwarded WebPaymentCoordinator
+ messages to the payment coordinator of the web page matching the decoder's destination ID.
+ (WebKit::NetworkProcessConnection::didReceiveSyncMessage): Ditto for sync messages.
+
+ * WebProcess/WebPage/Cocoa/WebPageCocoa.mm:
+ (WebKit::WebPage::paymentCoordinator): Added a payment coordinator getter.
+ * WebProcess/WebPage/WebPage.h: Ditto.
+
+ * WebProcess/WebProcess.cpp:
+ (WebKit::WebProcess::networkProcessConnectionClosed): Called
+ WebPaymentCoordinator::networkProcessConnectionClosed when the network process connection
+ closes.
+
2019-03-11 Per Arne Vollan <[email protected]>
[iOS] Block access to backboardd service
Modified: trunk/Source/WebKit/Configurations/Network-iOS.entitlements (242747 => 242748)
--- trunk/Source/WebKit/Configurations/Network-iOS.entitlements 2019-03-11 22:37:43 UTC (rev 242747)
+++ trunk/Source/WebKit/Configurations/Network-iOS.entitlements 2019-03-11 22:42:09 UTC (rev 242748)
@@ -2,8 +2,14 @@
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
+ <key>com.apple.multitasking.systemappassertions</key>
+ <true/>
+ <key>com.apple.payment.all-access</key>
+ <true/>
<key>com.apple.private.accounts.bundleidspoofing</key>
<true/>
+ <key>com.apple.private.memorystatus</key>
+ <true/>
<key>com.apple.private.network.socket-delegate</key>
<true/>
<key>seatbelt-profiles</key>
@@ -10,9 +16,5 @@
<array>
<string>com.apple.WebKit.Networking</string>
</array>
- <key>com.apple.multitasking.systemappassertions</key>
- <true/>
- <key>com.apple.private.memorystatus</key>
- <true/>
</dict>
</plist>
Modified: trunk/Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.cpp (242747 => 242748)
--- trunk/Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.cpp 2019-03-11 22:37:43 UTC (rev 242747)
+++ trunk/Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.cpp 2019-03-11 22:42:09 UTC (rev 242748)
@@ -62,6 +62,10 @@
#include <WebCore/SameSiteInfo.h>
#include <WebCore/SecurityPolicy.h>
+#if ENABLE(APPLE_PAY_REMOTE_UI)
+#include "WebPaymentCoordinatorProxyMessages.h"
+#endif
+
namespace WebKit {
using namespace WebCore;
@@ -197,6 +201,11 @@
}
#endif
+#if ENABLE(APPLE_PAY_REMOTE_UI)
+ if (decoder.messageReceiverName() == Messages::WebPaymentCoordinatorProxy::messageReceiverName())
+ return paymentCoordinator().didReceiveMessage(connection, decoder);
+#endif
+
ASSERT_NOT_REACHED();
}
@@ -231,6 +240,11 @@
}
#endif
+#if ENABLE(APPLE_PAY_REMOTE_UI)
+ if (decoder.messageReceiverName() == Messages::WebPaymentCoordinatorProxy::messageReceiverName())
+ return paymentCoordinator().didReceiveSyncMessage(connection, decoder, reply);
+#endif
+
ASSERT_NOT_REACHED();
}
@@ -278,6 +292,10 @@
#if ENABLE(SERVICE_WORKER)
unregisterSWConnections();
#endif
+
+#if ENABLE(APPLE_PAY_REMOTE_UI)
+ m_paymentCoordinator = nullptr;
+#endif
}
void NetworkConnectionToWebProcess::didReceiveInvalidMessage(IPC::Connection&, IPC::StringReference, IPC::StringReference)
Modified: trunk/Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.h (242747 => 242748)
--- trunk/Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.h 2019-03-11 22:37:43 UTC (rev 242747)
+++ trunk/Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.h 2019-03-11 22:42:09 UTC (rev 242748)
@@ -32,6 +32,7 @@
#include "NetworkConnectionToWebProcessMessages.h"
#include "NetworkMDNSRegister.h"
#include "NetworkRTCProvider.h"
+#include "WebPaymentCoordinatorProxy.h"
#include <WebCore/NetworkLoadInformation.h>
#include <WebCore/RegistrableDomain.h>
#include <wtf/RefCounted.h>
@@ -63,7 +64,12 @@
struct DataKey;
}
-class NetworkConnectionToWebProcess : public RefCounted<NetworkConnectionToWebProcess>, IPC::Connection::Client {
+class NetworkConnectionToWebProcess
+ : public RefCounted<NetworkConnectionToWebProcess>
+#if ENABLE(APPLE_PAY_REMOTE_UI)
+ , public WebPaymentCoordinatorProxy::Client
+#endif
+ , IPC::Connection::Client {
public:
using RegistrableDomain = WebCore::RegistrableDomain;
@@ -244,6 +250,20 @@
size_t findRootNetworkActivity(uint64_t pageID);
size_t findNetworkActivityTracker(ResourceLoadIdentifier resourceID);
+#if ENABLE(APPLE_PAY_REMOTE_UI)
+ WebPaymentCoordinatorProxy& paymentCoordinator();
+
+ // WebPaymentCoordinatorProxy::Client
+ IPC::Connection* paymentCoordinatorConnection(const WebPaymentCoordinatorProxy&) final;
+ UIViewController *paymentCoordinatorPresentingViewController(const WebPaymentCoordinatorProxy&) final;
+ const String& paymentCoordinatorCTDataConnectionServiceType(const WebPaymentCoordinatorProxy&, PAL::SessionID) final;
+ const String& paymentCoordinatorSourceApplicationBundleIdentifier(const WebPaymentCoordinatorProxy&, PAL::SessionID) final;
+ const String& paymentCoordinatorSourceApplicationSecondaryIdentifier(const WebPaymentCoordinatorProxy&, PAL::SessionID) final;
+ std::unique_ptr<PaymentAuthorizationPresenter> paymentCoordinatorAuthorizationPresenter(WebPaymentCoordinatorProxy&, PKPaymentRequest *) final;
+ void paymentCoordinatorAddMessageReceiver(WebPaymentCoordinatorProxy&, const IPC::StringReference&, IPC::MessageReceiver&) final;
+ void paymentCoordinatorRemoveMessageReceiver(WebPaymentCoordinatorProxy&, const IPC::StringReference&) final;
+#endif
+
Ref<IPC::Connection> m_connection;
Ref<NetworkProcess> m_networkProcess;
@@ -269,10 +289,14 @@
#if ENABLE(INDEXED_DATABASE)
HashMap<uint64_t, RefPtr<WebIDBConnectionToClient>> m_webIDBConnections;
#endif
-
+
#if ENABLE(SERVICE_WORKER)
HashMap<WebCore::SWServerConnectionIdentifier, WeakPtr<WebSWServerConnection>> m_swConnections;
#endif
+
+#if ENABLE(APPLE_PAY_REMOTE_UI)
+ std::unique_ptr<WebPaymentCoordinatorProxy> m_paymentCoordinator;
+#endif
};
} // namespace WebKit
Modified: trunk/Source/WebKit/NetworkProcess/cocoa/NetworkSessionCocoa.h (242747 => 242748)
--- trunk/Source/WebKit/NetworkProcess/cocoa/NetworkSessionCocoa.h 2019-03-11 22:37:43 UTC (rev 242747)
+++ trunk/Source/WebKit/NetworkProcess/cocoa/NetworkSessionCocoa.h 2019-03-11 22:42:09 UTC (rev 242748)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2016-2017 Apple Inc. All rights reserved.
+ * Copyright (C) 2016-2019 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -47,9 +47,12 @@
static Ref<NetworkSession> create(NetworkProcess&, NetworkSessionCreationParameters&&);
~NetworkSessionCocoa();
+ const String& sourceApplicationBundleIdentifier() const;
+ const String& sourceApplicationSecondaryIdentifier() const;
// Must be called before any NetworkSession has been created.
// FIXME: Move this to NetworkSessionCreationParameters.
#if PLATFORM(IOS_FAMILY)
+ const String& ctDataConnectionServiceType() const;
static void setCTDataConnectionServiceType(const String&);
#endif
@@ -82,6 +85,8 @@
RetainPtr<WKNetworkSessionDelegate> m_statelessSessionDelegate;
String m_boundInterfaceIdentifier;
+ String m_sourceApplicationBundleIdentifier;
+ String m_sourceApplicationSecondaryIdentifier;
RetainPtr<CFDictionaryRef> m_proxyConfiguration;
bool m_shouldLogCookieInformation { false };
Seconds m_loadThrottleLatency;
Modified: trunk/Source/WebKit/NetworkProcess/cocoa/NetworkSessionCocoa.mm (242747 => 242748)
--- trunk/Source/WebKit/NetworkProcess/cocoa/NetworkSessionCocoa.mm 2019-03-11 22:37:43 UTC (rev 242747)
+++ trunk/Source/WebKit/NetworkProcess/cocoa/NetworkSessionCocoa.mm 2019-03-11 22:42:09 UTC (rev 242748)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2015-2018 Apple Inc. All rights reserved.
+ * Copyright (C) 2015-2019 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -803,6 +803,16 @@
return [NSURLSessionConfiguration defaultSessionConfiguration];
}
+const String& NetworkSessionCocoa::sourceApplicationBundleIdentifier() const
+{
+ return m_sourceApplicationBundleIdentifier;
+}
+
+const String& NetworkSessionCocoa::sourceApplicationSecondaryIdentifier() const
+{
+ return m_sourceApplicationSecondaryIdentifier;
+}
+
#if PLATFORM(IOS_FAMILY)
static String& globalCTDataConnectionServiceType()
{
@@ -809,9 +819,12 @@
static NeverDestroyed<String> ctDataConnectionServiceType;
return ctDataConnectionServiceType.get();
}
-#endif
-#if PLATFORM(IOS_FAMILY)
+const String& NetworkSessionCocoa::ctDataConnectionServiceType() const
+{
+ return globalCTDataConnectionServiceType();
+}
+
void NetworkSessionCocoa::setCTDataConnectionServiceType(const String& type)
{
ASSERT(!sessionsCreated);
@@ -850,6 +863,8 @@
NetworkSessionCocoa::NetworkSessionCocoa(NetworkProcess& networkProcess, NetworkSessionCreationParameters&& parameters)
: NetworkSession(networkProcess, parameters.sessionID)
, m_boundInterfaceIdentifier(parameters.boundInterfaceIdentifier)
+ , m_sourceApplicationBundleIdentifier(parameters.sourceApplicationBundleIdentifier)
+ , m_sourceApplicationSecondaryIdentifier(parameters.sourceApplicationSecondaryIdentifier)
, m_proxyConfiguration(parameters.proxyConfiguration)
, m_shouldLogCookieInformation(parameters.shouldLogCookieInformation)
, m_loadThrottleLatency(parameters.loadThrottleLatency)
@@ -882,13 +897,13 @@
if (auto data = ""
configuration._sourceApplicationAuditTokenData = (__bridge NSData *)data.get();
- if (!parameters.sourceApplicationBundleIdentifier.isEmpty()) {
- configuration._sourceApplicationBundleIdentifier = parameters.sourceApplicationBundleIdentifier;
+ if (!m_sourceApplicationBundleIdentifier.isEmpty()) {
+ configuration._sourceApplicationBundleIdentifier = m_sourceApplicationBundleIdentifier;
configuration._sourceApplicationAuditTokenData = nil;
}
- if (!parameters.sourceApplicationSecondaryIdentifier.isEmpty())
- configuration._sourceApplicationSecondaryIdentifier = parameters.sourceApplicationSecondaryIdentifier;
+ if (!m_sourceApplicationSecondaryIdentifier.isEmpty())
+ configuration._sourceApplicationSecondaryIdentifier = m_sourceApplicationSecondaryIdentifier;
configuration.connectionProxyDictionary = proxyDictionary(parameters.httpProxy, parameters.httpsProxy);
Added: trunk/Source/WebKit/NetworkProcess/ios/NetworkConnectionToWebProcessIOS.mm (0 => 242748)
--- trunk/Source/WebKit/NetworkProcess/ios/NetworkConnectionToWebProcessIOS.mm (rev 0)
+++ trunk/Source/WebKit/NetworkProcess/ios/NetworkConnectionToWebProcessIOS.mm 2019-03-11 22:42:09 UTC (rev 242748)
@@ -0,0 +1,93 @@
+/*
+ * Copyright (C) 2019 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#import "config.h"
+#import "NetworkConnectionToWebProcess.h"
+
+#if PLATFORM(IOS_FAMILY)
+
+#import "NetworkSessionCocoa.h"
+#import "PaymentAuthorizationController.h"
+
+namespace WebKit {
+
+#if ENABLE(APPLE_PAY_REMOTE_UI)
+
+WebPaymentCoordinatorProxy& NetworkConnectionToWebProcess::paymentCoordinator()
+{
+ if (!m_paymentCoordinator)
+ m_paymentCoordinator = std::make_unique<WebPaymentCoordinatorProxy>(*this);
+ return *m_paymentCoordinator;
+}
+
+IPC::Connection* NetworkConnectionToWebProcess::paymentCoordinatorConnection(const WebPaymentCoordinatorProxy&)
+{
+ return &connection();
+}
+
+UIViewController *NetworkConnectionToWebProcess::paymentCoordinatorPresentingViewController(const WebPaymentCoordinatorProxy&)
+{
+ return nil;
+}
+
+const String& NetworkConnectionToWebProcess::paymentCoordinatorCTDataConnectionServiceType(const WebPaymentCoordinatorProxy&, PAL::SessionID sessionID)
+{
+ if (auto session = static_cast<NetworkSessionCocoa*>(m_networkProcess->networkSession(sessionID)))
+ return session->ctDataConnectionServiceType();
+ return emptyString();
+}
+
+const String& NetworkConnectionToWebProcess::paymentCoordinatorSourceApplicationBundleIdentifier(const WebPaymentCoordinatorProxy&, PAL::SessionID sessionID)
+{
+ if (auto session = static_cast<NetworkSessionCocoa*>(m_networkProcess->networkSession(sessionID)))
+ return session->sourceApplicationBundleIdentifier();
+ return emptyString();
+}
+
+const String& NetworkConnectionToWebProcess::paymentCoordinatorSourceApplicationSecondaryIdentifier(const WebPaymentCoordinatorProxy&, PAL::SessionID sessionID)
+{
+ if (auto session = static_cast<NetworkSessionCocoa*>(m_networkProcess->networkSession(sessionID)))
+ return session->sourceApplicationSecondaryIdentifier();
+ return emptyString();
+}
+
+std::unique_ptr<PaymentAuthorizationPresenter> NetworkConnectionToWebProcess::paymentCoordinatorAuthorizationPresenter(WebPaymentCoordinatorProxy& coordinator, PKPaymentRequest *request)
+{
+ return std::make_unique<PaymentAuthorizationController>(coordinator, request);
+}
+
+void NetworkConnectionToWebProcess::paymentCoordinatorAddMessageReceiver(WebPaymentCoordinatorProxy&, const IPC::StringReference&, IPC::MessageReceiver&)
+{
+}
+
+void NetworkConnectionToWebProcess::paymentCoordinatorRemoveMessageReceiver(WebPaymentCoordinatorProxy&, const IPC::StringReference&)
+{
+}
+
+#endif // ENABLE(APPLE_PAY_REMOTE_UI)
+
+} // namespace WebKit
+
+#endif // PLATFORM(IOS_FAMILY)
Copied: trunk/Source/WebKit/Platform/ios/PaymentAuthorizationController.h (from rev 242747, trunk/Source/WebKit/Shared/ApplePay/ios/WebPaymentCoordinatorProxyIOS.mm) (0 => 242748)
--- trunk/Source/WebKit/Platform/ios/PaymentAuthorizationController.h (rev 0)
+++ trunk/Source/WebKit/Platform/ios/PaymentAuthorizationController.h 2019-03-11 22:42:09 UTC (rev 242748)
@@ -0,0 +1,56 @@
+/*
+ * Copyright (C) 2019 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#if USE(PASSKIT) && PLATFORM(IOS_FAMILY)
+
+#include "PaymentAuthorizationPresenter.h"
+#include <wtf/RetainPtr.h>
+
+OBJC_CLASS PKPaymentAuthorizationController;
+OBJC_CLASS PKPaymentRequest;
+OBJC_CLASS WKPaymentAuthorizationControllerDelegate;
+OBJC_CLASS WKPaymentAuthorizationDelegate;
+
+namespace WebKit {
+
+class PaymentAuthorizationController final : public PaymentAuthorizationPresenter {
+public:
+ PaymentAuthorizationController(PaymentAuthorizationPresenter::Client&, PKPaymentRequest *);
+
+private:
+ // PaymentAuthorizationPresenter
+ WKPaymentAuthorizationDelegate *platformDelegate() final;
+ void dismiss() final;
+ void present(UIViewController *, CompletionHandler<void(bool)>&&) final;
+
+ RetainPtr<PKPaymentAuthorizationController> m_controller;
+ RetainPtr<WKPaymentAuthorizationControllerDelegate> m_delegate;
+};
+
+} // namespace WebKit
+
+#endif // USE(PASSKIT) && PLATFORM(IOS_FAMILY)
Added: trunk/Source/WebKit/Platform/ios/PaymentAuthorizationController.mm (0 => 242748)
--- trunk/Source/WebKit/Platform/ios/PaymentAuthorizationController.mm (rev 0)
+++ trunk/Source/WebKit/Platform/ios/PaymentAuthorizationController.mm 2019-03-11 22:42:09 UTC (rev 242748)
@@ -0,0 +1,129 @@
+/*
+ * Copyright (C) 2019 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#import "config.h"
+#import "PaymentAuthorizationController.h"
+
+#if USE(PASSKIT) && PLATFORM(IOS_FAMILY)
+
+#import "WKPaymentAuthorizationDelegate.h"
+#import <pal/cocoa/PassKitSoftLink.h>
+
+@interface WKPaymentAuthorizationControllerDelegate : WKPaymentAuthorizationDelegate <PKPaymentAuthorizationControllerDelegate, PKPaymentAuthorizationControllerPrivateDelegate>
+
+- (instancetype)initWithRequest:(PKPaymentRequest *)request presenter:(WebKit::PaymentAuthorizationPresenter&)presenter;
+
+@end
+
+@implementation WKPaymentAuthorizationControllerDelegate
+
+- (instancetype)initWithRequest:(PKPaymentRequest *)request presenter:(WebKit::PaymentAuthorizationPresenter&)presenter
+{
+ if (!(self = [super _initWithRequest:request presenter:presenter]))
+ return nil;
+
+ return self;
+}
+
+#pragma mark PKPaymentAuthorizationControllerDelegate
+
+- (void)paymentAuthorizationControllerDidFinish:(PKPaymentAuthorizationController *)controller
+{
+ [self _didFinish];
+}
+
+- (void)paymentAuthorizationController:(PKPaymentAuthorizationController *)controller didAuthorizePayment:(PKPayment *)payment handler:(void(^)(PKPaymentAuthorizationResult *result))completion
+{
+ [self _didAuthorizePayment:payment completion:completion];
+}
+
+- (void)paymentAuthorizationController:(PKPaymentAuthorizationController *)controller didSelectShippingMethod:(PKShippingMethod *)shippingMethod handler:(void(^)(PKPaymentRequestShippingMethodUpdate *requestUpdate))completion
+{
+ [self _didSelectShippingMethod:shippingMethod completion:completion];
+}
+
+- (void)paymentAuthorizationController:(PKPaymentAuthorizationController *)controller didSelectShippingContact:(PKContact *)contact handler:(void(^)(PKPaymentRequestShippingContactUpdate *requestUpdate))completion
+{
+ [self _didSelectShippingContact:contact completion:completion];
+}
+
+- (void)paymentAuthorizationController:(PKPaymentAuthorizationController *)controller didSelectPaymentMethod:(PKPaymentMethod *)paymentMethod handler:(void(^)(PKPaymentRequestPaymentMethodUpdate *requestUpdate))completion
+{
+ [self _didSelectPaymentMethod:paymentMethod completion:completion];
+}
+
+#pragma mark PKPaymentAuthorizationControllerPrivateDelegate
+
+- (void)paymentAuthorizationController:(PKPaymentAuthorizationController *)controller willFinishWithError:(NSError *)error
+{
+ [self _willFinishWithError:error];
+}
+
+- (void)paymentAuthorizationController:(PKPaymentAuthorizationController *)controller didRequestMerchantSession:(void(^)(PKPaymentMerchantSession *, NSError *))sessionBlock
+{
+ [self _didRequestMerchantSession:sessionBlock];
+}
+
+@end
+
+namespace WebKit {
+
+PaymentAuthorizationController::PaymentAuthorizationController(PaymentAuthorizationPresenter::Client& client, PKPaymentRequest *request)
+ : PaymentAuthorizationPresenter(client)
+ , m_controller(adoptNS([PAL::allocPKPaymentAuthorizationControllerInstance() initWithPaymentRequest:request]))
+ , m_delegate(adoptNS([[WKPaymentAuthorizationControllerDelegate alloc] initWithRequest:request presenter:*this]))
+{
+ [m_controller setDelegate:m_delegate.get()];
+ [m_controller setPrivateDelegate:m_delegate.get()];
+}
+
+WKPaymentAuthorizationDelegate *PaymentAuthorizationController::platformDelegate()
+{
+ return m_delegate.get();
+}
+
+void PaymentAuthorizationController::dismiss()
+{
+ [m_controller dismissWithCompletion:nil];
+ [m_controller setDelegate:nil];
+ [m_controller setPrivateDelegate:nil];
+ m_controller = nil;
+ [m_delegate invalidate];
+ m_delegate = nil;
+}
+
+void PaymentAuthorizationController::present(UIViewController *, CompletionHandler<void(bool)>&& completionHandler)
+{
+ if (!m_controller)
+ return completionHandler(false);
+
+ [m_controller presentWithCompletion:makeBlockPtr([completionHandler = WTFMove(completionHandler)](BOOL success) mutable {
+ completionHandler(success);
+ }).get()];
+}
+
+} // namespace WebKit
+
+#endif // USE(PASSKIT) && PLATFORM(IOS_FAMILY)
Modified: trunk/Source/WebKit/Resources/SandboxProfiles/ios/com.apple.WebKit.Networking.sb (242747 => 242748)
--- trunk/Source/WebKit/Resources/SandboxProfiles/ios/com.apple.WebKit.Networking.sb 2019-03-11 22:37:43 UTC (rev 242747)
+++ trunk/Source/WebKit/Resources/SandboxProfiles/ios/com.apple.WebKit.Networking.sb 2019-03-11 22:42:09 UTC (rev 242748)
@@ -1,4 +1,4 @@
-; Copyright (C) 2014-2015 Apple Inc. All rights reserved.
+; Copyright (C) 2014-2019 Apple Inc. All rights reserved.
;
; Redistribution and use in source and binary forms, with or without
; modification, are permitted provided that the following conditions
@@ -77,6 +77,11 @@
(global-name "com.apple.ocspd")
(global-name "com.apple.securityd"))
+;; PassKit framework
+(allow mach-lookup
+ (global-name "com.apple.passd.in-app-payment")
+ (global-name "com.apple.passd.library"))
+
(deny file-write-create
(vnode-type SYMLINK))
Modified: trunk/Source/WebKit/Shared/ApplePay/WebPaymentCoordinatorProxy.cpp (242747 => 242748)
--- trunk/Source/WebKit/Shared/ApplePay/WebPaymentCoordinatorProxy.cpp 2019-03-11 22:37:43 UTC (rev 242747)
+++ trunk/Source/WebKit/Shared/ApplePay/WebPaymentCoordinatorProxy.cpp 2019-03-11 22:42:09 UTC (rev 242748)
@@ -46,7 +46,7 @@
WebPaymentCoordinatorProxy::WebPaymentCoordinatorProxy(WebPaymentCoordinatorProxy::Client& client)
: m_client { client }
{
- m_client.paymentCoordinatorMessageReceiver(*this).addMessageReceiver(Messages::WebPaymentCoordinatorProxy::messageReceiverName(), m_client.paymentCoordinatorDestinationID(*this), *this);
+ m_client.paymentCoordinatorAddMessageReceiver(*this, Messages::WebPaymentCoordinatorProxy::messageReceiverName(), *this);
finishConstruction(*this);
}
@@ -55,7 +55,7 @@
if (m_state != State::Idle)
hidePaymentUI();
- m_client.paymentCoordinatorMessageReceiver(*this).removeMessageReceiver(Messages::WebPaymentCoordinatorProxy::messageReceiverName(), m_client.paymentCoordinatorDestinationID(*this));
+ m_client.paymentCoordinatorRemoveMessageReceiver(*this, Messages::WebPaymentCoordinatorProxy::messageReceiverName());
}
IPC::Connection* WebPaymentCoordinatorProxy::messageSenderConnection() const
@@ -65,7 +65,7 @@
uint64_t WebPaymentCoordinatorProxy::messageSenderDestinationID() const
{
- return m_client.paymentCoordinatorDestinationID(*this);
+ return *m_destinationID;
}
void WebPaymentCoordinatorProxy::availablePaymentNetworks(CompletionHandler<void(Vector<String>&&)>&& completionHandler)
@@ -78,9 +78,9 @@
reply(platformCanMakePayments());
}
-void WebPaymentCoordinatorProxy::canMakePaymentsWithActiveCard(const String& merchantIdentifier, const String& domainName, CompletionHandler<void(bool)>&& completionHandler)
+void WebPaymentCoordinatorProxy::canMakePaymentsWithActiveCard(const String& merchantIdentifier, const String& domainName, PAL::SessionID sessionID, CompletionHandler<void(bool)>&& completionHandler)
{
- platformCanMakePaymentsWithActiveCard(merchantIdentifier, domainName, WTFMove(completionHandler));
+ platformCanMakePaymentsWithActiveCard(merchantIdentifier, domainName, sessionID, WTFMove(completionHandler));
}
void WebPaymentCoordinatorProxy::openPaymentSetup(const String& merchantIdentifier, const String& domainName, CompletionHandler<void(bool)>&& completionHandler)
@@ -88,18 +88,18 @@
platformOpenPaymentSetup(merchantIdentifier, domainName, WTFMove(completionHandler));
}
-void WebPaymentCoordinatorProxy::showPaymentUI(const String& originatingURLString, const Vector<String>& linkIconURLStrings, const WebCore::ApplePaySessionPaymentRequest& paymentRequest, CompletionHandler<void(bool)>&& completionHandler)
+void WebPaymentCoordinatorProxy::showPaymentUI(uint64_t destinationID, PAL::SessionID sessionID, const String& originatingURLString, const Vector<String>& linkIconURLStrings, const WebCore::ApplePaySessionPaymentRequest& paymentRequest, CompletionHandler<void(bool)>&& completionHandler)
{
+ if (auto& coordinator = activePaymentCoordinatorProxy())
+ coordinator->didCancelPaymentSession();
+ activePaymentCoordinatorProxy() = makeWeakPtr(this);
+
// FIXME: Make this a message check.
ASSERT(canBegin());
+ ASSERT(!m_destinationID);
+ ASSERT(!m_authorizationPresenter);
- if (auto& coordinator = activePaymentCoordinatorProxy()) {
- coordinator->hidePaymentUI();
- coordinator->didCancelPaymentSession();
- }
-
- activePaymentCoordinatorProxy() = makeWeakPtr(this);
-
+ m_destinationID = destinationID;
m_state = State::Activating;
URL originatingURL(URL(), originatingURLString);
@@ -108,7 +108,7 @@
for (const auto& linkIconURLString : linkIconURLStrings)
linkIconURLs.append(URL(URL(), linkIconURLString));
- platformShowPaymentUI(originatingURL, linkIconURLs, paymentRequest, [weakThis = makeWeakPtr(*this)](bool result) {
+ platformShowPaymentUI(originatingURL, linkIconURLs, sessionID, paymentRequest, [weakThis = makeWeakPtr(*this)](bool result) {
if (!weakThis)
return;
@@ -124,7 +124,6 @@
completionHandler(true);
}
-
void WebPaymentCoordinatorProxy::completeMerchantValidation(const WebCore::PaymentMerchantSession& paymentMerchantSession)
{
// It's possible that the payment has been canceled already.
@@ -211,7 +210,6 @@
if (!canCancel())
return;
- hidePaymentUI();
didCancelPaymentSession();
}
@@ -218,9 +216,8 @@
void WebPaymentCoordinatorProxy::didCancelPaymentSession()
{
ASSERT(canCancel());
-
send(Messages::WebPaymentCoordinator::DidCancelPaymentSession());
-
+ hidePaymentUI();
didReachFinalState();
}
@@ -242,7 +239,8 @@
{
if (!didReachFinalState)
didCancelPaymentSession();
- hidePaymentUI();
+ else
+ hidePaymentUI();
}
void WebPaymentCoordinatorProxy::presenterDidSelectShippingMethod(PaymentAuthorizationPresenter&, const WebCore::ApplePaySessionPaymentRequest::ShippingMethod& shippingMethod)
@@ -335,6 +333,7 @@
void WebPaymentCoordinatorProxy::didReachFinalState()
{
+ m_destinationID = WTF::nullopt;
m_state = State::Idle;
m_merchantValidationState = MerchantValidationState::Idle;
Modified: trunk/Source/WebKit/Shared/ApplePay/WebPaymentCoordinatorProxy.h (242747 => 242748)
--- trunk/Source/WebKit/Shared/ApplePay/WebPaymentCoordinatorProxy.h 2019-03-11 22:37:43 UTC (rev 242747)
+++ trunk/Source/WebKit/Shared/ApplePay/WebPaymentCoordinatorProxy.h 2019-03-11 22:42:09 UTC (rev 242748)
@@ -41,9 +41,12 @@
namespace IPC {
class Connection;
-class MessageReceiverMap;
}
+namespace PAL {
+class SessionID;
+}
+
namespace WebCore {
enum class PaymentAuthorizationStatus;
class Payment;
@@ -72,13 +75,13 @@
virtual ~Client() = default;
virtual IPC::Connection* paymentCoordinatorConnection(const WebPaymentCoordinatorProxy&) = 0;
- virtual IPC::MessageReceiverMap& paymentCoordinatorMessageReceiver(const WebPaymentCoordinatorProxy&) = 0;
- virtual const String& paymentCoordinatorSourceApplicationBundleIdentifier(const WebPaymentCoordinatorProxy&) = 0;
- virtual const String& paymentCoordinatorSourceApplicationSecondaryIdentifier(const WebPaymentCoordinatorProxy&) = 0;
- virtual uint64_t paymentCoordinatorDestinationID(const WebPaymentCoordinatorProxy&) = 0;
+ virtual const String& paymentCoordinatorSourceApplicationBundleIdentifier(const WebPaymentCoordinatorProxy&, PAL::SessionID) = 0;
+ virtual const String& paymentCoordinatorSourceApplicationSecondaryIdentifier(const WebPaymentCoordinatorProxy&, PAL::SessionID) = 0;
+ virtual void paymentCoordinatorAddMessageReceiver(WebPaymentCoordinatorProxy&, const IPC::StringReference&, IPC::MessageReceiver&) = 0;
+ virtual void paymentCoordinatorRemoveMessageReceiver(WebPaymentCoordinatorProxy&, const IPC::StringReference&) = 0;
#if PLATFORM(IOS_FAMILY)
virtual UIViewController *paymentCoordinatorPresentingViewController(const WebPaymentCoordinatorProxy&) = 0;
- virtual const String& paymentCoordinatorCTDataConnectionServiceType(const WebPaymentCoordinatorProxy&) = 0;
+ virtual const String& paymentCoordinatorCTDataConnectionServiceType(const WebPaymentCoordinatorProxy&, PAL::SessionID) = 0;
virtual std::unique_ptr<PaymentAuthorizationPresenter> paymentCoordinatorAuthorizationPresenter(WebPaymentCoordinatorProxy&, PKPaymentRequest *) = 0;
#endif
#if PLATFORM(MAC)
@@ -86,12 +89,10 @@
#endif
};
+ friend class NetworkConnectionToWebProcess;
explicit WebPaymentCoordinatorProxy(Client&);
~WebPaymentCoordinatorProxy();
- void didCancelPaymentSession();
- void hidePaymentUI();
-
private:
// IPC::MessageReceiver
void didReceiveMessage(IPC::Connection&, IPC::Decoder&) override;
@@ -112,9 +113,9 @@
// Message handlers
void availablePaymentNetworks(CompletionHandler<void(Vector<String>&&)>&&);
void canMakePayments(CompletionHandler<void(bool)>&&);
- void canMakePaymentsWithActiveCard(const String& merchantIdentifier, const String& domainName, CompletionHandler<void(bool)>&&);
+ void canMakePaymentsWithActiveCard(const String& merchantIdentifier, const String& domainName, PAL::SessionID, CompletionHandler<void(bool)>&&);
void openPaymentSetup(const String& merchantIdentifier, const String& domainName, CompletionHandler<void(bool)>&&);
- void showPaymentUI(const String& originatingURLString, const Vector<String>& linkIconURLStrings, const WebCore::ApplePaySessionPaymentRequest&, CompletionHandler<void(bool)>&&);
+ void showPaymentUI(uint64_t destinationID, PAL::SessionID, const String& originatingURLString, const Vector<String>& linkIconURLStrings, const WebCore::ApplePaySessionPaymentRequest&, CompletionHandler<void(bool)>&&);
void completeMerchantValidation(const WebCore::PaymentMerchantSession&);
void completeShippingMethodSelection(const Optional<WebCore::ShippingMethodUpdate>&);
void completeShippingContactSelection(const Optional<WebCore::ShippingContactUpdate>&);
@@ -128,13 +129,15 @@
bool canCompletePayment() const;
bool canAbort() const;
+ void didCancelPaymentSession();
void didReachFinalState();
+ void hidePaymentUI();
Vector<String> platformAvailablePaymentNetworks();
bool platformCanMakePayments();
- void platformCanMakePaymentsWithActiveCard(const String& merchantIdentifier, const String& domainName, WTF::Function<void(bool)>&& completionHandler);
+ void platformCanMakePaymentsWithActiveCard(const String& merchantIdentifier, const String& domainName, PAL::SessionID, WTF::Function<void(bool)>&& completionHandler);
void platformOpenPaymentSetup(const String& merchantIdentifier, const String& domainName, WTF::Function<void(bool)>&& completionHandler);
- void platformShowPaymentUI(const URL& originatingURL, const Vector<URL>& linkIconURLs, const WebCore::ApplePaySessionPaymentRequest&, CompletionHandler<void(bool)>&&);
+ void platformShowPaymentUI(const URL& originatingURL, const Vector<URL>& linkIconURLs, PAL::SessionID, const WebCore::ApplePaySessionPaymentRequest&, CompletionHandler<void(bool)>&&);
void platformCompleteMerchantValidation(const WebCore::PaymentMerchantSession&);
void platformCompleteShippingMethodSelection(const Optional<WebCore::ShippingMethodUpdate>&);
void platformCompleteShippingContactSelection(const Optional<WebCore::ShippingContactUpdate>&);
@@ -141,10 +144,11 @@
void platformCompletePaymentMethodSelection(const Optional<WebCore::PaymentMethodUpdate>&);
void platformCompletePaymentSession(const Optional<WebCore::PaymentAuthorizationResult>&);
#if PLATFORM(COCOA)
- RetainPtr<PKPaymentRequest> platformPaymentRequest(const URL& originatingURL, const Vector<URL>& linkIconURLs, const WebCore::ApplePaySessionPaymentRequest&);
+ RetainPtr<PKPaymentRequest> platformPaymentRequest(const URL& originatingURL, const Vector<URL>& linkIconURLs, PAL::SessionID, const WebCore::ApplePaySessionPaymentRequest&);
#endif
Client& m_client;
+ Optional<uint64_t> m_destinationID;
enum class State {
// Idle - Nothing's happening.
Modified: trunk/Source/WebKit/Shared/ApplePay/WebPaymentCoordinatorProxy.messages.in (242747 => 242748)
--- trunk/Source/WebKit/Shared/ApplePay/WebPaymentCoordinatorProxy.messages.in 2019-03-11 22:37:43 UTC (rev 242747)
+++ trunk/Source/WebKit/Shared/ApplePay/WebPaymentCoordinatorProxy.messages.in 2019-03-11 22:42:09 UTC (rev 242748)
@@ -1,4 +1,4 @@
-# Copyright (C) 2015-2018 Apple Inc. All rights reserved.
+# Copyright (C) 2015-2019 Apple Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
@@ -28,10 +28,10 @@
AvailablePaymentNetworks() -> (Vector<String> availablePaymentNetworks) Delayed
CanMakePayments() -> (bool result) Delayed
- CanMakePaymentsWithActiveCard(String merchantIdentifier, String domainName) -> (bool canMakePayments) Async
+ CanMakePaymentsWithActiveCard(String merchantIdentifier, String domainName, PAL::SessionID sessionID) -> (bool canMakePayments) Async
OpenPaymentSetup(String merchantIdentifier, String domainName) -> (bool result) Async
- ShowPaymentUI(String originatingURLString, Vector<String> linkIconURLStrings, WebCore::ApplePaySessionPaymentRequest paymentRequest) -> (bool result) Delayed
+ ShowPaymentUI(uint64_t destinationID, PAL::SessionID sessionID, String originatingURLString, Vector<String> linkIconURLStrings, WebCore::ApplePaySessionPaymentRequest paymentRequest) -> (bool result) Delayed
CompleteMerchantValidation(WebCore::PaymentMerchantSession paymentMerchantSession)
CompleteShippingMethodSelection(Optional<WebCore::ShippingMethodUpdate> update)
CompleteShippingContactSelection(Optional<WebCore::ShippingContactUpdate> update)
Modified: trunk/Source/WebKit/Shared/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.mm (242747 => 242748)
--- trunk/Source/WebKit/Shared/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.mm 2019-03-11 22:37:43 UTC (rev 242747)
+++ trunk/Source/WebKit/Shared/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.mm 2019-03-11 22:42:09 UTC (rev 242748)
@@ -57,10 +57,10 @@
return [PAL::getPKPaymentAuthorizationViewControllerClass() canMakePayments];
}
-void WebPaymentCoordinatorProxy::platformCanMakePaymentsWithActiveCard(const String& merchantIdentifier, const String& domainName, WTF::Function<void(bool)>&& completionHandler)
+void WebPaymentCoordinatorProxy::platformCanMakePaymentsWithActiveCard(const String& merchantIdentifier, const String& domainName, PAL::SessionID sessionID, WTF::Function<void(bool)>&& completionHandler)
{
#if HAVE(PASSKIT_GRANULAR_ERRORS)
- PKCanMakePaymentsWithMerchantIdentifierDomainAndSourceApplication(merchantIdentifier, domainName, m_client.paymentCoordinatorSourceApplicationSecondaryIdentifier(*this), makeBlockPtr([completionHandler = WTFMove(completionHandler)](BOOL canMakePayments, NSError *error) mutable {
+ PKCanMakePaymentsWithMerchantIdentifierDomainAndSourceApplication(merchantIdentifier, domainName, m_client.paymentCoordinatorSourceApplicationSecondaryIdentifier(*this, sessionID), makeBlockPtr([completionHandler = WTFMove(completionHandler)](BOOL canMakePayments, NSError *error) mutable {
if (error)
LOG_ERROR("PKCanMakePaymentsWithMerchantIdentifierAndDomain error %@", error);
@@ -236,7 +236,7 @@
}
#endif
-RetainPtr<PKPaymentRequest> WebPaymentCoordinatorProxy::platformPaymentRequest(const URL& originatingURL, const Vector<URL>& linkIconURLs, const WebCore::ApplePaySessionPaymentRequest& paymentRequest)
+RetainPtr<PKPaymentRequest> WebPaymentCoordinatorProxy::platformPaymentRequest(const URL& originatingURL, const Vector<URL>& linkIconURLs, PAL::SessionID sessionID, const WebCore::ApplePaySessionPaymentRequest& paymentRequest)
{
auto result = adoptNS([PAL::allocPKPaymentRequestInstance() init]);
@@ -300,16 +300,16 @@
#endif
// FIXME: Instead of using respondsToSelector, this should use a proper #if version check.
- auto& bundleIdentifier = m_client.paymentCoordinatorSourceApplicationBundleIdentifier(*this);
+ auto& bundleIdentifier = m_client.paymentCoordinatorSourceApplicationBundleIdentifier(*this, sessionID);
if (!bundleIdentifier.isEmpty() && [result respondsToSelector:@selector(setSourceApplicationBundleIdentifier:)])
[result setSourceApplicationBundleIdentifier:bundleIdentifier];
- auto& secondaryIdentifier = m_client.paymentCoordinatorSourceApplicationSecondaryIdentifier(*this);
+ auto& secondaryIdentifier = m_client.paymentCoordinatorSourceApplicationSecondaryIdentifier(*this, sessionID);
if (!secondaryIdentifier.isEmpty() && [result respondsToSelector:@selector(setSourceApplicationSecondaryIdentifier:)])
[result setSourceApplicationSecondaryIdentifier:secondaryIdentifier];
#if PLATFORM(IOS_FAMILY)
- auto& serviceType = m_client.paymentCoordinatorCTDataConnectionServiceType(*this);
+ auto& serviceType = m_client.paymentCoordinatorCTDataConnectionServiceType(*this, sessionID);
if (!serviceType.isEmpty() && [result respondsToSelector:@selector(setCTDataConnectionServiceType:)])
[result setCTDataConnectionServiceType:serviceType];
#endif
Modified: trunk/Source/WebKit/Shared/ApplePay/ios/WebPaymentCoordinatorProxyIOS.mm (242747 => 242748)
--- trunk/Source/WebKit/Shared/ApplePay/ios/WebPaymentCoordinatorProxyIOS.mm 2019-03-11 22:37:43 UTC (rev 242747)
+++ trunk/Source/WebKit/Shared/ApplePay/ios/WebPaymentCoordinatorProxyIOS.mm 2019-03-11 22:42:09 UTC (rev 242748)
@@ -38,9 +38,9 @@
namespace WebKit {
-void WebPaymentCoordinatorProxy::platformShowPaymentUI(const URL& originatingURL, const Vector<URL>& linkIconURLStrings, const WebCore::ApplePaySessionPaymentRequest& request, CompletionHandler<void(bool)>&& completionHandler)
+void WebPaymentCoordinatorProxy::platformShowPaymentUI(const URL& originatingURL, const Vector<URL>& linkIconURLStrings, PAL::SessionID sessionID, const WebCore::ApplePaySessionPaymentRequest& request, CompletionHandler<void(bool)>&& completionHandler)
{
- auto paymentRequest = platformPaymentRequest(originatingURL, linkIconURLStrings, request);
+ auto paymentRequest = platformPaymentRequest(originatingURL, linkIconURLStrings, sessionID, request);
ASSERT(!m_authorizationPresenter);
m_authorizationPresenter = m_client.paymentCoordinatorAuthorizationPresenter(*this, paymentRequest.get());
@@ -52,7 +52,8 @@
void WebPaymentCoordinatorProxy::hidePaymentUI()
{
- m_authorizationPresenter->dismiss();
+ if (m_authorizationPresenter)
+ m_authorizationPresenter->dismiss();
m_authorizationPresenter = nullptr;
}
Modified: trunk/Source/WebKit/Shared/ApplePay/mac/WebPaymentCoordinatorProxyMac.mm (242747 => 242748)
--- trunk/Source/WebKit/Shared/ApplePay/mac/WebPaymentCoordinatorProxyMac.mm 2019-03-11 22:37:43 UTC (rev 242747)
+++ trunk/Source/WebKit/Shared/ApplePay/mac/WebPaymentCoordinatorProxyMac.mm 2019-03-11 22:42:09 UTC (rev 242748)
@@ -35,9 +35,9 @@
namespace WebKit {
-void WebPaymentCoordinatorProxy::platformShowPaymentUI(const URL& originatingURL, const Vector<URL>& linkIconURLStrings, const WebCore::ApplePaySessionPaymentRequest& request, CompletionHandler<void(bool)>&& completionHandler)
+void WebPaymentCoordinatorProxy::platformShowPaymentUI(const URL& originatingURL, const Vector<URL>& linkIconURLStrings, PAL::SessionID sessionID, const WebCore::ApplePaySessionPaymentRequest& request, CompletionHandler<void(bool)>&& completionHandler)
{
- auto paymentRequest = platformPaymentRequest(originatingURL, linkIconURLStrings, request);
+ auto paymentRequest = platformPaymentRequest(originatingURL, linkIconURLStrings, sessionID, request);
auto showPaymentUIRequestSeed = m_showPaymentUIRequestSeed;
auto weakThis = makeWeakPtr(*this);
@@ -97,7 +97,9 @@
m_sheetWindowWillCloseObserver = nullptr;
[[m_sheetWindow sheetParent] endSheet:m_sheetWindow.get()];
- m_authorizationPresenter->dismiss();
+
+ if (m_authorizationPresenter)
+ m_authorizationPresenter->dismiss();
m_authorizationPresenter = nullptr;
m_sheetWindow = nullptr;
Modified: trunk/Source/WebKit/Shared/WebPreferences.yaml (242747 => 242748)
--- trunk/Source/WebKit/Shared/WebPreferences.yaml 2019-03-11 22:37:43 UTC (rev 242747)
+++ trunk/Source/WebKit/Shared/WebPreferences.yaml 2019-03-11 22:42:09 UTC (rev 242748)
@@ -1580,6 +1580,14 @@
category: experimental
webcoreBinding: RuntimeEnabledFeatures
+ApplePayRemoteUIEnabled:
+ category: internal
+ condition: ENABLE(APPLE_PAY_REMOTE_UI)
+ defaultValue: true
+ humanReadableDescription: "Enable Apple Pay Remote UI"
+ humanReadableName: "Apple Pay Remote UI"
+ type: bool
+
# Deprecated
ICECandidateFilteringEnabled:
Modified: trunk/Source/WebKit/SourcesCocoa.txt (242747 => 242748)
--- trunk/Source/WebKit/SourcesCocoa.txt 2019-03-11 22:37:43 UTC (rev 242747)
+++ trunk/Source/WebKit/SourcesCocoa.txt 2019-03-11 22:42:09 UTC (rev 242748)
@@ -43,6 +43,7 @@
NetworkProcess/EntryPoint/Cocoa/Daemon/DaemonEntryPoint.mm
NetworkProcess/EntryPoint/Cocoa/XPCService/NetworkServiceEntryPoint.mm
+NetworkProcess/ios/NetworkConnectionToWebProcessIOS.mm
NetworkProcess/ios/NetworkProcessIOS.mm
NetworkProcess/mac/NetworkProcessMac.mm
@@ -75,6 +76,7 @@
Platform/foundation/LoggingFoundation.mm
Platform/ios/AccessibilityIOS.mm
+Platform/ios/PaymentAuthorizationController.mm
Platform/IPC/mac/ConnectionMac.mm
Platform/IPC/mac/MachMessage.cpp
Modified: trunk/Source/WebKit/UIProcess/AuxiliaryProcessProxy.h (242747 => 242748)
--- trunk/Source/WebKit/UIProcess/AuxiliaryProcessProxy.h 2019-03-11 22:37:43 UTC (rev 242747)
+++ trunk/Source/WebKit/UIProcess/AuxiliaryProcessProxy.h 2019-03-11 22:42:09 UTC (rev 242748)
@@ -86,8 +86,6 @@
void setProcessSuppressionEnabled(bool);
- IPC::MessageReceiverMap& messageReceiverMap() { return m_messageReceiverMap; }
-
protected:
// ProcessLauncher::Client
void didFinishLaunching(ProcessLauncher*, IPC::Connection::Identifier) override;
Modified: trunk/Source/WebKit/UIProcess/Cocoa/WebPageProxyCocoa.mm (242747 => 242748)
--- trunk/Source/WebKit/UIProcess/Cocoa/WebPageProxyCocoa.mm 2019-03-11 22:37:43 UTC (rev 242747)
+++ trunk/Source/WebKit/UIProcess/Cocoa/WebPageProxyCocoa.mm 2019-03-11 22:42:09 UTC (rev 242748)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2014-2019 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -35,6 +35,7 @@
#import "SafeBrowsingWarning.h"
#import "WebPageMessages.h"
#import "WebProcessProxy.h"
+#import "WebsiteDataStore.h"
#import <WebCore/DragItem.h>
#import <WebCore/NotImplemented.h>
#import <WebCore/SearchPopupMenuCocoa.h>
@@ -206,5 +207,36 @@
process().send(Messages::WebPage::PerformDictionaryLookupOfCurrentSelection(), m_pageID);
}
+
+#if ENABLE(APPLE_PAY)
+IPC::Connection* WebPageProxy::paymentCoordinatorConnection(const WebPaymentCoordinatorProxy&)
+{
+ return messageSenderConnection();
+}
+
+const String& WebPageProxy::paymentCoordinatorSourceApplicationBundleIdentifier(const WebPaymentCoordinatorProxy&, PAL::SessionID sessionID)
+{
+ ASSERT_UNUSED(sessionID, sessionID == websiteDataStore().sessionID());
+ return websiteDataStore().sourceApplicationBundleIdentifier();
+}
+
+const String& WebPageProxy::paymentCoordinatorSourceApplicationSecondaryIdentifier(const WebPaymentCoordinatorProxy&, PAL::SessionID sessionID)
+{
+ ASSERT_UNUSED(sessionID, sessionID == websiteDataStore().sessionID());
+ return websiteDataStore().sourceApplicationSecondaryIdentifier();
+}
+
+void WebPageProxy::paymentCoordinatorAddMessageReceiver(WebPaymentCoordinatorProxy&, const IPC::StringReference& messageReceiverName, IPC::MessageReceiver& messageReceiver)
+{
+ process().addMessageReceiver(messageReceiverName, m_pageID, messageReceiver);
+}
+
+void WebPageProxy::paymentCoordinatorRemoveMessageReceiver(WebPaymentCoordinatorProxy&, const IPC::StringReference& messageReceiverName)
+{
+ process().removeMessageReceiver(messageReceiverName, m_pageID);
+}
+
+#endif
+
} // namespace WebKit
Modified: trunk/Source/WebKit/UIProcess/WebPageProxy.cpp (242747 => 242748)
--- trunk/Source/WebKit/UIProcess/WebPageProxy.cpp 2019-03-11 22:37:43 UTC (rev 242747)
+++ trunk/Source/WebKit/UIProcess/WebPageProxy.cpp 2019-03-11 22:42:09 UTC (rev 242748)
@@ -8767,35 +8767,6 @@
m_process->processPool().clearAdClickAttribution(m_websiteDataStore->sessionID(), WTFMove(completionHandler));
}
-#if ENABLE(APPLE_PAY)
-
-IPC::Connection* WebPageProxy::paymentCoordinatorConnection(const WebPaymentCoordinatorProxy&)
-{
- return messageSenderConnection();
-}
-
-IPC::MessageReceiverMap& WebPageProxy::paymentCoordinatorMessageReceiver(const WebPaymentCoordinatorProxy&)
-{
- return process().messageReceiverMap();
-}
-
-const String& WebPageProxy::paymentCoordinatorSourceApplicationBundleIdentifier(const WebPaymentCoordinatorProxy&)
-{
- return websiteDataStore().sourceApplicationBundleIdentifier();
-}
-
-const String& WebPageProxy::paymentCoordinatorSourceApplicationSecondaryIdentifier(const WebPaymentCoordinatorProxy&)
-{
- return websiteDataStore().sourceApplicationSecondaryIdentifier();
-}
-
-uint64_t WebPageProxy::paymentCoordinatorDestinationID(const WebPaymentCoordinatorProxy&)
-{
- return messageSenderDestinationID();
-}
-
-#endif
-
void WebPageProxy::addObserver(WebViewDidMoveToWindowObserver& observer)
{
auto result = m_webViewDidMoveToWindowObservers.add(&observer, makeWeakPtr(observer));
Modified: trunk/Source/WebKit/UIProcess/WebPageProxy.h (242747 => 242748)
--- trunk/Source/WebKit/UIProcess/WebPageProxy.h 2019-03-11 22:37:43 UTC (rev 242747)
+++ trunk/Source/WebKit/UIProcess/WebPageProxy.h 2019-03-11 22:42:09 UTC (rev 242748)
@@ -1986,14 +1986,14 @@
// WebPaymentCoordinatorProxy::Client
#if ENABLE(APPLE_PAY)
IPC::Connection* paymentCoordinatorConnection(const WebPaymentCoordinatorProxy&) final;
- IPC::MessageReceiverMap& paymentCoordinatorMessageReceiver(const WebPaymentCoordinatorProxy&) final;
- const String& paymentCoordinatorSourceApplicationBundleIdentifier(const WebPaymentCoordinatorProxy&) final;
- const String& paymentCoordinatorSourceApplicationSecondaryIdentifier(const WebPaymentCoordinatorProxy&) final;
- uint64_t paymentCoordinatorDestinationID(const WebPaymentCoordinatorProxy&) final;
+ const String& paymentCoordinatorSourceApplicationBundleIdentifier(const WebPaymentCoordinatorProxy&, PAL::SessionID) final;
+ const String& paymentCoordinatorSourceApplicationSecondaryIdentifier(const WebPaymentCoordinatorProxy&, PAL::SessionID) final;
+ void paymentCoordinatorAddMessageReceiver(WebPaymentCoordinatorProxy&, const IPC::StringReference&, IPC::MessageReceiver&) final;
+ void paymentCoordinatorRemoveMessageReceiver(WebPaymentCoordinatorProxy&, const IPC::StringReference&) final;
#endif
#if ENABLE(APPLE_PAY) && PLATFORM(IOS_FAMILY)
UIViewController *paymentCoordinatorPresentingViewController(const WebPaymentCoordinatorProxy&) final;
- const String& paymentCoordinatorCTDataConnectionServiceType(const WebPaymentCoordinatorProxy&) final;
+ const String& paymentCoordinatorCTDataConnectionServiceType(const WebPaymentCoordinatorProxy&, PAL::SessionID) final;
std::unique_ptr<PaymentAuthorizationPresenter> paymentCoordinatorAuthorizationPresenter(WebPaymentCoordinatorProxy&, PKPaymentRequest *) final;
#endif
#if ENABLE(APPLE_PAY) && PLATFORM(MAC)
Modified: trunk/Source/WebKit/UIProcess/ios/WebPageProxyIOS.mm (242747 => 242748)
--- trunk/Source/WebKit/UIProcess/ios/WebPageProxyIOS.mm 2019-03-11 22:37:43 UTC (rev 242747)
+++ trunk/Source/WebKit/UIProcess/ios/WebPageProxyIOS.mm 2019-03-11 22:42:09 UTC (rev 242748)
@@ -1190,8 +1190,9 @@
return uiClient().presentingViewController();
}
-const String& WebPageProxy::paymentCoordinatorCTDataConnectionServiceType(const WebPaymentCoordinatorProxy&)
+const String& WebPageProxy::paymentCoordinatorCTDataConnectionServiceType(const WebPaymentCoordinatorProxy&, PAL::SessionID sessionID)
{
+ ASSERT_UNUSED(sessionID, sessionID == websiteDataStore().sessionID());
return process().processPool().configuration().ctDataConnectionServiceType();
}
Modified: trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj (242747 => 242748)
--- trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj 2019-03-11 22:37:43 UTC (rev 242747)
+++ trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj 2019-03-11 22:42:09 UTC (rev 242748)
@@ -1289,6 +1289,7 @@
A1798B43222D98DF000764BD /* PaymentAuthorizationViewController.h in Headers */ = {isa = PBXBuildFile; fileRef = A1798B3F222D98B6000764BD /* PaymentAuthorizationViewController.h */; };
A1798B49222E531D000764BD /* WKPaymentAuthorizationDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = A1798B47222E530A000764BD /* WKPaymentAuthorizationDelegate.h */; };
A1798B4C222F1BD4000764BD /* WebPaymentCoordinatorProxyCocoa.h in Headers */ = {isa = PBXBuildFile; fileRef = A1798B4B222F1BD4000764BD /* WebPaymentCoordinatorProxyCocoa.h */; };
+ A1798B512230A10E000764BD /* PaymentAuthorizationController.h in Headers */ = {isa = PBXBuildFile; fileRef = A1798B4F2230A0FE000764BD /* PaymentAuthorizationController.h */; };
A181A79821ACC74B0059A316 /* WebKitAdditions.mm in Sources */ = {isa = PBXBuildFile; fileRef = A181A79721ACAC610059A316 /* WebKitAdditions.mm */; };
A182D5B51BE6BD250087A7CC /* AccessibilityIOS.h in Headers */ = {isa = PBXBuildFile; fileRef = A182D5B31BE6BD250087A7CC /* AccessibilityIOS.h */; };
A19DD3C01D07D16800AC823B /* _WKWebViewPrintFormatterInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = A19DD3BF1D07D16800AC823B /* _WKWebViewPrintFormatterInternal.h */; };
@@ -3869,6 +3870,9 @@
A1798B48222E530A000764BD /* WKPaymentAuthorizationDelegate.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = WKPaymentAuthorizationDelegate.mm; sourceTree = "<group>"; };
A1798B4A222F133A000764BD /* PaymentAuthorizationPresenter.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = PaymentAuthorizationPresenter.mm; sourceTree = "<group>"; };
A1798B4B222F1BD4000764BD /* WebPaymentCoordinatorProxyCocoa.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WebPaymentCoordinatorProxyCocoa.h; sourceTree = "<group>"; };
+ A1798B4F2230A0FE000764BD /* PaymentAuthorizationController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = PaymentAuthorizationController.h; sourceTree = "<group>"; };
+ A1798B502230A0FE000764BD /* PaymentAuthorizationController.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = PaymentAuthorizationController.mm; sourceTree = "<group>"; };
+ A1798B5722332203000764BD /* NetworkConnectionToWebProcessIOS.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = NetworkConnectionToWebProcessIOS.mm; sourceTree = "<group>"; };
A181A79721ACAC610059A316 /* WebKitAdditions.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = WebKitAdditions.mm; sourceTree = "<group>"; };
A182D5B21BE6BD250087A7CC /* AccessibilityIOS.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = AccessibilityIOS.mm; sourceTree = "<group>"; };
A182D5B31BE6BD250087A7CC /* AccessibilityIOS.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AccessibilityIOS.h; sourceTree = "<group>"; };
@@ -5927,6 +5931,7 @@
2DA944BB188511DD00ED86DB /* ios */ = {
isa = PBXGroup;
children = (
+ A1798B5722332203000764BD /* NetworkConnectionToWebProcessIOS.mm */,
2DA944BC188511E700ED86DB /* NetworkProcessIOS.mm */,
);
path = ios;
@@ -7149,6 +7154,8 @@
children = (
A182D5B31BE6BD250087A7CC /* AccessibilityIOS.h */,
A182D5B21BE6BD250087A7CC /* AccessibilityIOS.mm */,
+ A1798B4F2230A0FE000764BD /* PaymentAuthorizationController.h */,
+ A1798B502230A0FE000764BD /* PaymentAuthorizationController.mm */,
);
path = ios;
sourceTree = "<group>";
@@ -9285,6 +9292,7 @@
1AC7537C183A9FDB0072CB15 /* PageLoadState.h in Headers */,
1A8B66B01BC43C860082DF77 /* PageLoadStateObserver.h in Headers */,
C574A58112E66681002DFE98 /* PasteboardTypes.h in Headers */,
+ A1798B512230A10E000764BD /* PaymentAuthorizationController.h in Headers */,
A1798B3E222D97A2000764BD /* PaymentAuthorizationPresenter.h in Headers */,
A1798B43222D98DF000764BD /* PaymentAuthorizationViewController.h in Headers */,
C1E123BA20A11573002646F4 /* PDFContextMenu.h in Headers */,
@@ -10227,6 +10235,9 @@
CreatedOnToolsVersion = 10.1;
ProvisioningStyle = Automatic;
};
+ A1798B59223464C4000764BD = {
+ CreatedOnToolsVersion = 10.2;
+ };
E1AC2E2720F7B94C00B0897D = {
CreatedOnToolsVersion = 9.3;
ProvisioningStyle = Automatic;
Modified: trunk/Source/WebKit/WebProcess/ApplePay/WebPaymentCoordinator.cpp (242747 => 242748)
--- trunk/Source/WebKit/WebProcess/ApplePay/WebPaymentCoordinator.cpp 2019-03-11 22:37:43 UTC (rev 242747)
+++ trunk/Source/WebKit/WebProcess/ApplePay/WebPaymentCoordinator.cpp 2019-03-11 22:42:09 UTC (rev 242748)
@@ -51,6 +51,14 @@
WebProcess::singleton().removeMessageReceiver(*this);
}
+void WebPaymentCoordinator::networkProcessConnectionClosed()
+{
+#if ENABLE(APPLE_PAY_REMOTE_UI)
+ if (remoteUIEnabled())
+ didCancelPaymentSession();
+#endif
+}
+
const WebPaymentCoordinator::AvailablePaymentNetworksSet& WebPaymentCoordinator::availablePaymentNetworks()
{
if (m_availablePaymentNetworks)
@@ -60,7 +68,7 @@
Vector<String> availablePaymentNetworks;
using AvailablePaymentNetworksMessage = Messages::WebPaymentCoordinatorProxy::AvailablePaymentNetworks;
- if (m_webPage.sendSync(AvailablePaymentNetworksMessage(), AvailablePaymentNetworksMessage::Reply(availablePaymentNetworks))) {
+ if (sendSync(AvailablePaymentNetworksMessage(), AvailablePaymentNetworksMessage::Reply(availablePaymentNetworks))) {
for (auto& network : availablePaymentNetworks)
m_availablePaymentNetworks->add(network);
}
@@ -80,7 +88,7 @@
bool WebPaymentCoordinator::canMakePayments()
{
bool canMakePayments;
- if (!m_webPage.sendSync(Messages::WebPaymentCoordinatorProxy::CanMakePayments(), Messages::WebPaymentCoordinatorProxy::CanMakePayments::Reply(canMakePayments)))
+ if (!sendSync(Messages::WebPaymentCoordinatorProxy::CanMakePayments(), Messages::WebPaymentCoordinatorProxy::CanMakePayments::Reply(canMakePayments)))
return false;
return canMakePayments;
@@ -88,12 +96,12 @@
void WebPaymentCoordinator::canMakePaymentsWithActiveCard(const String& merchantIdentifier, const String& domainName, CompletionHandler<void(bool)>&& completionHandler)
{
- m_webPage.sendWithAsyncReply(Messages::WebPaymentCoordinatorProxy::CanMakePaymentsWithActiveCard(merchantIdentifier, domainName), WTFMove(completionHandler));
+ sendWithAsyncReply(Messages::WebPaymentCoordinatorProxy::CanMakePaymentsWithActiveCard(merchantIdentifier, domainName, m_webPage.sessionID()), WTFMove(completionHandler));
}
void WebPaymentCoordinator::openPaymentSetup(const String& merchantIdentifier, const String& domainName, CompletionHandler<void(bool)>&& completionHandler)
{
- m_webPage.sendWithAsyncReply(Messages::WebPaymentCoordinatorProxy::OpenPaymentSetup(merchantIdentifier, domainName), WTFMove(completionHandler));
+ sendWithAsyncReply(Messages::WebPaymentCoordinatorProxy::OpenPaymentSetup(merchantIdentifier, domainName), WTFMove(completionHandler));
}
bool WebPaymentCoordinator::showPaymentUI(const URL& originatingURL, const Vector<URL>& linkIconURLs, const WebCore::ApplePaySessionPaymentRequest& paymentRequest)
@@ -103,7 +111,7 @@
linkIconURLStrings.append(linkIconURL.string());
bool result;
- if (!m_webPage.sendSync(Messages::WebPaymentCoordinatorProxy::ShowPaymentUI(originatingURL.string(), linkIconURLStrings, paymentRequest), Messages::WebPaymentCoordinatorProxy::ShowPaymentUI::Reply(result)))
+ if (!sendSync(Messages::WebPaymentCoordinatorProxy::ShowPaymentUI(m_webPage.pageID(), m_webPage.sessionID(), originatingURL.string(), linkIconURLStrings, paymentRequest), Messages::WebPaymentCoordinatorProxy::ShowPaymentUI::Reply(result)))
return false;
return result;
@@ -111,37 +119,37 @@
void WebPaymentCoordinator::completeMerchantValidation(const WebCore::PaymentMerchantSession& paymentMerchantSession)
{
- m_webPage.send(Messages::WebPaymentCoordinatorProxy::CompleteMerchantValidation(paymentMerchantSession));
+ send(Messages::WebPaymentCoordinatorProxy::CompleteMerchantValidation(paymentMerchantSession));
}
void WebPaymentCoordinator::completeShippingMethodSelection(Optional<WebCore::ShippingMethodUpdate>&& update)
{
- m_webPage.send(Messages::WebPaymentCoordinatorProxy::CompleteShippingMethodSelection(update));
+ send(Messages::WebPaymentCoordinatorProxy::CompleteShippingMethodSelection(update));
}
void WebPaymentCoordinator::completeShippingContactSelection(Optional<WebCore::ShippingContactUpdate>&& update)
{
- m_webPage.send(Messages::WebPaymentCoordinatorProxy::CompleteShippingContactSelection(update));
+ send(Messages::WebPaymentCoordinatorProxy::CompleteShippingContactSelection(update));
}
void WebPaymentCoordinator::completePaymentMethodSelection(Optional<WebCore::PaymentMethodUpdate>&& update)
{
- m_webPage.send(Messages::WebPaymentCoordinatorProxy::CompletePaymentMethodSelection(update));
+ send(Messages::WebPaymentCoordinatorProxy::CompletePaymentMethodSelection(update));
}
void WebPaymentCoordinator::completePaymentSession(Optional<WebCore::PaymentAuthorizationResult>&& result)
{
- m_webPage.send(Messages::WebPaymentCoordinatorProxy::CompletePaymentSession(result));
+ send(Messages::WebPaymentCoordinatorProxy::CompletePaymentSession(result));
}
void WebPaymentCoordinator::abortPaymentSession()
{
- m_webPage.send(Messages::WebPaymentCoordinatorProxy::AbortPaymentSession());
+ send(Messages::WebPaymentCoordinatorProxy::AbortPaymentSession());
}
void WebPaymentCoordinator::cancelPaymentSession()
{
- m_webPage.send(Messages::WebPaymentCoordinatorProxy::CancelPaymentSession());
+ send(Messages::WebPaymentCoordinatorProxy::CancelPaymentSession());
}
void WebPaymentCoordinator::paymentCoordinatorDestroyed()
@@ -149,6 +157,20 @@
delete this;
}
+IPC::Connection* WebPaymentCoordinator::messageSenderConnection() const
+{
+#if ENABLE(APPLE_PAY_REMOTE_UI)
+ if (remoteUIEnabled())
+ return &WebProcess::singleton().ensureNetworkProcessConnection().connection();
+#endif
+ return WebProcess::singleton().parentProcessConnection();
+}
+
+uint64_t WebPaymentCoordinator::messageSenderDestinationID() const
+{
+ return m_webPage.pageID();
+}
+
void WebPaymentCoordinator::validateMerchant(const String& validationURLString)
{
paymentCoordinator().validateMerchant(URL(URL(), validationURLString));
@@ -184,6 +206,15 @@
return m_webPage.corePage()->paymentCoordinator();
}
+#if ENABLE(APPLE_PAY_REMOTE_UI)
+bool WebPaymentCoordinator::remoteUIEnabled() const
+{
+ if (auto page = m_webPage.corePage())
+ return page->settings().applePayRemoteUIEnabled();
+ return false;
}
+#endif
+}
+
#endif
Modified: trunk/Source/WebKit/WebProcess/ApplePay/WebPaymentCoordinator.h (242747 => 242748)
--- trunk/Source/WebKit/WebProcess/ApplePay/WebPaymentCoordinator.h 2019-03-11 22:37:43 UTC (rev 242747)
+++ trunk/Source/WebKit/WebProcess/ApplePay/WebPaymentCoordinator.h 2019-03-11 22:42:09 UTC (rev 242748)
@@ -28,6 +28,7 @@
#if ENABLE(APPLE_PAY)
#include "MessageReceiver.h"
+#include "MessageSender.h"
#include <WebCore/PaymentCoordinatorClient.h>
#include <WebCore/PaymentHeaders.h>
#include <wtf/Forward.h>
@@ -46,13 +47,17 @@
namespace WebKit {
+class NetworkProcessConnection;
class WebPage;
-class WebPaymentCoordinator final : public WebCore::PaymentCoordinatorClient, private IPC::MessageReceiver {
+class WebPaymentCoordinator final : public WebCore::PaymentCoordinatorClient, private IPC::MessageReceiver, private IPC::MessageSender {
public:
+ friend class NetworkProcessConnection;
explicit WebPaymentCoordinator(WebPage&);
~WebPaymentCoordinator();
+ void networkProcessConnectionClosed();
+
private:
// WebCore::PaymentCoordinatorClient.
Optional<String> validatedPaymentNetwork(const String&) override;
@@ -71,8 +76,14 @@
void paymentCoordinatorDestroyed() override;
+ bool isWebPaymentCoordinator() const override { return true; }
+
// IPC::MessageReceiver.
void didReceiveMessage(IPC::Connection&, IPC::Decoder&) override;
+
+ // IPC::MessageSender.
+ IPC::Connection* messageSenderConnection() const final;
+ uint64_t messageSenderDestinationID() const final;
// Message handlers.
void validateMerchant(const String& validationURLString);
@@ -83,7 +94,11 @@
void didCancelPaymentSession();
WebCore::PaymentCoordinator& paymentCoordinator();
-
+
+#if ENABLE(APPLE_PAY_REMOTE_UI)
+ bool remoteUIEnabled() const;
+#endif
+
using AvailablePaymentNetworksSet = HashSet<String, ASCIICaseInsensitiveHash>;
const AvailablePaymentNetworksSet& availablePaymentNetworks();
@@ -96,5 +111,10 @@
#endif
};
-}
+} // namespace WebKit
+
+SPECIALIZE_TYPE_TRAITS_BEGIN(WebKit::WebPaymentCoordinator)
+static bool isType(const WebCore::PaymentCoordinatorClient& paymentCoordinatorClient) { return paymentCoordinatorClient.isWebPaymentCoordinator(); }
+SPECIALIZE_TYPE_TRAITS_END()
+
#endif
Modified: trunk/Source/WebKit/WebProcess/Network/NetworkProcessConnection.cpp (242747 => 242748)
--- trunk/Source/WebKit/WebProcess/Network/NetworkProcessConnection.cpp 2019-03-11 22:37:43 UTC (rev 242747)
+++ trunk/Source/WebKit/WebProcess/Network/NetworkProcessConnection.cpp 2019-03-11 22:42:09 UTC (rev 242748)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2010, 2011, 2012 Apple Inc. All rights reserved.
+ * Copyright (C) 2010-2019 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -39,6 +39,7 @@
#include "WebMDNSRegisterMessages.h"
#include "WebPage.h"
#include "WebPageMessages.h"
+#include "WebPaymentCoordinator.h"
#include "WebProcess.h"
#include "WebRTCMonitor.h"
#include "WebRTCMonitorMessages.h"
@@ -57,6 +58,10 @@
#include <WebCore/SharedBuffer.h>
#include <pal/SessionID.h>
+#if ENABLE(APPLE_PAY_REMOTE_UI)
+#include "WebPaymentCoordinatorMessages.h"
+#endif
+
namespace WebKit {
using namespace WebCore;
@@ -141,6 +146,14 @@
}
#endif
+#if ENABLE(APPLE_PAY_REMOTE_UI)
+ if (decoder.messageReceiverName() == Messages::WebPaymentCoordinator::messageReceiverName()) {
+ if (auto webPage = WebProcess::singleton().webPage(decoder.destinationID()))
+ webPage->paymentCoordinator()->didReceiveMessage(connection, decoder);
+ return;
+ }
+#endif
+
didReceiveNetworkProcessConnectionMessage(connection, decoder);
}
@@ -155,6 +168,14 @@
}
#endif
+#if ENABLE(APPLE_PAY_REMOTE_UI)
+ if (decoder.messageReceiverName() == Messages::WebPaymentCoordinator::messageReceiverName()) {
+ if (auto webPage = WebProcess::singleton().webPage(decoder.destinationID()))
+ webPage->paymentCoordinator()->didReceiveSyncMessage(connection, decoder, replyEncoder);
+ return;
+ }
+#endif
+
ASSERT_NOT_REACHED();
}
Modified: trunk/Source/WebKit/WebProcess/WebPage/Cocoa/WebPageCocoa.mm (242747 => 242748)
--- trunk/Source/WebKit/WebProcess/WebPage/Cocoa/WebPageCocoa.mm 2019-03-11 22:37:43 UTC (rev 242747)
+++ trunk/Source/WebKit/WebProcess/WebPage/Cocoa/WebPageCocoa.mm 2019-03-11 22:42:09 UTC (rev 242748)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2016-2017 Apple Inc. All rights reserved.
+ * Copyright (C) 2016-2019 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -30,6 +30,7 @@
#import "LoadParameters.h"
#import "PluginView.h"
#import "WebPageProxyMessages.h"
+#import "WebPaymentCoordinator.h"
#import <WebCore/DictionaryLookup.h>
#import <WebCore/Editor.h>
#import <WebCore/EventHandler.h>
@@ -37,6 +38,7 @@
#import <WebCore/HTMLConverter.h>
#import <WebCore/HitTestResult.h>
#import <WebCore/NodeRenderStyle.h>
+#import <WebCore/PaymentCoordinator.h>
#import <WebCore/PlatformMediaSessionManager.h>
#import <WebCore/RenderElement.h>
#import <WebCore/RenderObject.h>
@@ -189,6 +191,16 @@
send(Messages::WebPageProxy::RegisterWebProcessAccessibilityToken(dataToken));
}
+#if ENABLE(APPLE_PAY)
+WebPaymentCoordinator* WebPage::paymentCoordinator()
+{
+ if (!m_page)
+ return nullptr;
+ auto& client = m_page->paymentCoordinator().client();
+ return is<WebPaymentCoordinator>(client) ? downcast<WebPaymentCoordinator>(&client) : nullptr;
+}
+#endif
+
} // namespace WebKit
#endif // PLATFORM(COCOA)
Modified: trunk/Source/WebKit/WebProcess/WebPage/WebPage.h (242747 => 242748)
--- trunk/Source/WebKit/WebProcess/WebPage/WebPage.h 2019-03-11 22:37:43 UTC (rev 242747)
+++ trunk/Source/WebKit/WebProcess/WebPage/WebPage.h 2019-03-11 22:42:09 UTC (rev 242748)
@@ -232,6 +232,7 @@
class WebPageGroupProxy;
class WebPageInspectorTargetController;
class WebPageOverlay;
+class WebPaymentCoordinator;
class WebPopupMenu;
class WebTouchEvent;
class WebURLSchemeHandlerProxy;
@@ -1160,6 +1161,10 @@
void suspendAllMediaBuffering();
void resumeAllMediaBuffering();
+#if ENABLE(APPLE_PAY)
+ WebPaymentCoordinator* paymentCoordinator();
+#endif
+
private:
WebPage(uint64_t pageID, WebPageCreationParameters&&);
Modified: trunk/Source/WebKit/WebProcess/WebProcess.cpp (242747 => 242748)
--- trunk/Source/WebKit/WebProcess/WebProcess.cpp 2019-03-11 22:37:43 UTC (rev 242747)
+++ trunk/Source/WebKit/WebProcess/WebProcess.cpp 2019-03-11 22:42:09 UTC (rev 242748)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2009-2018 Apple Inc. All rights reserved.
+ * Copyright (C) 2009-2019 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -57,6 +57,7 @@
#include "WebMessagePortChannelProvider.h"
#include "WebPage.h"
#include "WebPageGroupProxy.h"
+#include "WebPaymentCoordinator.h"
#include "WebPlatformStrategies.h"
#include "WebPluginInfoProvider.h"
#include "WebProcessCreationParameters.h"
@@ -1286,8 +1287,13 @@
m_webLoaderStrategy.networkProcessCrashed();
WebSocketStream::networkProcessCrashed();
- for (auto& page : m_pageMap.values())
+ for (auto& page : m_pageMap.values()) {
page->stopAllURLSchemeTasks();
+#if ENABLE(APPLE_PAY)
+ if (auto paymentCoordinator = page->paymentCoordinator())
+ paymentCoordinator->networkProcessConnectionClosed();
+#endif
+ }
}
WebLoaderStrategy& WebProcess::webLoaderStrategy()