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
signature.asc
Description: This is a digitally signed message part
_______________________________________________ webkit-gtk mailing list [email protected] http://lists.webkit.org/mailman/listinfo.cgi/webkit-gtk
