From 0ba2ee846514f458b71824b0bf78a0c9da33eb28 Mon Sep 17 00:00:00 2001 From: gerito1 Date: Tue, 26 Feb 2019 13:58:20 -0300 Subject: Fix Adblock not working (#268) Check the subscription's whitelist and pattern for a match and insert the result into the cache. --- extensions/adblock/subscription.vala | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) 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; } } } -- cgit v1.2.1