WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
NEW
258558
`PageGroup`'s `Preferences`are ignored when creating `WKWebView`
https://bugs.webkit.org/show_bug.cgi?id=258558
Summary
`PageGroup`'s `Preferences`are ignored when creating `WKWebView`
Vitaly Dyackhov
Reported
2023-06-27 04:55:33 PDT
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
Comment 1
2023-06-27 05:00:17 PDT
Pull request:
https://github.com/WebKit/WebKit/pull/15325
Radar WebKit Bug Importer
Comment 2
2023-07-04 04:56:16 PDT
<
rdar://problem/111737120
>
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