| Left: | ||
| Right: |
| LEFT | RIGHT |
|---|---|
| 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 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 85 let canSafelyMatchAsLowercase = false; | 85 let canSafelyMatchAsLowercase = false; |
| 86 | 86 |
| 87 for (let i = 0; i < text.length; i++) | 87 for (let i = 0; i < text.length; i++) |
| 88 { | 88 { |
| 89 let c = text[i]; | 89 let c = text[i]; |
| 90 | 90 |
| 91 // If we're currently inside the hostname we have to be careful not to | 91 // If we're currently inside the hostname we have to be careful not to |
| 92 // escape any characters until after we have converted it to punycode. | 92 // escape any characters until after we have converted it to punycode. |
| 93 if (hostnameStart != null && !hostnameFinished) | 93 if (hostnameStart != null && !hostnameFinished) |
| 94 { | 94 { |
| 95 let endingChar = (c == "*" || c == "^" || c == "?" || c == "/"); | 95 let endingChar = (c == "*" || c == "^" || |
|
Sebastian Noack
2016/02/27 23:06:16
I know we didn't handle it before, but what's if w
kzar
2016/03/07 17:06:48
So do we want to always consider "|" to end the ho
Sebastian Noack
2016/03/08 09:31:22
I guess, for simplicity we can just assume that an
kzar
2016/03/08 12:36:01
Yea, sounds good to me. Also we already know that
| |
| 96 c == "?" || c == "/" || c == "|"); | |
| 96 if (!endingChar && i != lastIndex) | 97 if (!endingChar && i != lastIndex) |
| 97 continue; | 98 continue; |
| 98 | 99 |
| 99 let hostname = text.substring(hostnameStart, endingChar ? i : i + 1); | 100 let hostname = text.substring(hostnameStart, endingChar ? i : i + 1); |
| 100 hostnameFinished = true; | 101 hostnameFinished = true; |
| 101 result.push(escapeRegExp(punycode.toASCII(hostname))); | 102 result.push(escapeRegExp(punycode.toASCII(hostname))); |
| 102 if (!endingChar) | 103 if (!endingChar) |
| 103 break; | 104 break; |
| 104 } | 105 } |
| 105 | 106 |
| (...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 436 | 437 |
| 437 for (let filter of this.elemhideExceptions) | 438 for (let filter of this.elemhideExceptions) |
| 438 addRule(convertFilter(filter, "ignore-previous-rules", false)); | 439 addRule(convertFilter(filter, "ignore-previous-rules", false)); |
| 439 for (let filter of this.requestFilters) | 440 for (let filter of this.requestFilters) |
| 440 addRule(convertFilter(filter, "block", true)); | 441 addRule(convertFilter(filter, "block", true)); |
| 441 for (let filter of this.requestExceptions) | 442 for (let filter of this.requestExceptions) |
| 442 addRule(convertFilter(filter, "ignore-previous-rules", true)); | 443 addRule(convertFilter(filter, "ignore-previous-rules", true)); |
| 443 | 444 |
| 444 return rules; | 445 return rules; |
| 445 }; | 446 }; |
| LEFT | RIGHT |