summaryrefslogtreecommitdiff
path: root/embed/ephy-web-view.c
diff options
context:
space:
mode:
authorManuel Rego Casasnovas <rego@igalia.com>2014-01-14 17:12:34 +0100
committerManuel Rego Casasnovas <rego@igalia.com>2014-01-16 11:47:57 +0100
commitc6e2cc5f55a637c2e9b254e763b2779a01d6dea4 (patch)
treec6ed9f49d30dc4264731492a16b622aff6124b94 /embed/ephy-web-view.c
parent4a0e093bb09cac5ba08ad643b390b0eb14014338 (diff)
downloadepiphany-c6e2cc5f55a637c2e9b254e763b2779a01d6dea4.tar.gz
Fix web view document type setting it only for the main resource
Move document type set after main resource check. Otherwise Epiphany might think that some pages are images and disable some UI features, when they are actually regular pages but some images have been loaded a bit later than the HTML. https://bugzilla.gnome.org/show_bug.cgi?id=722194
Diffstat (limited to 'embed/ephy-web-view.c')
-rw-r--r--embed/ephy-web-view.c23
1 files changed, 12 insertions, 11 deletions
diff --git a/embed/ephy-web-view.c b/embed/ephy-web-view.c
index fecf18052..ab1c93138 100644
--- a/embed/ephy-web-view.c
+++ b/embed/ephy-web-view.c
@@ -1310,6 +1310,18 @@ decide_policy_cb (WebKitWebView *web_view,
response = webkit_response_policy_decision_get_response (response_decision);
mime_type = webkit_uri_response_get_mime_type (response);
+ /* If WebKit can't handle the mime type start the download
+ process */
+ if (webkit_response_policy_decision_is_mime_type_supported (response_decision))
+ return FALSE;
+
+ /* If it's not the main resource we don't need to set the document type. */
+ request = webkit_response_policy_decision_get_request (response_decision);
+ 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;
+
type = EPHY_WEB_VIEW_DOCUMENT_OTHER;
if (!strcmp (mime_type, "text/html") || !strcmp (mime_type, "text/plain"))
type = EPHY_WEB_VIEW_DOCUMENT_HTML;
@@ -1327,17 +1339,6 @@ decide_policy_cb (WebKitWebView *web_view,
g_object_notify (G_OBJECT (web_view), "document-type");
}
- /* If WebKit can't handle the mime type start the download
- process */
- if (webkit_response_policy_decision_is_mime_type_supported (response_decision))
- return FALSE;
-
- request = webkit_response_policy_decision_get_request (response_decision);
- 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;
-
webkit_policy_decision_download (decision);
return TRUE;