[Webkit-unassigned] [Bug 258558] New: `PageGroup`'s `Preferences`are ignored when creating `WKWebView`

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Tue Jun 27 04:55:33 PDT 2023


https://bugs.webkit.org/show_bug.cgi?id=258558

            Bug ID: 258558
           Summary: `PageGroup`'s `Preferences`are ignored when creating
                    `WKWebView`
           Product: WebKit
           Version: WebKit Nightly Build
          Hardware: Unspecified
                OS: Unspecified
            Status: NEW
          Severity: Normal
          Priority: P2
         Component: Tools / Tests
          Assignee: webkit-unassigned at lists.webkit.org
          Reporter: vitaly at igalia.com

There are two APIs to create a `WKWebView`:
- `PlatformWebView(WKPageConfigurationRef configuration)`
- `PlatformWebView(WKContextRef contextRef, WKPageGroupRef pageGroupRef)`

If we want to set some preferences, it's quite straightforward using `WKPageConfigurationRef`:
```
auto configuration = adoptWK(WKPageConfigurationCreate());
auto preferences = adoptWK(WKPreferencesCreate());
WKPageConfigurationSetPreferences(configuration.get(), preferences.get());
```

When using the context and the page group, we don't have access to the configuration object.
But it's possible to set preferences to the page group:
```
WKRetainPtr<WKPageGroupRef> pageGroup = adoptWK(WKPageGroupCreateWithIdentifier(Util::toWK("GetUserMedia").get()));
WKPreferencesRef preferences = WKPageGroupGetPreferences(pageGroup.get());
```

When we then create an instance of `WKWebView` we copy `WKPageConfigruation` into `WKWebViewConfigruation` and pass them as a parameter:
```
auto configuration = adoptNS([WKWebViewConfiguration new]);
if (auto* preferences = WKPageConfigurationGetPreferences(pageConfiguration))
    configuration.get().preferences = (WKPreferences *)preferences;
m_view = [[wkViewSubclass alloc] initWithFrame:rect configuration:configuration.get()];
```
But we ignore pageGroup's preferences.

I must say, that it's really confusing to have two levels of `Preferences`:
WKPageConfiguration
    |-WKPreferences
    |-WKPageGroup
        |-WKPreferences
but for now, we should at least copy pageGroup's preferences to WebViewConfiguration.

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20230627/8431973d/attachment-0001.htm>


More information about the webkit-unassigned mailing list