From ab70a535e07932ff8d2cd168a22bfbf58458a245 Mon Sep 17 00:00:00 2001 From: Carlos Garcia Campos Date: Tue, 16 Oct 2012 13:07:46 +0200 Subject: ephy-web-view: do not automatically download embedded objects in WebKit2 https://bugzilla.gnome.org/show_bug.cgi?id=683635 --- embed/ephy-web-view.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'embed') diff --git a/embed/ephy-web-view.c b/embed/ephy-web-view.c index 1276a4f35..68ecd91f1 100644 --- a/embed/ephy-web-view.c +++ b/embed/ephy-web-view.c @@ -1763,10 +1763,11 @@ decide_policy_cb (WebKitWebView *web_view, WebKitResponsePolicyDecision *response_decision; WebKitURIResponse *response; WebKitURIRequest *request; + WebKitWebResource *main_resource; EphyWebViewDocumentType type; GObject *single; const char *mime_type; - const char *uri; + const char *request_uri; gboolean handled = FALSE; if (decision_type != WEBKIT_POLICY_DECISION_TYPE_RESPONSE) @@ -1795,18 +1796,17 @@ decide_policy_cb (WebKitWebView *web_view, /* If WebKit can't handle the mime type start the download process */ - /* FIXME: we need to trigger the download only if this is the main - * resource, see the WK1 implementation and 'is_main_resource'. */ if (webkit_web_view_can_show_mime_type (web_view, mime_type)) return FALSE; - /* TODO: Check also Content-Disposition header before emitting - * handle-content signal. We need API for that in WebKit2. - */ - single = ephy_embed_shell_get_embed_single (embed_shell); request = webkit_response_policy_decision_get_request (response_decision); - uri = webkit_uri_request_get_uri (request); - g_signal_emit_by_name (single, "handle-content", mime_type, uri, &handled); + request_uri = webkit_uri_request_get_uri (request); + main_resource = webkit_web_view_get_main_resource (web_view); + if (g_strcmp0 (webkit_web_resource_get_uri (main_resource), request_uri) != 0) + return FALSE; + + single = ephy_embed_shell_get_embed_single (embed_shell); + g_signal_emit_by_name (single, "handle-content", mime_type, request_uri, &handled); if (handled) webkit_policy_decision_ignore (decision); -- cgit v1.2.3