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

Unified Diff: abp2blocklist.js

Issue 29473555: Issue 5345 - Whitelist $elemhide and $generichide domains where possible (Closed) Base URL: https://hg.adblockplus.org/abp2blocklist
Patch Set: Created June 24, 2017, 2:48 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 | lib/abp2blocklist.js » ('j') | lib/abp2blocklist.js » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: abp2blocklist.js
===================================================================
--- a/abp2blocklist.js
+++ b/abp2blocklist.js
@@ -27,10 +27,23 @@
rl.on("line", line =>
{
if (/^\s*[^\[\s]/.test(line))
blockerList.addFilter(Filter.fromText(Filter.normalize(line)));
});
rl.on("close", () =>
{
- console.log(JSON.stringify(blockerList.generateRules(), null, "\t"));
+ let rules = blockerList.generateRules();
+
+ // If the rule set is too huge, Node.js throws
Manish Jethani 2017/06/24 14:54:15 This had to be done because of this change.
kzar 2017/07/07 11:40:13 So if the exception is thrown then only half the J
Manish Jethani 2017/07/08 05:33:59 If the exception is thrown the program crashes. Th
kzar 2017/07/10 12:33:07 Acknowledged.
+ // "RangeError: Invalid string length". As a workaround, print each rule
+ // individually.
+ console.log("[");
+ if (rules.length > 0)
+ {
+ let stringifyRule = rule => JSON.stringify(rule, null, "\t");
+ for (let i = 0; i < rules.length - 1; i++)
+ console.log(stringifyRule(rules[i]) + ",");
+ console.log(stringifyRule(rules[rules.length - 1]));
+ }
+ console.log("]");
});
« no previous file with comments | « no previous file | lib/abp2blocklist.js » ('j') | lib/abp2blocklist.js » ('J')

Powered by Google App Engine
This is Rietveld