Index: lib/abp2blocklist.js |
diff --git a/lib/abp2blocklist.js b/lib/abp2blocklist.js |
index c86cb9d4b55725a8a44399bb853bcab7381d4521..4ac4453a010ad7ec0f1585b89d3dee6d1b9dab2d 100644 |
--- a/lib/abp2blocklist.js |
+++ b/lib/abp2blocklist.js |
@@ -276,6 +276,17 @@ function convertFilterAddRules(rules, filter, action, withResourceTypes) |
{ |
trigger["resource-type"] = getResourceTypes(filter); |
+ // Content Blocking rules can't differentiate between sub-document |
+ // requests (iframes) and top-level document requests (redirects). So to |
+ // avoid too many false-positives we stop generic rules (no hostname part) |
+ // from blocking document requests. |
+ if (action == "block" && !parsed.hostname) |
+ { |
+ let documentIndex = trigger["resource-type"].indexOf("document"); |
+ if (documentIndex > -1) |
+ trigger["resource-type"].splice(documentIndex, 1); |
+ } |
+ |
// Rules with no resource types to match shouldn't match anything and |
// therefore shouldn't be created. |
if (trigger["resource-type"].length == 0) |