[Webkit-unassigned] [Bug 29134] [GTK] Add API to access sub resources
bugzilla-daemon at webkit.org
bugzilla-daemon at webkit.org
Thu Sep 10 13:37:23 PDT 2009
https://bugs.webkit.org/show_bug.cgi?id=29134
--- Comment #3 from Xan Lopez <xan.lopez at gmail.com> 2009-09-10 13:37:23 PDT ---
(From update of attachment 39366)
> @@ -799,6 +808,11 @@ void FrameLoaderClient::finishedLoading(WebCore::DocumentLoader* documentLoader)
>
> void FrameLoaderClient::provisionalLoadStarted()
> {
> + WebKitWebView* webView = getViewFromFrame(m_frame);
> +
> + if (m_frame == webkit_web_view_get_main_frame(webView))
> + webkit_web_view_clear_resources(webView);
> +
> notImplemented();
> }
My usual question, what else do you need to do here? Either add a comment ar
remove the notImplemented().
>
> @@ -824,6 +838,23 @@ void FrameLoaderClient::dispatchDidFinishLoading(WebCore::DocumentLoader* loader
> {
> static_cast<WebKit::DocumentLoader*>(loader)->decreaseLoadCount(identifier);
>
> + WebKitWebView* webView = getViewFromFrame(m_frame);
> + GOwnPtr<gchar> identifierString(identifierToString(identifier));
> + WebKitWebResource* webResource = webkit_web_view_get_resource(webView, identifierString.get());
> +
> + const char* uri = webkit_web_resource_get_uri(webResource);
> + RefPtr<ArchiveResource> coreResource(loader->subresource(KURL(KURL(), uri)));
> +
> + // If coreResource is NULL here, the resource failed to load,
> + // unless it's the main resource.
> + if (!coreResource && (webResource != webkit_web_view_get_main_resource(webView)))
You don't really need the parenthesis.
> +
> + webkit_web_resource_init_with_core_resource(webResource, coreResource.get());
> +
> // FIXME: This function should notify the application that the resource
> // finished loading, maybe using a load-status property in the
> // WebKitWebResource object, similar to what we do for WebKitWebFrame'
> diff --git a/WebKit/gtk/webkit/webkitwebresource.cpp b/WebKit/gtk/webkit/webkitwebresource.cpp
> index 98e781a..17bead1 100644
> --- a/WebKit/gtk/webkit/webkitwebresource.cpp
> +++ b/WebKit/gtk/webkit/webkitwebresource.cpp
> @@ -60,12 +60,14 @@ G_DEFINE_TYPE(WebKitWebResource, webkit_web_resource, G_TYPE_OBJECT);
> static void webkit_web_resource_get_property(GObject* object, guint prop_id, GValue* value, GParamSpec* pspec);
> static void webkit_web_resource_set_property(GObject* object, guint prop_id, const GValue* value, GParamSpec* pspec);
>
> -static void webkit_web_resource_cleanup(WebKitWebResource* webResource)
> +static void webkit_web_resource_cleanup(WebKitWebResource* webResource, bool isFinalize)
> {
> WebKitWebResourcePrivate* priv = webResource->priv;
>
> - g_free(priv->uri);
> - priv->uri = NULL;
> + if (isFinalize) {
> + g_free(priv->uri);
> + priv->uri = NULL;
> + }
>
> g_free(priv->mimeType);
> priv->mimeType = NULL;
> @@ -98,7 +100,7 @@ static void webkit_web_resource_finalize(GObject* object)
> {
> WebKitWebResource* webResource = WEBKIT_WEB_RESOURCE(object);
>
> - webkit_web_resource_cleanup(webResource);
> + webkit_web_resource_cleanup(webResource, true);
>
> G_OBJECT_CLASS(webkit_web_resource_parent_class)->finalize(object);
> }
> @@ -230,6 +232,20 @@ WebKitWebResource* webkit_web_resource_new_with_core_resource(PassRefPtr<Archive
> return webResource;
> }
>
Per discussion on IRC it seems this is not useful, and that even cleaning up
the resource on init_with_core_resource is also not useful, so I'd say leave it
out.
Looks good otherwise, so 1/2 r=me (but we need tests!).
--
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
More information about the webkit-unassigned
mailing list