[epiphany/gnome-2-28] ephy-embed: only fetch the document type for a page from the main frame



commit ea3b184f6af161dc6581fac2b3b5b84d8290ed86
Author: Xan Lopez <xan gnome org>
Date:   Thu Nov 19 14:53:42 2009 +0200

    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 files changed, 19 insertions(+), 16 deletions(-)
---
diff --git a/embed/ephy-embed.c b/embed/ephy-embed.c
index c1b4e33..d215ed6 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 */



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]