[epiphany/gnome-3-18] Adblocker must not block main resource during redirects
- From: Michael Catanzaro <mcatanzaro src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [epiphany/gnome-3-18] Adblocker must not block main resource during redirects
- Date: Tue, 5 Sep 2017 19:19:43 +0000 (UTC)
commit fdd49cd8beddf0c9b76724d50013749fedd25ad6
Author: Michael Catanzaro <mcatanzaro igalia com>
Date: Tue Sep 5 14:17:47 2017 -0500
Adblocker must not block main resource during redirects
https://bugzilla.gnome.org/show_bug.cgi?id=787011
embed/web-extension/ephy-web-extension.c | 9 ++++++++-
1 files changed, 8 insertions(+), 1 deletions(-)
---
diff --git a/embed/web-extension/ephy-web-extension.c b/embed/web-extension/ephy-web-extension.c
index de00f6b..7afb390 100644
--- a/embed/web-extension/ephy-web-extension.c
+++ b/embed/web-extension/ephy-web-extension.c
@@ -114,11 +114,14 @@ web_page_send_request (WebKitWebPage *web_page,
const char *original_request_uri;
const char *request_uri;
const char *page_uri;
+ const char *redirected_response_uri;
gboolean ret;
request_uri = webkit_uri_request_get_uri (request);
original_request_uri = request_uri;
+ redirected_response_uri = redirected_response ? webkit_uri_response_get_uri (redirected_response) : NULL;
+
if (g_settings_get_boolean (EPHY_SETTINGS_WEB, EPHY_PREFS_WEB_DO_NOT_TRACK)) {
SoupMessageHeaders *headers;
char *new_uri;
@@ -144,10 +147,14 @@ web_page_send_request (WebKitWebPage *web_page,
page_uri = webkit_web_page_get_uri (web_page);
- /* Always load the main resource. */
+ /* Always load the main resource... */
if (g_strcmp0 (original_request_uri, page_uri) == 0)
return FALSE;
+ /* ...even during a redirect, when page_uri is stale. */
+ if (g_strcmp0 (page_uri, redirected_response_uri) == 0)
+ return FALSE;
+
/* Always load data requests, as uri_tester won't do any good here. */
if (g_str_has_prefix (request_uri, SOUP_URI_SCHEME_DATA))
return FALSE;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]