From 89cac090a47be7cf830fd9fbc1523146c3ae3910 Mon Sep 17 00:00:00 2001 From: Raymond Hill Date: Wed, 16 Dec 2020 06:55:46 -0500 Subject: [PATCH] Mind `important` only for valid redirect tokens Related feedback: - https://github.com/uBlockOrigin/uBlock-issues/issues/1366#issuecomment-745744824 --- src/js/static-net-filtering.js | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/js/static-net-filtering.js b/src/js/static-net-filtering.js index f52c4c45b..c38159bbb 100644 --- a/src/js/static-net-filtering.js +++ b/src/js/static-net-filtering.js @@ -4261,19 +4261,18 @@ FilterContainer.parseRedirectRequestValue = function(modifier) { }; FilterContainer.compareRedirectRequests = function(a, b) { - const abits = a.bits, bbits = b.bits; + const { token: atok, priority: aint, bits: abits } = + FilterContainer.parseRedirectRequestValue(a.modifier); + if ( µb.redirectEngine.hasToken(atok) === false ) { return -1; } + const { token: btok, priority: bint, bits: bbits } = + FilterContainer.parseRedirectRequestValue(b.modifier); + if ( µb.redirectEngine.hasToken(btok) === false ) { return 1; } if ( abits !== bbits ) { if ( (abits & Important) !== 0 ) { return 1; } if ( (bbits & Important) !== 0 ) { return -1; } if ( (abits & AllowAction) !== 0 ) { return -1; } if ( (bbits & AllowAction) !== 0 ) { return 1; } } - const { token: atok, priority: aint } = - FilterContainer.parseRedirectRequestValue(a.modifier); - if ( µb.redirectEngine.hasToken(atok) === false ) { return -1; } - const { token: btok, priority: bint } = - FilterContainer.parseRedirectRequestValue(b.modifier); - if ( µb.redirectEngine.hasToken(btok) === false ) { return 1; } return aint - bint; };