Bug 222945 - Preferences do not need to be passed to the WebProcess via WebPageCreationParameters since the store already is
Summary: Preferences do not need to be passed to the WebProcess via WebPageCreationPar...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Sam Weinig
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2021-03-08 15:38 PST by Sam Weinig
Modified: 2021-03-09 19:14 PST (History)
3 users (show)

See Also:


Attachments
Patch (18.72 KB, patch)
2021-03-08 15:46 PST, Sam Weinig
no flags Details | Formatted Diff | Diff
Patch (18.72 KB, patch)
2021-03-09 08:46 PST, Sam Weinig
no flags Details | Formatted Diff | Diff
Patch (15.28 KB, patch)
2021-03-09 16:24 PST, Sam Weinig
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Sam Weinig 2021-03-08 15:38:06 PST
Preferences do not need to be passed to the WebProcess via WebPageCreationParameters since the store already is
Comment 1 Sam Weinig 2021-03-08 15:46:09 PST Comment hidden (obsolete)
Comment 2 Sam Weinig 2021-03-09 08:46:11 PST
Created attachment 422707 [details]
Patch
Comment 3 Alex Christensen 2021-03-09 13:52:13 PST
Comment on attachment 422707 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=422707&action=review

> Source/WebKit/UIProcess/WebPageProxy.cpp:-7988
> -    parameters.httpsUpgradeEnabled = preferences().upgradeKnownHostsToHTTPSEnabled() ? m_configuration->httpsUpgradeEnabled() : false;

This is not equivalent to its replacement.  This uses the value from WKWebViewConfiguration only if the preference is on, which allows you to turn off the feature with the internal preference but by default it will use the value from WKWebViewConfiguration.

> Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm:554
> +    pageConfiguration->preferences()->setUpgradeKnownHostsToHTTPSEnabled(!![_configuration upgradeKnownHostsToHTTPS]);

This always uses the value from WKWebViewConfiguration, which Simon is about to discover breaks his internal performance benchmark.
Comment 4 Sam Weinig 2021-03-09 14:03:21 PST
(In reply to Alex Christensen from comment #3)
> Comment on attachment 422707 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=422707&action=review
> 
> > Source/WebKit/UIProcess/WebPageProxy.cpp:-7988
> > -    parameters.httpsUpgradeEnabled = preferences().upgradeKnownHostsToHTTPSEnabled() ? m_configuration->httpsUpgradeEnabled() : false;
> 
> This is not equivalent to its replacement.  This uses the value from
> WKWebViewConfiguration only if the preference is on, which allows you to
> turn off the feature with the internal preference but by default it will use
> the value from WKWebViewConfiguration.
> 
> > Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm:554
> > +    pageConfiguration->preferences()->setUpgradeKnownHostsToHTTPSEnabled(!![_configuration upgradeKnownHostsToHTTPS]);
> 
> This always uses the value from WKWebViewConfiguration, which Simon is about
> to discover breaks his internal performance benchmark.

Ah right, this needs to follow the mediaDevicesEnabled model.

    if (pageConfiguration->preferences().upgradeKnownHostsToHTTPSEnabled())
        pageConfiguration->preferences()->setUpgradeKnownHostsToHTTPSEnabled(!![_configuration upgradeKnownHostsToHTTPS]);

We should probably do that for a few others.

I'll add a test for this.
Comment 5 Sam Weinig 2021-03-09 14:18:03 PST
The whole concept of having something on the configuration is supposed to mean it is immutable, but if you also make it a preference, things get really weird, and don't really make sense. We should really try to avoid that whenever we can.

In reality, what this "internal feature" really is is "force disable upgradeKnownHostsToHTTPS", so perhaps the cleanest way to model this would be with two preferences, one for mapping the configuration state, and one for mapping the preferences state, annoying as that is.

What a mess.
Comment 6 Sam Weinig 2021-03-09 15:01:09 PST
I filed https://bugs.webkit.org/show_bug.cgi?id=222999 to actually rationalize this stuff.
Comment 7 Sam Weinig 2021-03-09 16:24:08 PST
Created attachment 422775 [details]
Patch
Comment 8 Sam Weinig 2021-03-09 16:24:34 PST
This version is a bit scaled back while I work out a general solution for the configuration / preference fiasco.
Comment 9 EWS 2021-03-09 19:13:01 PST
Committed r274192: <https://commits.webkit.org/r274192>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 422775 [details].
Comment 10 Radar WebKit Bug Importer 2021-03-09 19:14:16 PST
<rdar://problem/75246653>