diff --git a/src/js/static-net-filtering.js b/src/js/static-net-filtering.js index f726881fa..57314b6af 100644 --- a/src/js/static-net-filtering.js +++ b/src/js/static-net-filtering.js @@ -2599,20 +2599,6 @@ const FilterParser = class { this.token = matches[0]; this.tokenHash = urlTokenizer.tokenHashFromString(this.token); this.tokenBeg = matches.index; - - // https://www.reddit.com/r/uBlockOrigin/comments/dpcvfx/ - // Since we found a valid token, we can get rid of trailing - // wildcards if any. - if ( this.firstWildcardPos !== -1 ) { - const lastCharPos = this.f.length - 1; - if ( this.firstWildcardPos === lastCharPos ) { - this.f = this.f.slice(0, -1); - this.firstWildcardPos = -1; - } else if ( this.secondWildcardPos === lastCharPos ) { - this.f = this.f.slice(0, -1); - this.secondWildcardPos = -1; - } - } } findGoodToken() { diff --git a/src/js/strie.js b/src/js/strie.js index b7c62f27e..c084eb1a3 100644 --- a/src/js/strie.js +++ b/src/js/strie.js @@ -666,6 +666,7 @@ const roundToPageSize = v => (v + PAGE_SIZE-1) & ~(PAGE_SIZE-1); // Find the right-most instance of substring in main string. // WASMable. lastIndexOf(haystackBeg, haystackEnd, needleLeft, needleLen) { + if ( needleLen === 0 ) { return haystackBeg; } let haystackLeft = haystackEnd - needleLen; if ( haystackLeft < haystackBeg ) { return -1; } needleLeft += this.buf32[CHAR0_SLOT]; diff --git a/src/js/wasm/biditrie.wasm b/src/js/wasm/biditrie.wasm index a5d3aef9e..e1de9312c 100644 Binary files a/src/js/wasm/biditrie.wasm and b/src/js/wasm/biditrie.wasm differ diff --git a/src/js/wasm/biditrie.wat b/src/js/wasm/biditrie.wat index 5f7ec5e46..3cd76a618 100644 --- a/src/js/wasm/biditrie.wat +++ b/src/js/wasm/biditrie.wat @@ -639,6 +639,13 @@ (local $i i32) (local $j i32) (local $c0 i32) + ;; if ( needleLen === 0 ) { return haystackBeg; } + get_local $needleLen + i32.eqz + if + get_local $haystackBeg + return + end block $fail block $succeed ;; let haystackLeft = haystackEnd - needleLen;