WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
228803
[macOS] Clean up Feature Flags related code
https://bugs.webkit.org/show_bug.cgi?id=228803
Summary
[macOS] Clean up Feature Flags related code
Peng Liu
Reported
2021-08-04 15:29:55 PDT
[macOS] Clean up Feature Flags related code
Attachments
Patch
(17.23 KB, patch)
2021-08-04 15:39 PDT
,
Peng Liu
no flags
Details
Formatted Diff
Diff
Revise the patch based on Simon's comments
(16.94 KB, patch)
2021-08-04 16:06 PDT
,
Peng Liu
no flags
Details
Formatted Diff
Diff
Update change logs
(16.90 KB, patch)
2021-08-04 16:12 PDT
,
Peng Liu
no flags
Details
Formatted Diff
Diff
Update change logs
(17.67 KB, patch)
2021-08-04 22:47 PDT
,
Peng Liu
no flags
Details
Formatted Diff
Diff
Fix a layout test failure
(19.38 KB, patch)
2021-08-05 10:07 PDT
,
Peng Liu
no flags
Details
Formatted Diff
Diff
Revise the patch based on Kate's comment
(19.55 KB, patch)
2021-08-05 11:04 PDT
,
Peng Liu
no flags
Details
Formatted Diff
Diff
Update a layout test expectation
(20.81 KB, patch)
2021-08-05 14:08 PDT
,
Peng Liu
ews-feeder
: commit-queue-
Details
Formatted Diff
Diff
Revise the patch based on Tim's comments
(24.76 KB, patch)
2021-08-05 16:51 PDT
,
Peng Liu
no flags
Details
Formatted Diff
Diff
Update changelogs
(24.98 KB, patch)
2021-08-05 17:00 PDT
,
Peng Liu
no flags
Details
Formatted Diff
Diff
Rebase a test expectation for BigSur
(25.13 KB, patch)
2021-08-05 21:43 PDT
,
Peng Liu
no flags
Details
Formatted Diff
Diff
Show Obsolete
(8)
View All
Add attachment
proposed patch, testcase, etc.
Peng Liu
Comment 1
2021-08-04 15:37:38 PDT
<
rdar://81142982
>
Peng Liu
Comment 2
2021-08-04 15:39:05 PDT
Created
attachment 434944
[details]
Patch
Peng Liu
Comment 3
2021-08-04 15:42:57 PDT
Comment on
attachment 434944
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=434944&action=review
> Source/WebKit/ChangeLog:8 > + For system WebKit and staged framework, we use the Feature Flags SPI to
The comment is not accurate. For staged framework, webkit parses the plist file instead of using the SPI.
Simon Fraser (smfr)
Comment 4
2021-08-04 15:49:29 PDT
Comment on
attachment 434944
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=434944&action=review
> Source/WebKit/Shared/Cocoa/WebPreferencesDefaultValuesCocoa.mm:50 > + const static NSBundle *bundle = [NSBundle bundleForClass:NSClassFromString(@"WKWebView")]; > + > + static bool isSystemWebKit = [] { > + return [bundle.bundlePath hasPrefix:@"/System/"]; > + }();
Use AuxiliaryProcess::isSystemWebKit() which also had some logic for readonly system volumes?
> Source/WebKit/Shared/Cocoa/WebPreferencesDefaultValuesCocoa.mm:60 > if (!isWebKitBundleFromStagedFramework) > - return _os_feature_enabled_impl("WebKit", (const char*)featureName.utf8().data()); > + return defaultValue;
I would prefer you write this as: if (isWebKitBundleFromStagedFramework) { ... read from /Library/Apple/System/Library/FeatureFlags/Domain/WebKit.plist return; }
> Source/WebKit/Shared/Cocoa/WebPreferencesDefaultValuesCocoa.mm:65 > return _os_feature_enabled_impl("WebKit", (const char*)featureName.characters8());
I think it would make more sense here to return defaultValue?
> Source/WebKitLegacy/mac/WebView/WebPreferencesDefaultValues.mm:48 > +bool isFeatureFlagEnabled(const String& featureName, bool defaultValue)
I wish we could share this code. But make it identical.
Peng Liu
Comment 5
2021-08-04 15:55:21 PDT
Comment on
attachment 434944
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=434944&action=review
>> Source/WebKit/Shared/Cocoa/WebPreferencesDefaultValuesCocoa.mm:50 >> + }(); > > Use AuxiliaryProcess::isSystemWebKit() which also had some logic for readonly system volumes?
Yes. But it will return true for staged framework.
>> Source/WebKit/Shared/Cocoa/WebPreferencesDefaultValuesCocoa.mm:60 >> + return defaultValue; > > I would prefer you write this as: > > if (isWebKitBundleFromStagedFramework) { > ... read from /Library/Apple/System/Library/FeatureFlags/Domain/WebKit.plist > return; > }
Sounds a good idea considering the next comment.
>> Source/WebKit/Shared/Cocoa/WebPreferencesDefaultValuesCocoa.mm:65 >> return _os_feature_enabled_impl("WebKit", (const char*)featureName.characters8()); > > I think it would make more sense here to return defaultValue?
Yeah, that seems better.
>> Source/WebKitLegacy/mac/WebView/WebPreferencesDefaultValues.mm:48 >> +bool isFeatureFlagEnabled(const String& featureName, bool defaultValue) > > I wish we could share this code. But make it identical.
Agree.
Peng Liu
Comment 6
2021-08-04 16:06:00 PDT
Created
attachment 434948
[details]
Revise the patch based on Simon's comments
Peng Liu
Comment 7
2021-08-04 16:12:41 PDT
Created
attachment 434951
[details]
Update change logs
Tim Horton
Comment 8
2021-08-04 17:23:47 PDT
Comment on
attachment 434951
[details]
Update change logs View in context:
https://bugs.webkit.org/attachment.cgi?id=434951&action=review
> Source/WebKit/ChangeLog:10 > + For other cases, let's use hardcoded values.
This could use more words, we have a /strong/ motivation.
> Source/WebKit/Shared/WebPreferencesDefaultValues.cpp:258 > + // TODO: double check
This looks fine to me (since it's inside HAVE(INCREMENTAL_PDF_APIS); if you've got them, we want to use them.)
> Source/WebKitLegacy/mac/WebView/WebPreferencesDefaultValues.mm:81 > + // TODO: double check
Yeah, we don't have support in WebKitLegacy so this is right.
> Source/WebKitLegacy/mac/WebView/WebPreferencesDefaultValues.mm:92 > + // TODO: double check > + return isFeatureFlagEnabled("WebXR", false);
This is right
Peng Liu
Comment 9
2021-08-04 22:47:28 PDT
Created
attachment 434964
[details]
Update change logs
Peng Liu
Comment 10
2021-08-05 10:07:02 PDT
Created
attachment 434999
[details]
Fix a layout test failure
Kate Cheney
Comment 11
2021-08-05 10:52:49 PDT
Comment on
attachment 434999
[details]
Fix a layout test failure View in context:
https://bugs.webkit.org/attachment.cgi?id=434999&action=review
> Source/WebKit/Shared/WebPreferencesDefaultValues.cpp:245 > bool defaultInAppBrowserPrivacy()
It doesn't seem like this function is used anywhere. I think we can remove it.
Peng Liu
Comment 12
2021-08-05 11:04:41 PDT
Created
attachment 435010
[details]
Revise the patch based on Kate's comment
Peng Liu
Comment 13
2021-08-05 11:06:01 PDT
Comment on
attachment 434999
[details]
Fix a layout test failure View in context:
https://bugs.webkit.org/attachment.cgi?id=434999&action=review
>> Source/WebKit/Shared/WebPreferencesDefaultValues.cpp:245 >> bool defaultInAppBrowserPrivacy() > > It doesn't seem like this function is used anywhere. I think we can remove it.
Yes! Removed. I will remove the corresponding item in WebKit.plist in a follow-up patch.
Peng Liu
Comment 14
2021-08-05 14:08:06 PDT
Created
attachment 435023
[details]
Update a layout test expectation
Tim Horton
Comment 15
2021-08-05 14:25:23 PDT
Comment on
attachment 435023
[details]
Update a layout test expectation View in context:
https://bugs.webkit.org/attachment.cgi?id=435023&action=review
I really hope we can get rid of this ASAP
> Source/WebKit/Shared/WebPreferencesDefaultValues.cpp:122 > #if PLATFORM(MAC) > - return true; > + bool defaultValue = true; > +#else > + bool defaultValue = false; > #endif
This is wrong, async_frame_and_overflow_scrolling should be on everywhere (confirm with smfr, but the plists agree)
> Source/WebKit/Shared/WebPreferencesDefaultValues.cpp:313 > + return isFeatureFlagEnabled("webm_webaudio", false);
Why is this `false` here if it's `true` in the plist? That means that a local build will have it off on Monterey even though it's on in the system WebKit, and seems wrong.
> Source/WebKitLegacy/mac/WebView/WebPreferencesDefaultValues.mm:54 > + NSBundle *bundle = [NSBundle bundleForClass:NSClassFromString(@"WKWebView")];
It seems exceedingly bizarre that WebKitLegacy looks up WKWebView; maybe you should use WebView here? (what does other code do?)
> Source/WebKitLegacy/mac/WebView/WebPreferencesDefaultValues.mm:290 > + return isFeatureFlagEnabled("webm_webaudio", false);
Why is this `false` here if it's `true` in the plist? That means that a local build will have it off on Monterey even though it's on in the system WebKit, and seems wrong.
> Source/WebKitLegacy/mac/WebView/WebPreferencesDefaultValues.mm:299 > -#if HAVE(SYSTEM_FEATURE_FLAGS) > - return isFeatureFlagEnabled("vp8_decoder"); > -#endif > - > - return false; > + return isFeatureFlagEnabled("vp8_decoder", false);
This key does not exist in any of the feature flags plists, so this should not use isFeatureFlagEnabled, should just return false (at which point you should get rid of the function and just put the `false` in WebPreferences.yaml directly).
Tim Horton
Comment 16
2021-08-05 14:35:59 PDT
Comment on
attachment 435023
[details]
Update a layout test expectation View in context:
https://bugs.webkit.org/attachment.cgi?id=435023&action=review
>> Source/WebKit/Shared/WebPreferencesDefaultValues.cpp:122 >> #endif > > This is wrong, async_frame_and_overflow_scrolling should be on everywhere (confirm with smfr, but the plists agree)
Ah, simon points out the #ifdef above covers iOS
Peng Liu
Comment 17
2021-08-05 16:41:07 PDT
Comment on
attachment 435023
[details]
Update a layout test expectation View in context:
https://bugs.webkit.org/attachment.cgi?id=435023&action=review
>> Source/WebKit/Shared/WebPreferencesDefaultValues.cpp:313 >> + return isFeatureFlagEnabled("webm_webaudio", false); > > Why is this `false` here if it's `true` in the plist? That means that a local build will have it off on Monterey even though it's on in the system WebKit, and seems wrong.
It was a mistake to enable `webm_webaudio` through the plist file. I will remove it from the WebKit.plist for appletvOS, watchOS, and tvOS, and change its value to false in WebKit-macOS.plist.
>> Source/WebKitLegacy/mac/WebView/WebPreferencesDefaultValues.mm:54 >> + NSBundle *bundle = [NSBundle bundleForClass:NSClassFromString(@"WKWebView")]; > > It seems exceedingly bizarre that WebKitLegacy looks up WKWebView; maybe you should use WebView here? (what does other code do?)
Good catch. Will fix it. Thanks!
>> Source/WebKitLegacy/mac/WebView/WebPreferencesDefaultValues.mm:290 >> + return isFeatureFlagEnabled("webm_webaudio", false); > > Why is this `false` here if it's `true` in the plist? That means that a local build will have it off on Monterey even though it's on in the system WebKit, and seems wrong.
Will fix. Actually this feature should be disabled.
>> Source/WebKitLegacy/mac/WebView/WebPreferencesDefaultValues.mm:299 >> + return isFeatureFlagEnabled("vp8_decoder", false); > > This key does not exist in any of the feature flags plists, so this should not use isFeatureFlagEnabled, should just return false (at which point you should get rid of the function and just put the `false` in WebPreferences.yaml directly).
Will add an item to the plist files to enable it.
Peng Liu
Comment 18
2021-08-05 16:51:35 PDT
Created
attachment 435039
[details]
Revise the patch based on Tim's comments
Peng Liu
Comment 19
2021-08-05 17:00:14 PDT
Created
attachment 435040
[details]
Update changelogs
Peng Liu
Comment 20
2021-08-05 21:43:12 PDT
Created
attachment 435055
[details]
Rebase a test expectation for BigSur
Peng Liu
Comment 21
2021-08-06 09:32:01 PDT
The test failure (fast/speechrecognition/start-recognition-twice-exception.html) is not relevant to this patch.
EWS
Comment 22
2021-08-06 09:38:35 PDT
Committed
r280726
(
240316@main
): <
https://commits.webkit.org/240316@main
> All reviewed patches have been landed. Closing bug and clearing flags on
attachment 435055
[details]
.
Truitt Savell
Comment 23
2021-08-09 15:05:50 PDT
Looks like the changes here broke 25 imported/w3c/web-platform-tests/fetch/ tests, tracking in
https://bugs.webkit.org/show_bug.cgi?id=228926
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug