Skip to content

Commit d2b8d99

Browse files
committed
All exceptions filters are exempt from requiring a trusted source
Related feedback: uBlockOrigin/uBlock-issues#2895 (reply in thread)
1 parent 1e05665 commit d2b8d99

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

src/js/scriptlet-filtering.js

+4-2
Original file line numberDiff line numberDiff line change
@@ -235,8 +235,10 @@ const normalizeRawFilter = function(parser, sourceIsTrusted = false) {
235235
if ( reng.aliases.has(token) ) {
236236
token = reng.aliases.get(token);
237237
}
238-
if ( sourceIsTrusted !== true && reng.tokenRequiresTrust(token) ) {
239-
return;
238+
if ( parser.isException() !== true ) {
239+
if ( sourceIsTrusted !== true ) {
240+
if ( reng.tokenRequiresTrust(token) ) { return; }
241+
}
240242
}
241243
args[0] = token.slice(0, -3);
242244
}

src/js/static-filtering-parser.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1481,7 +1481,7 @@ export class AstFilterParser {
14811481
case NODE_TYPE_NET_OPTION_NAME_REPLACE: {
14821482
realBad = abstractTypeCount || behaviorTypeCount || unredirectableTypeCount;
14831483
if ( realBad ) { break; }
1484-
if ( this.options.trustedSource !== true ) {
1484+
if ( isException !== true && this.options.trustedSource !== true ) {
14851485
this.astError = AST_ERROR_UNTRUSTED_SOURCE;
14861486
realBad = true;
14871487
break;
@@ -1496,7 +1496,7 @@ export class AstFilterParser {
14961496
case NODE_TYPE_NET_OPTION_NAME_URLTRANSFORM:
14971497
realBad = abstractTypeCount || behaviorTypeCount || unredirectableTypeCount;
14981498
if ( realBad ) { break; }
1499-
if ( this.options.trustedSource !== true ) {
1499+
if ( isException !== true && this.options.trustedSource !== true ) {
15001500
this.astError = AST_ERROR_UNTRUSTED_SOURCE;
15011501
realBad = true;
15021502
break;

0 commit comments

Comments
 (0)