From 9029d1d715f01bf04d3210554e0da238c2489481 Mon Sep 17 00:00:00 2001 From: Raymond Hill Date: Wed, 9 Apr 2025 18:23:01 -0400 Subject: [PATCH] Fix regression in categorizing highly generic filters at load time Related feedback: https://github.com/uBlockOrigin/uBlock-issues/issues/3235#issuecomment-2790807915 Regression from: https://github.com/gorhill/uBlock/commit/8b696a691a0871da8200d1806300842d988a4326 --- src/js/cosmetic-filtering.js | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/src/js/cosmetic-filtering.js b/src/js/cosmetic-filtering.js index 24d2ab925..7cb520a98 100644 --- a/src/js/cosmetic-filtering.js +++ b/src/js/cosmetic-filtering.js @@ -474,18 +474,21 @@ CosmeticFilteringEngine.prototype.fromCompiledContent = function(reader, options // Handle specific filters meant to apply everywhere, i.e. selectors // not to be injected conditionally through the DOM surveyor. // hash, *, .promoted-tweet - case 8: - if ( args[1] === '*' ) { + case 8: { + if ( args[1] === '*' && args[2].charCodeAt(0) === 0x2D /* + */ ) { const selector = args[2].slice(1); - if ( this.reSimpleHighGeneric.test(selector) ) - this.highlyGeneric.simple.dict.add(selector); - else { - this.highlyGeneric.complex.dict.add(selector); + if ( selector.charCodeAt(0) !== 0x7B /* { */ ) { + if ( this.reSimpleHighGeneric.test(selector) ) { + this.highlyGeneric.simple.dict.add(selector); + } else { + this.highlyGeneric.complex.dict.add(selector); + } + break; } - break; } this.specificFilters.store(args[1], args[2]); break; + } default: this.discardedCount += 1; break;