summaryrefslogtreecommitdiff
path: root/embed
diff options
context:
space:
mode:
authorBastien Nocera <hadess@hadess.net>2013-12-16 11:13:48 +0100
committerBastien Nocera <hadess@hadess.net>2014-01-13 18:30:15 +0100
commit00946fff36aed48fac4645a2587bf9c9ef0b0b00 (patch)
tree2e2cdfa23030605d05a0db7f51e16828d55d2cdf /embed
parent7f09ee3763add068fc715da677568ffbbd2273df (diff)
downloadepiphany-00946fff36aed48fac4645a2587bf9c9ef0b0b00.tar.gz
Remove analytics from browsed URLs
When using "Do not track", also remove analytics information from URLs using the new URI helper. https://bugzilla.gnome.org/show_bug.cgi?id=720520
Diffstat (limited to 'embed')
-rw-r--r--embed/web-extension/Makefile.am2
-rw-r--r--embed/web-extension/ephy-web-extension.c13
2 files changed, 14 insertions, 1 deletions
diff --git a/embed/web-extension/Makefile.am b/embed/web-extension/Makefile.am
index 3f69e65df..68bf1d682 100644
--- a/embed/web-extension/Makefile.am
+++ b/embed/web-extension/Makefile.am
@@ -18,6 +18,8 @@ libephywebextension_la_SOURCES = \
$(top_srcdir)/lib/ephy-settings.h \
$(top_srcdir)/lib/ephy-string.c \
$(top_srcdir)/lib/ephy-string.h \
+ $(top_srcdir)/lib/ephy-uri-helpers.c \
+ $(top_srcdir)/lib/ephy-uri-helpers.h \
$(top_srcdir)/lib/ephy-web-dom-utils.c \
$(top_srcdir)/lib/ephy-web-dom-utils.h
diff --git a/embed/web-extension/ephy-web-extension.c b/embed/web-extension/ephy-web-extension.c
index 92c0ce291..8f2cf2bed 100644
--- a/embed/web-extension/ephy-web-extension.c
+++ b/embed/web-extension/ephy-web-extension.c
@@ -27,6 +27,7 @@
#include "ephy-prefs.h"
#include "ephy-settings.h"
#include "ephy-web-dom-utils.h"
+#include "ephy-uri-helpers.h"
#include "uri-tester.h"
#include <gio/gio.h>
@@ -81,8 +82,11 @@ web_page_send_request (WebKitWebPage *web_page,
const char *request_uri;
const char *page_uri;
+ request_uri = webkit_uri_request_get_uri (request);
+
if (g_settings_get_boolean (EPHY_SETTINGS_WEB, EPHY_PREFS_WEB_DO_NOT_TRACK)) {
SoupMessageHeaders *headers;
+ char *new_uri;
headers = webkit_uri_request_get_http_headers (request);
if (headers) {
@@ -90,12 +94,19 @@ web_page_send_request (WebKitWebPage *web_page,
* http://tools.ietf.org/id/draft-mayer-do-not-track-00.txt */
soup_message_headers_append (headers, "DNT", "1");
}
+
+ /* Remove analytics from URL before loading */
+ new_uri = ephy_remove_tracking_from_uri (request_uri);
+ if (new_uri) {
+ webkit_uri_request_set_uri (request, new_uri);
+ request_uri = webkit_uri_request_get_uri (request);
+ }
+ g_free (new_uri);
}
if (!g_settings_get_boolean (EPHY_SETTINGS_WEB, EPHY_PREFS_WEB_ENABLE_ADBLOCK))
return FALSE;
- request_uri = webkit_uri_request_get_uri (request);
page_uri = webkit_web_page_get_uri (web_page);
/* Always load the main resource. */