Left: | ||
Right: |
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 315 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
326 specificOnly) | 326 specificOnly) |
327 { | 327 { |
328 let candidates = location.toLowerCase().match(/[a-z0-9%]{3,}/g); | 328 let candidates = location.toLowerCase().match(/[a-z0-9%]{3,}/g); |
329 if (candidates === null) | 329 if (candidates === null) |
330 candidates = []; | 330 candidates = []; |
331 candidates.push(""); | 331 candidates.push(""); |
332 | 332 |
333 let whitelistHit = null; | 333 let whitelistHit = null; |
334 let blacklistHit = null; | 334 let blacklistHit = null; |
335 | 335 |
336 // If the type mask includes no types other than whitelist-only types, we | |
337 // can skip the blacklist. | |
336 if ((typeMask & ~WHITELIST_ONLY_TYPES) != 0) | 338 if ((typeMask & ~WHITELIST_ONLY_TYPES) != 0) |
Sebastian Noack
2018/10/21 22:41:39
I wonder if this logic is necessary. Shouldn't cal
Manish Jethani
2018/10/22 11:05:16
I like the idea, but we would lose out on the cach
Sebastian Noack
2018/10/22 15:04:31
No strong opinion either way, but in case we go wi
Manish Jethani
2018/10/22 20:39:30
We will be doing this as part of this:
https://co
Manish Jethani
2018/10/22 21:16:19
I've added comments to make it clearer.
Sebastian Noack
2018/10/22 22:12:35
I don't see any changes in the current patch there
Manish Jethani
2018/10/22 22:57:56
Yes, I'll suggest that change there if we agree on
| |
337 { | 339 { |
338 for (let i = 0, l = candidates.length; !blacklistHit && i < l; i++) | 340 for (let i = 0, l = candidates.length; !blacklistHit && i < l; i++) |
339 { | 341 { |
340 blacklistHit = this.blacklist._checkEntryMatch(candidates[i], location, | 342 blacklistHit = this.blacklist._checkEntryMatch(candidates[i], location, |
341 typeMask, docDomain, | 343 typeMask, docDomain, |
342 thirdParty, sitekey, | 344 thirdParty, sitekey, |
343 specificOnly); | 345 specificOnly); |
344 } | 346 } |
345 } | 347 } |
346 | 348 |
349 // If the type mask includes any whitelist-only types, we need to check the | |
350 // whitelist. | |
347 if (blacklistHit || (typeMask & WHITELIST_ONLY_TYPES) != 0) | 351 if (blacklistHit || (typeMask & WHITELIST_ONLY_TYPES) != 0) |
348 { | 352 { |
349 for (let i = 0, l = candidates.length; !whitelistHit && i < l; i++) | 353 for (let i = 0, l = candidates.length; !whitelistHit && i < l; i++) |
350 { | 354 { |
351 whitelistHit = this.whitelist._checkEntryMatch(candidates[i], location, | 355 whitelistHit = this.whitelist._checkEntryMatch(candidates[i], location, |
352 typeMask, docDomain, | 356 typeMask, docDomain, |
353 thirdParty, sitekey); | 357 thirdParty, sitekey); |
354 } | 358 } |
355 } | 359 } |
356 | 360 |
(...skipping 27 matching lines...) Expand all Loading... | |
384 | 388 |
385 exports.CombinedMatcher = CombinedMatcher; | 389 exports.CombinedMatcher = CombinedMatcher; |
386 | 390 |
387 /** | 391 /** |
388 * Shared {@link CombinedMatcher} instance that should usually be used. | 392 * Shared {@link CombinedMatcher} instance that should usually be used. |
389 * @type {CombinedMatcher} | 393 * @type {CombinedMatcher} |
390 */ | 394 */ |
391 let defaultMatcher = new CombinedMatcher(); | 395 let defaultMatcher = new CombinedMatcher(); |
392 | 396 |
393 exports.defaultMatcher = defaultMatcher; | 397 exports.defaultMatcher = defaultMatcher; |
LEFT | RIGHT |