Mind `important` only for valid redirect tokens

Related feedback:
- https://github.com/uBlockOrigin/uBlock-issues/issues/1366#issuecomment-745744824
This commit is contained in:
Raymond Hill 2020-12-16 06:55:46 -05:00
parent 058f160055
commit 89cac090a4
No known key found for this signature in database
GPG Key ID: 25E1490B761470C2
1 changed files with 6 additions and 7 deletions

View File

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