Bug 258558
| Summary: | `PageGroup`'s `Preferences`are ignored when creating `WKWebView` | ||
|---|---|---|---|
| Product: | WebKit | Reporter: | Vitaly Dyackhov <vitaly> |
| Component: | Tools / Tests | Assignee: | Nobody <webkit-unassigned> |
| Status: | NEW | ||
| Severity: | Normal | CC: | webkit-bug-importer |
| Priority: | P2 | Keywords: | InRadar |
| Version: | WebKit Nightly Build | ||
| Hardware: | Unspecified | ||
| OS: | Unspecified | ||
Vitaly Dyackhov
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.
| Attachments | ||
|---|---|---|
| Add attachment proposed patch, testcase, etc. |
Vitaly Dyackhov
Pull request: https://github.com/WebKit/WebKit/pull/15325
Radar WebKit Bug Importer
<rdar://problem/111737120>