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

Side by Side Diff: lib/abp2blocklist.js

Issue 29457578: Issue 4327 - Do not apply $subdocument filters to top-level documents (Closed) Base URL: https://hg.adblockplus.org/abp2blocklist
Patch Set: Created June 6, 2017, 12:50 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 296 matching lines...) Expand 10 before | Expand all | Expand 10 after
307 else 307 else
308 { 308 {
309 trigger["if-domain"].push("*" + name); 309 trigger["if-domain"].push("*" + name);
310 } 310 }
311 } 311 }
312 } 312 }
313 else if (excluded.length > 0) 313 else if (excluded.length > 0)
314 { 314 {
315 trigger["unless-domain"] = excluded.map(name => "*" + name); 315 trigger["unless-domain"] = excluded.map(name => "*" + name);
316 } 316 }
317 else if (filter instanceof filterClasses.BlockingFilter &&
318 filter.contentType & typeMap.SUBDOCUMENT)
319 {
320 trigger["unless-top-url"] = [trigger["url-filter"]];
321 if (trigger["url-filter-is-case-sensitive"])
322 trigger["top-url-filter-is-case-sensitive"] = true;
323 }
317 324
318 rules.push({trigger: trigger, action: {type: action}}); 325 rules.push({trigger: trigger, action: {type: action}});
319 } 326 }
320 327
321 function hasNonASCI(obj) 328 function hasNonASCI(obj)
322 { 329 {
323 if (typeof obj == "string") 330 if (typeof obj == "string")
324 { 331 {
325 if (/[^\x00-\x7F]/.test(obj)) 332 if (/[^\x00-\x7F]/.test(obj))
326 return true; 333 return true;
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after
532 { 539 {
533 convertFilterAddRules(rules, filter, "block", true, 540 convertFilterAddRules(rules, filter, "block", true,
534 requestFilterExceptionDomains); 541 requestFilterExceptionDomains);
535 } 542 }
536 543
537 for (let filter of this.requestExceptions) 544 for (let filter of this.requestExceptions)
538 convertFilterAddRules(rules, filter, "ignore-previous-rules", true); 545 convertFilterAddRules(rules, filter, "ignore-previous-rules", true);
539 546
540 return rules.filter(rule => !hasNonASCI(rule)); 547 return rules.filter(rule => !hasNonASCI(rule));
541 }; 548 };
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