Bug 207613

Summary: Can't enable color filter in MiniBrowser
Product: WebKit Reporter: Ryosuke Niwa <rniwa>
Component: WebKit Misc.Assignee: Nobody <webkit-unassigned>
Status: NEW ---    
Severity: Normal CC: achristensen, beidson, cdumez, sihui_liu, simon.fraser, thorton, wenson_hsieh
Priority: P2    
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   

Description Ryosuke Niwa 2020-02-11 20:37:10 PST
Enabling color filter, etc... is broken because [WK2BrowserWindowController didChangeSettings]
updates the properties of _webView.configuration.preferences but that's on a copy of WKWebView's _configuration.
Comment 1 Ryosuke Niwa 2020-02-11 20:37:33 PST
Has this changed recently? How did this work at all??
Comment 2 Tim Horton 2020-02-11 20:52:05 PST
The WKWebViewConfiguration is a copy, that's how WKWebViewConfiguration works. The WKPreferences object inside it should NOT be a copy.
Comment 3 Tim Horton 2020-02-11 20:53:47 PST
Also, in general you may have to make a new view once you've set a preference, which should work. We aren't super great about invalidating preferences.
Comment 4 Ryosuke Niwa 2020-02-11 22:29:12 PST
(In reply to Tim Horton from comment #2)
> The WKWebViewConfiguration is a copy, that's how WKWebViewConfiguration
> works. The WKPreferences object inside it should NOT be a copy.

(In reply to Tim Horton from comment #3)
> Also, in general you may have to make a new view once you've set a
> preference, which should work. We aren't super great about invalidating
> preferences.

Hm... I see what you're saying. Back to the original problem.
Comment 5 Ryosuke Niwa 2020-02-11 22:33:42 PST
Hm... maybe there is a race condition between when WebContent process is created & when WebPageProxy::preferencesDidChange() gets called. In particular, when hasRunningProcess() is false, we exit early without sending any IPC even if we're in the middle of starting a new web content process.
Comment 6 Ryosuke Niwa 2020-02-11 22:40:49 PST
_webView->_impl->page().hasRunningProcess() is still false after:

_webView = [[WKWebView alloc] initWithFrame:[containerView bounds] configuration:_configuration]
Comment 7 Tim Horton 2020-02-11 22:46:23 PST
(In reply to Ryosuke Niwa from comment #6)
> _webView->_impl->page().hasRunningProcess() is still false after:
> 
> _webView = [[WKWebView alloc] initWithFrame:[containerView bounds]
> configuration:_configuration]

Of course, process doesn't come up till later
Comment 8 Ryosuke Niwa 2020-02-11 22:48:02 PST
(In reply to Tim Horton from comment #7)
> (In reply to Ryosuke Niwa from comment #6)
> > _webView->_impl->page().hasRunningProcess() is still false after:
> > 
> > _webView = [[WKWebView alloc] initWithFrame:[containerView bounds]
> > configuration:_configuration]
> 
> Of course, process doesn't come up till later

Right, but by this time, we've already asked WebContent process to be stared with the old configuration / parameters so new WebContent process ends up receiving the stale configuration / preferences when launched. Yet we never notify them of the preference / configuration change we made.