From a6cd954a2aa892d9de8bcde1a001ab46040806c1 Mon Sep 17 00:00:00 2001 From: Raymond Hill Date: Sat, 25 Sep 2021 12:36:33 -0400 Subject: [PATCH] Fix handling of negated types in `all` filter option Related feedback: - https://github.com/uBlockOrigin/uBlock-issues/issues/1730 Related commit: - https://github.com/gorhill/uBlock/commit/8f98622374ca36e69c60878979583b55615d4dd9 --- src/js/static-net-filtering.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/js/static-net-filtering.js b/src/js/static-net-filtering.js index a9aec2a9b..ae5f68c7f 100644 --- a/src/js/static-net-filtering.js +++ b/src/js/static-net-filtering.js @@ -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; }