[Cocoa] Create a soft-linking file for PassKit
authoraestes@apple.com <aestes@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 22 Nov 2018 02:12:04 +0000 (02:12 +0000)
committeraestes@apple.com <aestes@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 22 Nov 2018 02:12:04 +0000 (02:12 +0000)
https://bugs.webkit.org/show_bug.cgi?id=191875
<rdar://problem/46203215>

Reviewed by Myles Maxfield.

Source/WebCore:

* Modules/applepay/cocoa/PaymentContactCocoa.mm: Removed SOFT_LINK macros and included PassKitSoftLink.h instead.
* Modules/applepay/cocoa/PaymentMerchantSessionCocoa.mm: Ditto.
* SourcesCocoa.txt: Removed @no-unify from PaymentMerchantSessionCocoa.mm.
* WebCore.xcodeproj/project.pbxproj: Removed PaymentMerchantSessionCocoa.mm from the WebCore target.
* rendering/RenderThemeCocoa.mm: Removed SOFT_LINK macros and included PassKitSoftLink.h instead.

Source/WebCore/PAL:

* PAL.xcodeproj/project.pbxproj:
* pal/PlatformMac.cmake:
* pal/cocoa/PassKitSoftLink.h: Added.
* pal/cocoa/PassKitSoftLink.mm: Added. Used _WITH_EXPORT soft-linking macros in order to
make the PAL soft-linking symbols visible to WebKit.
* pal/spi/cocoa/PassKitSPI.h:

Source/WebKit:

* Shared/Cocoa/WebCoreArgumentCodersCocoa.mm: Removed SOFT_LINK macros and included PassKitSoftLink.h instead.
* SourcesCocoa.txt: Removed @no-unify from WebPaymentCoordinatorProxyIOS.mm and WebPaymentCoordinatorProxyMac.mm.
* UIProcess/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.mm: Removed SOFT_LINK macros and included PassKitSoftLink.h instead.
* UIProcess/ApplePay/ios/WebPaymentCoordinatorProxyIOS.mm: Ditto.
* UIProcess/ApplePay/mac/WebPaymentCoordinatorProxyMac.mm: Ditto.
* UIProcess/Cocoa/SafeBrowsingWarningCocoa.mm: Included NSAttributedStringSPI.h.
* UIProcess/mac/WebProcessProxyMac.mm: Included ProcessPrivilege.h.
* WebKit.xcodeproj/project.pbxproj: Removed WebPaymentCoordinatorProxyIOS.mm and WebPaymentCoordinatorProxyMac.mm from the WebKit target.

Source/WTF:

* wtf/Platform.h: Defined USE_PASSKIT.
* wtf/cocoa/SoftLinking.h: Added _WITH_EXPORT variants of SOFT_LINK_FRAMEWORK_FOR_SOURCE,
SOFT_LINK_PRIVATE_FRAMEWORK_FOR_SOURCE, SOFT_LINK_CLASS_FOR_SOURCE,
SOFT_LINK_FUNCTION_FOR_SOURCE, and SOFT_LINK_CONSTANT_FOR_SOURCE.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@238434 268f45cc-cd09-0410-ab3c-d52691b4dbfc

24 files changed:
Source/WTF/ChangeLog
Source/WTF/wtf/Platform.h
Source/WTF/wtf/cocoa/SoftLinking.h
Source/WebCore/ChangeLog
Source/WebCore/Modules/applepay/cocoa/PaymentContactCocoa.mm
Source/WebCore/Modules/applepay/cocoa/PaymentMerchantSessionCocoa.mm
Source/WebCore/PAL/ChangeLog
Source/WebCore/PAL/PAL.xcodeproj/project.pbxproj
Source/WebCore/PAL/pal/PlatformMac.cmake
Source/WebCore/PAL/pal/cocoa/PassKitSoftLink.h [new file with mode: 0644]
Source/WebCore/PAL/pal/cocoa/PassKitSoftLink.mm [new file with mode: 0644]
Source/WebCore/PAL/pal/spi/cocoa/PassKitSPI.h
Source/WebCore/SourcesCocoa.txt
Source/WebCore/WebCore.xcodeproj/project.pbxproj
Source/WebCore/rendering/RenderThemeCocoa.mm
Source/WebKit/ChangeLog
Source/WebKit/Shared/Cocoa/WebCoreArgumentCodersCocoa.mm
Source/WebKit/SourcesCocoa.txt
Source/WebKit/UIProcess/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.mm
Source/WebKit/UIProcess/ApplePay/ios/WebPaymentCoordinatorProxyIOS.mm
Source/WebKit/UIProcess/ApplePay/mac/WebPaymentCoordinatorProxyMac.mm
Source/WebKit/UIProcess/Cocoa/SafeBrowsingWarningCocoa.mm
Source/WebKit/UIProcess/mac/WebProcessProxyMac.mm
Source/WebKit/WebKit.xcodeproj/project.pbxproj

index 25a0ac2..b68d0a6 100644 (file)
@@ -1,3 +1,16 @@
+2018-11-21  Andy Estes  <aestes@apple.com>
+
+        [Cocoa] Create a soft-linking file for PassKit
+        https://bugs.webkit.org/show_bug.cgi?id=191875
+        <rdar://problem/46203215>
+
+        Reviewed by Myles Maxfield.
+
+        * wtf/Platform.h: Defined USE_PASSKIT.
+        * wtf/cocoa/SoftLinking.h: Added _WITH_EXPORT variants of SOFT_LINK_FRAMEWORK_FOR_SOURCE,
+        SOFT_LINK_PRIVATE_FRAMEWORK_FOR_SOURCE, SOFT_LINK_CLASS_FOR_SOURCE,
+        SOFT_LINK_FUNCTION_FOR_SOURCE, and SOFT_LINK_CONSTANT_FOR_SOURCE.
+
 2018-11-21  Dominik Infuehr  <dinfuehr@igalia.com>
 
         Enable JIT on ARM/Linux
index b3f124d..b23a6e9 100644 (file)
 
 #if PLATFORM(MAC)
 
-#define USE_APPKIT 1
 #define HAVE_RUNLOOP_TIMER 1
 #define HAVE_SEC_KEYCHAIN 1
+#define USE_APPKIT 1
+#define USE_PASSKIT 1
 
 #if CPU(X86_64)
 #define HAVE_NETWORK_EXTENSION 1
 #endif
 
 #if PLATFORM(IOS)
+#define HAVE_APP_LINKS 1
+#define USE_PASSKIT 1
 #define USE_QUICK_LOOK 1
 #define USE_SYSTEM_PREVIEW 1
-#define HAVE_APP_LINKS 1
 #endif
 
 #if PLATFORM(IOS_FAMILY) && !PLATFORM(IOSMAC)
index 6aeedae..7fdc4e9 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2007, 2008, 2011-2015 Apple Inc. All rights reserved.
+ * Copyright (C) 2007-2018 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
     } \
     }
 
-#define SOFT_LINK_FRAMEWORK_FOR_SOURCE(functionNamespace, framework) \
+#define SOFT_LINK_FRAMEWORK_FOR_SOURCE_WITH_EXPORT(functionNamespace, framework, export) \
     namespace functionNamespace { \
-    void* framework##Library(bool isOptional = false); \
+    export void* framework##Library(bool isOptional = false); \
     void* framework##Library(bool isOptional) \
     { \
         static void* frameworkLibrary; \
     } \
     }
 
-#define SOFT_LINK_PRIVATE_FRAMEWORK_FOR_SOURCE(functionNamespace, framework) \
+#define SOFT_LINK_FRAMEWORK_FOR_SOURCE(functionNamespace, framework) \
+    SOFT_LINK_FRAMEWORK_FOR_SOURCE_WITH_EXPORT(functionNamespace, framework, )
+
+#define SOFT_LINK_PRIVATE_FRAMEWORK_FOR_SOURCE_WITH_EXPORT(functionNamespace, framework, export) \
     namespace functionNamespace { \
-    void* framework##Library(bool isOptional = false); \
+    export void* framework##Library(bool isOptional = false); \
     void* framework##Library(bool isOptional) \
     { \
         static void* frameworkLibrary; \
     } \
     }
 
+#define SOFT_LINK_PRIVATE_FRAMEWORK_FOR_SOURCE(functionNamespace, framework) \
+    SOFT_LINK_PRIVATE_FRAMEWORK_FOR_SOURCE_WITH_EXPORT(functionNamespace, framework, )
+
 #define SOFT_LINK_CLASS_FOR_HEADER(functionNamespace, framework, className) \
     @class className; \
     namespace functionNamespace { \
     } \
     }
 
-#define SOFT_LINK_CLASS_FOR_SOURCE(functionNamespace, framework, className) \
+#define SOFT_LINK_CLASS_FOR_SOURCE_WITH_EXPORT(functionNamespace, framework, className, export) \
     @class className; \
     namespace functionNamespace { \
     static Class init##className(); \
-    Class (*get_##framework##_##className##Class)() = init##className; \
+    export Class (*get_##framework##_##className##Class)() = init##className; \
     static Class class##className; \
     \
     static Class className##Function() \
     } \
     }
 
+#define SOFT_LINK_CLASS_FOR_SOURCE(functionNamespace, framework, className) \
+    SOFT_LINK_CLASS_FOR_SOURCE_WITH_EXPORT(functionNamespace, framework, className, )
+
 #define SOFT_LINK_CONSTANT_FOR_HEADER(functionNamespace, framework, variableName, variableType) \
     WTF_EXTERN_C_BEGIN \
     extern const variableType variableName; \
     variableType get_##framework##_##variableName(); \
     }
 
-#define SOFT_LINK_CONSTANT_FOR_SOURCE(functionNamespace, framework, variableName, variableType) \
+#define SOFT_LINK_CONSTANT_FOR_SOURCE_WITH_EXPORT(functionNamespace, framework, variableName, variableType, export) \
     WTF_EXTERN_C_BEGIN \
     extern const variableType variableName; \
     WTF_EXTERN_C_END \
     namespace functionNamespace { \
-    variableType get_##framework##_##variableName(); \
+    export variableType get_##framework##_##variableName(); \
     variableType get_##framework##_##variableName() \
     { \
         static variableType constant##framework##variableName; \
     } \
     }
 
+#define SOFT_LINK_CONSTANT_FOR_SOURCE(functionNamespace, framework, variableName, variableType) \
+    SOFT_LINK_CONSTANT_FOR_SOURCE_WITH_EXPORT(functionNamespace, framework, variableName, variableType, )
+
 #define SOFT_LINK_CONSTANT_MAY_FAIL_FOR_HEADER(functionNamespace, framework, variableName, variableType) \
     WTF_EXTERN_C_BEGIN \
     extern const variableType variableName; \
         return functionNamespace::softLink##framework##functionName parameterNames; \
     }
 
-#define SOFT_LINK_FUNCTION_FOR_SOURCE(functionNamespace, framework, functionName, resultType, parameterDeclarations, parameterNames) \
+#define SOFT_LINK_FUNCTION_FOR_SOURCE_WITH_EXPORT(functionNamespace, framework, functionName, resultType, parameterDeclarations, parameterNames, export) \
     WTF_EXTERN_C_BEGIN \
     resultType functionName parameterDeclarations; \
     WTF_EXTERN_C_END \
     namespace functionNamespace { \
     static resultType init##framework##functionName parameterDeclarations; \
-    resultType (*softLink##framework##functionName) parameterDeclarations = init##framework##functionName; \
+    export resultType(*softLink##framework##functionName) parameterDeclarations = init##framework##functionName; \
     static resultType init##framework##functionName parameterDeclarations \
     { \
         static dispatch_once_t once; \
     } \
     }
 
+#define SOFT_LINK_FUNCTION_FOR_SOURCE(functionNamespace, framework, functionName, resultType, parameterDeclarations, parameterNames) \
+    SOFT_LINK_FUNCTION_FOR_SOURCE_WITH_EXPORT(functionNamespace, framework, functionName, resultType, parameterDeclarations, parameterNames, )
+
 #define SOFT_LINK_FUNCTION_MAY_FAIL_FOR_HEADER(functionNamespace, framework, functionName, resultType, parameterDeclarations, parameterNames) \
     WTF_EXTERN_C_BEGIN \
     resultType functionName parameterDeclarations; \
index ee53216..1a396dd 100644 (file)
@@ -1,3 +1,17 @@
+2018-11-21  Andy Estes  <aestes@apple.com>
+
+        [Cocoa] Create a soft-linking file for PassKit
+        https://bugs.webkit.org/show_bug.cgi?id=191875
+        <rdar://problem/46203215>
+
+        Reviewed by Myles Maxfield.
+
+        * Modules/applepay/cocoa/PaymentContactCocoa.mm: Removed SOFT_LINK macros and included PassKitSoftLink.h instead.
+        * Modules/applepay/cocoa/PaymentMerchantSessionCocoa.mm: Ditto.
+        * SourcesCocoa.txt: Removed @no-unify from PaymentMerchantSessionCocoa.mm.
+        * WebCore.xcodeproj/project.pbxproj: Removed PaymentMerchantSessionCocoa.mm from the WebCore target.
+        * rendering/RenderThemeCocoa.mm: Removed SOFT_LINK macros and included PassKitSoftLink.h instead.
+
 2018-11-21  Zalan Bujtas  <zalan@apple.com>
 
         [LFC] LayoutState should always be initialized with the initial containing block.
index 0b0204c..cc97fd5 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2016-2017 Apple Inc. All rights reserved.
+ * Copyright (C) 2016-2018 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,7 +30,7 @@
 
 #import "ApplePayPaymentContact.h"
 #import <Contacts/Contacts.h>
-#import <pal/spi/cocoa/PassKitSPI.h>
+#import <pal/cocoa/PassKitSoftLink.h>
 #import <wtf/SoftLinking.h>
 #import <wtf/text/StringBuilder.h>
 
@@ -38,14 +38,6 @@ SOFT_LINK_FRAMEWORK(Contacts)
 SOFT_LINK_CLASS(Contacts, CNMutablePostalAddress)
 SOFT_LINK_CLASS(Contacts, CNPhoneNumber)
 
-#if PLATFORM(MAC)
-SOFT_LINK_PRIVATE_FRAMEWORK(PassKit)
-#else
-SOFT_LINK_FRAMEWORK(PassKit)
-#endif
-
-SOFT_LINK_CLASS(PassKit, PKContact)
-
 namespace WebCore {
 
 static NSString *subLocality(CNPostalAddress *address)
@@ -106,7 +98,7 @@ static void setSubAdministrativeArea(CNMutablePostalAddress *address, NSString *
 
 static RetainPtr<PKContact> convert(unsigned version, const ApplePayPaymentContact& contact)
 {
-    auto result = adoptNS([allocPKContactInstance() init]);
+    auto result = adoptNS([PAL::allocPKContactInstance() init]);
 
     NSString *familyName = nil;
     NSString *phoneticFamilyName = nil;
index 81c8ccb..fc36c89 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2016 Apple Inc. All rights reserved.
+ * Copyright (C) 2016-2018 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
 #if ENABLE(APPLE_PAY)
 
 #import <JavaScriptCore/JSONObject.h>
-#import <pal/spi/cocoa/PassKitSPI.h>
-#import <wtf/SoftLinking.h>
-
-#if PLATFORM(MAC)
-SOFT_LINK_PRIVATE_FRAMEWORK(PassKit)
-#else
-SOFT_LINK_FRAMEWORK(PassKit)
-#endif
-
-SOFT_LINK_CLASS(PassKit, PKPaymentMerchantSession)
+#import <pal/cocoa/PassKitSoftLink.h>
 
 namespace WebCore {
 
@@ -53,7 +44,7 @@ std::optional<PaymentMerchantSession> PaymentMerchantSession::fromJS(JSC::ExecSt
     if (!dictionary || ![dictionary isKindOfClass:[NSDictionary class]])
         return std::nullopt;
 
-    auto pkPaymentMerchantSession = adoptNS([allocPKPaymentMerchantSessionInstance() initWithDictionary:dictionary]);
+    auto pkPaymentMerchantSession = adoptNS([PAL::allocPKPaymentMerchantSessionInstance() initWithDictionary:dictionary]);
 
     return PaymentMerchantSession(pkPaymentMerchantSession.get());
 }
index 0edee5c..bbb6491 100644 (file)
@@ -1,3 +1,18 @@
+2018-11-21  Andy Estes  <aestes@apple.com>
+
+        [Cocoa] Create a soft-linking file for PassKit
+        https://bugs.webkit.org/show_bug.cgi?id=191875
+        <rdar://problem/46203215>
+
+        Reviewed by Myles Maxfield.
+
+        * PAL.xcodeproj/project.pbxproj:
+        * pal/PlatformMac.cmake:
+        * pal/cocoa/PassKitSoftLink.h: Added.
+        * pal/cocoa/PassKitSoftLink.mm: Added. Used _WITH_EXPORT soft-linking macros in order to
+        make the PAL soft-linking symbols visible to WebKit.
+        * pal/spi/cocoa/PassKitSPI.h:
+
 2018-11-17  Wenson Hsieh  <wenson_hsieh@apple.com>
 
         [iOS] Remove all usages of UIItemProvider, UIItemProviderReading, and related classes
index 21552df..77f2467 100644 (file)
                A1175B581F6B470500C4B9F0 /* DefaultSearchProvider.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A1175B561F6B470500C4B9F0 /* DefaultSearchProvider.cpp */; };
                A1175B5A1F6B4A8400C4B9F0 /* NSScrollViewSPI.h in Headers */ = {isa = PBXBuildFile; fileRef = A1175B591F6B4A8400C4B9F0 /* NSScrollViewSPI.h */; };
                A1F55DCF1F5528EC00EDB75F /* MetadataSPI.h in Headers */ = {isa = PBXBuildFile; fileRef = A1F55DCE1F5528EC00EDB75F /* MetadataSPI.h */; };
+               A1F63C9F21A4DBF7006FB43B /* PassKitSoftLink.h in Headers */ = {isa = PBXBuildFile; fileRef = A1F63C9D21A4DBF7006FB43B /* PassKitSoftLink.h */; };
+               A1F63CA021A4DBF7006FB43B /* PassKitSoftLink.mm in Sources */ = {isa = PBXBuildFile; fileRef = A1F63C9E21A4DBF7006FB43B /* PassKitSoftLink.mm */; };
                A30D41211F0DD0EA00B71954 /* KillRing.h in Headers */ = {isa = PBXBuildFile; fileRef = A30D411E1F0DD0EA00B71954 /* KillRing.h */; };
                A30D41221F0DD0EA00B71954 /* KillRing.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A30D411F1F0DD0EA00B71954 /* KillRing.cpp */; };
                A30D41251F0DD12D00B71954 /* KillRingMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = A30D41241F0DD12D00B71954 /* KillRingMac.mm */; };
                A1175B561F6B470500C4B9F0 /* DefaultSearchProvider.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = DefaultSearchProvider.cpp; sourceTree = "<group>"; };
                A1175B591F6B4A8400C4B9F0 /* NSScrollViewSPI.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = NSScrollViewSPI.h; sourceTree = "<group>"; };
                A1F55DCE1F5528EC00EDB75F /* MetadataSPI.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MetadataSPI.h; sourceTree = "<group>"; };
+               A1F63C9D21A4DBF7006FB43B /* PassKitSoftLink.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = PassKitSoftLink.h; sourceTree = "<group>"; };
+               A1F63C9E21A4DBF7006FB43B /* PassKitSoftLink.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = PassKitSoftLink.mm; sourceTree = "<group>"; };
                A30D411E1F0DD0EA00B71954 /* KillRing.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KillRing.h; sourceTree = "<group>"; };
                A30D411F1F0DD0EA00B71954 /* KillRing.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = KillRing.cpp; sourceTree = "<group>"; };
                A30D41241F0DD12D00B71954 /* KillRingMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = KillRingMac.mm; sourceTree = "<group>"; };
                        isa = PBXGroup;
                        children = (
                                F44291661FA52705002CC93E /* FileSizeFormatterCocoa.mm */,
+                               A1F63C9D21A4DBF7006FB43B /* PassKitSoftLink.h */,
+                               A1F63C9E21A4DBF7006FB43B /* PassKitSoftLink.mm */,
                        );
                        path = cocoa;
                        sourceTree = "<group>";
                                0C77859D1F45130F00F4EBB6 /* NSWindowSPI.h in Headers */,
                                570AB8F920AF6E3D00B8BE87 /* NSXPCConnectionSPI.h in Headers */,
                                0C5AF91F1F43A4C7002EAC02 /* OpenGLESSPI.h in Headers */,
+                               A1F63C9F21A4DBF7006FB43B /* PassKitSoftLink.h in Headers */,
                                0C2DA1551F3BEB4900DBC317 /* PassKitSPI.h in Headers */,
                                0C77859E1F45130F00F4EBB6 /* PIPSPI.h in Headers */,
                                A1175B4E1F6B337300C4B9F0 /* PopupMenu.h in Headers */,
                                A30D41251F0DD12D00B71954 /* KillRingMac.mm in Sources */,
                                1C4876D81F8D7F4E00CCEEBD /* Logging.cpp in Sources */,
                                0CF99CA41F736375007EE793 /* MediaTimeAVFoundation.cpp in Sources */,
+                               A1F63CA021A4DBF7006FB43B /* PassKitSoftLink.mm in Sources */,
                                A1175B4F1F6B337300C4B9F0 /* PopupMenu.mm in Sources */,
                                A3C66CDC1F462D6A009E6EE9 /* SessionID.cpp in Sources */,
                                A3AB6E521F3D1DC5009C14B1 /* SleepDisabler.cpp in Sources */,
index b2acfbb..b78088b 100644 (file)
@@ -3,6 +3,8 @@ list(APPEND PAL_PUBLIC_HEADERS
 
     cf/CoreMediaSoftLink.h
 
+    cocoa/PassKitSoftLink.h
+
     spi/cf/CFLocaleSPI.h
     spi/cf/CFNetworkConnectionCacheSPI.h
     spi/cf/CFNetworkSPI.h
@@ -96,6 +98,7 @@ list(APPEND PAL_SOURCES
 
     cocoa/FileSizeFormatterCocoa.mm
     cocoa/LoggingCocoa.mm
+    cocoa/PassKitSoftLink.mm
 
     crypto/commoncrypto/CryptoDigestCommonCrypto.cpp
 
@@ -114,6 +117,7 @@ list(APPEND PAL_SOURCES
 list(APPEND PAL_PRIVATE_INCLUDE_DIRECTORIES
     "${PAL_DIR}/pal/avfoundation"
     "${PAL_DIR}/pal/cf"
+    "${PAL_DIR}/pal/cocoa"
     "${PAL_DIR}/pal/spi/cf"
     "${PAL_DIR}/pal/spi/cg"
     "${PAL_DIR}/pal/spi/cocoa"
diff --git a/Source/WebCore/PAL/pal/cocoa/PassKitSoftLink.h b/Source/WebCore/PAL/pal/cocoa/PassKitSoftLink.h
new file mode 100644 (file)
index 0000000..85300f8
--- /dev/null
@@ -0,0 +1,65 @@
+/*
+ * Copyright (C) 2018 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)
+
+#import <pal/spi/cocoa/PassKitSPI.h>
+#import <wtf/SoftLinking.h>
+
+SOFT_LINK_FRAMEWORK_FOR_HEADER(PAL, PassKit)
+
+SOFT_LINK_CLASS_FOR_HEADER(PAL, PassKit, PKContact)
+SOFT_LINK_CLASS_FOR_HEADER(PAL, PassKit, PKPassLibrary)
+SOFT_LINK_CLASS_FOR_HEADER(PAL, PassKit, PKPayment)
+SOFT_LINK_CLASS_FOR_HEADER(PAL, PassKit, PKPaymentAuthorizationViewController)
+SOFT_LINK_CLASS_FOR_HEADER(PAL, PassKit, PKPaymentMethod)
+SOFT_LINK_CLASS_FOR_HEADER(PAL, PassKit, PKPaymentMerchantSession)
+SOFT_LINK_CLASS_FOR_HEADER(PAL, PassKit, PKPaymentRequest)
+SOFT_LINK_CLASS_FOR_HEADER(PAL, PassKit, PKPaymentSummaryItem)
+SOFT_LINK_CLASS_FOR_HEADER(PAL, PassKit, PKShippingMethod)
+
+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))
+
+#if PLATFORM(IOS) || (PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101300)
+SOFT_LINK_CLASS_FOR_HEADER(PAL, PassKit, PKPaymentAuthorizationResult)
+SOFT_LINK_CLASS_FOR_HEADER(PAL, PassKit, PKPaymentRequestPaymentMethodUpdate)
+SOFT_LINK_CLASS_FOR_HEADER(PAL, PassKit, PKPaymentRequestShippingContactUpdate)
+SOFT_LINK_CLASS_FOR_HEADER(PAL, PassKit, PKPaymentRequestShippingMethodUpdate)
+
+SOFT_LINK_CONSTANT_FOR_HEADER(PAL, PassKit, PKContactFieldEmailAddress, PKContactField)
+SOFT_LINK_CONSTANT_FOR_HEADER(PAL, PassKit, PKContactFieldName, PKContactField)
+SOFT_LINK_CONSTANT_FOR_HEADER(PAL, PassKit, PKContactFieldPhoneNumber, PKContactField)
+SOFT_LINK_CONSTANT_FOR_HEADER(PAL, PassKit, PKContactFieldPhoneticName, PKContactField)
+SOFT_LINK_CONSTANT_FOR_HEADER(PAL, PassKit, PKContactFieldPostalAddress, PKContactField)
+SOFT_LINK_CONSTANT_FOR_HEADER(PAL, PassKit, PKPaymentErrorContactFieldUserInfoKey, PKPaymentErrorKey)
+SOFT_LINK_CONSTANT_FOR_HEADER(PAL, PassKit, PKPaymentErrorPostalAddressUserInfoKey, PKPaymentErrorKey)
+
+SOFT_LINK_FUNCTION_FOR_HEADER(PAL, PassKit, PKCanMakePaymentsWithMerchantIdentifierDomainAndSourceApplication, void, (NSString *identifier, NSString *domain, NSString *sourceApplicationSecondaryIdentifier, PKCanMakePaymentsCompletion completion), (identifier, domain, sourceApplicationSecondaryIdentifier, completion))
+#endif
+
+#endif // USE(PASSKIT)
diff --git a/Source/WebCore/PAL/pal/cocoa/PassKitSoftLink.mm b/Source/WebCore/PAL/pal/cocoa/PassKitSoftLink.mm
new file mode 100644 (file)
index 0000000..32f7be0
--- /dev/null
@@ -0,0 +1,69 @@
+/*
+ * Copyright (C) 2018 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"
+
+#if USE(PASSKIT)
+
+#import "PassKitSPI.h"
+#import <wtf/SoftLinking.h>
+
+#if PLATFORM(MAC)
+SOFT_LINK_PRIVATE_FRAMEWORK_FOR_SOURCE_WITH_EXPORT(PAL, PassKit, PAL_EXPORT)
+#else
+SOFT_LINK_FRAMEWORK_FOR_SOURCE_WITH_EXPORT(PAL, PassKit, PAL_EXPORT)
+#endif
+
+SOFT_LINK_CLASS_FOR_SOURCE_WITH_EXPORT(PAL, PassKit, PKContact, PAL_EXPORT)
+SOFT_LINK_CLASS_FOR_SOURCE_WITH_EXPORT(PAL, PassKit, PKPassLibrary, PAL_EXPORT)
+SOFT_LINK_CLASS_FOR_SOURCE_WITH_EXPORT(PAL, PassKit, PKPayment, PAL_EXPORT)
+SOFT_LINK_CLASS_FOR_SOURCE_WITH_EXPORT(PAL, PassKit, PKPaymentAuthorizationViewController, PAL_EXPORT)
+SOFT_LINK_CLASS_FOR_SOURCE_WITH_EXPORT(PAL, PassKit, PKPaymentMerchantSession, PAL_EXPORT)
+SOFT_LINK_CLASS_FOR_SOURCE_WITH_EXPORT(PAL, PassKit, PKPaymentMethod, PAL_EXPORT)
+SOFT_LINK_CLASS_FOR_SOURCE_WITH_EXPORT(PAL, PassKit, PKPaymentRequest, PAL_EXPORT)
+SOFT_LINK_CLASS_FOR_SOURCE_WITH_EXPORT(PAL, PassKit, PKPaymentSummaryItem, PAL_EXPORT)
+SOFT_LINK_CLASS_FOR_SOURCE_WITH_EXPORT(PAL, PassKit, PKShippingMethod, PAL_EXPORT)
+
+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))
+
+#if PLATFORM(IOS) || (PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101300)
+SOFT_LINK_CLASS_FOR_SOURCE_WITH_EXPORT(PAL, PassKit, PKPaymentAuthorizationResult, PAL_EXPORT)
+SOFT_LINK_CLASS_FOR_SOURCE_WITH_EXPORT(PAL, PassKit, PKPaymentRequestPaymentMethodUpdate, PAL_EXPORT)
+SOFT_LINK_CLASS_FOR_SOURCE_WITH_EXPORT(PAL, PassKit, PKPaymentRequestShippingContactUpdate, PAL_EXPORT)
+SOFT_LINK_CLASS_FOR_SOURCE_WITH_EXPORT(PAL, PassKit, PKPaymentRequestShippingMethodUpdate, PAL_EXPORT)
+
+SOFT_LINK_CONSTANT_FOR_SOURCE_WITH_EXPORT(PAL, PassKit, PKContactFieldEmailAddress, PKContactField, PAL_EXPORT)
+SOFT_LINK_CONSTANT_FOR_SOURCE_WITH_EXPORT(PAL, PassKit, PKContactFieldName, PKContactField, PAL_EXPORT)
+SOFT_LINK_CONSTANT_FOR_SOURCE_WITH_EXPORT(PAL, PassKit, PKContactFieldPhoneNumber, PKContactField, PAL_EXPORT)
+SOFT_LINK_CONSTANT_FOR_SOURCE_WITH_EXPORT(PAL, PassKit, PKContactFieldPhoneticName, PKContactField, PAL_EXPORT)
+SOFT_LINK_CONSTANT_FOR_SOURCE_WITH_EXPORT(PAL, PassKit, PKContactFieldPostalAddress, PKContactField, PAL_EXPORT)
+SOFT_LINK_CONSTANT_FOR_SOURCE_WITH_EXPORT(PAL, PassKit, PKPaymentErrorContactFieldUserInfoKey, PKPaymentErrorKey, PAL_EXPORT)
+SOFT_LINK_CONSTANT_FOR_SOURCE_WITH_EXPORT(PAL, PassKit, PKPaymentErrorPostalAddressUserInfoKey, PKPaymentErrorKey, PAL_EXPORT)
+
+SOFT_LINK_FUNCTION_FOR_SOURCE_WITH_EXPORT(PAL, PassKit, PKCanMakePaymentsWithMerchantIdentifierDomainAndSourceApplication, void, (NSString *identifier, NSString *domain, NSString *sourceApplicationSecondaryIdentifier, PKCanMakePaymentsCompletion completion), (identifier, domain, sourceApplicationSecondaryIdentifier, completion), PAL_EXPORT)
+#endif
+
+#endif // USE(PASSKIT)
index b5e5930..3ca39fa 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2016-2017 Apple Inc. All rights reserved.
+ * Copyright (C) 2016-2018 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
 
 #pragma once
 
+#if !PLATFORM(MAC) || USE(APPLE_INTERNAL_SDK)
+
+// FIXME: PassKit does not declare its NSString constant symbols with C linkage, so we end up with
+// linkage mismatches in the SOFT_LINK_CONSTANT macros used in PassKitSoftLink.mm unless we wrap
+// these includes in an extern "C" block.
+WTF_EXTERN_C_BEGIN
+#import <PassKit/PKConstants.h>
+#import <PassKit/PKError.h>
+WTF_EXTERN_C_END
+
+#endif
+
 #if USE(APPLE_INTERNAL_SDK)
 
 #import <PassKit/PassKit.h>
@@ -39,8 +51,8 @@
 
 #elif PLATFORM(MAC)
 
+#import <AppKit/AppKit.h>
 #import <Contacts/Contacts.h>
-#import <Foundation/Foundation.h>
 
 NS_ASSUME_NONNULL_BEGIN
 
@@ -53,6 +65,7 @@ NS_ASSUME_NONNULL_BEGIN
 @class PKPaymentRequestShippingContactUpdate;
 
 typedef NSString *PKContactField;
+typedef NSString *PKPaymentErrorKey;
 
 extern NSString * const PKPaymentErrorDomain;
 typedef NS_ERROR_ENUM(PKPaymentErrorDomain, PKPaymentErrorCode) {
@@ -225,7 +238,7 @@ typedef NSString * PKPaymentNetwork NS_EXTENSIBLE_STRING_ENUM;
 
 NS_ASSUME_NONNULL_END
 
-#endif
+#endif // PLATFORM(MAC)
 
 NS_ASSUME_NONNULL_BEGIN
 
@@ -261,7 +274,7 @@ typedef NS_ENUM(NSUInteger, PKPaymentRequestAPIType) {
 
 NS_ASSUME_NONNULL_END
 
-#endif
+#endif // USE(APPLE_INTERNAL_SDK)
 
 #if PLATFORM(MAC) && !USE(APPLE_INTERNAL_SDK)
 typedef NS_ENUM(NSInteger, PKPaymentButtonStyle) {
@@ -324,4 +337,6 @@ NS_ASSUME_NONNULL_BEGIN
 @property (nonatomic, strong) NSString *CTDataConnectionServiceType;
 @end
 
+typedef void(^PKCanMakePaymentsCompletion)(BOOL isValid, NSError *);
+
 NS_ASSUME_NONNULL_END
index fd831e6..c9a5446 100644 (file)
@@ -587,7 +587,7 @@ platform/mediastream/libwebrtc/LibWebRTCProviderCocoa.cpp
 
     Modules/applepay/cocoa/PaymentCocoa.mm
     Modules/applepay/cocoa/PaymentContactCocoa.mm
-    Modules/applepay/cocoa/PaymentMerchantSessionCocoa.mm @no-unify
+    Modules/applepay/cocoa/PaymentMerchantSessionCocoa.mm
     Modules/applepay/cocoa/PaymentMethodCocoa.mm
 
     Modules/applepay/paymentrequest/ApplePayPaymentHandler.cpp
index 052281e..eeeceea 100644 (file)
                DE5F860D1FA2386B006DB63A /* UnifiedSource478.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DE5F85D21FA23856006DB63A /* UnifiedSource478.cpp */; };
                DE5F860E1FA2386B006DB63A /* UnifiedSource479.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DE5F85CF1FA23850006DB63A /* UnifiedSource479.cpp */; };
                DE5F860F1FA2386B006DB63A /* UnifiedSource480.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DE5F85D31FA23859006DB63A /* UnifiedSource480.cpp */; };
-               DE5F86101FA238D9006DB63A /* PaymentMerchantSessionCocoa.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1ADA4A1B1D22F2C0005A9A15 /* PaymentMerchantSessionCocoa.mm */; };
                DE5F86111FA239DA006DB63A /* InternalSettingsGenerated.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 53E29E5C167A8A1900586D3D /* InternalSettingsGenerated.cpp */; };
                DE5F86121FA239E7006DB63A /* JSGCObservation.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 51714EAE1CF6654A004723C4 /* JSGCObservation.cpp */; };
                DE5F861D1FA2815B006DB63A /* WebAccessibilityObjectWrapperMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = AA478A7E16CD70C3007D1BB4 /* WebAccessibilityObjectWrapperMac.mm */; };
                                A31C4E4D16E02AA6002F7957 /* OESTextureHalfFloat.cpp in Sources */,
                                31078CC71880AAB5008099DC /* OESTextureHalfFloatLinear.cpp in Sources */,
                                77A17A7112F28182004E02F6 /* OESVertexArrayObject.cpp in Sources */,
-                               DE5F86101FA238D9006DB63A /* PaymentMerchantSessionCocoa.mm in Sources */,
                                CEA284662141E84900E407E8 /* PlatformEventFactoryIOS.mm in Sources */,
                                AA12DF491743DF83004DAFDF /* PlatformSpeechSynthesizerIOS.mm in Sources */,
                                CDA29A301CBF74D400901CCF /* PlaybackSessionInterfaceAVKit.mm in Sources */,
index b4aaf64..cb61082 100644 (file)
 
 #if ENABLE(APPLE_PAY)
 
-#import <pal/spi/cocoa/PassKitSPI.h>
-#import <wtf/SoftLinking.h>
-
-#if PLATFORM(MAC)
-SOFT_LINK_PRIVATE_FRAMEWORK(PassKit);
-#else
-SOFT_LINK_FRAMEWORK(PassKit);
-#endif
-
-SOFT_LINK_MAY_FAIL(PassKit, PKDrawApplePayButton, void, (CGContextRef context, CGRect drawRect, CGFloat scale, PKPaymentButtonType type, PKPaymentButtonStyle style, NSString *languageCode), (context, drawRect, scale, type, style, languageCode));
+#import <pal/cocoa/PassKitSoftLink.h>
 
 #endif // ENABLE(APPLE_PAY)
 
@@ -108,9 +99,6 @@ static PKPaymentButtonType toPKPaymentButtonType(ApplePayButtonType type)
 
 bool RenderThemeCocoa::paintApplePayButton(const RenderObject& renderer, const PaintInfo& paintInfo, const IntRect& paintRect)
 {
-    if (!canLoadPKDrawApplePayButton())
-        return false;
-
     GraphicsContextStateSaver stateSaver(paintInfo.context());
 
     paintInfo.context().setShouldSmoothFonts(true);
index 0078421..e15c296 100644 (file)
@@ -1,3 +1,20 @@
+2018-11-21  Andy Estes  <aestes@apple.com>
+
+        [Cocoa] Create a soft-linking file for PassKit
+        https://bugs.webkit.org/show_bug.cgi?id=191875
+        <rdar://problem/46203215>
+
+        Reviewed by Myles Maxfield.
+
+        * Shared/Cocoa/WebCoreArgumentCodersCocoa.mm: Removed SOFT_LINK macros and included PassKitSoftLink.h instead.
+        * SourcesCocoa.txt: Removed @no-unify from WebPaymentCoordinatorProxyIOS.mm and WebPaymentCoordinatorProxyMac.mm.
+        * UIProcess/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.mm: Removed SOFT_LINK macros and included PassKitSoftLink.h instead.
+        * UIProcess/ApplePay/ios/WebPaymentCoordinatorProxyIOS.mm: Ditto.
+        * UIProcess/ApplePay/mac/WebPaymentCoordinatorProxyMac.mm: Ditto.
+        * UIProcess/Cocoa/SafeBrowsingWarningCocoa.mm: Included NSAttributedStringSPI.h.
+        * UIProcess/mac/WebProcessProxyMac.mm: Included ProcessPrivilege.h.
+        * WebKit.xcodeproj/project.pbxproj: Removed WebPaymentCoordinatorProxyIOS.mm and WebPaymentCoordinatorProxyMac.mm from the WebKit target.
+
 2018-11-21  Fujii Hironori  <Hironori.Fujii@sony.com>
 
         Remove @no-unify of InjectedBundleRangeHandle.cpp and InjectedBundleNodeHandle.cpp
index 35f98b1..d0e3745 100644 (file)
 
 #import "DataReference.h"
 #import <WebCore/PaymentAuthorizationStatus.h>
+#import <pal/cocoa/PassKitSoftLink.h>
 #import <pal/spi/cocoa/NSKeyedArchiverSPI.h>
-#import <pal/spi/cocoa/PassKitSPI.h>
-#import <wtf/SoftLinking.h>
-
-#if PLATFORM(MAC)
-SOFT_LINK_PRIVATE_FRAMEWORK(PassKit)
-#else
-SOFT_LINK_FRAMEWORK(PassKit)
-#endif
-
-SOFT_LINK_CLASS(PassKit, PKContact);
-SOFT_LINK_CLASS(PassKit, PKPayment);
-SOFT_LINK_CLASS(PassKit, PKPaymentMethod);
-SOFT_LINK_CLASS(PassKit, PKPaymentMerchantSession);
 
 namespace IPC {
 using namespace WebCore;
@@ -67,7 +55,7 @@ bool ArgumentCoder<WebCore::Payment>::decode(Decoder& decoder, WebCore::Payment&
     auto data = adoptNS([[NSData alloc] initWithBytesNoCopy:const_cast<void*>(static_cast<const void*>(dataReference.data())) length:dataReference.size() freeWhenDone:NO]);
     auto unarchiver = secureUnarchiverFromData(data.get());
     @try {
-        PKPayment *pkPayment = [unarchiver decodeObjectOfClass:getPKPaymentClass() forKey:NSKeyedArchiveRootObjectKey];
+        PKPayment *pkPayment = [unarchiver decodeObjectOfClass:PAL::get_PassKit_PKPaymentClass() forKey:NSKeyedArchiveRootObjectKey];
         payment = Payment(pkPayment);
     } @catch (NSException *exception) {
         LOG_ERROR("Failed to decode PKPayment: %@", exception);
@@ -118,7 +106,7 @@ bool ArgumentCoder<WebCore::PaymentContact>::decode(Decoder& decoder, WebCore::P
     auto data = adoptNS([[NSData alloc] initWithBytesNoCopy:const_cast<void*>(static_cast<const void*>(dataReference.data())) length:dataReference.size() freeWhenDone:NO]);
     auto unarchiver = secureUnarchiverFromData(data.get());
     @try {
-        PKContact *pkContact = [unarchiver decodeObjectOfClass:getPKContactClass() forKey:NSKeyedArchiveRootObjectKey];
+        PKContact *pkContact = [unarchiver decodeObjectOfClass:PAL::get_PassKit_PKContactClass() forKey:NSKeyedArchiveRootObjectKey];
         paymentContact = PaymentContact(pkContact);
     } @catch (NSException *exception) {
         LOG_ERROR("Failed to decode PKContact: %@", exception);
@@ -175,7 +163,7 @@ bool ArgumentCoder<WebCore::PaymentMerchantSession>::decode(Decoder& decoder, We
     auto data = adoptNS([[NSData alloc] initWithBytesNoCopy:const_cast<void*>(static_cast<const void*>(dataReference.data())) length:dataReference.size() freeWhenDone:NO]);
     auto unarchiver = secureUnarchiverFromData(data.get());
     @try {
-        PKPaymentMerchantSession *pkPaymentMerchantSession = [unarchiver decodeObjectOfClass:getPKPaymentMerchantSessionClass() forKey:NSKeyedArchiveRootObjectKey];
+        PKPaymentMerchantSession *pkPaymentMerchantSession = [unarchiver decodeObjectOfClass:PAL::get_PassKit_PKPaymentMerchantSessionClass() forKey:NSKeyedArchiveRootObjectKey];
         paymentMerchantSession = PaymentMerchantSession(pkPaymentMerchantSession);
     } @catch (NSException *exception) {
         LOG_ERROR("Failed to decode PKPaymentMerchantSession: %@", exception);
@@ -205,7 +193,7 @@ bool ArgumentCoder<WebCore::PaymentMethod>::decode(Decoder& decoder, WebCore::Pa
     auto data = adoptNS([[NSData alloc] initWithBytesNoCopy:const_cast<void*>(static_cast<const void*>(dataReference.data())) length:dataReference.size() freeWhenDone:NO]);
     auto unarchiver = secureUnarchiverFromData(data.get());
     @try {
-        PKPaymentMethod *pkPaymentMethod = [unarchiver decodeObjectOfClass:getPKPaymentMethodClass() forKey:NSKeyedArchiveRootObjectKey];
+        PKPaymentMethod *pkPaymentMethod = [unarchiver decodeObjectOfClass:PAL::get_PassKit_PKPaymentMethodClass() forKey:NSKeyedArchiveRootObjectKey];
         paymentMethod = PaymentMethod(pkPaymentMethod);
     } @catch (NSException *exception) {
         LOG_ERROR("Failed to decode PKPayment: %@", exception);
index 08dbd7b..e88c5fe 100644 (file)
@@ -294,9 +294,9 @@ UIProcess/API/mac/WKView.mm
 
 UIProcess/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.mm
 
-UIProcess/ApplePay/ios/WebPaymentCoordinatorProxyIOS.mm @no-unify
+UIProcess/ApplePay/ios/WebPaymentCoordinatorProxyIOS.mm
 
-UIProcess/ApplePay/mac/WebPaymentCoordinatorProxyMac.mm @no-unify
+UIProcess/ApplePay/mac/WebPaymentCoordinatorProxyMac.mm
 
 UIProcess/Authentication/cocoa/AuthenticationChallengeProxyCocoa.mm
 UIProcess/Authentication/cocoa/SecKeyProxyStore.mm
index db2b6c8..c94a5f0 100644 (file)
 #import <WebCore/PaymentAuthorizationStatus.h>
 #import <WebCore/PaymentHeaders.h>
 #import <WebCore/URL.h>
-#import <pal/spi/cocoa/PassKitSPI.h>
+#import <pal/cocoa/PassKitSoftLink.h>
 #import <wtf/BlockPtr.h>
 #import <wtf/RunLoop.h>
-#import <wtf/SoftLinking.h>
 
-#if PLATFORM(MAC)
-SOFT_LINK_PRIVATE_FRAMEWORK_OPTIONAL(PassKit)
-#else
-SOFT_LINK_FRAMEWORK(PassKit)
-#endif
-
-SOFT_LINK_CLASS(PassKit, PKPassLibrary);
-SOFT_LINK_CLASS(PassKit, PKPaymentAuthorizationViewController);
-SOFT_LINK_CLASS(PassKit, PKPaymentMerchantSession);
-SOFT_LINK_CLASS(PassKit, PKPaymentRequest);
-SOFT_LINK_CLASS(PassKit, PKPaymentSummaryItem);
-SOFT_LINK_CLASS(PassKit, PKShippingMethod);
-
-#if (PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101300) || (PLATFORM(IOS_FAMILY) && __IPHONE_OS_VERSION_MIN_REQUIRED >= 110000)
+#if PLATFORM(IOS) || (PLATFORM(MAC) && __MAC_OS_X_VERSION_MAX_ALLOWED >= 101300)
 SOFT_LINK_FRAMEWORK(Contacts)
 SOFT_LINK_CONSTANT(Contacts, CNPostalAddressStreetKey, NSString *);
 SOFT_LINK_CONSTANT(Contacts, CNPostalAddressSubLocalityKey, NSString *);
@@ -61,30 +47,9 @@ SOFT_LINK_CONSTANT(Contacts, CNPostalAddressStateKey, NSString *);
 SOFT_LINK_CONSTANT(Contacts, CNPostalAddressPostalCodeKey, NSString *);
 SOFT_LINK_CONSTANT(Contacts, CNPostalAddressCountryKey, NSString *);
 SOFT_LINK_CONSTANT(Contacts, CNPostalAddressISOCountryCodeKey, NSString *);
-SOFT_LINK_CLASS(PassKit, PKPaymentAuthorizationResult)
-SOFT_LINK_CLASS(PassKit, PKPaymentRequestPaymentMethodUpdate)
-SOFT_LINK_CLASS(PassKit, PKPaymentRequestShippingContactUpdate)
-SOFT_LINK_CLASS(PassKit, PKPaymentRequestShippingMethodUpdate)
-SOFT_LINK_CONSTANT(PassKit, PKPaymentErrorDomain, NSString *);
-SOFT_LINK_CONSTANT(PassKit, PKContactFieldPostalAddress, NSString *);
-SOFT_LINK_CONSTANT(PassKit, PKContactFieldEmailAddress, NSString *);
-SOFT_LINK_CONSTANT(PassKit, PKContactFieldPhoneNumber, NSString *);
-SOFT_LINK_CONSTANT(PassKit, PKContactFieldName, NSString *);
-SOFT_LINK_CONSTANT(PassKit, PKContactFieldPhoneticName, NSString *);
-SOFT_LINK_CONSTANT(PassKit, PKPaymentErrorContactFieldUserInfoKey, NSString *);
-SOFT_LINK_CONSTANT(PassKit, PKPaymentErrorPostalAddressUserInfoKey, NSString *);
+SOFT_LINK_CONSTANT(PAL::PassKit, PKPaymentErrorDomain, NSString *);
 #endif
 
-typedef void (^PKCanMakePaymentsCompletion)(BOOL isValid, NSError *error);
-#if (PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101300) || (PLATFORM(IOS_FAMILY) && __IPHONE_OS_VERSION_MIN_REQUIRED >= 110000)
-extern "C" void PKCanMakePaymentsWithMerchantIdentifierDomainAndSourceApplication(NSString *identifier, NSString *domain, NSString *sourceApplicationSecondaryIdentifier, PKCanMakePaymentsCompletion completion);
-SOFT_LINK_FUNCTION_MAY_FAIL_FOR_SOURCE(WebKit, PassKit, PKCanMakePaymentsWithMerchantIdentifierDomainAndSourceApplication, void, (NSString *identifier, NSString *domain, NSString *sourceApplicationSecondaryIdentifier, PKCanMakePaymentsCompletion completion), (identifier, domain, sourceApplicationSecondaryIdentifier, completion));
-#else
-extern "C" void PKCanMakePaymentsWithMerchantIdentifierAndDomain(NSString *identifier, NSString *domain, PKCanMakePaymentsCompletion completion);
-SOFT_LINK_FUNCTION_MAY_FAIL_FOR_SOURCE(WebKit, PassKit, PKCanMakePaymentsWithMerchantIdentifierAndDomain, void, (NSString *identifier, NSString *domain, PKCanMakePaymentsCompletion completion), (identifier, domain, completion));
-#endif
-
-
 @implementation WKPaymentAuthorizationViewControllerDelegate
 
 - (instancetype)initWithPaymentCoordinatorProxy:(WebKit::WebPaymentCoordinatorProxy&)webPaymentCoordinatorProxy
@@ -102,7 +67,7 @@ SOFT_LINK_FUNCTION_MAY_FAIL_FOR_SOURCE(WebKit, PassKit, PKCanMakePaymentsWithMer
     _webPaymentCoordinatorProxy = nullptr;
     if (_paymentAuthorizedCompletion) {
 #if (PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101300) || (PLATFORM(IOS_FAMILY) && __IPHONE_OS_VERSION_MIN_REQUIRED >= 110000)
-        _paymentAuthorizedCompletion(adoptNS([allocPKPaymentAuthorizationResultInstance() initWithStatus:PKPaymentAuthorizationStatusFailure errors:@[ ]]).get());
+        _paymentAuthorizedCompletion(adoptNS([PAL::allocPKPaymentAuthorizationResultInstance() initWithStatus:PKPaymentAuthorizationStatusFailure errors:@[ ]]).get());
 #else
         _paymentAuthorizedCompletion(PKPaymentAuthorizationStatusFailure);
 #endif
@@ -119,7 +84,7 @@ SOFT_LINK_FUNCTION_MAY_FAIL_FOR_SOURCE(WebKit, PassKit, PKCanMakePaymentsWithMer
     ASSERT(!_sessionBlock);
     _sessionBlock = sessionBlock;
 
-    [getPKPaymentAuthorizationViewControllerClass() paymentServicesMerchantURL:^(NSURL *merchantURL, NSError *error) {
+    [PAL::get_PassKit_PKPaymentAuthorizationViewControllerClass() paymentServicesMerchantURL:^(NSURL *merchantURL, NSError *error) {
         if (error)
             LOG_ERROR("PKCanMakePaymentsWithMerchantIdentifierAndDomain error %@", error);
 
@@ -155,7 +120,7 @@ static WebCore::ApplePaySessionPaymentRequest::ShippingMethod toShippingMethod(P
 {
 #if (PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101300) || (PLATFORM(IOS_FAMILY) && __IPHONE_OS_VERSION_MIN_REQUIRED >= 110000)
     if (!_webPaymentCoordinatorProxy) {
-        completion(adoptNS([allocPKPaymentAuthorizationResultInstance() initWithStatus:PKPaymentAuthorizationStatusFailure errors:@[ ]]).get());
+        completion(adoptNS([PAL::allocPKPaymentAuthorizationResultInstance() initWithStatus:PKPaymentAuthorizationStatusFailure errors:@[ ]]).get());
         return;
     }
 
@@ -170,7 +135,7 @@ static WebCore::ApplePaySessionPaymentRequest::ShippingMethod toShippingMethod(P
 {
 #if (PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101300) || (PLATFORM(IOS_FAMILY) && __IPHONE_OS_VERSION_MIN_REQUIRED >= 110000)
     if (!_webPaymentCoordinatorProxy) {
-        completion(adoptNS([allocPKPaymentRequestPaymentMethodUpdateInstance() initWithPaymentSummaryItems:@[ ]]).get());
+        completion(adoptNS([PAL::allocPKPaymentRequestPaymentMethodUpdateInstance() initWithPaymentSummaryItems:@[ ]]).get());
         return;
     }
 
@@ -183,7 +148,7 @@ static WebCore::ApplePaySessionPaymentRequest::ShippingMethod toShippingMethod(P
 - (void)paymentAuthorizationViewController:(PKPaymentAuthorizationViewController *)controller didSelectShippingMethod:(PKShippingMethod *)shippingMethod handler:(void (^)(PKPaymentRequestShippingMethodUpdate *update))completion {
 #if (PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101300) || (PLATFORM(IOS_FAMILY) && __IPHONE_OS_VERSION_MIN_REQUIRED >= 110000)
     if (!_webPaymentCoordinatorProxy) {
-        completion(adoptNS([allocPKPaymentRequestShippingMethodUpdateInstance() initWithPaymentSummaryItems:@[ ]]).get());
+        completion(adoptNS([PAL::allocPKPaymentRequestShippingMethodUpdateInstance() initWithPaymentSummaryItems:@[ ]]).get());
         return;
     }
 
@@ -197,7 +162,7 @@ static WebCore::ApplePaySessionPaymentRequest::ShippingMethod toShippingMethod(P
 {
 #if (PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101300) || (PLATFORM(IOS_FAMILY) && __IPHONE_OS_VERSION_MIN_REQUIRED >= 110000)
     if (!_webPaymentCoordinatorProxy) {
-        completion(adoptNS([allocPKPaymentRequestShippingContactUpdateInstance() initWithErrors:@[ ] paymentSummaryItems:@[ ] shippingMethods:@[ ]]).get());
+        completion(adoptNS([PAL::allocPKPaymentRequestShippingContactUpdateInstance() initWithErrors:@[ ] paymentSummaryItems:@[ ] shippingMethods:@[ ]]).get());
         return;
     }
 
@@ -293,32 +258,13 @@ namespace WebKit {
 
 bool WebPaymentCoordinatorProxy::platformCanMakePayments()
 {
-#if PLATFORM(MAC)
-    if (!PassKitLibrary())
-        return false;
-#endif
-
-    return [getPKPaymentAuthorizationViewControllerClass() canMakePayments];
+    return [PAL::get_PassKit_PKPaymentAuthorizationViewControllerClass() canMakePayments];
 }
 
 void WebPaymentCoordinatorProxy::platformCanMakePaymentsWithActiveCard(const String& merchantIdentifier, const String& domainName, WTF::Function<void (bool)>&& completionHandler)
 {
-#if PLATFORM(MAC)
-    if (!PassKitLibrary()) {
-        completionHandler(false);
-        return;
-    }
-#endif
-
 #if (PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101300) || (PLATFORM(IOS_FAMILY) && __IPHONE_OS_VERSION_MIN_REQUIRED >= 110000)
-    if (!canLoad_PassKit_PKCanMakePaymentsWithMerchantIdentifierDomainAndSourceApplication()) {
-        RunLoop::main().dispatch([completionHandler = WTFMove(completionHandler)] {
-            completionHandler(false);
-        });
-        return;
-    }
-
-    softLink_PassKit_PKCanMakePaymentsWithMerchantIdentifierDomainAndSourceApplication(merchantIdentifier, domainName, m_webPageProxy.process().processPool().configuration().sourceApplicationSecondaryIdentifier(), BlockPtr<void (BOOL, NSError *)>::fromCallable([completionHandler = WTFMove(completionHandler)](BOOL canMakePayments, NSError *error) mutable {
+    PKCanMakePaymentsWithMerchantIdentifierDomainAndSourceApplication(merchantIdentifier, domainName, m_webPageProxy.process().processPool().configuration().sourceApplicationSecondaryIdentifier(), BlockPtr<void(BOOL, NSError *)>::fromCallable([completionHandler = WTFMove(completionHandler)](BOOL canMakePayments, NSError *error) mutable {
         if (error)
             LOG_ERROR("PKCanMakePaymentsWithMerchantIdentifierAndDomain error %@", error);
 
@@ -327,14 +273,7 @@ void WebPaymentCoordinatorProxy::platformCanMakePaymentsWithActiveCard(const Str
         });
     }).get());
 #else
-    if (!canLoad_PassKit_PKCanMakePaymentsWithMerchantIdentifierAndDomain()) {
-        RunLoop::main().dispatch([completionHandler = WTFMove(completionHandler)] {
-            completionHandler(false);
-        });
-        return;
-    }
-
-    softLink_PassKit_PKCanMakePaymentsWithMerchantIdentifierAndDomain(merchantIdentifier, domainName, BlockPtr<void (BOOL, NSError *)>::fromCallable([completionHandler = WTFMove(completionHandler)](BOOL canMakePayments, NSError *error) mutable {
+    PKCanMakePaymentsWithMerchantIdentifierAndDomain(merchantIdentifier, domainName, BlockPtr<void(BOOL, NSError *)>::fromCallable([completionHandler = WTFMove(completionHandler)](BOOL canMakePayments, NSError *error) mutable {
         if (error)
             LOG_ERROR("PKCanMakePaymentsWithMerchantIdentifierAndDomain error %@", error);
 
@@ -347,14 +286,7 @@ void WebPaymentCoordinatorProxy::platformCanMakePaymentsWithActiveCard(const Str
 
 void WebPaymentCoordinatorProxy::platformOpenPaymentSetup(const String& merchantIdentifier, const String& domainName, WTF::Function<void (bool)>&& completionHandler)
 {
-#if PLATFORM(MAC)
-    if (!PassKitLibrary()) {
-        completionHandler(false);
-        return;
-    }
-#endif
-
-    auto passLibrary = adoptNS([allocPKPassLibraryInstance() init]);
+    auto passLibrary = adoptNS([PAL::allocPKPassLibraryInstance() init]);
     [passLibrary openPaymentSetupForMerchantIdentifier:merchantIdentifier domain:domainName completion:BlockPtr<void (BOOL)>::fromCallable([completionHandler = WTFMove(completionHandler)](BOOL result) mutable {
         RunLoop::main().dispatch([completionHandler = WTFMove(completionHandler), result] {
             completionHandler(result);
@@ -368,15 +300,15 @@ static RetainPtr<NSSet> toPKContactFields(const WebCore::ApplePaySessionPaymentR
     Vector<NSString *> result;
 
     if (contactFields.postalAddress)
-        result.append(getPKContactFieldPostalAddress());
+        result.append(PAL::get_PassKit_PKContactFieldPostalAddress());
     if (contactFields.phone)
-        result.append(getPKContactFieldPhoneNumber());
+        result.append(PAL::get_PassKit_PKContactFieldPhoneNumber());
     if (contactFields.email)
-        result.append(getPKContactFieldEmailAddress());
+        result.append(PAL::get_PassKit_PKContactFieldEmailAddress());
     if (contactFields.name)
-        result.append(getPKContactFieldName());
+        result.append(PAL::get_PassKit_PKContactFieldName());
     if (contactFields.phoneticName)
-        result.append(getPKContactFieldPhoneticName());
+        result.append(PAL::get_PassKit_PKContactFieldPhoneticName());
 
     return adoptNS([[NSSet alloc] initWithObjects:result.data() count:result.size()]);
 }
@@ -418,7 +350,7 @@ static NSDecimalNumber *toDecimalNumber(const String& amount)
 
 static RetainPtr<PKPaymentSummaryItem> toPKPaymentSummaryItem(const WebCore::ApplePaySessionPaymentRequest::LineItem& lineItem)
 {
-    return [getPKPaymentSummaryItemClass() summaryItemWithLabel:lineItem.label amount:toDecimalNumber(lineItem.amount) type:toPKPaymentSummaryItemType(lineItem.type)];
+    return [PAL::get_PassKit_PKPaymentSummaryItemClass() summaryItemWithLabel:lineItem.label amount:toDecimalNumber(lineItem.amount) type:toPKPaymentSummaryItemType(lineItem.type)];
 }
 
 static RetainPtr<NSArray> toPKPaymentSummaryItems(const WebCore::ApplePaySessionPaymentRequest::TotalAndLineItems& totalAndLineItems)
@@ -477,7 +409,7 @@ static PKShippingType toPKShippingType(WebCore::ApplePaySessionPaymentRequest::S
 
 static RetainPtr<PKShippingMethod> toPKShippingMethod(const WebCore::ApplePaySessionPaymentRequest::ShippingMethod& shippingMethod)
 {
-    RetainPtr<PKShippingMethod> result = [getPKShippingMethodClass() summaryItemWithLabel:shippingMethod.label amount:toDecimalNumber(shippingMethod.amount)];
+    RetainPtr<PKShippingMethod> result = [PAL::get_PassKit_PKShippingMethodClass() summaryItemWithLabel:shippingMethod.label amount:toDecimalNumber(shippingMethod.amount)];
     [result setIdentifier:shippingMethod.identifier];
     [result setDetail:shippingMethod.detail];
 
@@ -512,7 +444,7 @@ static PKPaymentRequestAPIType toAPIType(WebCore::ApplePaySessionPaymentRequest:
 
 RetainPtr<PKPaymentRequest> toPKPaymentRequest(WebPageProxy& webPageProxy, const WebCore::URL& originatingURL, const Vector<WebCore::URL>& linkIconURLs, const WebCore::ApplePaySessionPaymentRequest& paymentRequest)
 {
-    auto result = adoptNS([allocPKPaymentRequestInstance() init]);
+    auto result = adoptNS([PAL::allocPKPaymentRequestInstance() init]);
 
     [result setOriginatingURL:originatingURL];
 
@@ -632,69 +564,69 @@ static RetainPtr<NSError> toNSError(const WebCore::PaymentError& error)
 
         switch (*error.contactField) {
         case WebCore::PaymentError::ContactField::PhoneNumber:
-            pkContactField = getPKContactFieldPhoneNumber();
+            pkContactField = PAL::get_PassKit_PKContactFieldPhoneNumber();
             break;
 
         case WebCore::PaymentError::ContactField::EmailAddress:
-            pkContactField = getPKContactFieldEmailAddress();
+            pkContactField = PAL::get_PassKit_PKContactFieldEmailAddress();
             break;
 
         case WebCore::PaymentError::ContactField::Name:
-            pkContactField = getPKContactFieldName();
+            pkContactField = PAL::get_PassKit_PKContactFieldName();
             break;
 
         case WebCore::PaymentError::ContactField::PhoneticName:
-            pkContactField = getPKContactFieldPhoneticName();
+            pkContactField = PAL::get_PassKit_PKContactFieldPhoneticName();
             break;
 
         case WebCore::PaymentError::ContactField::PostalAddress:
-            pkContactField = getPKContactFieldPostalAddress();
+            pkContactField = PAL::get_PassKit_PKContactFieldPostalAddress();
             break;
 
         case WebCore::PaymentError::ContactField::AddressLines:
-            pkContactField = getPKContactFieldPostalAddress();
+            pkContactField = PAL::get_PassKit_PKContactFieldPostalAddress();
             postalAddressKey = getCNPostalAddressStreetKey();
             break;
 
         case WebCore::PaymentError::ContactField::SubLocality:
-            pkContactField = getPKContactFieldPostalAddress();
+            pkContactField = PAL::get_PassKit_PKContactFieldPostalAddress();
             postalAddressKey = getCNPostalAddressSubLocalityKey();
             break;
 
         case WebCore::PaymentError::ContactField::Locality:
-            pkContactField = getPKContactFieldPostalAddress();
+            pkContactField = PAL::get_PassKit_PKContactFieldPostalAddress();
             postalAddressKey = getCNPostalAddressCityKey();
             break;
 
         case WebCore::PaymentError::ContactField::PostalCode:
-            pkContactField = getPKContactFieldPostalAddress();
+            pkContactField = PAL::get_PassKit_PKContactFieldPostalAddress();
             postalAddressKey = getCNPostalAddressPostalCodeKey();
             break;
 
         case WebCore::PaymentError::ContactField::SubAdministrativeArea:
-            pkContactField = getPKContactFieldPostalAddress();
+            pkContactField = PAL::get_PassKit_PKContactFieldPostalAddress();
             postalAddressKey = getCNPostalAddressSubAdministrativeAreaKey();
             break;
 
         case WebCore::PaymentError::ContactField::AdministrativeArea:
-            pkContactField = getPKContactFieldPostalAddress();
+            pkContactField = PAL::get_PassKit_PKContactFieldPostalAddress();
             postalAddressKey = getCNPostalAddressStateKey();
             break;
 
         case WebCore::PaymentError::ContactField::Country:
-            pkContactField = getPKContactFieldPostalAddress();
+            pkContactField = PAL::get_PassKit_PKContactFieldPostalAddress();
             postalAddressKey = getCNPostalAddressCountryKey();
             break;
 
         case WebCore::PaymentError::ContactField::CountryCode:
-            pkContactField = getPKContactFieldPostalAddress();
+            pkContactField = PAL::get_PassKit_PKContactFieldPostalAddress();
             postalAddressKey = getCNPostalAddressISOCountryCodeKey();
             break;
         }
 
-        [userInfo setObject:pkContactField forKey:getPKPaymentErrorContactFieldUserInfoKey()];
+        [userInfo setObject:pkContactField forKey:PAL::get_PassKit_PKPaymentErrorContactFieldUserInfoKey()];
         if (postalAddressKey)
-            [userInfo setObject:postalAddressKey forKey:getPKPaymentErrorPostalAddressUserInfoKey()];
+            [userInfo setObject:postalAddressKey forKey:PAL::get_PassKit_PKPaymentErrorPostalAddressUserInfoKey()];
     }
 
     return adoptNS([[NSError alloc] initWithDomain:getPKPaymentErrorDomain() code:toPKPaymentErrorCode(error.code) userInfo:userInfo.get()]);
@@ -761,7 +693,7 @@ void WebPaymentCoordinatorProxy::platformCompletePaymentSession(const std::optio
 
 #if (PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101300) || (PLATFORM(IOS_FAMILY) && __IPHONE_OS_VERSION_MIN_REQUIRED >= 110000)
     auto status = result ? result->status : WebCore::PaymentAuthorizationStatus::Success;
-    auto pkPaymentAuthorizationResult = adoptNS([allocPKPaymentAuthorizationResultInstance() initWithStatus:toPKPaymentAuthorizationStatus(status) errors:result ? toNSErrors(result->errors).get() : @[ ]]);
+    auto pkPaymentAuthorizationResult = adoptNS([PAL::allocPKPaymentAuthorizationResultInstance() initWithStatus:toPKPaymentAuthorizationStatus(status) errors:result ? toNSErrors(result->errors).get() : @[ ]]);
     m_paymentAuthorizationViewControllerDelegate->_paymentAuthorizedCompletion(pkPaymentAuthorizationResult.get());
 #else
     m_paymentAuthorizationViewControllerDelegate->_paymentAuthorizedCompletion(toPKPaymentAuthorizationStatus(result));
@@ -787,7 +719,7 @@ void WebPaymentCoordinatorProxy::platformCompleteShippingMethodSelection(const s
         m_paymentAuthorizationViewControllerDelegate->_paymentSummaryItems = toPKPaymentSummaryItems(update->newTotalAndLineItems);
 
 #if (PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101300) || (PLATFORM(IOS_FAMILY) && __IPHONE_OS_VERSION_MIN_REQUIRED >= 110000)
-    auto pkShippingMethodUpdate = adoptNS([allocPKPaymentRequestShippingMethodUpdateInstance() initWithPaymentSummaryItems:m_paymentAuthorizationViewControllerDelegate->_paymentSummaryItems.get()]);
+    auto pkShippingMethodUpdate = adoptNS([PAL::allocPKPaymentRequestShippingMethodUpdateInstance() initWithPaymentSummaryItems:m_paymentAuthorizationViewControllerDelegate->_paymentSummaryItems.get()]);
     m_paymentAuthorizationViewControllerDelegate->_didSelectShippingMethodCompletion(pkShippingMethodUpdate.get());
 #else
     m_paymentAuthorizationViewControllerDelegate->_didSelectShippingMethodCompletion(PKPaymentAuthorizationStatusSuccess, m_paymentAuthorizationViewControllerDelegate->_paymentSummaryItems.get());
@@ -839,7 +771,7 @@ void WebPaymentCoordinatorProxy::platformCompleteShippingContactSelection(const
     }
 
 #if (PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101300) || (PLATFORM(IOS_FAMILY) && __IPHONE_OS_VERSION_MIN_REQUIRED >= 110000)
-    auto pkShippingContactUpdate = adoptNS([allocPKPaymentRequestShippingContactUpdateInstance() initWithErrors:update ? toNSErrors(update->errors).get() : @[ ] paymentSummaryItems:m_paymentAuthorizationViewControllerDelegate->_paymentSummaryItems.get() shippingMethods:m_paymentAuthorizationViewControllerDelegate->_shippingMethods.get()]);
+    auto pkShippingContactUpdate = adoptNS([PAL::allocPKPaymentRequestShippingContactUpdateInstance() initWithErrors:update ? toNSErrors(update->errors).get() : @[ ] paymentSummaryItems:m_paymentAuthorizationViewControllerDelegate->_paymentSummaryItems.get() shippingMethods:m_paymentAuthorizationViewControllerDelegate->_shippingMethods.get()]);
     m_paymentAuthorizationViewControllerDelegate->_didSelectShippingContactCompletion(pkShippingContactUpdate.get());
 #else
     m_paymentAuthorizationViewControllerDelegate->_didSelectShippingContactCompletion(toPKPaymentAuthorizationStatus(update), m_paymentAuthorizationViewControllerDelegate->_shippingMethods.get(), m_paymentAuthorizationViewControllerDelegate->_paymentSummaryItems.get());
@@ -856,7 +788,7 @@ void WebPaymentCoordinatorProxy::platformCompletePaymentMethodSelection(const st
         m_paymentAuthorizationViewControllerDelegate->_paymentSummaryItems = toPKPaymentSummaryItems(update->newTotalAndLineItems);
 
 #if (PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101300) || (PLATFORM(IOS_FAMILY) && __IPHONE_OS_VERSION_MIN_REQUIRED >= 110000)
-    auto pkPaymentMethodUpdate = adoptNS([allocPKPaymentRequestPaymentMethodUpdateInstance() initWithPaymentSummaryItems:m_paymentAuthorizationViewControllerDelegate->_paymentSummaryItems.get()]);
+    auto pkPaymentMethodUpdate = adoptNS([PAL::allocPKPaymentRequestPaymentMethodUpdateInstance() initWithPaymentSummaryItems:m_paymentAuthorizationViewControllerDelegate->_paymentSummaryItems.get()]);
     m_paymentAuthorizationViewControllerDelegate->_didSelectPaymentMethodCompletion(pkPaymentMethodUpdate.get());
 #else
     m_paymentAuthorizationViewControllerDelegate->_didSelectPaymentMethodCompletion(m_paymentAuthorizationViewControllerDelegate->_paymentSummaryItems.get());
@@ -866,12 +798,7 @@ void WebPaymentCoordinatorProxy::platformCompletePaymentMethodSelection(const st
 
 Vector<String> WebPaymentCoordinatorProxy::platformAvailablePaymentNetworks()
 {
-#if PLATFORM(MAC)
-    if (!PassKitLibrary())
-        return { };
-#endif
-    
-    NSArray<PKPaymentNetwork> *availableNetworks = [getPKPaymentRequestClass() availableNetworks];
+    NSArray<PKPaymentNetwork> *availableNetworks = [PAL::get_PassKit_PKPaymentRequestClass() availableNetworks];
     Vector<String> result;
     result.reserveInitialCapacity(availableNetworks.count);
     for (PKPaymentNetwork network in availableNetworks)
index c0df3c8..f9e280d 100644 (file)
 #import <PassKit/PassKit.h>
 #import <UIKit/UIViewController.h>
 #import <WebCore/PaymentAuthorizationStatus.h>
-#import <wtf/SoftLinking.h>
-
-SOFT_LINK_FRAMEWORK(PassKit)
-SOFT_LINK_CLASS(PassKit, PKPaymentAuthorizationViewController);
+#import <pal/cocoa/PassKitSoftLink.h>
 
 namespace WebKit {
 
@@ -54,7 +51,7 @@ void WebPaymentCoordinatorProxy::platformShowPaymentUI(const WebCore::URL& origi
 
     auto paymentRequest = toPKPaymentRequest(m_webPageProxy, originatingURL, linkIconURLStrings, request);
 
-    m_paymentAuthorizationViewController = adoptNS([allocPKPaymentAuthorizationViewControllerInstance() initWithPaymentRequest:paymentRequest.get()]);
+    m_paymentAuthorizationViewController = adoptNS([PAL::allocPKPaymentAuthorizationViewControllerInstance() initWithPaymentRequest:paymentRequest.get()]);
     if (!m_paymentAuthorizationViewController) {
         completionHandler(false);
         return;
index 7415938..2e99cb1 100644 (file)
 
 #import "WebPageProxy.h"
 #import "WebPaymentCoordinatorProxyCocoa.h"
-#import <pal/spi/cocoa/PassKitSPI.h>
+#import <pal/cocoa/PassKitSoftLink.h>
 #import <wtf/BlockPtr.h>
-#import <wtf/SoftLinking.h>
-
-SOFT_LINK_PRIVATE_FRAMEWORK_OPTIONAL(PassKit)
-
-SOFT_LINK_CLASS(PassKit, PKPaymentAuthorizationViewController);
-SOFT_LINK_CONSTANT(PassKit, PKExtensionPaymentAuthorizationUIExtensionPointName, NSString *);
 
 namespace WebKit {
 
 void WebPaymentCoordinatorProxy::platformShowPaymentUI(const WebCore::URL& originatingURL, const Vector<WebCore::URL>& linkIconURLStrings, const WebCore::ApplePaySessionPaymentRequest& request, WTF::Function<void (bool)>&& completionHandler)
 {
-    if (!PassKitLibrary()) {
-        completionHandler(false);
-        return;
-    }
-
     auto paymentRequest = toPKPaymentRequest(m_webPageProxy, originatingURL, linkIconURLStrings, request);
 
     auto showPaymentUIRequestSeed = m_showPaymentUIRequestSeed;
     auto weakThis = makeWeakPtr(*this);
-    [getPKPaymentAuthorizationViewControllerClass() requestViewControllerWithPaymentRequest:paymentRequest.get() completion:BlockPtr<void (PKPaymentAuthorizationViewController *, NSError *)>::fromCallable([paymentRequest, showPaymentUIRequestSeed, weakThis, completionHandler = WTFMove(completionHandler)](PKPaymentAuthorizationViewController *viewController, NSError *error) {
+    [PAL::get_PassKit_PKPaymentAuthorizationViewControllerClass() requestViewControllerWithPaymentRequest:paymentRequest.get() completion:BlockPtr<void(PKPaymentAuthorizationViewController *, NSError *)>::fromCallable([paymentRequest, showPaymentUIRequestSeed, weakThis, completionHandler = WTFMove(completionHandler)](PKPaymentAuthorizationViewController *viewController, NSError *error) {
         auto paymentCoordinatorProxy = weakThis.get();
         if (!paymentCoordinatorProxy)
             return;
index 83ffed3..0375b83 100644 (file)
@@ -28,6 +28,7 @@
 
 #import "SafeBrowsingSPI.h"
 #import <WebCore/LocalizedStrings.h>
+#import <pal/spi/cocoa/NSAttributedStringSPI.h>
 #import <wtf/Language.h>
 
 namespace WebKit {
index 4904e26..839ea68 100644 (file)
@@ -30,6 +30,7 @@
 #if PLATFORM(MAC)
 
 #import "WKFullKeyboardAccessWatcher.h"
+#import <wtf/ProcessPrivilege.h>
 
 #if __MAC_OS_X_VERSION_MIN_REQUIRED >= 101400
 #import <Kernel/kern/cs_blobs.h>
index bd8158c..2438ffe 100644 (file)
                2D92A795212B6AD400F493FD /* PluginProcessCreationParameters.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A2D90D11281C966001EB962 /* PluginProcessCreationParameters.cpp */; };
                2D92A796212B6ADA00F493FD /* NetscapePluginModule.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A4A9C5312B816CF008FE984 /* NetscapePluginModule.cpp */; };
                2D92A797212B6ADA00F493FD /* PluginInformation.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7C3F8C8E173AF52D007B7F39 /* PluginInformation.cpp */; };
-               2D92A79821348D8500F493FD /* WebPaymentCoordinatorProxyMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1AB1F77D1D1B30A9007C9BD1 /* WebPaymentCoordinatorProxyMac.mm */; };
-               2D92A79F2134B07E00F493FD /* WebPaymentCoordinatorProxyIOS.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1AB1F77B1D1B30A9007C9BD1 /* WebPaymentCoordinatorProxyIOS.mm */; };
                2D931169212F61B200044BFE /* WKContentView.mm in Sources */ = {isa = PBXBuildFile; fileRef = 0FCB4E3D18BBE044000FCFC9 /* WKContentView.mm */; };
                2D93116A212F61B500044BFE /* WKContentViewInteraction.mm in Sources */ = {isa = PBXBuildFile; fileRef = 0FCB4E6B18BBF26A000FCFC9 /* WKContentViewInteraction.mm */; };
                2D9EA30D1A96CB59002D2807 /* WKPageInjectedBundleClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 2D9EA30C1A96CB59002D2807 /* WKPageInjectedBundleClient.h */; settings = {ATTRIBUTES = (Private, ); }; };
                                7CE9CE101FA0767A000177DE /* WebPageUpdatePreferences.cpp in Sources */,
                                7C4694C91A4B4EA100AD5845 /* WebPasteboardProxyMessageReceiver.cpp in Sources */,
                                1AB1F7961D1B3613007C9BD1 /* WebPaymentCoordinatorMessageReceiver.cpp in Sources */,
-                               2D92A79F2134B07E00F493FD /* WebPaymentCoordinatorProxyIOS.mm in Sources */,
-                               2D92A79821348D8500F493FD /* WebPaymentCoordinatorProxyMac.mm in Sources */,
                                1AB1F7981D1B3613007C9BD1 /* WebPaymentCoordinatorProxyMessageReceiver.cpp in Sources */,
                                2D92A78D212B6AB100F493FD /* WebPlatformTouchPoint.cpp in Sources */,
                                2D91344E212CF9F000128AFD /* WebPluginInfoProvider.cpp in Sources */,