mirror of
https://github.com/gorhill/uBlock.git
synced 2026-03-11 09:04:36 +00:00
[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:
parent
f6048a0804
commit
329e99fd19
1 changed files with 12 additions and 9 deletions
|
|
@ -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,
|
||||
|
|
|
|||
Loading…
Reference in a new issue