Title: [246235] trunk/Source
Revision
246235
Author
[email protected]
Date
2019-06-08 16:45:28 -0700 (Sat, 08 Jun 2019)

Log Message

[Apple Pay] If we have a bound interface identifier, set it on new PKPaymentRequests
https://bugs.webkit.org/show_bug.cgi?id=198690
<rdar://problem/48041803>

Reviewed by Tim Horton.

Source/WebCore/PAL:

* pal/spi/cocoa/PassKitSPI.h: Included PKPaymentRequest_WebKit.h to declare some
WebKit-specific PKPaymentRequest SPIs for internal SDKs, and re-declared these SPIs - now
including the boundInterfaceIdentifier property - for public SDKs.

Source/WebKit:

* NetworkProcess/cocoa/NetworkSessionCocoa.h:
* NetworkProcess/cocoa/NetworkSessionCocoa.mm:
(WebKit::NetworkSessionCocoa::boundInterfaceIdentifier const): Implemented a public getter
for m_boundInterfaceIdentifier.

* NetworkProcess/NetworkConnectionToWebProcess.h:
* NetworkProcess/ios/NetworkConnectionToWebProcessIOS.mm:
(WebKit::NetworkConnectionToWebProcess::paymentCoordinatorBoundInterfaceIdentifier):
Implemented an override for paymentCoordinatorBoundInterfaceIdentifier.

* Shared/ApplePay/WebPaymentCoordinatorProxy.h: Declared
paymentCoordinatorBoundInterfaceIdentifier for clients to override.

* Shared/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.mm:
(WebKit::WebPaymentCoordinatorProxy::platformPaymentRequest): If the client has a non-empty
bound interface identifier, set it on the new PKPaymentRequest.

* UIProcess/WebPageProxy.h:
* UIProcess/Cocoa/WebPageProxyCocoa.mm:
(WebKit::WebPageProxy::paymentCoordinatorBoundInterfaceIdentifier): Implemented an override
for paymentCoordinatorBoundInterfaceIdentifier.

Source/WTF:

* wtf/FeatureDefines.h: Defined HAVE_PASSKIT_BOUND_INTERFACE_IDENTIFIER, and cleaned up some
other PassKit HAVEs.

Modified Paths

Diff

Modified: trunk/Source/WTF/ChangeLog (246234 => 246235)


--- trunk/Source/WTF/ChangeLog	2019-06-08 18:48:41 UTC (rev 246234)
+++ trunk/Source/WTF/ChangeLog	2019-06-08 23:45:28 UTC (rev 246235)
@@ -1,3 +1,14 @@
+2019-06-08  Andy Estes  <[email protected]>
+
+        [Apple Pay] If we have a bound interface identifier, set it on new PKPaymentRequests
+        https://bugs.webkit.org/show_bug.cgi?id=198690
+        <rdar://problem/48041803>
+
+        Reviewed by Tim Horton.
+
+        * wtf/FeatureDefines.h: Defined HAVE_PASSKIT_BOUND_INTERFACE_IDENTIFIER, and cleaned up some
+        other PassKit HAVEs.
+
 2019-06-06  Caio Lima  <[email protected]>
 
         [JSCOnly] JSCOnly port is not building on macOS

Modified: trunk/Source/WTF/wtf/FeatureDefines.h (246234 => 246235)


--- trunk/Source/WTF/wtf/FeatureDefines.h	2019-06-08 18:48:41 UTC (rev 246234)
+++ trunk/Source/WTF/wtf/FeatureDefines.h	2019-06-08 23:45:28 UTC (rev 246235)
@@ -205,6 +205,12 @@
 #define HAVE_PASSKIT_API_TYPE 1
 #endif
 
+#if !defined(HAVE_PASSKIT_BOUND_INTERFACE_IDENTIFIER)
+#if __IPHONE_OS_VERSION_MIN_REQUIRED >= 130000
+#define HAVE_PASSKIT_BOUND_INTERFACE_IDENTIFIER 1
+#endif
+#endif
+
 #endif /* PLATFORM(IOS_FAMILY) */
 
 /* --------- Apple WATCHOS port --------- */
@@ -286,13 +292,23 @@
 #endif
 
 #if !defined(HAVE_PASSKIT_GRANULAR_ERRORS)
-#define HAVE_PASSKIT_GRANULAR_ERRORS __MAC_OS_X_VERSION_MIN_REQUIRED >= 101300
+#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 101300
+#define HAVE_PASSKIT_GRANULAR_ERRORS 1
 #endif
+#endif
 
 #if !defined(HAVE_PASSKIT_API_TYPE)
-#define HAVE_PASSKIT_API_TYPE __MAC_OS_X_VERSION_MIN_REQUIRED >= 101300 && __MAC_OS_X_VERSION_MAX_ALLOWED >= 101304
+#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 101300 && __MAC_OS_X_VERSION_MAX_ALLOWED >= 101304
+#define HAVE_PASSKIT_API_TYPE 1
 #endif
+#endif
 
+#if !defined(HAVE_PASSKIT_BOUND_INTERFACE_IDENTIFIER)
+#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 101400
+#define HAVE_PASSKIT_BOUND_INTERFACE_IDENTIFIER 1
+#endif
+#endif
+
 #endif /* PLATFORM(MAC) */
 
 #if PLATFORM(COCOA)

Modified: trunk/Source/WebCore/PAL/ChangeLog (246234 => 246235)


--- trunk/Source/WebCore/PAL/ChangeLog	2019-06-08 18:48:41 UTC (rev 246234)
+++ trunk/Source/WebCore/PAL/ChangeLog	2019-06-08 23:45:28 UTC (rev 246235)
@@ -1,3 +1,15 @@
+2019-06-08  Andy Estes  <[email protected]>
+
+        [Apple Pay] If we have a bound interface identifier, set it on new PKPaymentRequests
+        https://bugs.webkit.org/show_bug.cgi?id=198690
+        <rdar://problem/48041803>
+
+        Reviewed by Tim Horton.
+
+        * pal/spi/cocoa/PassKitSPI.h: Included PKPaymentRequest_WebKit.h to declare some
+        WebKit-specific PKPaymentRequest SPIs for internal SDKs, and re-declared these SPIs - now
+        including the boundInterfaceIdentifier property - for public SDKs.
+
 2019-06-05  Alex Christensen  <[email protected]>
 
         Progress towards resurrecting Mac CMake build

Modified: trunk/Source/WebCore/PAL/pal/spi/cocoa/PassKitSPI.h (246234 => 246235)


--- trunk/Source/WebCore/PAL/pal/spi/cocoa/PassKitSPI.h	2019-06-08 18:48:41 UTC (rev 246234)
+++ trunk/Source/WebCore/PAL/pal/spi/cocoa/PassKitSPI.h	2019-06-08 23:45:28 UTC (rev 246235)
@@ -42,6 +42,7 @@
 #import <PassKit/PassKit.h>
 #import <PassKit/PKPaymentAuthorizationViewController_Private.h>
 #import <PassKit/PKPaymentRequest_Private.h>
+#import <PassKitCore/PKPaymentRequest_WebKit.h>
 
 #if PLATFORM(IOS_FAMILY)
 #import <PassKit/PKPaymentAuthorizationController_Private.h>
@@ -296,6 +297,15 @@
 - (void)paymentAuthorizationViewController:(PKPaymentAuthorizationViewController *)controller didRequestMerchantSession:(void(^)(PKPaymentMerchantSession *, NSError *))sessionBlock;
 @end
 
+@interface PKPaymentRequest ()
+@property (nonatomic, strong) NSArray *thumbnailURLs;
+@property (nonatomic, retain) NSURL *originatingURL;
+@property (nonatomic, assign) BOOL expectsMerchantSession;
+@property (nonatomic, strong) NSString *sourceApplicationBundleIdentifier;
+@property (nonatomic, strong) NSString *sourceApplicationSecondaryIdentifier;
+@property (nonatomic, strong) NSString *CTDataConnectionServiceType;
+@end
+
 #if HAVE(PASSKIT_API_TYPE)
 @interface PKPaymentRequest ()
 @property (nonatomic, assign) PKPaymentRequestAPIType APIType;
@@ -302,6 +312,12 @@
 @end
 #endif
 
+#if HAVE(PASSKIT_BOUND_INTERFACE_IDENTIFIER)
+@interface PKPaymentRequest ()
+@property (nonatomic, copy) NSString *boundInterfaceIdentifier;
+@end
+#endif
+
 NS_ASSUME_NONNULL_END
 
 #endif // USE(APPLE_INTERNAL_SDK)
@@ -370,12 +386,6 @@
 @interface PKPaymentMethod () <NSSecureCoding>
 @end
 
-@interface PKPaymentRequest ()
-@property (nonatomic, strong) NSString *sourceApplicationBundleIdentifier;
-@property (nonatomic, strong) NSString *sourceApplicationSecondaryIdentifier;
-@property (nonatomic, strong) NSString *CTDataConnectionServiceType;
-@end
-
 typedef void(^PKCanMakePaymentsCompletion)(BOOL isValid, NSError *);
 
 NS_ASSUME_NONNULL_END

Modified: trunk/Source/WebKit/ChangeLog (246234 => 246235)


--- trunk/Source/WebKit/ChangeLog	2019-06-08 18:48:41 UTC (rev 246234)
+++ trunk/Source/WebKit/ChangeLog	2019-06-08 23:45:28 UTC (rev 246235)
@@ -1,3 +1,33 @@
+2019-06-08  Andy Estes  <[email protected]>
+
+        [Apple Pay] If we have a bound interface identifier, set it on new PKPaymentRequests
+        https://bugs.webkit.org/show_bug.cgi?id=198690
+        <rdar://problem/48041803>
+
+        Reviewed by Tim Horton.
+
+        * NetworkProcess/cocoa/NetworkSessionCocoa.h:
+        * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
+        (WebKit::NetworkSessionCocoa::boundInterfaceIdentifier const): Implemented a public getter
+        for m_boundInterfaceIdentifier.
+
+        * NetworkProcess/NetworkConnectionToWebProcess.h:
+        * NetworkProcess/ios/NetworkConnectionToWebProcessIOS.mm:
+        (WebKit::NetworkConnectionToWebProcess::paymentCoordinatorBoundInterfaceIdentifier):
+        Implemented an override for paymentCoordinatorBoundInterfaceIdentifier.
+
+        * Shared/ApplePay/WebPaymentCoordinatorProxy.h: Declared
+        paymentCoordinatorBoundInterfaceIdentifier for clients to override.
+
+        * Shared/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.mm:
+        (WebKit::WebPaymentCoordinatorProxy::platformPaymentRequest): If the client has a non-empty
+        bound interface identifier, set it on the new PKPaymentRequest.
+
+        * UIProcess/WebPageProxy.h:
+        * UIProcess/Cocoa/WebPageProxyCocoa.mm:
+        (WebKit::WebPageProxy::paymentCoordinatorBoundInterfaceIdentifier): Implemented an override
+        for paymentCoordinatorBoundInterfaceIdentifier.
+
 2019-06-07  Antti Koivisto  <[email protected]>
 
         REGRESSION (r245006): Setting scrollview.scrollEnabled clobbers any scrollEnabled set by a client

Modified: trunk/Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.h (246234 => 246235)


--- trunk/Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.h	2019-06-08 18:48:41 UTC (rev 246234)
+++ trunk/Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.h	2019-06-08 23:45:28 UTC (rev 246235)
@@ -271,6 +271,7 @@
     // WebPaymentCoordinatorProxy::Client
     IPC::Connection* paymentCoordinatorConnection(const WebPaymentCoordinatorProxy&) final;
     UIViewController *paymentCoordinatorPresentingViewController(const WebPaymentCoordinatorProxy&) final;
+    const String& paymentCoordinatorBoundInterfaceIdentifier(const WebPaymentCoordinatorProxy&, PAL::SessionID) 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;

Modified: trunk/Source/WebKit/NetworkProcess/cocoa/NetworkSessionCocoa.h (246234 => 246235)


--- trunk/Source/WebKit/NetworkProcess/cocoa/NetworkSessionCocoa.h	2019-06-08 18:48:41 UTC (rev 246234)
+++ trunk/Source/WebKit/NetworkProcess/cocoa/NetworkSessionCocoa.h	2019-06-08 23:45:28 UTC (rev 246235)
@@ -50,6 +50,7 @@
 
     void initializeEphemeralStatelessCookielessSession();
 
+    const String& boundInterfaceIdentifier() const;
     const String& sourceApplicationBundleIdentifier() const;
     const String& sourceApplicationSecondaryIdentifier() const;
     // Must be called before any NetworkSession has been created.

Modified: trunk/Source/WebKit/NetworkProcess/cocoa/NetworkSessionCocoa.mm (246234 => 246235)


--- trunk/Source/WebKit/NetworkProcess/cocoa/NetworkSessionCocoa.mm	2019-06-08 18:48:41 UTC (rev 246234)
+++ trunk/Source/WebKit/NetworkProcess/cocoa/NetworkSessionCocoa.mm	2019-06-08 23:45:28 UTC (rev 246235)
@@ -828,6 +828,11 @@
     return [NSURLSessionConfiguration defaultSessionConfiguration];
 }
 
+const String& NetworkSessionCocoa::boundInterfaceIdentifier() const
+{
+    return m_boundInterfaceIdentifier;
+}
+
 const String& NetworkSessionCocoa::sourceApplicationBundleIdentifier() const
 {
     return m_sourceApplicationBundleIdentifier;

Modified: trunk/Source/WebKit/NetworkProcess/ios/NetworkConnectionToWebProcessIOS.mm (246234 => 246235)


--- trunk/Source/WebKit/NetworkProcess/ios/NetworkConnectionToWebProcessIOS.mm	2019-06-08 18:48:41 UTC (rev 246234)
+++ trunk/Source/WebKit/NetworkProcess/ios/NetworkConnectionToWebProcessIOS.mm	2019-06-08 23:45:28 UTC (rev 246235)
@@ -52,6 +52,13 @@
     return nil;
 }
 
+const String& NetworkConnectionToWebProcess::paymentCoordinatorBoundInterfaceIdentifier(const WebPaymentCoordinatorProxy&, PAL::SessionID sessionID)
+{
+    if (auto session = static_cast<NetworkSessionCocoa*>(m_networkProcess->networkSession(sessionID)))
+        return session->boundInterfaceIdentifier();
+    return emptyString();
+}
+
 const String& NetworkConnectionToWebProcess::paymentCoordinatorCTDataConnectionServiceType(const WebPaymentCoordinatorProxy&, PAL::SessionID sessionID)
 {
     if (auto session = static_cast<NetworkSessionCocoa*>(m_networkProcess->networkSession(sessionID)))

Modified: trunk/Source/WebKit/Shared/ApplePay/WebPaymentCoordinatorProxy.h (246234 => 246235)


--- trunk/Source/WebKit/Shared/ApplePay/WebPaymentCoordinatorProxy.h	2019-06-08 18:48:41 UTC (rev 246234)
+++ trunk/Source/WebKit/Shared/ApplePay/WebPaymentCoordinatorProxy.h	2019-06-08 23:45:28 UTC (rev 246235)
@@ -77,6 +77,7 @@
         virtual ~Client() = default;
 
         virtual IPC::Connection* paymentCoordinatorConnection(const WebPaymentCoordinatorProxy&) = 0;
+        virtual const String& paymentCoordinatorBoundInterfaceIdentifier(const WebPaymentCoordinatorProxy&, PAL::SessionID) = 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;

Modified: trunk/Source/WebKit/Shared/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.mm (246234 => 246235)


--- trunk/Source/WebKit/Shared/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.mm	2019-06-08 18:48:41 UTC (rev 246234)
+++ trunk/Source/WebKit/Shared/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.mm	2019-06-08 23:45:28 UTC (rev 246235)
@@ -37,18 +37,17 @@
 #import <wtf/RunLoop.h>
 #import <wtf/URL.h>
 
-// FIXME: Once rdar://problem/24420024 has been fixed, import PKPaymentRequest_Private.h instead.
+// FIXME: We don't support any platforms without -setThumbnailURLs:, so this can be removed.
 @interface PKPaymentRequest ()
-@property (nonatomic, retain) NSURL *originatingURL;
+@property (nonatomic, strong) NSURL *thumbnailURL;
 @end
 
-@interface PKPaymentRequest ()
-// FIXME: Remove this once it's in an SDK.
-@property (nonatomic, strong) NSArray *thumbnailURLs;
-@property (nonatomic, strong) NSURL *thumbnailURL;
-
-@property (nonatomic, assign) BOOL expectsMerchantSession;
+#if HAVE(PASSKIT_BOUND_INTERFACE_IDENTIFIER)
+// FIXME: Remove once rdar://problem/48041516 is widely available in SDKs.
+@interface PKPaymentRequest (Staging)
+@property (nonatomic, copy) NSString *boundInterfaceIdentifier;
 @end
+#endif
 
 namespace WebKit {
 
@@ -249,6 +248,7 @@
 
     [result setOriginatingURL:originatingURL];
 
+    // FIXME: We don't support any platforms without -setThumbnailURLs:, so this can be simplified.
     if ([result respondsToSelector:@selector(setThumbnailURLs:)]) {
         auto thumbnailURLs = adoptNS([[NSMutableArray alloc] init]);
         for (auto& linkIconURL : linkIconURLs)
@@ -306,6 +306,13 @@
     [result setSupportedCountries:toNSSet(paymentRequest.supportedCountries()).get()];
 #endif
 
+#if HAVE(PASSKIT_BOUND_INTERFACE_IDENTIFIER)
+    // FIXME: Remove -respondsToSelector: check once rdar://problem/48041516 is widely available in SDKs.
+    auto& boundInterfaceIdentifier = m_client.paymentCoordinatorBoundInterfaceIdentifier(*this, sessionID);
+    if (!boundInterfaceIdentifier.isEmpty() && [result respondsToSelector:@selector(setBoundInterfaceIdentifier:)])
+        [result setBoundInterfaceIdentifier:boundInterfaceIdentifier];
+#endif
+
     // FIXME: Instead of using respondsToSelector, this should use a proper #if version check.
     auto& bundleIdentifier = m_client.paymentCoordinatorSourceApplicationBundleIdentifier(*this, sessionID);
     if (!bundleIdentifier.isEmpty() && [result respondsToSelector:@selector(setSourceApplicationBundleIdentifier:)])

Modified: trunk/Source/WebKit/UIProcess/Cocoa/WebPageProxyCocoa.mm (246234 => 246235)


--- trunk/Source/WebKit/UIProcess/Cocoa/WebPageProxyCocoa.mm	2019-06-08 18:48:41 UTC (rev 246234)
+++ trunk/Source/WebKit/UIProcess/Cocoa/WebPageProxyCocoa.mm	2019-06-08 23:45:28 UTC (rev 246235)
@@ -225,6 +225,12 @@
     return messageSenderConnection();
 }
 
+const String& WebPageProxy::paymentCoordinatorBoundInterfaceIdentifier(const WebPaymentCoordinatorProxy&, PAL::SessionID sessionID)
+{
+    ASSERT_UNUSED(sessionID, sessionID == websiteDataStore().sessionID());
+    return websiteDataStore().boundInterfaceIdentifier();
+}
+
 const String& WebPageProxy::paymentCoordinatorSourceApplicationBundleIdentifier(const WebPaymentCoordinatorProxy&, PAL::SessionID sessionID)
 {
     ASSERT_UNUSED(sessionID, sessionID == websiteDataStore().sessionID());

Modified: trunk/Source/WebKit/UIProcess/WebPageProxy.h (246234 => 246235)


--- trunk/Source/WebKit/UIProcess/WebPageProxy.h	2019-06-08 18:48:41 UTC (rev 246234)
+++ trunk/Source/WebKit/UIProcess/WebPageProxy.h	2019-06-08 23:45:28 UTC (rev 246235)
@@ -2065,6 +2065,7 @@
     // WebPaymentCoordinatorProxy::Client
 #if ENABLE(APPLE_PAY)
     IPC::Connection* paymentCoordinatorConnection(const WebPaymentCoordinatorProxy&) final;
+    const String& paymentCoordinatorBoundInterfaceIdentifier(const WebPaymentCoordinatorProxy&, PAL::SessionID) 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;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to