[webkit-gtk] Resources in WebKit2 GTK+ API
Carlos Garcia Campos
cgarcia at igalia.com
Thu Feb 9 09:52:54 PST 2012
After spending the whole day debugging resource loading due to bug
https://bugs.webkit.org/show_bug.cgi?id=78227 , I've started to think
about how to expose web resources in the WebKit2 API.
My initial idea is to provide an api very similar to downloads. A signal
in WebKitWebView is emitted when a new resources load starts
(didInitiateLoadForResource callback in the Resource Load Client):
WebKitWebView::resource-load-started
A new WebKitWebResource object is created and cached by the
WebKitWebView (like in WebKit1) and passed to the signal. In the
callback the user can connect to the resource signals.
The WebKitWebResource object will have a signal for all other callbacks
of the Resource Load Client and a method to get the data.
WebKitWebResource::sent-request
- WebKitWebResource *resource
- WebKitURIRequest *request
- WebKitURIResponse *redirect_response
WebKitWebResource::received-response
- WebKitWebResource *resource
- WebKitURIResponse *response
WebKitWebResource::received-content-length
- WebKitWebResource *resource
- gsize content_length
WebKitWebResource::failed
- WebKitWebResource *resource
- GError *error
WebKitWebResource::finished
- WebKitWebResource *resource
void webkit_web_resource_get_data (WebKitWebResouce *resource,
GAsyncReadyCallback callback,
gpointer user_data);
gchar *webkit_web_resource_get_data_finish (WebKitWebResouce *resource,
GAsyncResult *result,
gsize *data_length,
GError **error);
A method in WebKitWebView to get the list of subresources:
GList *webkit_web_view_get_subresources (WebKitWebView *web_view);
The same method than WebKit1.
And we can probably add a convenient method to save a WebView:
void webkit_web_view_save_to_dir (WebKitWebView *web_view,
const gchar *uri,
GAsyncReadyCallback callback,
gpointer user_data);
gboolean webkit_web_view_save_to_dir_finish (WebKitWebResouce *resource,
GAsyncResult *result,
GError **error);
Does it sound good?
--
Carlos Garcia Campos
http://pgp.rediris.es:11371/pks/lookup?op=get&search=0xF3D322D0EC4582C3
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part
URL: <http://lists.webkit.org/pipermail/webkit-gtk/attachments/20120209/8ee1a5b0/attachment.bin>
More information about the webkit-gtk
mailing list