From d5f9c05d62afa44d01318d6fe25f3e9b4e8a43f9 Mon Sep 17 00:00:00 2001 From: Raymond Hill Date: Sat, 24 Dec 2022 09:49:46 -0500 Subject: [PATCH] Take `method=` into account when evaluating whether a filter is pure hostname Related issue: - https://github.com/uBlockOrigin/uBlock-issues/issues/2117 --- src/js/static-net-filtering.js | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/src/js/static-net-filtering.js b/src/js/static-net-filtering.js index 6801fa914..561338ed3 100644 --- a/src/js/static-net-filtering.js +++ b/src/js/static-net-filtering.js @@ -3421,6 +3421,7 @@ class FilterCompiler { break; case parser.OPTTokenMethod: this.processMethodOption(val); + this.optionUnitBits |= this.METHOD_BIT; break; case parser.OPTTokenInvalid: return false; @@ -3900,16 +3901,17 @@ class FilterCompiler { } } -FilterCompiler.prototype.FROM_BIT = 0b0000000001; -FilterCompiler.prototype.TO_BIT = 0b0000000010; -FilterCompiler.prototype.DENYALLOW_BIT = 0b0000000100; -FilterCompiler.prototype.HEADER_BIT = 0b0000001000; -FilterCompiler.prototype.STRICT_PARTY_BIT = 0b0000010000; -FilterCompiler.prototype.CSP_BIT = 0b0000100000; -FilterCompiler.prototype.REMOVEPARAM_BIT = 0b0001000000; -FilterCompiler.prototype.REDIRECT_BIT = 0b0010000000; -FilterCompiler.prototype.NOT_TYPE_BIT = 0b0100000000; -FilterCompiler.prototype.IMPORTANT_BIT = 0b1000000000; +FilterCompiler.prototype.FROM_BIT = 0b00000000001; +FilterCompiler.prototype.TO_BIT = 0b00000000010; +FilterCompiler.prototype.DENYALLOW_BIT = 0b00000000100; +FilterCompiler.prototype.HEADER_BIT = 0b00000001000; +FilterCompiler.prototype.STRICT_PARTY_BIT = 0b00000010000; +FilterCompiler.prototype.CSP_BIT = 0b00000100000; +FilterCompiler.prototype.REMOVEPARAM_BIT = 0b00001000000; +FilterCompiler.prototype.REDIRECT_BIT = 0b00010000000; +FilterCompiler.prototype.NOT_TYPE_BIT = 0b00100000000; +FilterCompiler.prototype.IMPORTANT_BIT = 0b01000000000; +FilterCompiler.prototype.METHOD_BIT = 0b10000000000; FilterCompiler.prototype.FILTER_OK = 0; FilterCompiler.prototype.FILTER_INVALID = 1;