1
0
mirror of https://github.com/gorhill/uBlock.git synced 2024-09-14 15:02:27 +02: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:
Raymond Hill 2020-12-07 11:12:41 -05:00
parent 5d7a5a559d
commit 904aa87e2a
No known key found for this signature in database
GPG Key ID: 25E1490B761470C2
2 changed files with 8 additions and 2 deletions

View File

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

View File

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