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 385 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
396 let key = location + " " + typeMask + " " + docDomain + " " + thirdParty + | 396 let key = location + " " + typeMask + " " + docDomain + " " + thirdParty + |
397 " " + sitekey + " " + specificOnly; | 397 " " + sitekey + " " + specificOnly; |
398 | 398 |
399 let result = this.resultCache.get(key); | 399 let result = this.resultCache.get(key); |
400 if (typeof result != "undefined") | 400 if (typeof result != "undefined") |
401 return result; | 401 return result; |
402 | 402 |
403 result = this.matchesAnyInternal(location, typeMask, docDomain, | 403 result = this.matchesAnyInternal(location, typeMask, docDomain, |
404 thirdParty, sitekey, specificOnly); | 404 thirdParty, sitekey, specificOnly); |
405 | 405 |
406 if (this.resultCache.size >= CombinedMatcher.maxCacheEntries) | 406 if (this.resultCache.size >= this.maxCacheEntries) |
407 this.resultCache.clear(); | 407 this.resultCache.clear(); |
408 | 408 |
409 this.resultCache.set(key, result); | 409 this.resultCache.set(key, result); |
410 | 410 |
411 return result; | 411 return result; |
412 } | 412 } |
413 } | 413 } |
414 | 414 |
415 exports.CombinedMatcher = CombinedMatcher; | 415 exports.CombinedMatcher = CombinedMatcher; |
416 | 416 |
417 /** | 417 /** |
418 * Shared {@link CombinedMatcher} instance that should usually be used. | 418 * Shared {@link CombinedMatcher} instance that should usually be used. |
419 * @type {CombinedMatcher} | 419 * @type {CombinedMatcher} |
420 */ | 420 */ |
421 let defaultMatcher = new CombinedMatcher(); | 421 let defaultMatcher = new CombinedMatcher(); |
422 | 422 |
423 exports.defaultMatcher = defaultMatcher; | 423 exports.defaultMatcher = defaultMatcher; |
OLD | NEW |