[mv3] Fix regression in conversion of removeparam filters

`removeparam` filters with `important` option must have higher priority
than `allow` filters.
This commit is contained in:
Raymond Hill 2026-01-04 09:07:48 -05:00
parent f6048a0804
commit 329e99fd19
No known key found for this signature in database
GPG key ID: F5630CAE62A14316

View file

@ -4528,14 +4528,14 @@ StaticNetFilteringEngine.prototype.dnrFromCompiled = function(op, context, ...ar
[ ALLOW_REALM, { type: 'allow', priority: 30 } ],
[ BLOCK_REALM | IMPORTANT_REALM, { type: 'block', priority: 10 } ],
[ REDIRECT_REALM, { type: 'redirect', priority: 11 } ],
[ REMOVEPARAM_REALM, { type: 'removeparam', priority: 0 } ],
[ CSP_REALM, { type: 'csp', priority: 0 } ],
[ PERMISSIONS_REALM, { type: 'permissions', priority: 0 } ],
[ URLTRANSFORM_REALM, { type: 'uritransform', priority: 0 } ],
[ REMOVEPARAM_REALM, { type: 'removeparam', priority: 1 } ],
[ CSP_REALM, { type: 'csp', priority: 1 } ],
[ PERMISSIONS_REALM, { type: 'permissions', priority: 1 } ],
[ URLTRANSFORM_REALM, { type: 'uritransform', priority: 1 } ],
[ HEADERS_REALM, { type: 'block', priority: 10 } ],
[ HEADERS_REALM | ALLOW_REALM, { type: 'allow', priority: 30 } ],
[ HEADERS_REALM | IMPORTANT_REALM, { type: 'allow', priority: 10 } ],
[ URLSKIP_REALM, { type: 'urlskip', priority: 0 } ],
[ URLSKIP_REALM, { type: 'urlskip', priority: 1 } ],
]);
const partyness = new Map([
[ ANYPARTY_REALM, '' ],
@ -4598,10 +4598,7 @@ StaticNetFilteringEngine.prototype.dnrFromCompiled = function(op, context, ...ar
// - https://github.com/uBlockOrigin/uAssets/issues/29451#issuecomment-3150181993
for ( const rule of ruleset ) {
if ( rule.__important !== true ) { continue; }
if ( rule.priority === undefined ) {
if ( rule.__modifierType !== 'removeparam' ) { continue; }
rule.priority ||= 0;
}
rule.priority ??= 0;
rule.priority += 30;
}
@ -4836,6 +4833,12 @@ StaticNetFilteringEngine.prototype.dnrFromCompiled = function(op, context, ...ar
}
}
// Default priority is 1, remove priority if 1 or less.
for ( const rule of ruleset ) {
if ( rule.priority > 1 ) { continue; }
rule.priority = undefined;
}
return {
ruleset,
filterCount: context.filterCount,