diff --git a/src/js/static-net-filtering.js b/src/js/static-net-filtering.js index 7df10d3e8..2a1a8c296 100644 --- a/src/js/static-net-filtering.js +++ b/src/js/static-net-filtering.js @@ -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,