[mv3] Determine "genericity" on a per-cosmetic filter basis

Related issue:
https://github.com/uBlockOrigin/uBOL-home/issues/328
This commit is contained in:
Raymond Hill 2025-04-13 09:02:12 -04:00
parent 12c8bc6c5b
commit f51a4c79db
No known key found for this signature in database
GPG key ID: 25E1490B761470C2

View file

@ -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;
}
}