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

Side by Side Diff: lib/abp2blocklist.js

Issue 29349790: Issue 4326 - || should match subdomains too (Closed)
Patch Set: Created Aug. 12, 2016, 2:31 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-2016 Eyeo GmbH 3 * Copyright (C) 2006-2016 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 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 } 146 }
147 if (i == lastIndex) 147 if (i == lastIndex)
148 { 148 {
149 regexp.push("$"); 149 regexp.push("$");
150 break; 150 break;
151 } 151 }
152 if (i == 1 && text[0] == "|") 152 if (i == 1 && text[0] == "|")
153 { 153 {
154 hostnameStart = i + 1; 154 hostnameStart = i + 1;
155 canSafelyMatchAsLowercase = true; 155 canSafelyMatchAsLowercase = true;
156 regexp.push("https?://"); 156 regexp.push("https?://([^/]+\\.)?");
157 break; 157 break;
158 } 158 }
159 regexp.push("\\|"); 159 regexp.push("\\|");
160 break; 160 break;
161 case "/": 161 case "/":
162 if (!hostnameFinished && 162 if (!hostnameFinished &&
163 text.charAt(i-2) == ":" && text.charAt(i-1) == "/") 163 text.charAt(i-2) == ":" && text.charAt(i-1) == "/")
164 { 164 {
165 hostnameStart = i + 1; 165 hostnameStart = i + 1;
166 canSafelyMatchAsLowercase = true; 166 canSafelyMatchAsLowercase = true;
(...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after
461 461
462 for (let filter of this.elemhideExceptions) 462 for (let filter of this.elemhideExceptions)
463 convertFilterAddRules(rules, filter, "ignore-previous-rules", false); 463 convertFilterAddRules(rules, filter, "ignore-previous-rules", false);
464 for (let filter of this.requestFilters) 464 for (let filter of this.requestFilters)
465 convertFilterAddRules(rules, filter, "block", true); 465 convertFilterAddRules(rules, filter, "block", true);
466 for (let filter of this.requestExceptions) 466 for (let filter of this.requestExceptions)
467 convertFilterAddRules(rules, filter, "ignore-previous-rules", true); 467 convertFilterAddRules(rules, filter, "ignore-previous-rules", true);
468 468
469 return rules.filter(rule => !hasNonASCI(rule)); 469 return rules.filter(rule => !hasNonASCI(rule));
470 }; 470 };
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