Bug 255779 - [GLib] Some default values for WebKitSettings properties do not match UnifiedWebPreferences.yaml
Summary: [GLib] Some default values for WebKitSettings properties do not match Unified...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKit API (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Philippe Normand
URL:
Keywords: InRadar
Depends on: 275776
Blocks:
  Show dependency treegraph
 
Reported: 2023-04-21 05:29 PDT by Adrian Perez
Modified: 2024-06-28 04:39 PDT (History)
4 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Adrian Perez 2023-04-21 05:29:24 PDT
While working on bug #255518 one of the checks I wrote for the API tests
was something like this:

   // Check that enabled status is the same as the declared default.
   GRefPtr<WebKitSettings> settings = adoptGRef(webkit_settings_new());
   for (gsize i = 0; i < allFeaturesCount; i++) {
        auto* feature = webkit_feature_list_get(allFeatures, i);
        g_assert(webkit_settings_get_feature_enabled(settings.get(), feature) == webkit_feature_get_default_value(feature));
   }

This fails for some settings for which the default value declared in
the UnifiedWebPreferences.yaml file does not match the default value for
the corresponding WebKitSettings property. As en example:

  # From UnifiedWebPreferences.yaml
  EncryptedMediaAPIEnabled:
    type: bool
    status: embedder
    condition: ENABLE(ENCRYPTED_MEDIA)
    defaultValue:
      WebKitLegacy:
        default: false
      WebKit:
        default: true
      WebCore:
        default: false


  // WebKitSettings.cpp
  sObjProperties[PROP_ENABLE_ENCRYPTED_MEDIA] =
      g_param_spec_boolean(
          "enable-encrypted-media",
          _("Enable EncryptedMedia"),
          _("Whether EncryptedMedia should be enabled."),
          FALSE,
          readWriteConstructParamFlags);

Note how the YAML file uses “true” as the default value on the WebKit
layer, but then the WebKit GLib API code uses “FALSE” as the default.

We should either derive the values at the GLib API layer from the YAML
file, or update the YAML file so it reflects the reality imposed by the
GLib API code. This would be good make the new API introduced in
bug #255518 behave consistently with the existing WebKitSettings
properties which happen to control WebKit features.
Comment 1 Adrian Perez 2023-04-21 05:29:58 PDT
I will do this as a follow-up after bug #255518 =)
Comment 2 Adrian Perez 2024-06-17 04:59:13 PDT
Pull request: https://github.com/WebKit/WebKit/pull/29895
Comment 3 EWS 2024-06-17 11:31:56 PDT
Committed 280080@main (4ad8749ae961): <https://commits.webkit.org/280080@main>

Reviewed commits have been landed. Closing PR #29895 and removing active labels.
Comment 4 Radar WebKit Bug Importer 2024-06-17 11:32:14 PDT
<rdar://problem/130018124>
Comment 5 WebKit Commit Bot 2024-06-22 03:15:07 PDT
Re-opened since this is blocked by bug 275776
Comment 6 Philippe Normand 2024-06-28 01:46:52 PDT
Pull request: https://github.com/WebKit/WebKit/pull/30262
Comment 7 EWS 2024-06-28 04:39:27 PDT
Committed 280453@main (ff6ffc06d5f8): <https://commits.webkit.org/280453@main>

Reviewed commits have been landed. Closing PR #30262 and removing active labels.