Symbols not always properly hidden when using WebKitAdditions to introduce new API
https://bugs.webkit.org/show_bug.cgi?id=235674
<rdar://87999257>
Reviewed by Wenson Hsieh.
Surround APIs from WebKitAdditions with `#if ENABLE(API_WEBKIT_ADDITIONS)` instead of
`#if USE(APPLE_INTERNAL_SDK)` and leaving API_WEBKIT_ADDITIONS to be intentionally
undefined. This is because we never want to build the code inside this #if block.
Instead, those blocks are only meant to be replaced by the
replace-webkit-additions-includes.py with the code from WebKitAdditions.
* UIProcess/API/Cocoa/WKWebpagePreferences.h:
* mac/replace-webkit-additions-includes.py:
(main):
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@288658 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/Source/WebKit/ChangeLog b/Source/WebKit/ChangeLog
index 8ee9037..a20e0e9 100644
--- a/Source/WebKit/ChangeLog
+++ b/Source/WebKit/ChangeLog
@@ -1,3 +1,21 @@
+2022-01-26 Chris Dumez <cdumez@apple.com>
+
+ Symbols not always properly hidden when using WebKitAdditions to introduce new API
+ https://bugs.webkit.org/show_bug.cgi?id=235674
+ <rdar://87999257>
+
+ Reviewed by Wenson Hsieh.
+
+ Surround APIs from WebKitAdditions with `#if ENABLE(API_WEBKIT_ADDITIONS)` instead of
+ `#if USE(APPLE_INTERNAL_SDK)` and leaving API_WEBKIT_ADDITIONS to be intentionally
+ undefined. This is because we never want to build the code inside this #if block.
+ Instead, those blocks are only meant to be replaced by the
+ replace-webkit-additions-includes.py with the code from WebKitAdditions.
+
+ * UIProcess/API/Cocoa/WKWebpagePreferences.h:
+ * mac/replace-webkit-additions-includes.py:
+ (main):
+
2022-01-26 J Pascoe <j_pascoe@apple.com>
[WebAuthn] We should pass extensions to ASC if possible
diff --git a/Source/WebKit/UIProcess/API/Cocoa/WKWebpagePreferences.h b/Source/WebKit/UIProcess/API/Cocoa/WKWebpagePreferences.h
index 9ee7693..e19c32b 100644
--- a/Source/WebKit/UIProcess/API/Cocoa/WKWebpagePreferences.h
+++ b/Source/WebKit/UIProcess/API/Cocoa/WKWebpagePreferences.h
@@ -71,7 +71,7 @@
*/
@property (nonatomic) BOOL allowsContentJavaScript WK_API_AVAILABLE(macos(11.0), ios(14.0));
-#if USE(APPLE_INTERNAL_SDK)
+#if ENABLE(API_WEBKIT_ADDITIONS)
#import <WebKitAdditions/WKWebpagePreferencesAdditions.h>
#endif
diff --git a/Source/WebKit/mac/replace-webkit-additions-includes.py b/Source/WebKit/mac/replace-webkit-additions-includes.py
index 0ae1bda..85c2c4e 100755
--- a/Source/WebKit/mac/replace-webkit-additions-includes.py
+++ b/Source/WebKit/mac/replace-webkit-additions-includes.py
@@ -88,7 +88,9 @@
# We currently only support WebKitAdditions in Framework headers on macOS 13+ and iOS 16+.
should_do_replacement = is_supported_os()
- additions_import_pattern = re.compile(r"\#if USE\(APPLE_INTERNAL_SDK\)\n#import <WebKitAdditions/(.*)>\n#endif")
+ # API_WEBKIT_ADDITIONS is intentionally not defined anywhere so that we never try to build this code. It is only
+ # meant to be used by this script to identify where to introduce replacement in API headers from WebKitAdditions.
+ additions_import_pattern = re.compile(r"\#if ENABLE\(API_WEBKIT_ADDITIONS\)\n#import <WebKitAdditions/(.*)>\n#endif")
try:
with open(header_path, "r") as header:
header_contents = header.read()