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-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 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
248 }); | 248 }); |
249 // If the filter contains other supported options we'll need to generate | 249 // If the filter contains other supported options we'll need to generate |
250 // further rules for it, but if not we can simply return now. | 250 // further rules for it, but if not we can simply return now. |
251 if (!(filter.contentType & whitelistableRequestTypes)) | 251 if (!(filter.contentType & whitelistableRequestTypes)) |
252 return; | 252 return; |
253 } | 253 } |
254 | 254 |
255 let trigger = {"url-filter": parsed.regexp}; | 255 let trigger = {"url-filter": parsed.regexp}; |
256 | 256 |
257 // Limit rules to HTTP(S) URLs | 257 // Limit rules to HTTP(S) URLs |
258 if (!/^(\^|http)/i.test(trigger["url-filter"])) | 258 if (!/^\^/.test(trigger["url-filter"])) |
259 trigger["url-filter"] = "^https?://.*" + trigger["url-filter"]; | 259 trigger["url-filter"] = "^https?://.*" + trigger["url-filter"]; |
260 | 260 |
261 // For rules containing only a hostname we know that we're matching against | 261 // For rules containing only a hostname we know that we're matching against |
262 // a lowercase string unless the matchCase option was passed. | 262 // a lowercase string unless the matchCase option was passed. |
263 if (parsed.canSafelyMatchAsLowercase && !filter.matchCase) | 263 if (parsed.canSafelyMatchAsLowercase && !filter.matchCase) |
264 trigger["url-filter"] = trigger["url-filter"].toLowerCase(); | 264 trigger["url-filter"] = trigger["url-filter"].toLowerCase(); |
265 | 265 |
266 if (parsed.canSafelyMatchAsLowercase || filter.matchCase) | 266 if (parsed.canSafelyMatchAsLowercase || filter.matchCase) |
267 trigger["url-filter-is-case-sensitive"] = true; | 267 trigger["url-filter-is-case-sensitive"] = true; |
268 | 268 |
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
532 { | 532 { |
533 convertFilterAddRules(rules, filter, "block", true, | 533 convertFilterAddRules(rules, filter, "block", true, |
534 requestFilterExceptionDomains); | 534 requestFilterExceptionDomains); |
535 } | 535 } |
536 | 536 |
537 for (let filter of this.requestExceptions) | 537 for (let filter of this.requestExceptions) |
538 convertFilterAddRules(rules, filter, "ignore-previous-rules", true); | 538 convertFilterAddRules(rules, filter, "ignore-previous-rules", true); |
539 | 539 |
540 return rules.filter(rule => !hasNonASCI(rule)); | 540 return rules.filter(rule => !hasNonASCI(rule)); |
541 }; | 541 }; |
OLD | NEW |