| 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-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 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 133 domain = nextDot == -1 ? null : domain.substring(nextDot + 1); | 133 domain = nextDot == -1 ? null : domain.substring(nextDot + 1); |
| 134 } | 134 } |
| 135 | 135 |
| 136 return filtersList; | 136 return filtersList; |
| 137 } | 137 } |
| 138 | 138 |
| 139 /** | 139 /** |
| 140 * Returns a list of selectors that apply on a domain from a given list of | 140 * Returns a list of selectors that apply on a domain from a given list of |
| 141 * filters | 141 * filters |
| 142 * @param {string} [domain] | 142 * @param {string} [domain] |
| 143 * @param {?Array.<?Map.<Filter,boolean>>} filtersList | 143 * @param {Array.<?Map.<Filter,boolean>>} filtersList |
| 144 * @param {Set.<Filter>} excludeSet | 144 * @param {Set.<Filter>} excludeSet |
| 145 * @returns {string[]} | 145 * @returns {string[]} |
| 146 */ | 146 */ |
| 147 function matchSelectors(domain, filtersList, excludeSet) | 147 function matchSelectors(domain, filtersList, excludeSet) |
| 148 { | 148 { |
| 149 let matches = []; | 149 let matches = []; |
| 150 | 150 |
| 151 // This code is a performance hot-spot, which is why we've made certain | 151 // This code is a performance hot-spot, which is why we've made certain |
| 152 // micro-optimisations. Please be careful before making changes. | 152 // micro-optimisations. Please be careful before making changes. |
| 153 for (let i = 0; i < filtersList.length; i++) | 153 for (let i = 0; i < filtersList.length; i++) |
| (...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 386 getUnconditionalSelectors() | 386 getUnconditionalSelectors() |
| 387 .concat(getConditionalGenericSelectors()); | 387 .concat(getConditionalGenericSelectors()); |
| 388 } | 388 } |
| 389 | 389 |
| 390 let excluded = new Set(); | 390 let excluded = new Set(); |
| 391 let selectors = matchSelectors(domain, specificFilters, excluded); | 391 let selectors = matchSelectors(domain, specificFilters, excluded); |
| 392 | 392 |
| 393 if (specificOnly) | 393 if (specificOnly) |
| 394 return selectors; | 394 return selectors; |
| 395 | 395 |
| 396 let genericFilters = [filtersByDomain.get("")]; | 396 return getUnconditionalSelectors() |
| 397 selectors = selectors.concat(matchSelectors(domain, genericFilters, | 397 .concat(selectors, |
| 398 excluded)); | 398 matchSelectors(domain, [filtersByDomain.get("")], |
| 399 return getUnconditionalSelectors().concat(selectors); | 399 excluded)); |
| 400 } | 400 } |
| 401 }; | 401 }; |
| LEFT | RIGHT |