mirror of
https://github.com/gorhill/uBlock.git
synced 2024-11-05 18:32:30 +01:00
Fix various regression in behavior of redirect-rule=
Related issue: - https://github.com/uBlockOrigin/uBlock-issues/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.
This commit is contained in:
parent
5d7a5a559d
commit
904aa87e2a
@ -305,6 +305,7 @@ RedirectEngine.prototype.tokenToURL = function(
|
||||
/******************************************************************************/
|
||||
|
||||
RedirectEngine.prototype.hasToken = function(token) {
|
||||
if ( token === 'none' ) { return true; }
|
||||
const asDataURI = token.charCodeAt(0) === 0x25 /* '%' */;
|
||||
if ( asDataURI ) {
|
||||
token = token.slice(1);
|
||||
|
@ -4261,8 +4261,13 @@ FilterContainer.parseRedirectRequestValue = function(modifier) {
|
||||
};
|
||||
|
||||
FilterContainer.compareRedirectRequests = function(a, b) {
|
||||
if ( (a.bits & AllowAction) !== 0 ) { return -1; }
|
||||
if ( (b.bits & AllowAction) !== 0 ) { return 1; }
|
||||
const abits = a.bits, bbits = b.bits;
|
||||
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; }
|
||||
|
Loading…
Reference in New Issue
Block a user