From 80b1f00b99bec7a0d11312d9f429ca199f8e7132 Mon Sep 17 00:00:00 2001 From: Xan Lopez Date: Thu, 19 Nov 2009 14:53:42 +0200 Subject: ephy-embed: only fetch the document type for a page from the main frame Otherwise we will rewrite the right document type with the document type from other frames in the page. Bug #602400 --- embed/ephy-embed.c | 35 +++++++++++++++++++---------------- 1 file changed, 19 insertions(+), 16 deletions(-) (limited to 'embed/ephy-embed.c') diff --git a/embed/ephy-embed.c b/embed/ephy-embed.c index ebb5e64e4..b49ab0fc6 100644 --- a/embed/ephy-embed.c +++ b/embed/ephy-embed.c @@ -369,22 +369,25 @@ mime_type_policy_decision_requested_cb (WebKitWebView *web_view, g_return_val_if_fail (mime_type, FALSE); - type = EPHY_WEB_VIEW_DOCUMENT_OTHER; - - if (!strcmp (mime_type, "text/html")) - type = EPHY_WEB_VIEW_DOCUMENT_HTML; - else if (!strcmp (mime_type, "application/xhtml+xml")) - type = EPHY_WEB_VIEW_DOCUMENT_XML; - else if (!strncmp (mime_type, "image/", 6)) - type = EPHY_WEB_VIEW_DOCUMENT_IMAGE; - - /* FIXME: maybe it makes more sense to have an API to query the mime - * type when the load of a page starts than doing this here. - */ - /* FIXME: rename ge-document-type (and all ge- signals...) to - * something else - */ - g_signal_emit_by_name (EPHY_GET_EPHY_WEB_VIEW_FROM_EMBED (embed), "ge-document-type", type); + /* Get the mime type for the page only from the main frame */ + if (webkit_web_view_get_main_frame (web_view) == frame) { + type = EPHY_WEB_VIEW_DOCUMENT_OTHER; + + if (!strcmp (mime_type, "text/html")) + type = EPHY_WEB_VIEW_DOCUMENT_HTML; + else if (!strcmp (mime_type, "application/xhtml+xml")) + type = EPHY_WEB_VIEW_DOCUMENT_XML; + else if (!strncmp (mime_type, "image/", 6)) + type = EPHY_WEB_VIEW_DOCUMENT_IMAGE; + + /* FIXME: mayb e it makes more sense to have an API to query the mime + * type when the load of a page starts than doing this here. + */ + /* FIXME: rename ge-document-type (and all ge- signals...) to + * something else + */ + g_signal_emit_by_name (EPHY_GET_EPHY_WEB_VIEW_FROM_EMBED (embed), "ge-document-type", type); + } /* If WebKit can't handle the mime type start the download process */ -- cgit v1.2.3