| Left: | ||
| Right: |
| OLD | NEW |
|---|---|
| 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 Loading... | |
| 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)) |
|
kzar
2016/05/25 16:20:54
Fixed this bug in the process of writing the tests
Sebastian Noack
2016/05/25 17:16:33
Awesome, but how will that fix ever be tested, or
kzar
2016/05/25 18:31:54
Good point, created this issue https://issues.adbl
| |
| 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 Loading... | |
| 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 }; |
| OLD | NEW |