From f51a4c79db09913b8705391b7da481c31959ab2f Mon Sep 17 00:00:00 2001 From: Raymond Hill Date: Sun, 13 Apr 2025 09:02:12 -0400 Subject: [PATCH] [mv3] Determine "genericity" on a per-cosmetic filter basis Related issue: https://github.com/uBlockOrigin/uBOL-home/issues/328 --- src/js/static-dnr-filtering.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/js/static-dnr-filtering.js b/src/js/static-dnr-filtering.js index b097e51d3..df23d863c 100644 --- a/src/js/static-dnr-filtering.js +++ b/src/js/static-dnr-filtering.js @@ -222,6 +222,7 @@ function addExtendedToDNR(context, parser) { return; } let details = context.specificCosmeticFilters.get(compiled); + let isGeneric = true; for ( const { hn, not, bad } of parser.getExtFilterDomainIterator() ) { if ( bad ) { continue; } if ( not && exception ) { continue; } @@ -247,14 +248,14 @@ function addExtendedToDNR(context, parser) { details.matches = [ '*' ]; continue; } + isGeneric = false; details.matches.push(hn); } if ( details === undefined ) { return; } if ( exception ) { return; } if ( compiled.startsWith('{') ) { return; } - if ( details.matches === undefined || details.matches.includes('*') ) { + if ( isGeneric ) { addGenericCosmeticFilter(context, compiled, false); - details.matches = undefined; } }