Fix handling of negated types in `all` filter option

Related feedback:
- https://github.com/uBlockOrigin/uBlock-issues/issues/1730

Related commit:
- 8f98622374
This commit is contained in:
Raymond Hill 2021-09-25 12:36:33 -04:00
parent 6d21bd4af9
commit a6cd954a2a
No known key found for this signature in database
GPG Key ID: 25E1490B761470C2
1 changed files with 5 additions and 3 deletions

View File

@ -3546,15 +3546,17 @@ class FilterCompiler {
compileToAtomicFilter(fdata, writer) {
const catBits = this.action | this.party;
let { typeBits } = this;
let { notTypeBits, typeBits } = this;
// Typeless
if ( typeBits === 0 ) {
writer.push([ catBits, this.tokenHash, fdata ]);
return;
}
// If all network types are set, create a typeless filter
if ( (typeBits & allNetworkTypesBits) === allNetworkTypesBits ) {
// If all network types are set, create a typeless filter. Excluded
// network types are tested at match time, se we act as if they are
// set.
if ( ((typeBits | notTypeBits) & allNetworkTypesBits) === allNetworkTypesBits ) {
writer.push([ catBits, this.tokenHash, fdata ]);
typeBits &= ~allNetworkTypesBits;
if ( typeBits === 0 ) { return; }