Skip to content

Commit

Permalink
Generate web preferences using feature status taxonomy
Browse files Browse the repository at this point in the history
https://bugs.webkit.org/show_bug.cgi?id=247926
rdar://92112770

Reviewed by Brent Fulgham.

Merge WebPreferences*.yaml into UnifiedWebPreferences.yaml. Insteading
of using different preference files to distinguish between experimental
features, internal features, and debug preferences, each preference has
a `status` field that determines where it ends up. The status field was
introduced as WebKit::API::FeatureStatus in
https://commits.webkit.org/257166@main, and current statuses were
generated by surveying Safari/WebKit contributors at Apple.

Feature status determines whether a preference is ephemeral, or backed
by persistent storage. It currently determines which of the preexisting
experimental / internal debug API declarations a preference appears in.

Future work will expose a new interface for clients to see *all* exposed
features, grouping them by status, and will replace the preexisting
ExperimentalFeatures/InternalDebugFeatures listings with views onto the
main list.

* Source/WTF/Scripts/GeneratePreferences.rb:
  - Remove the base/debug/experimental/internal distinctions, and just
    parse an arbitrary list of preference files.
  - Parse feature statuses, and add methods for preference templates to
    query them.
  - Add support for automatically static_casting enum preferences to
    their unrefined type. It's still not possible for a UI-visible
    feature to be anything other than a boolean toggle, which limits the
    features that can be marked as "internal", "developer", "testable",
    "preview", and "stable".
  - Small quality of life changes, such as the ability to output _all_
    the parse errors in a single run of the generator script.

* Source/WTF/Scripts/Preferences/WebPreferences.yaml: Removed.
* Source/WTF/Scripts/Preferences/WebPreferencesDebug.yaml: Removed.
* Source/WTF/Scripts/Preferences/WebPreferencesExperimental.yaml: Removed.
* Source/WTF/Scripts/Preferences/WebPreferencesInternal.yaml: Removed.
* Source/WTF/Scripts/Preferences/UnifiedWebPreferences.yaml: Added. Make
  some fixes and status changes to the initial version of this file
  generated from the survey. The main categories of fixes are:
  - Any preference which can be exposed in UI (including "internal"
    features) needs a human-readable name.
  - Any preference exposed beyond WebCore needs defaults values for
    WebKit and WebKitLegacy.
  - Preferences with "custom" bindings that were merely static_casts now
    use the automatic static_cast support provided by the generator
    script.
  - Non-boolean preferences can't be exposed as an "experimental" or
    "internal debug" feature yet. For now, these are reclassified as
    "embedder" preferences.
  As a test fixup: Service workers are not implemented for WebKitLegacy,
  and ServiceWorkersEnabled's new status of "developer" was causing the
  setting to be errantly turned on in DumpRenderTree. There's no reason
  for this flag to be exposed at all in WKL, so hide it.

* Source/WTF/WTF.xcodeproj/project.pbxproj: Update file references.
* Source/WTF/wtf/CMakeLists.txt: Update file references.

* Source/WebCore/CMakeLists.txt: Update GenerateSettings.rb invocation.
  Inline the settings macro since this is the only place we use it.
* Source/WebCore/DerivedSources-input.xcfilelist: Update file
  references.
* Source/WebCore/DerivedSources.make: Update file references and
  GenerateSettings.rb invocation.
* Source/WebCore/Scripts/GenerateSettings.rb: Update to consume the
  unified preferences file. The WebCore-only Settings.yaml still hosts
  non-feature settings. These don't need a status assigned to them;
  WebCore::Settings doesn't use the feature status field and these are
  never exposed in API (if they were, we'd probably consider them all
  "embedder settings").
* Source/WebCore/WebCoreMacros.cmake: Remove settings macro, no longer
  used.
* Source/WebCore/WebCore.xcodeproj/project.pbxproj: Update file
  references.

* Source/WebKit/CMakeLists.txt: Update GenerateSettings.rb invocation.
* Source/WebKit/DerivedSources-input.xcfilelist: Update file references.
* Source/WebKit/DerivedSources.make: Update file references and
  GenerateSettings.rb invocation.

* Source/WebKit/Scripts/PreferencesTemplates/WebPageUpdatePreferences.cpp.erb:
  Automatic static_casting.
* Source/WebKit/Scripts/PreferencesTemplates/WebPreferencesDefinitions.h.erb:
  Replace "Internal Debug" and "Experimental" classifications with
  status-based categories.
* Source/WebKit/Scripts/PreferencesTemplates/WebPreferencesExperimentalFeatures.cpp.erb:
  Use statuses to determine what constitutes an "experimental feature".
* Source/WebKit/Scripts/PreferencesTemplates/WebPreferencesGetterSetters.cpp.erb:
  Enumerate the entire list of exposed preferences. Instead of calling
  special updateBoolValueForFeatureKey functions for experimental or
  internal-debug features, pass an "ephemeral?" flag into the main
  updateValueForKey which determines whether the update should be
  persisted into user defaults.
* Source/WebKit/Scripts/PreferencesTemplates/WebPreferencesInternalDebugFeatures.cpp.erb:
  Use statuses to determine what constitutes an "internal debug" feature.

* Source/WebKit/UIProcess/API/C/WKPreferences.cpp: Pass an "ephemeral"
  flag to set*ValueforKey. To match existing behavior, layout testing
  overrides are set as non-ephemeral. They don't actually cause user
  defaults writes, because the WebPreferences instance used by layout
  tests is non-persistent (doesn't have an identifier).
(WKPreferencesSetBoolValueForKeyForTesting):
(WKPreferencesSetDoubleValueForKeyForTesting):
(WKPreferencesSetUInt32ValueForKeyForTesting):
(WKPreferencesSetStringValueForKeyForTesting):

* Source/WebKit/UIProcess/Cocoa/WebPreferencesCocoa.mm:
(WebKit::WebPreferences::platformInitializeStore): Adopt new
  macro names.
(WebKit::setDebugUInt32ValueIfInUserDefaults): Deleted because no
  persisted preferences use uint32_t values.

* Source/WebKit/UIProcess/WebPreferences.cpp: Instead of calling
  special updateBoolValueForFeatureKey functions for experimental or
  internal-debug features, update the main
  set/updateValueForKey methods to take an "ephemeral?" flag which
  determines whether the update should be persisted into user defaults.
(WebKit::WebPreferences::setBoolValueForKey):
(WebKit::WebPreferences::setDoubleValueForKey):
(WebKit::WebPreferences::setUInt32ValueForKey):
(WebKit::WebPreferences::setStringValueForKey):
(WebKit::WebPreferences::updateStringValueForKey):
(WebKit::WebPreferences::updateBoolValueForKey):
(WebKit::WebPreferences::updateUInt32ValueForKey):
(WebKit::WebPreferences::updateDoubleValueForKey):
(WebKit::WebPreferences::updateFloatValueForKey):
(WebKit::WebPreferences::updateBoolValueForInternalDebugFeatureKey): Deleted.
(WebKit::WebPreferences::updateBoolValueForExperimentalFeatureKey): Deleted.
* Source/WebKit/UIProcess/WebPreferences.h: Ditto above changes.

* Source/WebKitLegacy/WebKitLegacy.xcodeproj/project.pbxproj: Update
  file references.
* Source/WebKitLegacy/PlatformMac.cmake: Update GeneratePreferences.rb
  invocation.
* Source/WebKitLegacy/PlatformWin.cmake: Ditto.
* Source/WebKitLegacy/mac/Scripts/PreferencesTemplates/WebPreferencesExperimentalFeatures.mm.erb:
  Use statuses.
* Source/WebKitLegacy/mac/Scripts/PreferencesTemplates/WebPreferencesInternalFeatures.mm.erb:
  Use statuses.
* Source/WebKitLegacy/mac/Scripts/PreferencesTemplates/WebViewPreferencesChangedGenerated.mm.erb:
  Support automatic static_casting.
* Source/WebKitLegacy/mac/Scripts/generate-preferences.sh: Update
  GeneratePreferences.rb invocation.
* Source/WebKitLegacy/mac/WebView/WebPreferencesDefaultValues.h: Add
  include statement needed for static_casting.

* Source/ThirdParty/libwebrtc/Source/webrtc/modules/rtp_rtcp/source/rtcp_packet/remote_estimate.h:
  An added import revealed a macro name collision in unified sources on
  some versions of macOS. Fix by #undef-ing the unneeded macro.

In TestWebKitAPI, many API tests set features by searching
+[WKPreferences _experimentalFeatures] and +[WKPreferences
_internalDebugFeatures] for a matching key. This is frustratingly
brittle, and because many features are being removed from the
"experimental" UI, these search sites must be updated.

* Tools/TestWebKitAPI/Tests/WebKit/GetUserMedia.mm:
* Tools/TestWebKitAPI/Tests/WebKitCocoa/ProcessSwapOnNavigation.mm:
* Tools/TestWebKitAPI/Tests/WebKitCocoa/SiteIsolation.mm:
(TestWebKitAPI::TEST):
* Tools/TestWebKitAPI/Tests/WebKitCocoa/WebPushDaemon.mm:
* Tools/TestWebKitAPI/Tests/ios/DragAndDropTestsIOS.mm:
(TestWebKitAPI::TEST):

* Tools/DumpRenderTree/DerivedSources-input.xcfilelist: Update file
  references.
* Tools/DumpRenderTree/DerivedSources.make: Update
  GeneratePreferences.rb invocation.
* Tools/WebKitTestRunner/DerivedSources-input.xcfilelist: Ditto.
* Tools/WebKitTestRunner/DerivedSources.make: Ditto.

Update some layout test baselines, and modify some tests to enable a
feature flag that they depend on which was previously in Experimental
Features (and therefore on by default). Going forward, features in the
"testable" status or one of the developer-facing statuses ("developer",
"preview", "stable") are enabled during layout testing.

* LayoutTests/css-custom-properties-api/initialValue.html:
* LayoutTests/fast/css-custom-paint/properties.html:
* LayoutTests/fast/css/css-typed-om/style-property-map-set-CSSMathSum-value.html:
* LayoutTests/fast/images/text-recognition/mac/image-overlay-text-disables-app-highlight-menu-items.html:
* LayoutTests/fast/text/text-edge-with-margin-padding-border-simple.html:
* LayoutTests/highlight/highlight-world-leak.html:
* LayoutTests/http/tests/clear-site-data/bfcache.html:
* LayoutTests/http/tests/misc/favicon-loads-with-images-disabled.html:
* LayoutTests/imported/w3c/web-platform-tests/html/semantics/embedded-content/media-elements/mime-types/canPlayType-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/media-capabilities/decodingInfo.webrtc.html:
* LayoutTests/imported/w3c/web-platform-tests/media-capabilities/encodingInfo.webrtc.html:
* LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/unregister-immediately-during-extendable-events.https.html:
* LayoutTests/media/vp9.html:
* LayoutTests/platform/gtk/fast/dom/navigator-detached-no-crash-expected.txt:
* LayoutTests/platform/mac-wk1/fast/dom/navigator-detached-no-crash-expected.txt:
* LayoutTests/platform/mac-wk2/fast/dom/navigator-detached-no-crash-expected.txt:
* LayoutTests/webgl/webgl-draft-extensions-flag-default.html:
* LayoutTests/webrtc/video-av1.html:
* LayoutTests/webrtc/vp9-vtb.html:

Canonical link: https://commits.webkit.org/258448@main
  • Loading branch information
emw-apple committed Jan 4, 2023
1 parent 54dd464 commit 9def6e6
Show file tree
Hide file tree
Showing 68 changed files with 7,280 additions and 6,925 deletions.
1 change: 1 addition & 0 deletions LayoutTests/css-custom-properties-api/initialValue.html
@@ -1,3 +1,4 @@
<!-- webkit-test-runner [ CSSCustomPropertiesAndValuesEnabled=true ] -->
<html>
<head>
<style>
Expand Down
2 changes: 1 addition & 1 deletion LayoutTests/fast/css-custom-paint/properties.html
@@ -1,4 +1,4 @@
<!DOCTYPE html><!-- webkit-test-runner [ CSSPaintingAPIEnabled=true ] -->
<!DOCTYPE html><!-- webkit-test-runner [ CSSCustomPropertiesAndValuesEnabled=true CSSTypedOMEnabled=true CSSPaintingAPIEnabled=true ] -->
<meta name="author" title="Justin Michaud" href="mailto:justin_michaud@webkit.org">
<meta name="assert" content="Test paint worklet input properties and arguments">
<link rel="help" content="https://drafts.css-houdini.org/css-paint-api-1/">
Expand Down
@@ -1,4 +1,4 @@
<!DOCTYPE html>
<!DOCTYPE html> <!-- webkit-test-runner [ CSSTypedOMEnabled=true ] -->
<html>
<body>
<script src="../../../resources/js-test.js"></script>
Expand Down
@@ -1,4 +1,4 @@
<!DOCTYPE html> <!-- webkit-test-runner [ appHighlightsEnabled=true ] -->
<!DOCTYPE html> <!-- webkit-test-runner [ AppHighlightsEnabled=true ] -->
<html>
<head>
<script src="../../../../resources/js-test.js"></script>
Expand Down Expand Up @@ -74,4 +74,4 @@
text.remove();
});
</script>
</html>
</html>
@@ -1,3 +1,4 @@
<!-- webkit-test-runner [ CSSLeadingTrimEnabled=true ] -->
<style>
div {
font-family: "Arial";
Expand Down
2 changes: 1 addition & 1 deletion LayoutTests/highlight/highlight-world-leak.html
@@ -1,4 +1,4 @@
<!DOCTYPE html>
<!DOCTYPE html> <!-- webkit-test-runner [ HighlightAPIEnabled=true ] -->
<html>
<body>
<script src="../resources/js-test-pre.js"></script>
Expand Down
2 changes: 1 addition & 1 deletion LayoutTests/http/tests/clear-site-data/bfcache.html
@@ -1,4 +1,4 @@
<!-- webkit-test-runner [ UsesBackForwardCache=true ] -->
<!-- webkit-test-runner [ ClearSiteDataHTTPHeaderEnabled=true UsesBackForwardCache=true ] -->
<!DOCTYPE html>
<html>
<body>
Expand Down
@@ -1,4 +1,4 @@
<html><!-- webkit-test-runner [ LoadsImagesAutomatically=false ] -->
<html><!-- webkit-test-runner [ LoadsImagesAutomatically=false LoadsSiteIconsIgnoringImageLoadingPreference=false ] -->
<head>
<script>
function runTest()
Expand Down
Expand Up @@ -5,28 +5,28 @@ PASS application/octet-stream not supported
PASS fictional formats and codecs not supported
PASS audio/mp4 (optional)
PASS audio/mp4; codecs="mp4a.40.2" (optional)
FAIL audio/mp4 with bogus codec assert_equals: audio/mp4; codecs="bogus" expected "" but got "maybe"
PASS audio/mp4 with bogus codec
PASS audio/mp4 with and without codecs
FAIL audio/ogg (optional) assert_equals: audio/ogg expected "maybe" but got ""
FAIL audio/ogg; codecs="opus" (optional) assert_equals: audio/ogg; codecs="opus" expected "probably" but got ""
FAIL audio/ogg; codecs="vorbis" (optional) assert_equals: audio/ogg; codecs="vorbis" expected "probably" but got ""
PASS audio/ogg with bogus codec
PASS audio/ogg with and without codecs
PASS audio/wav (optional)
FAIL audio/wav; codecs="1" (optional) assert_equals: audio/wav; codecs="1" expected "probably" but got "maybe"
FAIL audio/wav with bogus codec assert_equals: audio/wav; codecs="bogus" expected "" but got "maybe"
FAIL audio/wav; codecs="1" (optional) assert_equals: audio/wav; codecs="1" expected "probably" but got ""
PASS audio/wav with bogus codec
FAIL audio/wav with and without codecs assert_equals: expected false but got true
FAIL audio/webm (optional) assert_equals: audio/webm expected "maybe" but got ""
FAIL audio/webm; codecs="opus" (optional) assert_equals: audio/webm; codecs="opus" expected "probably" but got ""
FAIL audio/webm; codecs="vorbis" (optional) assert_equals: audio/webm; codecs="vorbis" expected "probably" but got ""
PASS audio/webm (optional)
PASS audio/webm; codecs="opus" (optional)
PASS audio/webm; codecs="vorbis" (optional)
PASS audio/webm with bogus codec
PASS audio/webm with and without codecs
PASS video/3gpp (optional)
PASS video/3gpp; codecs="samr" (optional)
PASS video/3gpp; codecs="mp4v.20.8" (optional)
PASS video/3gpp codecs subset
PASS video/3gpp codecs order
FAIL video/3gpp with bogus codec assert_equals: video/3gpp; codecs="bogus" expected "" but got "maybe"
PASS video/3gpp with bogus codec
PASS video/3gpp with and without codecs
PASS video/mp4 (optional)
PASS video/mp4; codecs="mp4a.40.2" (optional)
Expand All @@ -38,7 +38,7 @@ PASS video/mp4; codecs="mp4v.20.8" (optional)
PASS video/mp4; codecs="mp4v.20.240" (optional)
PASS video/mp4 codecs subset
PASS video/mp4 codecs order
FAIL video/mp4 with bogus codec assert_equals: video/mp4; codecs="bogus" expected "" but got "maybe"
PASS video/mp4 with bogus codec
PASS video/mp4 with and without codecs
FAIL video/ogg (optional) assert_equals: video/ogg expected "maybe" but got ""
FAIL video/ogg; codecs="opus" (optional) assert_equals: video/ogg; codecs="opus" expected "probably" but got ""
Expand All @@ -48,13 +48,13 @@ PASS video/ogg codecs subset
PASS video/ogg codecs order
PASS video/ogg with bogus codec
PASS video/ogg with and without codecs
FAIL video/webm (optional) assert_equals: video/webm expected "maybe" but got ""
FAIL video/webm; codecs="opus" (optional) assert_equals: video/webm; codecs="opus" expected "probably" but got ""
FAIL video/webm; codecs="vorbis" (optional) assert_equals: video/webm; codecs="vorbis" expected "probably" but got ""
FAIL video/webm; codecs="vp8" (optional) assert_equals: video/webm; codecs="vp8" expected "probably" but got ""
FAIL video/webm; codecs="vp8.0" (optional) assert_equals: video/webm; codecs="vp8.0" expected "probably" but got ""
FAIL video/webm; codecs="vp9" (optional) assert_equals: video/webm; codecs="vp9" expected "probably" but got ""
FAIL video/webm; codecs="vp9.0" (optional) assert_equals: video/webm; codecs="vp9.0" expected "probably" but got ""
PASS video/webm (optional)
PASS video/webm; codecs="opus" (optional)
PASS video/webm; codecs="vorbis" (optional)
PASS video/webm; codecs="vp8" (optional)
PASS video/webm; codecs="vp8.0" (optional)
PASS video/webm; codecs="vp9" (optional)
PASS video/webm; codecs="vp9.0" (optional)
PASS video/webm codecs subset
PASS video/webm codecs order
PASS video/webm with bogus codec
Expand Down
@@ -1,4 +1,4 @@
<!DOCTYPE html>
<!DOCTYPE html> <!-- webkit-test-runner [ WebRTCAV1CodecEnabled=true WebRTCH265CodecEnabled=true WebRTCVP9Profile2CodecEnabled=true ] -->
<title>MediaCapabilities.decodingInfo() for webrtc</title>
<script src=/resources/testharness.js></script>
<script src="/resources/testharnessreport.js"></script>
Expand Down
@@ -1,4 +1,4 @@
<!DOCTYPE html>
<!DOCTYPE html> <!-- webkit-test-runner [ WebRTCAV1CodecEnabled=true WebRTCH265CodecEnabled=true WebRTCVP9Profile2CodecEnabled=true ] -->
<title>MediaCapabilities.encodingInfo() for webrtc</title>
<script src=/resources/testharness.js></script>
<script src="/resources/testharnessreport.js"></script>
Expand Down
@@ -1,4 +1,4 @@
<!doctype html>
<!doctype html> <!-- webkit-test-runner [ ClearSiteDataHTTPHeaderEnabled=true ] -->
<meta charset=utf-8>
<title>Use Clear-Site-Data to immediately unregister service workers</title>
<script src="/resources/testharness.js"></script>
Expand Down
2 changes: 1 addition & 1 deletion LayoutTests/media/vp9.html
@@ -1,4 +1,4 @@
<html>
<html> <!-- webkit-test-runner [ VP9SWDecoderEnabledOnBattery=true ] -->
<body>
<script src="../resources/testharness.js"></script>
<script src="../resources/testharnessreport.js"></script>
Expand Down
Expand Up @@ -7,6 +7,7 @@ navigator.clipboard is OK
navigator.contacts is OK
navigator.cookieEnabled is OK
navigator.getStorageUpdates() is OK
navigator.gpu is OK
navigator.hardwareConcurrency is OK
navigator.javaEnabled() is OK
navigator.language is OK
Expand Down Expand Up @@ -40,6 +41,7 @@ navigator.clipboard is OK
navigator.contacts is OK
navigator.cookieEnabled is OK
navigator.getStorageUpdates() is OK
navigator.gpu is OK
navigator.hardwareConcurrency is OK
navigator.javaEnabled() is OK
navigator.language is OK
Expand Down
Expand Up @@ -6,6 +6,7 @@ navigator.appVersion is OK
navigator.audioSession is OK
navigator.cookieEnabled is OK
navigator.getStorageUpdates() is OK
navigator.gpu is OK
navigator.hardwareConcurrency is OK
navigator.javaEnabled() is OK
navigator.language is OK
Expand Down Expand Up @@ -37,6 +38,7 @@ navigator.appVersion is OK
navigator.audioSession is OK
navigator.cookieEnabled is OK
navigator.getStorageUpdates() is OK
navigator.gpu is OK
navigator.hardwareConcurrency is OK
navigator.javaEnabled() is OK
navigator.language is OK
Expand Down
Expand Up @@ -10,6 +10,7 @@ navigator.contacts is OK
navigator.cookieEnabled is OK
navigator.credentials is OK
navigator.getStorageUpdates() is OK
navigator.gpu is OK
navigator.hardwareConcurrency is OK
navigator.isLoggedIn() is OK
navigator.javaEnabled() is OK
Expand Down Expand Up @@ -51,6 +52,7 @@ navigator.contacts is OK
navigator.cookieEnabled is OK
navigator.credentials is OK
navigator.getStorageUpdates() is OK
navigator.gpu is OK
navigator.hardwareConcurrency is OK
navigator.isLoggedIn() is OK
navigator.javaEnabled() is OK
Expand Down
2 changes: 1 addition & 1 deletion LayoutTests/webgl/webgl-draft-extensions-flag-default.html
@@ -1,4 +1,4 @@
<!DOCTYPE html>
<!DOCTYPE html> <!-- webkit-test-runner [ WebGLDraftExtensionsEnabled=true ] -->
<html>
<head>
<meta charset="utf-8">
Expand Down
2 changes: 1 addition & 1 deletion LayoutTests/webrtc/video-av1.html
@@ -1,4 +1,4 @@
<!doctype html>
<!doctype html> <!-- webkit-test-runner [ WebRTCAV1CodecEnabled=true ] -->
<html>
<head>
<meta charset="utf-8">
Expand Down
2 changes: 1 addition & 1 deletion LayoutTests/webrtc/vp9-vtb.html
@@ -1,4 +1,4 @@
<!doctype html>
<!doctype html> <!-- webkit-test-runner [ VP9SWDecoderEnabledOnBattery=true ] -->
<html>
<head>
<meta charset="utf-8">
Expand Down
Expand Up @@ -41,6 +41,8 @@ class RemoteEstimate : public App {
explicit RemoteEstimate(App&& app);
// Note, sub type must be unique among all app messages with "goog" name.
static constexpr uint8_t kSubType = 13;
// Avoid macro name collision on macOS (https://bugs.webkit.org/show_bug.cgi?id=250065).
#undef kName
static constexpr uint32_t kName = NameToInt("goog");
static TimeDelta GetTimestampPeriod();

Expand Down

0 comments on commit 9def6e6

Please sign in to comment.