WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
55473
[GTK] Add support for external protocol handlers
https://bugs.webkit.org/show_bug.cgi?id=55473
Summary
[GTK] Add support for external protocol handlers
Sergio Villar Senin
Reported
2011-03-01 08:42:06 PST
In order to do that we need: * Some way to disable the default handling of about: protocols in webcore (by default about: means empty document) * WebKitGtk+ API to disable the about: default behaviour commented above
Attachments
Patch
(7.31 KB, patch)
2011-03-01 08:51 PST
,
Sergio Villar Senin
abarth
: review-
Details
Formatted Diff
Diff
Patch
(1.66 KB, patch)
2011-03-02 02:21 PST
,
Sergio Villar Senin
no flags
Details
Formatted Diff
Diff
Show Obsolete
(1)
View All
Add attachment
proposed patch, testcase, etc.
Sergio Villar Senin
Comment 1
2011-03-01 08:51:06 PST
Created
attachment 84235
[details]
Patch
Martin Robinson
Comment 2
2011-03-01 09:21:52 PST
Comment on
attachment 84235
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=84235&action=review
Instead of adding new API (though perhaps we still want to), would it make sense to just query soup for an installed "about:" handler while handling a request. If the handler is installed then remove it from the empty document schemas. What does Chromium do to get around the empty document scheme issue?
> Source/WebKit/gtk/webkit/webkitglobals.cpp:220 > +void webkit_register_url_scheme_as_local (const gchar* scheme) > +{ > + webkitInit(); > + SchemeRegistry::registerURLSchemeAsLocal(String::fromUTF8(scheme)); > +} > + > +void webkit_remove_url_scheme_registered_as_local (const gchar* scheme) > +{ > + webkitInit(); > + SchemeRegistry::removeURLSchemeRegisteredAsLocal(String::fromUTF8(scheme)); > +} > + > +void webkit_register_url_scheme_as_empty_document (const gchar* scheme) > +{ > + webkitInit(); > + SchemeRegistry::registerURLSchemeAsEmptyDocument(String::fromUTF8(scheme)); > +} > + > +void webkit_remove_url_scheme_registered_as_empty_document (const gchar* scheme) > +{ > + webkitInit(); > + SchemeRegistry::removeURLSchemeRegisteredAsEmptyDocument(String::fromUTF8(scheme)); > +}
extra space after the function names.
Sergio Villar Senin
Comment 3
2011-03-01 10:15:49 PST
(In reply to
comment #2
)
> (From update of
attachment 84235
[details]
) > View in context:
https://bugs.webkit.org/attachment.cgi?id=84235&action=review
> > Instead of adding new API (though perhaps we still want to), would it make sense to just query soup for an installed "about:" handler while handling a request. If the handler is installed then remove it from the empty document schemas.
That's indeed possible. I went for the new API approach because all the other ports offer that API, so I thought it'd be sensible to have it also in WebKitGtk+.
> What does Chromium do to get around the empty document scheme issue?
I didn't check that but Dan commented once that they just don't issue the request to webkit and handle it all at browser's level.
Eric Seidel (no email)
Comment 4
2011-03-01 11:53:48 PST
I'm really not the protocol expert.
Sergio Villar Senin
Comment 5
2011-03-01 12:39:46 PST
(In reply to
comment #2
)
> (From update of
attachment 84235
[details]
) > View in context:
https://bugs.webkit.org/attachment.cgi?id=84235&action=review
> > Instead of adding new API (though perhaps we still want to), would it make sense to just query soup for an installed "about:" handler while handling a request. If the handler is installed then remove it from the empty document schemas.
BTW forget about my answer, I missunderstood what you meant. What you suggest isn't possible because the request does not even reach the platform network layer as it's handled internally by WebCore.
Martin Robinson
Comment 6
2011-03-01 12:40:44 PST
(In reply to
comment #5
)
> > Instead of adding new API (though perhaps we still want to), would it make sense to just query soup for an installed "about:" handler while handling a request. If the handler is installed then remove it from the empty document schemas. > BTW forget about my answer, I missunderstood what you meant. What you suggest isn't possible because the request does not even reach the platform network layer as it's handled internally by WebCore.
I guess this could be handled in the WebKit layer. Perhaps FrameLoaderClient allows some access.
Adam Barth
Comment 7
2011-03-01 13:37:12 PST
Comment on
attachment 84235
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=84235&action=review
> Source/WebCore/platform/SchemeRegistry.cpp:82 > + DEFINE_STATIC_LOCAL(bool, firstTime, (true));
I don't think this is needed for primitive types.
Adam Barth
Comment 8
2011-03-01 13:39:39 PST
Comment on
attachment 84235
[details]
Patch This isn't really a good idea. That about scheme is super magical. Putting non-empty documents in the about scheme doesn't really work. The about:blah URLs in Chrome are handled by the embedder. Typically, they're either translated to a data URL for WebKit or to another internal URL in the "chrome" scheme.
Sergio Villar Senin
Comment 9
2011-03-02 02:17:24 PST
(In reply to
comment #8
)
> (From update of
attachment 84235
[details]
) > This isn't really a good idea. That about scheme is super magical. Putting non-empty documents in the about scheme doesn't really work.
Just for the sake of knowing a bit more about WebCore guts, what is special about the "about:" protocol? What kind of tricky stuff does it?
> The about:blah URLs in Chrome are handled by the embedder. Typically, they're either translated to a data URL for WebKit or to another internal URL in the "chrome" scheme.
Ok, I'll follow that approach then. Thanks for reviewing.
Sergio Villar Senin
Comment 10
2011-03-02 02:19:32 PST
Renaming the bug title. We're not going to change the "about:" behaviour but we still need to allow external protocol handlers. In order to do that we have to allow clients to create their own SoupRequesters that will be used to register new protocols.
Sergio Villar Senin
Comment 11
2011-03-02 02:21:07 PST
Created
attachment 84384
[details]
Patch I just kept the ResourceHandleSoup part of the original patch.
Sergio Villar Senin
Comment 12
2011-03-02 10:03:27 PST
Comment on
attachment 84384
[details]
Patch Clearing flags on attachment: 84384 Committed
r80143
: <
http://trac.webkit.org/changeset/80143
>
Sergio Villar Senin
Comment 13
2011-03-02 10:03:36 PST
All reviewed patches have been landed. Closing bug.
Adam Barth
Comment 14
2011-03-02 22:42:51 PST
> Just for the sake of knowing a bit more about WebCore guts, what is special about the "about:" protocol? What kind of tricky stuff does it?
Some examples: 1) Loads of about: URLs are synchronous instead of asynchronous. 2) about: URLs inherit the security context of their parent (or opener if there isn't a parent). 3) about: URLs are used internally by the WebKit in various situations where having a non-empty document would be problematic (e.g., frame initialization and in the XSS filter). (2) is really scary if about: URLs start containing anything besides the empty document.
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