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 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
266 | 266 |
267 if (parsed.canSafelyMatchAsLowercase || filter.matchCase) | 267 if (parsed.canSafelyMatchAsLowercase || filter.matchCase) |
268 trigger["url-filter-is-case-sensitive"] = true; | 268 trigger["url-filter-is-case-sensitive"] = true; |
269 | 269 |
270 let included = []; | 270 let included = []; |
271 let excluded = []; | 271 let excluded = []; |
272 | 272 |
273 parseDomains(filter.domains, included, excluded); | 273 parseDomains(filter.domains, included, excluded); |
274 | 274 |
275 if (withResourceTypes) | 275 if (withResourceTypes) |
276 { | |
276 trigger["resource-type"] = getResourceTypes(filter); | 277 trigger["resource-type"] = getResourceTypes(filter); |
278 | |
279 // Rules with no resource types to match shouldn't match anything and | |
Sebastian Noack
2016/08/20 13:42:50
Not sure whether this comment is necessary. Isn't
kzar
2016/08/22 12:44:36
Fair enough, removed.
| |
280 // therefore shouldn't be created. | |
281 if (trigger["resource-type"].length == 0) | |
282 return; | |
283 } | |
284 | |
277 if (filter.thirdParty != null) | 285 if (filter.thirdParty != null) |
278 trigger["load-type"] = [filter.thirdParty ? "third-party" : "first-party"]; | 286 trigger["load-type"] = [filter.thirdParty ? "third-party" : "first-party"]; |
279 | 287 |
280 if (included.length > 0) | 288 if (included.length > 0) |
281 trigger["if-domain"] = addDomainPrefix(included); | 289 trigger["if-domain"] = addDomainPrefix(included); |
282 else if (excluded.length > 0) | 290 else if (excluded.length > 0) |
283 trigger["unless-domain"] = addDomainPrefix(excluded); | 291 trigger["unless-domain"] = addDomainPrefix(excluded); |
284 | 292 |
285 rules.push({trigger: trigger, action: {type: action}}); | 293 rules.push({trigger: trigger, action: {type: action}}); |
286 } | 294 } |
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
461 | 469 |
462 for (let filter of this.elemhideExceptions) | 470 for (let filter of this.elemhideExceptions) |
463 convertFilterAddRules(rules, filter, "ignore-previous-rules", false); | 471 convertFilterAddRules(rules, filter, "ignore-previous-rules", false); |
464 for (let filter of this.requestFilters) | 472 for (let filter of this.requestFilters) |
465 convertFilterAddRules(rules, filter, "block", true); | 473 convertFilterAddRules(rules, filter, "block", true); |
466 for (let filter of this.requestExceptions) | 474 for (let filter of this.requestExceptions) |
467 convertFilterAddRules(rules, filter, "ignore-previous-rules", true); | 475 convertFilterAddRules(rules, filter, "ignore-previous-rules", true); |
468 | 476 |
469 return rules.filter(rule => !hasNonASCI(rule)); | 477 return rules.filter(rule => !hasNonASCI(rule)); |
470 }; | 478 }; |
OLD | NEW |