WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
188030
Begin making WKWebViewConfiguration a wrapper around an API::PageConfiguration
https://bugs.webkit.org/show_bug.cgi?id=188030
Summary
Begin making WKWebViewConfiguration a wrapper around an API::PageConfiguration
Alex Christensen
Reported
2018-07-25 16:56:11 PDT
Begin making WKWebViewConfiguration a wrapper around an API::PageConfiguration
Attachments
Patch
(15.66 KB, patch)
2018-07-25 16:57 PDT
,
Alex Christensen
no flags
Details
Formatted Diff
Diff
Patch
(16.48 KB, patch)
2018-07-26 16:01 PDT
,
Alex Christensen
sam
: review+
Details
Formatted Diff
Diff
Show Obsolete
(1)
View All
Add attachment
proposed patch, testcase, etc.
Alex Christensen
Comment 1
2018-07-25 16:57:03 PDT
Created
attachment 345802
[details]
Patch
Sam Weinig
Comment 2
2018-07-26 15:16:43 PDT
Comment on
attachment 345802
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=345802&action=review
> Source/WebKit/ChangeLog:9 > + I've arbitrarily chosen _treatsSHA1SignedCertificatesAsInsecure and _urlSchemeHandlers > + as the first two properties to transition, and I've made a way to incrementally transition.
Because, what is happening here is a bit tricky, this would be much nicer if the ChangeLog included an explanation of the changes being made.
> Source/WebKit/UIProcess/API/APIPageConfiguration.h:153 > + HashMap<WTF::String, RefPtr<WebKit::WebURLSchemeHandler>> m_urlSchemeHandlers;
Can you add a null WebURLSchemeHandler into this map? If not, can this be a HashMap<WTF::String, Ref<WebKit::WebURLSchemeHandler>>?
> Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm:509 > + auto pageConfiguration = [configuration copyPageConfiguration];
Why is copying the configuration necessary here? What precludes us from simply referencing the underlying configuration? Is this a short term necessity while conversion is happening?
> Source/WebKit/UIProcess/API/Cocoa/WKWebViewConfiguration.mm:119 > BOOL _treatsSHA1SignedCertificatesAsInsecure;
Why is this not being removed?
> Source/WebKit/UIProcess/API/Cocoa/WKWebViewConfiguration.mm:507 > if (!canonicalScheme) > [NSException raise:NSInvalidArgumentException format:@"'%@' is not a valid URL scheme", urlScheme]; > > - if ([urlSchemeHandlers objectForKey:(NSString *)canonicalScheme.value()]) > + if (_pageConfiguration->urlSchemeHandlerForURLScheme(*canonicalScheme)) > [NSException raise:NSInvalidArgumentException format:@"URL scheme '%@' already has a registered URL scheme handler", urlScheme]; > > - [urlSchemeHandlers setObject:urlSchemeHandler forKey:(NSString *)canonicalScheme.value()]; > + _pageConfiguration->setURLSchemeHandlerForURLScheme(WebKit::WebURLSchemeHandlerCocoa::create(urlSchemeHandler), *canonicalScheme);
Seems odd to have this much logic in the wrapper. Would be nice if it could move down to the underlying PageConfiguration. If it can't, a comment indicating why would be good.
Chris Dumez
Comment 3
2018-07-26 15:23:37 PDT
Comment on
attachment 345802
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=345802&action=review
>> Source/WebKit/UIProcess/API/APIPageConfiguration.h:153 >> + HashMap<WTF::String, RefPtr<WebKit::WebURLSchemeHandler>> m_urlSchemeHandlers; > > Can you add a null WebURLSchemeHandler into this map? If not, can this be a HashMap<WTF::String, Ref<WebKit::WebURLSchemeHandler>>?
It will probably work with a String as key but be careful, our support for Ref<> as value in HashMap is buggy depending on the key traits :( See
https://bugs.webkit.org/show_bug.cgi?id=184012
for e.g.
Chris Dumez
Comment 4
2018-07-26 15:24:07 PDT
Comment on
attachment 345802
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=345802&action=review
>>> Source/WebKit/UIProcess/API/APIPageConfiguration.h:153 >>> + HashMap<WTF::String, RefPtr<WebKit::WebURLSchemeHandler>> m_urlSchemeHandlers; >> >> Can you add a null WebURLSchemeHandler into this map? If not, can this be a HashMap<WTF::String, Ref<WebKit::WebURLSchemeHandler>>? > > It will probably work with a String as key but be careful, our support for Ref<> as value in HashMap is buggy depending on the key traits :( > See
https://bugs.webkit.org/show_bug.cgi?id=184012
for e.g.
And by buggy, I mean that it builds but crashes at runtime :S
Alex Christensen
Comment 5
2018-07-26 15:30:15 PDT
Comment on
attachment 345802
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=345802&action=review
>> Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm:509 >> + auto pageConfiguration = [configuration copyPageConfiguration]; > > Why is copying the configuration necessary here? What precludes us from simply referencing the underlying configuration? Is this a short term necessity while conversion is happening?
It's at least necessary during conversion because this function mutates it, and it is the base of a WKWebViewConfiguration which can be used for other things later in the program and should not be mutated. I think we'll have to copy it once we're done, too, because the WebPageProxy hangs on to it.
>> Source/WebKit/UIProcess/API/Cocoa/WKWebViewConfiguration.mm:119 >> BOOL _treatsSHA1SignedCertificatesAsInsecure; > > Why is this not being removed?
It should be.
>> Source/WebKit/UIProcess/API/Cocoa/WKWebViewConfiguration.mm:507 >> + _pageConfiguration->setURLSchemeHandlerForURLScheme(WebKit::WebURLSchemeHandlerCocoa::create(urlSchemeHandler), *canonicalScheme); > > Seems odd to have this much logic in the wrapper. Would be nice if it could move down to the underlying PageConfiguration. If it can't, a comment indicating why would be good.
Raising NSExceptions in wrapped C++ types is tricky. I'd prefer not to change that behavior in this patch.
Alex Christensen
Comment 6
2018-07-26 16:01:15 PDT
Created
attachment 345886
[details]
Patch
Alex Christensen
Comment 7
2018-07-27 10:07:40 PDT
https://trac.webkit.org/changeset/234313/webkit
Radar WebKit Bug Importer
Comment 8
2018-07-27 10:08:17 PDT
<
rdar://problem/42664760
>
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