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

Side by Side Diff: lib/abp2blocklist.js

Issue 29467595: Issue 5325 - Add support for separator characters (Closed) Base URL: https://hg.adblockplus.org/abp2blocklist
Patch Set: Created June 16, 2017, 5:25 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | test/abp2blocklist.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * This file is part of Adblock Plus <https://adblockplus.org/>, 2 * This file is part of Adblock Plus <https://adblockplus.org/>,
3 * Copyright (C) 2006-2017 eyeo GmbH 3 * Copyright (C) 2006-2017 eyeo GmbH
4 * 4 *
5 * Adblock Plus is free software: you can redistribute it and/or modify 5 * Adblock Plus is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 3 as 6 * it under the terms of the GNU General Public License version 3 as
7 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
8 * 8 *
9 * Adblock Plus is distributed in the hope that it will be useful, 9 * Adblock Plus is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 } 142 }
143 143
144 switch (c) 144 switch (c)
145 { 145 {
146 case "*": 146 case "*":
147 if (regexp.length > 0 && i < lastIndex && text[i + 1] != "*") 147 if (regexp.length > 0 && i < lastIndex && text[i + 1] != "*")
148 regexp.push(".*"); 148 regexp.push(".*");
149 break; 149 break;
150 case "^": 150 case "^":
151 if (i < lastIndex) 151 if (i < lastIndex)
152 regexp.push("."); 152 regexp.push("[^.%A-Za-z0-9_]");
153 else
154 regexp.push("([^.%A-Za-z0-9_].*)?$");
Sebastian Noack 2017/06/16 21:13:18 Can you put the duplicated part of the regexp in a
Manish Jethani 2017/06/19 10:39:54 Done.
155 canSafelyMatchAsLowercase = false;
Sebastian Noack 2017/06/16 21:13:18 Why is that necessary?
Manish Jethani 2017/06/19 10:39:54 It was converting "A-Z" into "a-z". I thought abou
153 break; 156 break;
154 case "|": 157 case "|":
155 if (i == 0) 158 if (i == 0)
156 { 159 {
157 regexp.push("^"); 160 regexp.push("^");
158 break; 161 break;
159 } 162 }
160 if (i == lastIndex) 163 if (i == lastIndex)
161 { 164 {
162 regexp.push("$"); 165 regexp.push("$");
(...skipping 376 matching lines...) Expand 10 before | Expand all | Expand 10 after
539 { 542 {
540 convertFilterAddRules(rules, filter, "block", true, 543 convertFilterAddRules(rules, filter, "block", true,
541 requestFilterExceptionDomains); 544 requestFilterExceptionDomains);
542 } 545 }
543 546
544 for (let filter of this.requestExceptions) 547 for (let filter of this.requestExceptions)
545 convertFilterAddRules(rules, filter, "ignore-previous-rules", true); 548 convertFilterAddRules(rules, filter, "ignore-previous-rules", true);
546 549
547 return rules.filter(rule => !hasNonASCI(rule)); 550 return rules.filter(rule => !hasNonASCI(rule));
548 }; 551 };
OLDNEW
« no previous file with comments | « no previous file | test/abp2blocklist.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld