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

Side by Side Diff: lib/abp2blocklist.js

Issue 29344565: Issue 4072 - Fix typo in domain whitelisting logic (Closed)
Patch Set: Created May 25, 2016, 6:32 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 | no next file » | 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 231 matching lines...) Expand 10 before | Expand all | Expand 10 after
242 { 242 {
243 rules.push({ 243 rules.push({
244 trigger: { 244 trigger: {
245 "url-filter": ".*", 245 "url-filter": ".*",
246 "if-domain": addDomainPrefix([parsed.hostname]) 246 "if-domain": addDomainPrefix([parsed.hostname])
247 }, 247 },
248 action: {type: "ignore-previous-rules"} 248 action: {type: "ignore-previous-rules"}
249 }); 249 });
250 // If the filter contains other supported options we'll need to generate 250 // If the filter contains other supported options we'll need to generate
251 // further rules for it, but if not we can simply return now. 251 // further rules for it, but if not we can simply return now.
252 if (!(filter.contentType | whitelistableRequestTypes)) 252 if (!(filter.contentType & whitelistableRequestTypes))
253 return; 253 return;
254 } 254 }
255 255
256 let trigger = {"url-filter": parsed.regexp}; 256 let trigger = {"url-filter": parsed.regexp};
257 257
258 // Limit rules to HTTP(S) URLs 258 // Limit rules to HTTP(S) URLs
259 if (!/^(\^|http)/i.test(trigger["url-filter"])) 259 if (!/^(\^|http)/i.test(trigger["url-filter"]))
260 trigger["url-filter"] = "^https?://.*" + trigger["url-filter"]; 260 trigger["url-filter"] = "^https?://.*" + trigger["url-filter"];
261 261
262 // For rules containing only a hostname we know that we're matching against 262 // For rules containing only a hostname we know that we're matching against
(...skipping 198 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 | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld