summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorgerito1 <gero.bare@gmail.com>2019-02-26 13:58:20 -0300
committerChristian Dywan <christian@twotoasts.de>2019-02-26 17:58:20 +0100
commit0ba2ee846514f458b71824b0bf78a0c9da33eb28 (patch)
treeea9d9656e1be94d745016ae9e70522e52705221d
parentb76366ee5de8a7a3fc653977fd672b2169f5f77a (diff)
downloadmidori-git-0ba2ee846514f458b71824b0bf78a0c9da33eb28.tar.gz
Fix Adblock not working (#268)
Check the subscription's whitelist and pattern for a match and insert the result into the cache.
-rw-r--r--extensions/adblock/subscription.vala16
1 files changed, 15 insertions, 1 deletions
diff --git a/extensions/adblock/subscription.vala b/extensions/adblock/subscription.vala
index 4bc191ed..d262ba81 100644
--- a/extensions/adblock/subscription.vala
+++ b/extensions/adblock/subscription.vala
@@ -355,7 +355,21 @@ namespace Adblock {
debug ("%s for %s (%s)", directive.to_string (), request_uri, page_uri);
return directive;
}
- return null;
+
+ try {
+ //The uri is either Allowed(whitelist), Blocked(pattern), or neither
+ directive = whitelist.match (request_uri, page_uri);
+ if (directive == null) {
+ directive = pattern.match (request_uri, page_uri);
+ }
+ } catch (Error error) {
+ critical ("Error matching %s %s: %s", request_uri, uri, error.message);
+ }
+
+ if (directive != null)
+ cache.insert (request_uri, directive);
+
+ return directive;
}
}
}