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 351 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
362 let matcher = ( | 362 let matcher = ( |
363 filter instanceof WhitelistFilter ? this.whitelist : this.blacklist | 363 filter instanceof WhitelistFilter ? this.whitelist : this.blacklist |
364 ); | 364 ); |
365 if (matcher.hasFilter(filter)) | 365 if (matcher.hasFilter(filter)) |
366 return !matcher.getKeywordForFilter(filter); | 366 return !matcher.getKeywordForFilter(filter); |
367 return !matcher.findKeyword(filter); | 367 return !matcher.findKeyword(filter); |
368 }, | 368 }, |
369 | 369 |
370 /** | 370 /** |
371 * Optimized filter matching testing both whitelist and blacklist matchers | 371 * Optimized filter matching testing both whitelist and blacklist matchers |
372 * simultaneously. For parameters see Matcher.matchesAny(). | 372 * simultaneously. For parameters see |
| 373 {@link Matcher#matchesAny Matcher.matchesAny()}. |
373 * @see Matcher#matchesAny | 374 * @see Matcher#matchesAny |
374 * @inheritdoc | 375 * @inheritdoc |
375 */ | 376 */ |
376 matchesAnyInternal(location, typeMask, docDomain, thirdParty, sitekey, | 377 matchesAnyInternal(location, typeMask, docDomain, thirdParty, sitekey, |
377 specificOnly) | 378 specificOnly) |
378 { | 379 { |
379 let candidates = location.toLowerCase().match(/[a-z0-9%]{3,}/g); | 380 let candidates = location.toLowerCase().match(/[a-z0-9%]{3,}/g); |
380 if (candidates === null) | 381 if (candidates === null) |
381 candidates = []; | 382 candidates = []; |
382 candidates.push(""); | 383 candidates.push(""); |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
424 | 425 |
425 return result; | 426 return result; |
426 } | 427 } |
427 }; | 428 }; |
428 | 429 |
429 /** | 430 /** |
430 * Shared CombinedMatcher instance that should usually be used. | 431 * Shared CombinedMatcher instance that should usually be used. |
431 * @type {CombinedMatcher} | 432 * @type {CombinedMatcher} |
432 */ | 433 */ |
433 exports.defaultMatcher = new CombinedMatcher(); | 434 exports.defaultMatcher = new CombinedMatcher(); |
OLD | NEW |