[epiphany/gnome-3-36] Fix download in non main resources



commit c9bb427f533a1c88d861da180fa4ba672a4eb4c0
Author: Jan-Michael Brummer <jan brummer tabos org>
Date:   Sun Mar 15 08:26:49 2020 +0000

    Fix download in non main resources
    
    Fixes: https://gitlab.gnome.org/GNOME/epiphany/issues/1127
    
    
    (cherry picked from commit 8682a084bab7e758a9b8efe1deaf0cb8d55fcf44)

 embed/ephy-web-view.c | 35 +++++++++++++++++------------------
 1 file changed, 17 insertions(+), 18 deletions(-)
---
diff --git a/embed/ephy-web-view.c b/embed/ephy-web-view.c
index 841baab17..7885877df 100644
--- a/embed/ephy-web-view.c
+++ b/embed/ephy-web-view.c
@@ -878,24 +878,23 @@ decide_policy_cb (WebKitWebView            *web_view,
     return FALSE;
 
   /* If it's not the main resource we don't need to set the document type. */
-  if (!is_main_resource)
-    return FALSE;
-
-  type = EPHY_WEB_VIEW_DOCUMENT_OTHER;
-  if (!strcmp (mime_type, "text/html") || !strcmp (mime_type, "text/plain"))
-    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.
-   */
-  if (EPHY_WEB_VIEW (web_view)->document_type != type) {
-    EPHY_WEB_VIEW (web_view)->document_type = type;
-
-    g_object_notify_by_pspec (G_OBJECT (web_view), obj_properties[PROP_DOCUMENT_TYPE]);
+  if (is_main_resource) {
+    type = EPHY_WEB_VIEW_DOCUMENT_OTHER;
+    if (!strcmp (mime_type, "text/html") || !strcmp (mime_type, "text/plain"))
+      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.
+     */
+    if (EPHY_WEB_VIEW (web_view)->document_type != type) {
+      EPHY_WEB_VIEW (web_view)->document_type = type;
+
+      g_object_notify_by_pspec (G_OBJECT (web_view), obj_properties[PROP_DOCUMENT_TYPE]);
+    }
   }
 
   webkit_policy_decision_download (decision);


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