Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: lib/abp2blocklist.js

Issue 29349981: Noissue - Remove rules which match no resource types (Closed)
Patch Set: Created Aug. 19, 2016, 5:33 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | test/abp2blocklist.js » ('j') | test/abp2blocklist.js » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/abp2blocklist.js
diff --git a/lib/abp2blocklist.js b/lib/abp2blocklist.js
index 0309dd21bc22fce2d68f896028bfba32c5d2715a..c86cb9d4b55725a8a44399bb853bcab7381d4521 100644
--- a/lib/abp2blocklist.js
+++ b/lib/abp2blocklist.js
@@ -273,7 +273,15 @@ function convertFilterAddRules(rules, filter, action, withResourceTypes)
parseDomains(filter.domains, included, excluded);
if (withResourceTypes)
+ {
trigger["resource-type"] = getResourceTypes(filter);
+
+ // Rules with no resource types to match shouldn't match anything and
Sebastian Noack 2016/08/20 13:42:50 Not sure whether this comment is necessary. Isn't
kzar 2016/08/22 12:44:36 Fair enough, removed.
+ // therefore shouldn't be created.
+ if (trigger["resource-type"].length == 0)
+ return;
+ }
+
if (filter.thirdParty != null)
trigger["load-type"] = [filter.thirdParty ? "third-party" : "first-party"];
« no previous file with comments | « no previous file | test/abp2blocklist.js » ('j') | test/abp2blocklist.js » ('J')

Powered by Google App Engine
This is Rietveld