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 330 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
341 * @param {RegExpFilter} filter | 341 * @param {RegExpFilter} filter |
342 * @returns {boolean} | 342 * @returns {boolean} |
343 */ | 343 */ |
344 isSlowFilter(filter) | 344 isSlowFilter(filter) |
345 { | 345 { |
346 let matcher = ( | 346 let matcher = ( |
347 filter instanceof WhitelistFilter ? this.whitelist : this.blacklist | 347 filter instanceof WhitelistFilter ? this.whitelist : this.blacklist |
348 ); | 348 ); |
349 let keyword = matcher.getKeywordForFilter(filter); | 349 let keyword = matcher.getKeywordForFilter(filter); |
350 if (keyword != null) | 350 if (keyword != null) |
351 return keyword == ""; | 351 return !keyword; |
352 return !matcher.findKeyword(filter); | 352 return !matcher.findKeyword(filter); |
353 } | 353 } |
354 | 354 |
355 /** | 355 /** |
356 * Optimized filter matching testing both whitelist and blacklist matchers | 356 * Optimized filter matching testing both whitelist and blacklist matchers |
357 * simultaneously. For parameters see | 357 * simultaneously. For parameters see |
358 {@link Matcher#matchesAny Matcher.matchesAny()}. | 358 {@link Matcher#matchesAny Matcher.matchesAny()}. |
359 * @see Matcher#matchesAny | 359 * @see Matcher#matchesAny |
360 * @inheritdoc | 360 * @inheritdoc |
361 */ | 361 */ |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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; |
LEFT | RIGHT |