1
0
mirror of https://github.com/gorhill/uBlock.git synced 2024-07-08 04:49:12 +02:00

Remove requirement for presence of type with redirect= option

Related issue:
- https://github.com/gorhill/uBlock/issues/3590

Since the `redirect=` option was refactored into a modifier
filter, presence of a type (`script`, `xhr`, etc.) is no
longer a requirement.
This commit is contained in:
Raymond Hill 2020-11-28 08:52:18 -05:00
parent f75040afb8
commit c6d0204b23
No known key found for this signature in database
GPG Key ID: 25E1490B761470C2
2 changed files with 3 additions and 10 deletions

View File

@ -42,6 +42,7 @@ a*
! valid options
$script,redirect=noop.js
*$redirect=noop.js
*$empty
*$xhr,empty
*$xhr,redirect=empty
@ -91,9 +92,6 @@ $
! bad regex
/(abc|def/$xhr
! can't redirect without type (except to `empty`)
*$redirect=noop.js
! non-redirectable types
*$beacon,redirect-rule=empty
*$ping,redirect-rule=empty

View File

@ -2383,18 +2383,13 @@ const NetOptionsIterator = class {
}
}
}
// `redirect=`: requires at least one single redirectable type
// `redirect=`: can't redirect non-redirectable types
{
let i = this.tokenPos[OPTTokenRedirect];
if ( i === -1 ) {
i = this.tokenPos[OPTTokenRedirectRule];
}
if (
i !== -1 && (
hasNoBits(allBits, OPTRedirectableType) ||
hasBits(allBits, OPTNonRedirectableType)
)
) {
if ( i !== -1 && hasBits(allBits, OPTNonRedirectableType) ) {
optSlices[i] = OPTTokenInvalid;
if ( this.interactive ) {
this.parser.errorSlices(optSlices[i+1], optSlices[i+5]);