Diff
Modified: trunk/LayoutTests/ChangeLog (280725 => 280726)
--- trunk/LayoutTests/ChangeLog 2021-08-06 16:25:55 UTC (rev 280725)
+++ trunk/LayoutTests/ChangeLog 2021-08-06 16:38:28 UTC (rev 280726)
@@ -1,3 +1,16 @@
+2021-08-06 Peng Liu <[email protected]>
+
+ [macOS] Clean up Feature Flags related code
+ https://bugs.webkit.org/show_bug.cgi?id=228803
+ <rdar://problem/81142982>
+
+ Reviewed by Tim Horton.
+
+ Update a mac-bigsur specific test expectation file because the test is passing now.
+
+ * platform/mac/imported/w3c/web-platform-tests/media-source/mediasource-addsourcebuffer-expected.txt: Removed.
+ * platform/mac-bigsur/imported/w3c/web-platform-tests/media-source/mediasource-addsourcebuffer-expected.txt:
+
2021-08-06 Antti Koivisto <[email protected]>
REGRESSION (r274038): Keyframe animation with top/left with percentages fails to animate
Deleted: trunk/LayoutTests/platform/mac/imported/w3c/web-platform-tests/media-source/mediasource-addsourcebuffer-expected.txt (280725 => 280726)
--- trunk/LayoutTests/platform/mac/imported/w3c/web-platform-tests/media-source/mediasource-addsourcebuffer-expected.txt 2021-08-06 16:25:55 UTC (rev 280725)
+++ trunk/LayoutTests/platform/mac/imported/w3c/web-platform-tests/media-source/mediasource-addsourcebuffer-expected.txt 2021-08-06 16:38:28 UTC (rev 280726)
@@ -1,12 +0,0 @@
-
-PASS Test addSourceBuffer() in 'ended' state.
-PASS Test addSourceBuffer() with empty type
-PASS Test addSourceBuffer() with null
-PASS Test addSourceBuffer() with unsupported type
-FAIL Test addSourceBuffer() with Vorbis and VP8 assert_true: video/webm;codecs="vp8,vorbis" is supported expected true got false
-FAIL Test addSourceBuffer() with Vorbis and VP8 in separate SourceBuffers assert_true: video/webm;codecs="vp8" is supported expected true got false
-PASS Test addSourceBuffer() video only
-PASS Test addSourceBuffer() audio only
-PASS Test addSourceBuffer() with AAC and H.264
-PASS Test addSourceBuffer() with AAC and H.264 in separate SourceBuffers
-
Modified: trunk/LayoutTests/platform/mac-bigsur/imported/w3c/web-platform-tests/media-source/mediasource-addsourcebuffer-expected.txt (280725 => 280726)
--- trunk/LayoutTests/platform/mac-bigsur/imported/w3c/web-platform-tests/media-source/mediasource-addsourcebuffer-expected.txt 2021-08-06 16:25:55 UTC (rev 280725)
+++ trunk/LayoutTests/platform/mac-bigsur/imported/w3c/web-platform-tests/media-source/mediasource-addsourcebuffer-expected.txt 2021-08-06 16:38:28 UTC (rev 280726)
@@ -3,8 +3,8 @@
PASS Test addSourceBuffer() with empty type
PASS Test addSourceBuffer() with null
PASS Test addSourceBuffer() with unsupported type
-FAIL Test addSourceBuffer() with Vorbis and VP8 assert_true: video/webm;codecs="vp8,vorbis" is supported expected true got false
-FAIL Test addSourceBuffer() with Vorbis and VP8 in separate SourceBuffers assert_true: audio/webm;codecs="vorbis" is supported expected true got false
+PASS Test addSourceBuffer() with Vorbis and VP8
+PASS Test addSourceBuffer() with Vorbis and VP8 in separate SourceBuffers
PASS Test addSourceBuffer() video only
PASS Test addSourceBuffer() audio only
PASS Test addSourceBuffer() with AAC and H.264
Modified: trunk/Source/WebKit/ChangeLog (280725 => 280726)
--- trunk/Source/WebKit/ChangeLog 2021-08-06 16:25:55 UTC (rev 280725)
+++ trunk/Source/WebKit/ChangeLog 2021-08-06 16:38:28 UTC (rev 280726)
@@ -1,3 +1,51 @@
+2021-08-06 Peng Liu <[email protected]>
+
+ [macOS] Clean up Feature Flags related code
+ https://bugs.webkit.org/show_bug.cgi?id=228803
+ <rdar://problem/81142982>
+
+ Reviewed by Tim Horton.
+
+ On macOS, Safari Technology Preview or a local build WebKit/Safari will always
+ get the default preference values through the "Feature Flags" SPI. Unfortunately,
+ this approach won't work if the OS does not provide correct default preference values.
+
+ With this patch, we only get default preference values with the SPI for system
+ WebKit on macOS. For all other cases, we use hardcoded values. So that
+ WebKit will always get the correct default preference values.
+
+ This patch also fixes a few mistakes in two preferences: "webm_webaudio" and "vp8_decoder".
+
+ * FeatureFlags/WebKit-appletvos.plist:
+ * FeatureFlags/WebKit-ios.plist:
+ * FeatureFlags/WebKit-macos.plist:
+ * FeatureFlags/WebKit-watchos.plist:
+
+ * Shared/Cocoa/WebPreferencesDefaultValuesCocoa.mm:
+ (WebKit::isFeatureFlagEnabled):
+ * Shared/WebPreferencesDefaultValues.cpp:
+ (WebKit::isFeatureFlagEnabled):
+ (WebKit::defaultAsyncFrameAndOverflowScrollingEnabled):
+ (WebKit::defaultUseGPUProcessForCanvasRenderingEnabled):
+ (WebKit::defaultUseGPUProcessForDOMRenderingEnabled):
+ (WebKit::defaultUseGPUProcessForMediaEnabled):
+ (WebKit::defaultUseGPUProcessForWebGLEnabled):
+ (WebKit::defaultCaptureAudioInGPUProcessEnabled):
+ (WebKit::defaultCaptureVideoInGPUProcessEnabled):
+ (WebKit::defaultWebRTCCodecsInGPUProcess):
+ (WebKit::defaultIncrementalPDFEnabled):
+ (WebKit::defaultWebMFormatReaderEnabled):
+ (WebKit::defaultVP8DecoderEnabled):
+ (WebKit::defaultVP9DecoderEnabled):
+ (WebKit::defaultVP9SWDecoderEnabledOnBattery):
+ (WebKit::defaultWebMParserEnabled):
+ (WebKit::defaultWebMWebAudioEnabled):
+ (WebKit::defaultInAppBrowserPrivacy): Deleted.
+ * Shared/WebPreferencesDefaultValues.h:
+
+ * UIProcess/WebPageProxy.cpp:
+ (WebKit::WebPageProxy::creationParameters): Fix a typo.
+
2021-08-06 Jer Noble <[email protected]>
[Cocoa] Remove support for AVAssetImageGenerator
Modified: trunk/Source/WebKit/FeatureFlags/WebKit-appletvos.plist (280725 => 280726)
--- trunk/Source/WebKit/FeatureFlags/WebKit-appletvos.plist 2021-08-06 16:25:55 UTC (rev 280725)
+++ trunk/Source/WebKit/FeatureFlags/WebKit-appletvos.plist 2021-08-06 16:38:28 UTC (rev 280726)
@@ -67,6 +67,11 @@
<key>Enabled</key>
<true/>
</dict>
+ <key>vp8_decoder</key>
+ <dict>
+ <key>Enabled</key>
+ <true/>
+ </dict>
<key>WebXR</key>
<dict>
<key>Enabled</key>
@@ -82,11 +87,6 @@
<key>Enabled</key>
<true/>
</dict>
- <key>webm_webaudio</key>
- <dict>
- <key>Enabled</key>
- <true/>
- </dict>
<key>RB_full_manage_WK_jetsam</key>
<dict>
<key>Enabled</key>
Modified: trunk/Source/WebKit/FeatureFlags/WebKit-ios.plist (280725 => 280726)
--- trunk/Source/WebKit/FeatureFlags/WebKit-ios.plist 2021-08-06 16:25:55 UTC (rev 280725)
+++ trunk/Source/WebKit/FeatureFlags/WebKit-ios.plist 2021-08-06 16:38:28 UTC (rev 280726)
@@ -67,6 +67,11 @@
<key>Enabled</key>
<true/>
</dict>
+ <key>vp8_decoder</key>
+ <dict>
+ <key>Enabled</key>
+ <true/>
+ </dict>
<key>WebXR</key>
<dict>
<key>Enabled</key>
@@ -82,11 +87,6 @@
<key>Enabled</key>
<true/>
</dict>
- <key>webm_webaudio</key>
- <dict>
- <key>Enabled</key>
- <true/>
- </dict>
<key>RB_full_manage_WK_jetsam</key>
<dict>
<key>Enabled</key>
Modified: trunk/Source/WebKit/FeatureFlags/WebKit-macos.plist (280725 => 280726)
--- trunk/Source/WebKit/FeatureFlags/WebKit-macos.plist 2021-08-06 16:25:55 UTC (rev 280725)
+++ trunk/Source/WebKit/FeatureFlags/WebKit-macos.plist 2021-08-06 16:38:28 UTC (rev 280726)
@@ -67,6 +67,11 @@
<key>Enabled</key>
<true/>
</dict>
+ <key>vp8_decoder</key>
+ <dict>
+ <key>Enabled</key>
+ <true/>
+ </dict>
<key>WebXR</key>
<dict>
<key>Enabled</key>
@@ -85,7 +90,7 @@
<key>webm_webaudio</key>
<dict>
<key>Enabled</key>
- <true/>
+ <false/>
</dict>
<key>RB_full_manage_WK_jetsam</key>
<dict>
Modified: trunk/Source/WebKit/FeatureFlags/WebKit-watchos.plist (280725 => 280726)
--- trunk/Source/WebKit/FeatureFlags/WebKit-watchos.plist 2021-08-06 16:25:55 UTC (rev 280725)
+++ trunk/Source/WebKit/FeatureFlags/WebKit-watchos.plist 2021-08-06 16:38:28 UTC (rev 280726)
@@ -67,6 +67,11 @@
<key>Enabled</key>
<true/>
</dict>
+ <key>vp8_decoder</key>
+ <dict>
+ <key>Enabled</key>
+ <true/>
+ </dict>
<key>WebXR</key>
<dict>
<key>Enabled</key>
@@ -82,11 +87,6 @@
<key>Enabled</key>
<true/>
</dict>
- <key>webm_webaudio</key>
- <dict>
- <key>Enabled</key>
- <true/>
- </dict>
<key>RB_full_manage_WK_jetsam</key>
<dict>
<key>Enabled</key>
Modified: trunk/Source/WebKit/Shared/Cocoa/WebPreferencesDefaultValuesCocoa.mm (280725 => 280726)
--- trunk/Source/WebKit/Shared/Cocoa/WebPreferencesDefaultValuesCocoa.mm 2021-08-06 16:25:55 UTC (rev 280725)
+++ trunk/Source/WebKit/Shared/Cocoa/WebPreferencesDefaultValuesCocoa.mm 2021-08-06 16:38:28 UTC (rev 280726)
@@ -26,7 +26,7 @@
#import "config.h"
#import "WebPreferencesDefaultValues.h"
-#if PLATFORM(COCOA) && HAVE(SYSTEM_FEATURE_FLAGS)
+#if PLATFORM(COCOA)
#import <Foundation/NSBundle.h>
@@ -38,22 +38,31 @@
namespace WebKit {
// Because of <rdar://problem/60608008>, WebKit has to parse the feature flags plist file
-bool isFeatureFlagEnabled(const String& featureName)
+bool isFeatureFlagEnabled(const String& featureName, bool defaultValue)
{
- static bool isWebKitBundleFromStagedFramework = [] {
- NSBundle *webkit2Bundle = [NSBundle bundleForClass:NSClassFromString(@"WKWebView")];
- return [webkit2Bundle.bundlePath hasPrefix:@"/Library/Apple/System/Library/StagedFrameworks/Safari/"];
+#if HAVE(SYSTEM_FEATURE_FLAGS)
+
+#if PLATFORM(MAC)
+ static bool isSystemWebKit = [] {
+ NSBundle *bundle = [NSBundle bundleForClass:NSClassFromString(@"WKWebView")];
+ return [bundle.bundlePath hasPrefix:@"/System/"];
}();
- if (!isWebKitBundleFromStagedFramework)
- return _os_feature_enabled_impl("WebKit", (const char*)featureName.utf8().data());
+ if (isSystemWebKit)
+ return _os_feature_enabled_impl("WebKit", (const char*)featureName.characters8());
- static NeverDestroyed<RetainPtr<NSDictionary>> dictionary = [NSDictionary dictionaryWithContentsOfFile:@"/Library/Apple/System/Library/FeatureFlags/Domain/WebKit.plist"];
+ return defaultValue;
+#else
+ UNUSED_PARAM(defaultValue);
+ return _os_feature_enabled_impl("WebKit", (const char*)featureName.characters8());
+#endif // PLATFORM(MAC)
- if (![[dictionary.get() objectForKey:featureName] objectForKey:@"Enabled"])
- return _os_feature_enabled_impl("WebKit", (const char*)featureName.characters8());
+#else
- return [[[dictionary.get() objectForKey:featureName] objectForKey:@"Enabled"] isKindOfClass:[NSNumber class]] && [[[dictionary.get() objectForKey:featureName] objectForKey:@"Enabled"] boolValue];
+ UNUSED_PARAM(featureName);
+ return defaultValue;
+
+#endif // HAVE(SYSTEM_FEATURE_FLAGS)
}
} // namespace WebKit
Modified: trunk/Source/WebKit/Shared/WebPreferencesDefaultValues.cpp (280725 => 280726)
--- trunk/Source/WebKit/Shared/WebPreferencesDefaultValues.cpp 2021-08-06 16:25:55 UTC (rev 280725)
+++ trunk/Source/WebKit/Shared/WebPreferencesDefaultValues.cpp 2021-08-06 16:38:28 UTC (rev 280726)
@@ -41,6 +41,13 @@
namespace WebKit {
+#if !PLATFORM(COCOA)
+bool isFeatureFlagEnabled(const String&, bool defaultValue)
+{
+ return defaultValue;
+}
+#endif
+
#if PLATFORM(IOS_FAMILY)
bool defaultPassiveTouchListenersAsDefaultOnDocument()
@@ -108,15 +115,13 @@
return true;
#endif
-#if HAVE(SYSTEM_FEATURE_FLAGS)
- return isFeatureFlagEnabled("async_frame_and_overflow_scrolling");
-#endif
-
#if PLATFORM(MAC)
- return true;
+ bool defaultValue = true;
+#else
+ bool defaultValue = false;
#endif
- return false;
+ return isFeatureFlagEnabled("async_frame_and_overflow_scrolling", defaultValue);
}
bool defaultAsyncFrameScrollingEnabled()
@@ -150,49 +155,33 @@
bool defaultUseGPUProcessForCanvasRenderingEnabled()
{
#if ENABLE(GPU_PROCESS_BY_DEFAULT)
-#if HAVE(SYSTEM_FEATURE_FLAGS)
- return isFeatureFlagEnabled("gpu_process_canvas_rendering");
+ bool defaultValue = true;
#else
- return true;
-#endif // HAVE(SYSTEM_FEATURE_FLAGS)
-#else
- return false;
+ bool defaultValue = false;
#endif
+
+ return isFeatureFlagEnabled("gpu_process_canvas_rendering", defaultValue);
}
bool defaultUseGPUProcessForDOMRenderingEnabled()
{
-#if ENABLE(GPU_PROCESS_BY_DEFAULT)
-#if HAVE(SYSTEM_FEATURE_FLAGS)
- return isFeatureFlagEnabled("gpu_process_dom_rendering");
-#else
- return false;
-#endif // HAVE(SYSTEM_FEATURE_FLAGS)
-#else
- return false;
-#endif
+ return isFeatureFlagEnabled("gpu_process_dom_rendering", false);
}
bool defaultUseGPUProcessForMediaEnabled()
{
#if ENABLE(GPU_PROCESS_BY_DEFAULT)
-#if HAVE(SYSTEM_FEATURE_FLAGS)
- return isFeatureFlagEnabled("gpu_process_media");
+ bool defaultValue = true;
#else
- return true;
-#endif // HAVE(SYSTEM_FEATURE_FLAGS)
-#else
- return false;
+ bool defaultValue = false;
#endif
+
+ return isFeatureFlagEnabled("gpu_process_media", defaultValue);
}
bool defaultUseGPUProcessForWebGLEnabled()
{
-#if HAVE(SYSTEM_FEATURE_FLAGS)
- return isFeatureFlagEnabled("gpu_process_webgl");
-#endif
-
- return false;
+ return isFeatureFlagEnabled("gpu_process_webgl", false);
}
#endif // ENABLE(GPU_PROCESS)
@@ -202,19 +191,17 @@
bool defaultCaptureAudioInGPUProcessEnabled()
{
#if ENABLE(GPU_PROCESS_BY_DEFAULT)
+ bool defaultValue = true;
+#else
+ bool defaultValue = false;
+#endif
-#if HAVE(SYSTEM_FEATURE_FLAGS)
#if PLATFORM(MAC)
- return isFeatureFlagEnabled("gpu_process_webrtc");
+ return isFeatureFlagEnabled("gpu_process_webrtc", defaultValue);
#elif PLATFORM(IOS_FAMILY)
- return isFeatureFlagEnabled("gpu_process_media");
-#endif
+ return isFeatureFlagEnabled("gpu_process_media", defaultValue);
#else
- return true;
-#endif // HAVE(SYSTEM_FEATURE_FLAGS)
-
-#else
- return false;
+ return defaultValue;
#endif
}
@@ -230,14 +217,12 @@
bool defaultCaptureVideoInGPUProcessEnabled()
{
#if ENABLE(GPU_PROCESS_BY_DEFAULT)
-#if HAVE(SYSTEM_FEATURE_FLAGS)
- return isFeatureFlagEnabled("gpu_process_webrtc");
+ bool defaultValue = true;
#else
- return true;
-#endif // HAVE(SYSTEM_FEATURE_FLAGS)
-#else
- return false;
+ bool defaultValue = false;
#endif
+
+ return isFeatureFlagEnabled("gpu_process_webrtc", defaultValue);
}
#endif // ENABLE(MEDIA_STREAM)
@@ -247,39 +232,26 @@
bool defaultWebRTCCodecsInGPUProcess()
{
#if ENABLE(GPU_PROCESS_BY_DEFAULT)
-#if HAVE(SYSTEM_FEATURE_FLAGS)
- return isFeatureFlagEnabled("gpu_process_webrtc");
+ bool defaultValue = true;
#else
- return true;
-#endif // HAVE(SYSTEM_FEATURE_FLAGS)
-#else
- return false;
+ bool defaultValue = false;
#endif
+
+ return isFeatureFlagEnabled("gpu_process_webrtc", defaultValue);
}
#endif // ENABLE(WEB_RTC)
-bool defaultInAppBrowserPrivacy()
-{
-#if HAVE(SYSTEM_FEATURE_FLAGS)
- return isFeatureFlagEnabled("InAppBrowserPrivacy");
-#endif
-
- return false;
-}
-
#if HAVE(INCREMENTAL_PDF_APIS)
bool defaultIncrementalPDFEnabled()
{
-#if HAVE(SYSTEM_FEATURE_FLAGS)
- return isFeatureFlagEnabled("incremental_pdf");
-#endif
-
#if PLATFORM(MAC)
- return true;
+ bool defaultValue = true;
#else
- return false;
+ bool defaultValue = false;
#endif
+
+ return isFeatureFlagEnabled("incremental_pdf", defaultValue);
}
#endif
@@ -300,15 +272,13 @@
bool defaultWebMFormatReaderEnabled()
{
-#if HAVE(SYSTEM_FEATURE_FLAGS)
- return isFeatureFlagEnabled("webm_format_reader");
-#endif
-
#if PLATFORM(MAC)
- return true;
+ bool defaultValue = true;
#else
- return false;
+ bool defaultValue = false;
#endif
+
+ return isFeatureFlagEnabled("webm_format_reader", defaultValue);
}
#endif // ENABLE(WEBM_FORMAT_READER)
@@ -317,29 +287,17 @@
bool defaultVP8DecoderEnabled()
{
-#if HAVE(SYSTEM_FEATURE_FLAGS)
- return isFeatureFlagEnabled("vp8_decoder");
-#endif
-
- return false;
+ return isFeatureFlagEnabled("vp8_decoder", true);
}
bool defaultVP9DecoderEnabled()
{
-#if HAVE(SYSTEM_FEATURE_FLAGS)
- return isFeatureFlagEnabled("vp9_decoder");
-#endif
-
- return true;
+ return isFeatureFlagEnabled("vp9_decoder", true);
}
bool defaultVP9SWDecoderEnabledOnBattery()
{
-#if HAVE(SYSTEM_FEATURE_FLAGS)
- return isFeatureFlagEnabled("sw_vp9_decoder_on_battery");
-#endif
-
- return false;
+ return isFeatureFlagEnabled("sw_vp9_decoder_on_battery", false);
}
#endif // ENABLE(VP9)
@@ -347,20 +305,12 @@
bool defaultWebMParserEnabled()
{
-#if HAVE(SYSTEM_FEATURE_FLAGS)
- return isFeatureFlagEnabled("webm_parser");
-#endif
-
- return true;
+ return isFeatureFlagEnabled("webm_parser", true);
}
bool defaultWebMWebAudioEnabled()
{
-#if HAVE(SYSTEM_FEATURE_FLAGS)
- return isFeatureFlagEnabled("webm_webaudio");
-#endif
-
- return false;
+ return isFeatureFlagEnabled("webm_webaudio", false);
}
#endif // ENABLE(MEDIA_SOURCE)
Modified: trunk/Source/WebKit/Shared/WebPreferencesDefaultValues.h (280725 => 280726)
--- trunk/Source/WebKit/Shared/WebPreferencesDefaultValues.h 2021-08-06 16:25:55 UTC (rev 280725)
+++ trunk/Source/WebKit/Shared/WebPreferencesDefaultValues.h 2021-08-06 16:38:28 UTC (rev 280726)
@@ -35,9 +35,7 @@
namespace WebKit {
-#if HAVE(SYSTEM_FEATURE_FLAGS)
-bool isFeatureFlagEnabled(const String&);
-#endif
+bool isFeatureFlagEnabled(const String&, bool defaultValue = false);
#if PLATFORM(IOS_FAMILY)
bool defaultPassiveTouchListenersAsDefaultOnDocument();
@@ -85,8 +83,6 @@
bool defaultWebRTCCodecsInGPUProcess();
#endif
-bool defaultInAppBrowserPrivacy();
-
#if HAVE(INCREMENTAL_PDF_APIS)
bool defaultIncrementalPDFEnabled();
#endif
Modified: trunk/Source/WebKit/UIProcess/WebPageProxy.cpp (280725 => 280726)
--- trunk/Source/WebKit/UIProcess/WebPageProxy.cpp 2021-08-06 16:25:55 UTC (rev 280725)
+++ trunk/Source/WebKit/UIProcess/WebPageProxy.cpp 2021-08-06 16:38:28 UTC (rev 280726)
@@ -8239,7 +8239,7 @@
parameters.shouldEnableVP9Decoder = preferences().vp9DecoderEnabled();
#if ENABLE(VP9) && PLATFORM(COCOA)
// FIXME: This is also being passed over the to WebProcess via the PreferencesStore.
- parameters.shouldEnableVP8Decoder = preferences().vp9DecoderEnabled();
+ parameters.shouldEnableVP8Decoder = preferences().vp8DecoderEnabled();
// FIXME: This is also being passed over the to WebProcess via the PreferencesStore.
parameters.shouldEnableVP9SWDecoder = preferences().vp9DecoderEnabled() && (!WebCore::systemHasBattery() || preferences().vp9SWDecoderEnabledOnBattery());
#endif
Modified: trunk/Source/WebKitLegacy/mac/ChangeLog (280725 => 280726)
--- trunk/Source/WebKitLegacy/mac/ChangeLog 2021-08-06 16:25:55 UTC (rev 280725)
+++ trunk/Source/WebKitLegacy/mac/ChangeLog 2021-08-06 16:38:28 UTC (rev 280726)
@@ -1,3 +1,31 @@
+2021-08-06 Peng Liu <[email protected]>
+
+ [macOS] Clean up Feature Flags related code
+ https://bugs.webkit.org/show_bug.cgi?id=228803
+ <rdar://problem/81142982>
+
+ Reviewed by Tim Horton.
+
+ On macOS, Safari Technology Preview or a local build WebKit/Safari will always
+ get the default preference values through the "Feature Flags" SPI. Unfortunately,
+ this approach won't work if the OS does not provide correct default preference values.
+
+ With this patch, we only get default preference values with the SPI for system
+ WebKit on macOS. For all other cases, we use hardcoded values. So that
+ WebKit will always get the correct default preference values.
+
+ This patch also fixes a few mistakes in two preferences: "webm_webaudio" and "vp8_decoder".
+
+ * WebView/WebPreferencesDefaultValues.h:
+ * WebView/WebPreferencesDefaultValues.mm:
+ (WebKit::isFeatureFlagEnabled):
+ (WebKit::defaultIncrementalPDFEnabled):
+ (WebKit::defaultWebXREnabled):
+ (WebKit::defaultWebMParserEnabled):
+ (WebKit::defaultWebMWebAudioEnabled):
+ (WebKit::defaultVP8DecoderEnabled):
+ (WebKit::defaultVP9DecoderEnabled):
+
2021-08-05 Cameron McCormack <[email protected]>
Stop tracking form elements with FormController
Modified: trunk/Source/WebKitLegacy/mac/WebView/WebPreferencesDefaultValues.h (280725 => 280726)
--- trunk/Source/WebKitLegacy/mac/WebView/WebPreferencesDefaultValues.h 2021-08-06 16:25:55 UTC (rev 280725)
+++ trunk/Source/WebKitLegacy/mac/WebView/WebPreferencesDefaultValues.h 2021-08-06 16:38:28 UTC (rev 280726)
@@ -35,8 +35,8 @@
namespace WebKit {
-#if PLATFORM(COCOA) && HAVE(SYSTEM_FEATURE_FLAGS)
-bool isFeatureFlagEnabled(const String&);
+#if PLATFORM(COCOA)
+bool isFeatureFlagEnabled(const String&, bool defaultValue = false);
#endif
#if HAVE(INCREMENTAL_PDF_APIS)
Modified: trunk/Source/WebKitLegacy/mac/WebView/WebPreferencesDefaultValues.mm (280725 => 280726)
--- trunk/Source/WebKitLegacy/mac/WebView/WebPreferencesDefaultValues.mm 2021-08-06 16:25:55 UTC (rev 280725)
+++ trunk/Source/WebKitLegacy/mac/WebView/WebPreferencesDefaultValues.mm 2021-08-06 16:38:28 UTC (rev 280726)
@@ -42,22 +42,34 @@
namespace WebKit {
-#if PLATFORM(COCOA) && HAVE(SYSTEM_FEATURE_FLAGS)
+#if PLATFORM(COCOA)
// Because of <rdar://problem/60608008>, WebKit has to parse the feature flags plist file
-bool isFeatureFlagEnabled(const String& featureName)
+bool isFeatureFlagEnabled(const String& featureName, bool defaultValue)
{
- BOOL isWebKitBundleFromStagedFramework = [[[NSBundle mainBundle] bundlePath] hasPrefix:@"/Library/Apple/System/Library/StagedFrameworks/WebKit"];
+#if HAVE(SYSTEM_FEATURE_FLAGS)
- if (!isWebKitBundleFromStagedFramework)
- return _os_feature_enabled_impl("WebKit", (const char*)featureName.utf8().data());
+#if PLATFORM(MAC)
+ static bool isSystemWebKit = [] {
+ NSBundle *bundle = [NSBundle bundleForClass:NSClassFromString(@"WebView")];
+ return [bundle.bundlePath hasPrefix:@"/System/"];
+ }();
- static NeverDestroyed<RetainPtr<NSDictionary>> dictionary = [NSDictionary dictionaryWithContentsOfFile:@"/Library/Apple/System/Library/FeatureFlags/Domain/WebKit.plist"];
-
- if (![[dictionary.get() objectForKey:featureName] objectForKey:@"Enabled"])
+ if (isSystemWebKit)
return _os_feature_enabled_impl("WebKit", (const char*)featureName.characters8());
- return [[[dictionary.get() objectForKey:featureName] objectForKey:@"Enabled"] isKindOfClass:[NSNumber class]] && [[[dictionary.get() objectForKey:featureName] objectForKey:@"Enabled"] boolValue];
+ return defaultValue;
+#else
+ UNUSED_PARAM(defaultValue);
+ return _os_feature_enabled_impl("WebKit", (const char*)featureName.characters8());
+#endif // PLATFORM(MAC)
+
+#else
+
+ UNUSED_PARAM(featureName);
+ return defaultValue;
+
+#endif // HAVE(SYSTEM_FEATURE_FLAGS)
}
#endif
@@ -66,11 +78,7 @@
bool defaultIncrementalPDFEnabled()
{
-#if HAVE(SYSTEM_FEATURE_FLAGS)
- return isFeatureFlagEnabled("incremental_pdf");
-#endif
-
- return false;
+ return isFeatureFlagEnabled("incremental_pdf", false);
}
#endif
@@ -79,11 +87,7 @@
bool defaultWebXREnabled()
{
-#if HAVE(SYSTEM_FEATURE_FLAGS)
- return isFeatureFlagEnabled("WebXR");
-#endif
-
- return false;
+ return isFeatureFlagEnabled("WebXR", false);
}
#endif // ENABLE(WEBXR)
@@ -278,20 +282,12 @@
bool defaultWebMParserEnabled()
{
-#if HAVE(SYSTEM_FEATURE_FLAGS)
- return isFeatureFlagEnabled("webm_parser");
-#endif
-
- return true;
+ return isFeatureFlagEnabled("webm_parser", true);
}
bool defaultWebMWebAudioEnabled()
{
-#if HAVE(SYSTEM_FEATURE_FLAGS)
- return isFeatureFlagEnabled("webm_webaudio");
-#endif
-
- return false;
+ return isFeatureFlagEnabled("webm_webaudio", false);
}
#endif // ENABLE(MEDIA_SOURCE)
@@ -300,20 +296,12 @@
bool defaultVP8DecoderEnabled()
{
-#if HAVE(SYSTEM_FEATURE_FLAGS)
- return isFeatureFlagEnabled("vp8_decoder");
-#endif
-
- return false;
+ return isFeatureFlagEnabled("vp8_decoder", true);
}
bool defaultVP9DecoderEnabled()
{
-#if HAVE(SYSTEM_FEATURE_FLAGS)
- return isFeatureFlagEnabled("vp9_decoder");
-#endif
-
- return true;
+ return isFeatureFlagEnabled("vp9_decoder", true);
}
#endif // ENABLE(VP9)