| 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-present eyeo GmbH | 3 * Copyright (C) 2006-present 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 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 64 * | 64 * |
| 65 * @yields {string} The next suffix for the domain. | 65 * @yields {string} The next suffix for the domain. |
| 66 */ | 66 */ |
| 67 function* domainSuffixes(domain, includeBlank = false) | 67 function* domainSuffixes(domain, includeBlank = false) |
| 68 { | 68 { |
| 69 while (domain != "") | 69 while (domain != "") |
| 70 { | 70 { |
| 71 yield domain; | 71 yield domain; |
| 72 | 72 |
| 73 let dotIndex = domain.indexOf("."); | 73 let dotIndex = domain.indexOf("."); |
| 74 domain = dotIndex == -1 ? "" : domain.substr(dotIndex + 1); | 74 domain = dotIndex == -1 ? "" : domain.substring(dotIndex + 1); |
|
Manish Jethani
2019/02/21 15:04:39
This is a hot spot, let's leave it as it is.
hub
2019/02/21 18:09:42
Done.
| |
| 75 } | 75 } |
| 76 | 76 |
| 77 if (includeBlank) | 77 if (includeBlank) |
| 78 yield ""; | 78 yield ""; |
| 79 } | 79 } |
| 80 | 80 |
| 81 exports.domainSuffixes = domainSuffixes; | 81 exports.domainSuffixes = domainSuffixes; |
| 82 | 82 |
| 83 /** | 83 /** |
| 84 * Checks whether the given hostname is a domain. | 84 * Checks whether the given hostname is a domain. |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 153 if (requestHostname == documentHostname) | 153 if (requestHostname == documentHostname) |
| 154 return false; | 154 return false; |
| 155 | 155 |
| 156 if (!isDomain(requestHostname) || !isDomain(documentHostname)) | 156 if (!isDomain(requestHostname) || !isDomain(documentHostname)) |
| 157 return true; | 157 return true; |
| 158 | 158 |
| 159 return getBaseDomain(requestHostname) != getBaseDomain(documentHostname); | 159 return getBaseDomain(requestHostname) != getBaseDomain(documentHostname); |
| 160 } | 160 } |
| 161 | 161 |
| 162 exports.isThirdParty = isThirdParty; | 162 exports.isThirdParty = isThirdParty; |
| OLD | NEW |