Bug 169422

Summary: Add WKURLSchemeHandler API for handling custom protocols
Product: WebKit Reporter: Brady Eidson <beidson>
Component: WebKit2Assignee: Brady Eidson <beidson>
Status: RESOLVED FIXED    
Severity: Normal CC: achristensen, commit-queue, ggaren, mitz, thorton
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
See Also: https://bugs.webkit.org/show_bug.cgi?id=169434
Attachments:
Description Flags
Patch
none
Patch
none
Patch
none
Patch
none
Patch
none
Patch none

Description Brady Eidson 2017-03-09 11:29:06 PST
Add WKURLSchemeHandler API for handling custom protocols
Comment 1 Brady Eidson 2017-03-09 11:29:14 PST
<rdar://problem/17190141>
Comment 2 Brady Eidson 2017-03-09 11:46:09 PST
Created attachment 303942 [details]
Patch
Comment 3 WebKit Commit Bot 2017-03-09 11:49:01 PST
Attachment 303942 [details] did not pass style-queue:


ERROR: Source/WebKit2/UIProcess/API/Cocoa/WKWebViewConfiguration.mm:36:  Found header this file implements after other header. Should be: config.h, primary header, blank line, and then alphabetically sorted.  [build/include_order] [4]
ERROR: Source/WebKit2/UIProcess/API/Cocoa/WKWebViewConfiguration.mm:410:  More than one command on the same line  [whitespace/newline] [4]
ERROR: Source/WebKit2/UIProcess/API/Cocoa/WKWebViewConfiguration.mm:431:  More than one command on the same line  [whitespace/newline] [4]
ERROR: Source/WebKit2/UIProcess/API/Cocoa/WKWebViewConfiguration.mm:452:  More than one command on the same line  [whitespace/newline] [4]
Total errors found: 4 in 38 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 4 mitz 2017-03-09 11:52:55 PST
Comment on attachment 303942 [details]
Patch

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

> Source/WebKit2/Shared/API/APIObject.h:123
> +        URLSchemeHandlerTask,

Feels out of place here between the K and the M…
Comment 5 Tim Horton 2017-03-09 12:03:21 PST
Comment on attachment 303942 [details]
Patch

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

> Source/WebKit2/UIProcess/API/Cocoa/WKURLSchemeHandler.h:44
> + represented by the url scheme handler task.

should URL in all these comments be capitalized?

> Source/WebKit2/WebProcess/Network/WebLoaderStrategy.cpp:203
> +            RELEASE_LOG_IF_ALLOWED(resourceLoader, "scheduleLoad: URL will be handled by a UIProcess url scheme handler (frame = %p, resourceID = %" PRIu64 ")", resourceLoader.frame(), identifier);

URL url URL url URL
Comment 6 Brady Eidson 2017-03-09 12:06:07 PST
(In reply to comment #5)
> Comment on attachment 303942 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=303942&action=review
> 
> > Source/WebKit2/UIProcess/API/Cocoa/WKURLSchemeHandler.h:44
> > + represented by the url scheme handler task.
> 
> should URL in all these comments be capitalized?

Probably.

> 
> > Source/WebKit2/WebProcess/Network/WebLoaderStrategy.cpp:203
> > +            RELEASE_LOG_IF_ALLOWED(resourceLoader, "scheduleLoad: URL will be handled by a UIProcess url scheme handler (frame = %p, resourceID = %" PRIu64 ")", resourceLoader.frame(), identifier);
> 
> URL url URL url URL

See above.
Comment 7 Brady Eidson 2017-03-09 12:12:01 PST
Created attachment 303946 [details]
Patch
Comment 8 WebKit Commit Bot 2017-03-09 12:13:44 PST
Attachment 303946 [details] did not pass style-queue:


ERROR: Source/WebKit2/UIProcess/API/Cocoa/WKWebViewConfiguration.mm:36:  Found header this file implements after other header. Should be: config.h, primary header, blank line, and then alphabetically sorted.  [build/include_order] [4]
ERROR: Source/WebKit2/UIProcess/API/Cocoa/WKWebViewConfiguration.mm:410:  More than one command on the same line  [whitespace/newline] [4]
ERROR: Source/WebKit2/UIProcess/API/Cocoa/WKWebViewConfiguration.mm:431:  More than one command on the same line  [whitespace/newline] [4]
ERROR: Source/WebKit2/UIProcess/API/Cocoa/WKWebViewConfiguration.mm:452:  More than one command on the same line  [whitespace/newline] [4]
Total errors found: 4 in 39 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 9 Brady Eidson 2017-03-09 12:26:11 PST
Created attachment 303949 [details]
Patch
Comment 10 WebKit Commit Bot 2017-03-09 12:28:32 PST
Attachment 303949 [details] did not pass style-queue:


ERROR: Source/WebKit2/UIProcess/API/Cocoa/WKWebViewConfiguration.mm:36:  Found header this file implements after other header. Should be: config.h, primary header, blank line, and then alphabetically sorted.  [build/include_order] [4]
ERROR: Source/WebKit2/UIProcess/API/Cocoa/WKWebViewConfiguration.mm:410:  More than one command on the same line  [whitespace/newline] [4]
ERROR: Source/WebKit2/UIProcess/API/Cocoa/WKWebViewConfiguration.mm:431:  More than one command on the same line  [whitespace/newline] [4]
ERROR: Source/WebKit2/UIProcess/API/Cocoa/WKWebViewConfiguration.mm:452:  More than one command on the same line  [whitespace/newline] [4]
Total errors found: 4 in 39 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 11 Tim Horton 2017-03-09 12:46:04 PST
Comment on attachment 303949 [details]
Patch

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

> Source/WebKit2/UIProcess/API/Cocoa/WKWebViewConfiguration.h:193
> +/* @abstract Returns the currently registered url scheme handler object for the given URL scheme.

tiny URL again.

> Source/WebKit2/UIProcess/API/Cocoa/WKWebViewConfiguration.mm:334
> +    configuration->_urlSchemeHandlers.set([self._urlSchemeHandlers mutableCopyWithZone:zone]);

Isn't this a leak?
Comment 12 Brady Eidson 2017-03-09 12:59:49 PST
Created attachment 303962 [details]
Patch
Comment 13 Brady Eidson 2017-03-09 13:00:55 PST
FWIW, I have a growing set of tests that I will be submitting in https://bugs.webkit.org/show_bug.cgi?id=169434
Comment 14 WebKit Commit Bot 2017-03-09 13:01:24 PST
Attachment 303962 [details] did not pass style-queue:


ERROR: Source/WebKit2/UIProcess/API/Cocoa/WKWebViewConfiguration.mm:36:  Found header this file implements after other header. Should be: config.h, primary header, blank line, and then alphabetically sorted.  [build/include_order] [4]
ERROR: Source/WebKit2/UIProcess/API/Cocoa/WKWebViewConfiguration.mm:410:  More than one command on the same line  [whitespace/newline] [4]
ERROR: Source/WebKit2/UIProcess/API/Cocoa/WKWebViewConfiguration.mm:431:  More than one command on the same line  [whitespace/newline] [4]
ERROR: Source/WebKit2/UIProcess/API/Cocoa/WKWebViewConfiguration.mm:452:  More than one command on the same line  [whitespace/newline] [4]
Total errors found: 4 in 39 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 15 Tim Horton 2017-03-09 13:06:13 PST
Comment on attachment 303962 [details]
Patch

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

> Source/WebKit2/UIProcess/WebURLSchemeHandler.h:57
> +    uint64_t m_identifier { 1 };

why?
Comment 16 Brady Eidson 2017-03-09 13:20:55 PST
(In reply to comment #15)
> Comment on attachment 303962 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=303962&action=review
> 
> > Source/WebKit2/UIProcess/WebURLSchemeHandler.h:57
> > +    uint64_t m_identifier { 1 };
> 
> why?

Because if you try to put 0 in a hash table you're gonna have a bad time.

(But if your comment is that since we always initialize it in the c'tor with the next identifier so why bother with the default initializer.... good call. I just put the default in there very early on while testing)
Comment 17 Tim Horton 2017-03-09 13:29:46 PST
Comment on attachment 303962 [details]
Patch

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

> Source/WebKit2/Shared/API/APIObject.h:123
> +        URLSchemeHandlerTask,

As previously noted, this seems out of order in an otherwise sorted list.

> Source/WebKit2/UIProcess/API/Cocoa/WKURLSchemeHandlerTask.mm:40
> +    if (exceptionType == WebKit::WebURLSchemeHandlerTask::ExceptionType::TaskAlreadyStopped)

Should this be a switch so you catch new enum values?

> Source/WebKit2/WebProcess/WebPage/WebURLSchemeHandlerTaskProxy.h:40
> +class WebURLSchemeHandlerTaskProxy {

Do all of your C++ classes want any MAKE_NONCOPYABLE or whatever?
Comment 18 Brady Eidson 2017-03-09 13:36:19 PST
(In reply to comment #17)
> Comment on attachment 303962 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=303962&action=review
> 
> > Source/WebKit2/Shared/API/APIObject.h:123
> > +        URLSchemeHandlerTask,
> 
> As previously noted, this seems out of order in an otherwise sorted list.

Yup, leftover from the rename. Moved.

> 
> > Source/WebKit2/UIProcess/API/Cocoa/WKURLSchemeHandlerTask.mm:40
> > +    if (exceptionType == WebKit::WebURLSchemeHandlerTask::ExceptionType::TaskAlreadyStopped)
> 
> Should this be a switch so you catch new enum values?

Yup.

> 
> > Source/WebKit2/WebProcess/WebPage/WebURLSchemeHandlerTaskProxy.h:40
> > +class WebURLSchemeHandlerTaskProxy {
> 
> Do all of your C++ classes want any MAKE_NONCOPYABLE or whatever?

Prolly.

Thx!
Comment 19 Brady Eidson 2017-03-09 13:42:51 PST
Created attachment 303981 [details]
Patch
Comment 20 WebKit Commit Bot 2017-03-09 13:44:52 PST
Attachment 303981 [details] did not pass style-queue:


ERROR: Source/WebKit2/UIProcess/API/Cocoa/WKWebViewConfiguration.mm:36:  Found header this file implements after other header. Should be: config.h, primary header, blank line, and then alphabetically sorted.  [build/include_order] [4]
ERROR: Source/WebKit2/UIProcess/API/Cocoa/WKWebViewConfiguration.mm:410:  More than one command on the same line  [whitespace/newline] [4]
ERROR: Source/WebKit2/UIProcess/API/Cocoa/WKWebViewConfiguration.mm:431:  More than one command on the same line  [whitespace/newline] [4]
ERROR: Source/WebKit2/UIProcess/API/Cocoa/WKWebViewConfiguration.mm:452:  More than one command on the same line  [whitespace/newline] [4]
Total errors found: 4 in 39 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 21 Brady Eidson 2017-03-09 15:20:29 PST
Created attachment 303999 [details]
Patch
Comment 22 WebKit Commit Bot 2017-03-09 15:22:41 PST
Attachment 303999 [details] did not pass style-queue:


ERROR: Source/WebKit2/UIProcess/API/Cocoa/WKWebViewConfiguration.mm:36:  Found header this file implements after other header. Should be: config.h, primary header, blank line, and then alphabetically sorted.  [build/include_order] [4]
ERROR: Source/WebKit2/UIProcess/API/Cocoa/WKWebViewConfiguration.mm:413:  More than one command on the same line  [whitespace/newline] [4]
ERROR: Source/WebKit2/UIProcess/API/Cocoa/WKWebViewConfiguration.mm:434:  More than one command on the same line  [whitespace/newline] [4]
ERROR: Source/WebKit2/UIProcess/API/Cocoa/WKWebViewConfiguration.mm:455:  More than one command on the same line  [whitespace/newline] [4]
Total errors found: 4 in 39 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 23 WebKit Commit Bot 2017-03-09 16:38:24 PST
Comment on attachment 303999 [details]
Patch

Clearing flags on attachment: 303999

Committed r213686: <http://trac.webkit.org/changeset/213686>
Comment 24 WebKit Commit Bot 2017-03-09 16:38:30 PST
All reviewed patches have been landed.  Closing bug.
Comment 25 Brady Eidson 2017-03-09 17:00:24 PST
32-bit debug build fix in https://trac.webkit.org/changeset/213693