Skip to content

Commit 904aa87

Browse files
committed
Fix various regression in behavior of redirect-rule=
Related issue: - uBlockOrigin/uBlock-issues#1388 Fixed the special `none` redirect resource no longer being enforced. Fixed the enforcement of `important` redirect rules over exceptions and non-important ones.
1 parent 5d7a5a5 commit 904aa87

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

‎src/js/redirect-engine.js‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -305,6 +305,7 @@ RedirectEngine.prototype.tokenToURL = function(
305305
/******************************************************************************/
306306

307307
RedirectEngine.prototype.hasToken = function(token) {
308+
if ( token === 'none' ) { return true; }
308309
const asDataURI = token.charCodeAt(0) === 0x25 /* '%' */;
309310
if ( asDataURI ) {
310311
token = token.slice(1);

‎src/js/static-net-filtering.js‎

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4261,8 +4261,13 @@ FilterContainer.parseRedirectRequestValue = function(modifier) {
42614261
};
42624262

42634263
FilterContainer.compareRedirectRequests = function(a, b) {
4264-
if ( (a.bits & AllowAction) !== 0 ) { return -1; }
4265-
if ( (b.bits & AllowAction) !== 0 ) { return 1; }
4264+
const abits = a.bits, bbits = b.bits;
4265+
if ( abits !== bbits ) {
4266+
if ( (abits & Important) !== 0 ) { return 1; }
4267+
if ( (bbits & Important) !== 0 ) { return -1; }
4268+
if ( (abits & AllowAction) !== 0 ) { return -1; }
4269+
if ( (bbits & AllowAction) !== 0 ) { return 1; }
4270+
}
42664271
const { token: atok, priority: aint } =
42674272
FilterContainer.parseRedirectRequestValue(a.modifier);
42684273
if ( µb.redirectEngine.hasToken(atok) === false ) { return -1; }

0 commit comments

Comments
 (0)