| 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 302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 313 * @inheritdoc | 313 * @inheritdoc |
| 314 */ | 314 */ |
| 315 matchesAnyInternal(location, typeMask, docDomain, thirdParty, sitekey, | 315 matchesAnyInternal(location, typeMask, docDomain, thirdParty, sitekey, |
| 316 specificOnly) | 316 specificOnly) |
| 317 { | 317 { |
| 318 let candidates = location.toLowerCase().match(/[a-z0-9%]{3,}/g); | 318 let candidates = location.toLowerCase().match(/[a-z0-9%]{3,}/g); |
| 319 if (candidates === null) | 319 if (candidates === null) |
| 320 candidates = []; | 320 candidates = []; |
| 321 candidates.push(""); | 321 candidates.push(""); |
| 322 | 322 |
| 323 let whitelistHit = null; |
| 323 let blacklistHit = null; | 324 let blacklistHit = null; |
| 325 |
| 324 for (let i = 0, l = candidates.length; i < l; i++) | 326 for (let i = 0, l = candidates.length; i < l; i++) |
| 325 { | 327 { |
| 326 let substr = candidates[i]; | 328 let substr = candidates[i]; |
| 327 let result = this.whitelist._checkEntryMatch( | 329 blacklistHit = this.blacklist._checkEntryMatch( |
| 328 substr, location, typeMask, docDomain, thirdParty, sitekey | 330 substr, location, typeMask, docDomain, thirdParty, sitekey, |
| 331 specificOnly |
| 329 ); | 332 ); |
| 330 if (result) | 333 if (blacklistHit) |
| 331 return result; | 334 break; |
| 332 if (blacklistHit === null) | 335 } |
| 336 |
| 337 if (blacklistHit) |
| 338 { |
| 339 for (let i = 0, l = candidates.length; i < l; i++) |
| 333 { | 340 { |
| 334 blacklistHit = this.blacklist._checkEntryMatch( | 341 let substr = candidates[i]; |
| 335 substr, location, typeMask, docDomain, thirdParty, sitekey, | 342 whitelistHit = this.whitelist._checkEntryMatch( |
| 336 specificOnly | 343 substr, location, typeMask, docDomain, thirdParty, sitekey |
| 337 ); | 344 ); |
| 345 if (whitelistHit) |
| 346 break; |
| 338 } | 347 } |
| 339 } | 348 } |
| 340 return blacklistHit; | 349 |
| 350 return whitelistHit || blacklistHit; |
| 341 } | 351 } |
| 342 | 352 |
| 343 /** | 353 /** |
| 344 * @see Matcher#matchesAny | 354 * @see Matcher#matchesAny |
| 345 * @inheritdoc | 355 * @inheritdoc |
| 346 */ | 356 */ |
| 347 matchesAny(location, typeMask, docDomain, thirdParty, sitekey, specificOnly) | 357 matchesAny(location, typeMask, docDomain, thirdParty, sitekey, specificOnly) |
| 348 { | 358 { |
| 349 let key = location + " " + typeMask + " " + docDomain + " " + thirdParty + | 359 let key = location + " " + typeMask + " " + docDomain + " " + thirdParty + |
| 350 " " + sitekey + " " + specificOnly; | 360 " " + sitekey + " " + specificOnly; |
| (...skipping 16 matching lines...) Expand all Loading... |
| 367 | 377 |
| 368 exports.CombinedMatcher = CombinedMatcher; | 378 exports.CombinedMatcher = CombinedMatcher; |
| 369 | 379 |
| 370 /** | 380 /** |
| 371 * Shared {@link CombinedMatcher} instance that should usually be used. | 381 * Shared {@link CombinedMatcher} instance that should usually be used. |
| 372 * @type {CombinedMatcher} | 382 * @type {CombinedMatcher} |
| 373 */ | 383 */ |
| 374 let defaultMatcher = new CombinedMatcher(); | 384 let defaultMatcher = new CombinedMatcher(); |
| 375 | 385 |
| 376 exports.defaultMatcher = defaultMatcher; | 386 exports.defaultMatcher = defaultMatcher; |
| OLD | NEW |