After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 684445 - DNS prefetching support in WebKit2
DNS prefetching support in WebKit2
Status: RESOLVED FIXED
Product: epiphany
Classification: Core
Component: Backend
3.5.x
Other Linux
: Normal normal
: ---
Assigned To: Xan Lopez
Epiphany Maintainers
Depends on:
Blocks: 678610
 
 
Reported: 2012-09-20 09:20 UTC by Carlos Garcia Campos
Modified: 2013-03-06 17:16 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Patch (1.96 KB, patch)
2013-02-20 13:21 UTC, Carlos Garcia Campos
committed Details | Review

Description Carlos Garcia Campos 2012-09-20 09:20:56 UTC
In WebKit1 the location entry widget uses the SoupSession object to call soup_session_prepare_for_uri(), but we don't have access to the SoupSession in WebKit2.
Comment 1 Sergio Villar 2012-09-20 17:02:52 UTC
Some InjectedBundle magic in WebKitGtk ?
Comment 2 Carlos Garcia Campos 2012-09-20 17:23:12 UTC
I don't think we need magic, we can just add custom IPC messages like we have done for other network features. I guess we just need to send a URI (or list of URIs) to the web process and call soup_session_prepare_for_uri() there.
Comment 3 Dan Winship 2012-09-20 18:34:53 UTC
you mean soup_session_prefetch_dns(). prepare_for_uri() is deprecated
Comment 4 Carlos Garcia Campos 2012-10-11 09:13:52 UTC
Ah, I didn't know soup_session_prefetch_dns(). So, we could simply add webkit_web_context_prefetch_dns() with the same API than libsoup. I wonder how this affects "enable-dns-prefetching" setting in WebKit, though. I mean, if there's already a setting to do DNS prefetching, and WebKit already does it, woulnd't be enough to enable the setting? why do we need api for that?
Comment 5 Dan Winship 2012-10-11 12:42:13 UTC
the network process doesn't know what names you want to prefetch, so the web process has to tell it
Comment 6 Carlos Garcia Campos 2012-10-15 08:15:01 UTC
Ok, after looking at wk code, the enable-dns-prefetching settings enable the DNS prefetch for parsed links, and it's indeed implemented using soup_session_prefetch_dns() in the soup backend. So we still need to add a way for the user to prefetch any hostname from the API. We could use the same soup api webkit_web_context_prefetch_dns(), although I wonder whether we need the callback with the result. To implement it in the WebProcess we can use DNS::prefetchDNS(), if we don't include the callback in the API, or soup_session_prefetch_dns() directly if we need to send back the result to the ui process.
Comment 7 Sergio Villar 2012-10-16 16:44:37 UTC
(In reply to comment #6)
> Ok, after looking at wk code, the enable-dns-prefetching settings enable the
> DNS prefetch for parsed links, and it's indeed implemented using
> soup_session_prefetch_dns() in the soup backend. So we still need to add a way
> for the user to prefetch any hostname from the API. We could use the same soup
> api webkit_web_context_prefetch_dns(), although I wonder whether we need the
> callback with the result. To implement it in the WebProcess we can use
> DNS::prefetchDNS(), if we don't include the callback in the API, or
> soup_session_prefetch_dns() directly if we need to send back the result to the
> ui process.

We needed the callback because we are using dns prefetching throttling in order not to flood the network stack with tons of DNS resolutions that will slow down (and even cancel) the resolutions needed by the resources being loaded.

It isn't the result what we really want but the ack that the resolution is finished.
Comment 8 Carlos Garcia Campos 2012-10-17 10:36:53 UTC
Yes, the callback is used in WebCore just to decrement the DNS request counter, but my question is about the API. Ephy still uses prepare_uri, so it doesn't receive any notification when the operation is done. Do the user of the WebKitGTK API need such information? should we use the gio async pattern for the api in such case?
Comment 9 Sergio Villar 2012-10-17 16:33:14 UTC
Ah ok, regarding the API I don't think a client would need such kind of information unless it wants to implement something similar. One thing to consider in the implementation is that it would be nice to directly use WebCore's prefetching mechanism in order to have throttling instead of directly calling the libsoup method.
Comment 10 Carlos Garcia Campos 2012-10-17 17:07:11 UTC
(In reply to comment #9)
> Ah ok, regarding the API I don't think a client would need such kind of
> information unless it wants to implement something similar. 

We all agree, Dan told me the same :-)

> One thing to
> consider in the implementation is that it would be nice to directly use
> WebCore's prefetching mechanism in order to have throttling instead of directly
> calling the libsoup method.

See comment #6:

"To implement it in the WebProcess we can use DNS::prefetchDNS(), if we don't include the callback in the API"
Comment 11 Carlos Garcia Campos 2012-10-18 08:05:00 UTC
See https://bugs.webkit.org/show_bug.cgi?id=99695
Comment 12 Carlos Garcia Campos 2013-02-20 13:21:51 UTC
Created attachment 236927 [details] [review]
Patch
Comment 13 Xan Lopez 2013-03-06 12:01:27 UTC
Review of attachment 236927 [details] [review]:

OK.