[epiphany/mcatanzaro/adblocker-tweaks: 1/2] Remove final leftovers of HTTPS Everywhere support
- From: Michael Catanzaro <mcatanzaro src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [epiphany/mcatanzaro/adblocker-tweaks: 1/2] Remove final leftovers of HTTPS Everywhere support
- Date: Mon, 6 May 2019 19:09:37 +0000 (UTC)
commit 3cfc09b4431156b5896a135a4416c43807bdcbbf
Author: Michael Catanzaro <mcatanzaro igalia com>
Date: Mon May 6 13:56:15 2019 -0500
Remove final leftovers of HTTPS Everywhere support
The URI tester never rewrites URIs anymore, so remove support for doing
this.
embed/web-extension/ephy-uri-tester.c | 23 ++++-------------------
embed/web-extension/ephy-uri-tester.h | 10 +++++-----
embed/web-extension/ephy-web-extension.c | 18 ++++--------------
3 files changed, 13 insertions(+), 38 deletions(-)
---
diff --git a/embed/web-extension/ephy-uri-tester.c b/embed/web-extension/ephy-uri-tester.c
index feaa19c5d..1191b6069 100644
--- a/embed/web-extension/ephy-uri-tester.c
+++ b/embed/web-extension/ephy-uri-tester.c
@@ -566,10 +566,10 @@ file_read_cb (GFile *file, GAsyncResult *result, EphyUriTester *tester)
(GAsyncReadyCallback)file_parse_cb, tester);
}
-static gboolean
-ephy_uri_tester_block_uri (EphyUriTester *tester,
- const char *req_uri,
- const char *page_uri)
+gboolean
+ephy_uri_tester_is_uri_allowed (EphyUriTester *tester,
+ const char *req_uri,
+ const char *page_uri)
{
/* check whitelisting rules before the normal ones */
if (ephy_uri_tester_is_matched (tester, NULL, req_uri, page_uri, TRUE))
@@ -577,21 +577,6 @@ ephy_uri_tester_block_uri (EphyUriTester *tester,
return ephy_uri_tester_is_matched (tester, NULL, req_uri, page_uri, FALSE);
}
-char *
-ephy_uri_tester_rewrite_uri (EphyUriTester *tester,
- const char *request_uri,
- const char *page_uri)
-{
- /* Should we block the URL outright? */
- if (ephy_uri_tester_block_uri (tester, request_uri, page_uri)) {
- g_debug ("Request '%s' blocked (page: '%s')", request_uri, page_uri);
-
- return NULL;
- }
-
- return g_strdup (request_uri);
-}
-
static void
adblock_file_monitor_changed (GFileMonitor *monitor,
GFile *file,
diff --git a/embed/web-extension/ephy-uri-tester.h b/embed/web-extension/ephy-uri-tester.h
index 5b22faad9..bb3edcc38 100644
--- a/embed/web-extension/ephy-uri-tester.h
+++ b/embed/web-extension/ephy-uri-tester.h
@@ -28,11 +28,11 @@ G_BEGIN_DECLS
G_DECLARE_FINAL_TYPE (EphyUriTester, ephy_uri_tester, EPHY, URI_TESTER, GObject)
-EphyUriTester *ephy_uri_tester_new (const char *adblock_data_dir);
-void ephy_uri_tester_load (EphyUriTester *tester);
-char *ephy_uri_tester_rewrite_uri (EphyUriTester *tester,
- const char *request_uri,
- const char *page_uri);
+EphyUriTester *ephy_uri_tester_new (const char *adblock_data_dir);
+void ephy_uri_tester_load (EphyUriTester *tester);
+gboolean ephy_uri_tester_is_uri_allowed (EphyUriTester *tester,
+ const char *request_uri,
+ const char *page_uri);
G_END_DECLS
diff --git a/embed/web-extension/ephy-web-extension.c b/embed/web-extension/ephy-web-extension.c
index 54c91a7e9..c03949bc4 100644
--- a/embed/web-extension/ephy-web-extension.c
+++ b/embed/web-extension/ephy-web-extension.c
@@ -168,26 +168,16 @@ web_page_send_request (WebKitWebPage *web_page,
modified_uri = ephy_remove_tracking_from_uri (request_uri);
if (should_use_adblocker (request_uri, page_uri, redirected_response_uri, extension)) {
- char *result;
+ gboolean result;
ephy_uri_tester_load (extension->uri_tester);
- result = ephy_uri_tester_rewrite_uri (extension->uri_tester,
- modified_uri ? modified_uri : request_uri,
- page_uri);
+ result = ephy_uri_tester_is_uri_allowed (extension->uri_tester,
+ modified_uri ? modified_uri : request_uri,
+ page_uri);
if (!result) {
LOG ("Refused to load %s", request_uri);
return TRUE;
}
-
- g_free (modified_uri);
- modified_uri = result;
- } else if (!modified_uri) {
- return FALSE;
- }
-
- if (g_strcmp0 (request_uri, modified_uri) != 0) {
- LOG ("Rewrote %s to %s", request_uri, modified_uri);
- webkit_uri_request_set_uri (request, modified_uri);
}
return FALSE;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]