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-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 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
164 * be included. | 164 * be included. |
165 * | 165 * |
166 * @returns {Array.<string>} The list of selectors. | 166 * @returns {Array.<string>} The list of selectors. |
167 */ | 167 */ |
168 function getConditionalSelectors(domain, specificOnly) | 168 function getConditionalSelectors(domain, specificOnly) |
169 { | 169 { |
170 let selectors = []; | 170 let selectors = []; |
171 | 171 |
172 let excluded = new Set(); | 172 let excluded = new Set(); |
173 | 173 |
174 // This code is a performance hot-spot, which is why we've made certain | |
175 // micro-optimisations. Please be careful before making changes. | |
176 for (let currentDomain of suffixes(domain, !specificOnly)) | 174 for (let currentDomain of suffixes(domain, !specificOnly)) |
hub
2019/02/06 12:55:05
I assume that this change doesn't cause a performa
Manish Jethani
2019/02/06 13:13:31
This is no longer a hot spot and in fact this comm
Manish Jethani
2019/02/06 13:17:06
Done.
| |
177 { | 175 { |
178 let filters = filtersByDomain.get(currentDomain); | 176 let filters = filtersByDomain.get(currentDomain); |
179 if (filters) | 177 if (filters) |
180 { | 178 { |
181 for (let [filter, isIncluded] of filters) | 179 for (let [filter, isIncluded] of filters) |
182 { | 180 { |
183 if (!isIncluded) | 181 if (!isIncluded) |
184 { | 182 { |
185 excluded.add(filter); | 183 excluded.add(filter); |
186 } | 184 } |
(...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
508 { | 506 { |
509 let styleSheet = ""; | 507 let styleSheet = ""; |
510 | 508 |
511 for (let selectorGroup of splitSelectors(selectors)) | 509 for (let selectorGroup of splitSelectors(selectors)) |
512 styleSheet += createRule(selectorGroup); | 510 styleSheet += createRule(selectorGroup); |
513 | 511 |
514 return styleSheet; | 512 return styleSheet; |
515 } | 513 } |
516 | 514 |
517 exports.createStyleSheet = createStyleSheet; | 515 exports.createStyleSheet = createStyleSheet; |
LEFT | RIGHT |