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 328 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
339 /** | 339 /** |
340 * Checks whether a particular filter is slow | 340 * Checks whether a particular filter is slow |
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 if (matcher.hasFilter(filter)) | 349 let keyword = matcher.getKeywordForFilter(filter); |
350 return !matcher.getKeywordForFilter(filter); | 350 if (keyword != null) |
| 351 return keyword == ""; |
351 return !matcher.findKeyword(filter); | 352 return !matcher.findKeyword(filter); |
352 } | 353 } |
353 | 354 |
354 /** | 355 /** |
355 * Optimized filter matching testing both whitelist and blacklist matchers | 356 * Optimized filter matching testing both whitelist and blacklist matchers |
356 * simultaneously. For parameters see | 357 * simultaneously. For parameters see |
357 {@link Matcher#matchesAny Matcher.matchesAny()}. | 358 {@link Matcher#matchesAny Matcher.matchesAny()}. |
358 * @see Matcher#matchesAny | 359 * @see Matcher#matchesAny |
359 * @inheritdoc | 360 * @inheritdoc |
360 */ | 361 */ |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
413 | 414 |
414 exports.CombinedMatcher = CombinedMatcher; | 415 exports.CombinedMatcher = CombinedMatcher; |
415 | 416 |
416 /** | 417 /** |
417 * Shared {@link CombinedMatcher} instance that should usually be used. | 418 * Shared {@link CombinedMatcher} instance that should usually be used. |
418 * @type {CombinedMatcher} | 419 * @type {CombinedMatcher} |
419 */ | 420 */ |
420 let defaultMatcher = new CombinedMatcher(); | 421 let defaultMatcher = new CombinedMatcher(); |
421 | 422 |
422 exports.defaultMatcher = defaultMatcher; | 423 exports.defaultMatcher = defaultMatcher; |
OLD | NEW |