Skip to content

Commit

Permalink
Improve trusted-suppress-native-method scriptlet
Browse files Browse the repository at this point in the history
As per AdGuard's documentation `/.../` is a valid matcher, to
match a string argument against a regex pattern.
  • Loading branch information
gorhill committed Dec 26, 2024
1 parent 3ae2842 commit cb6c11a
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/js/resources/scriptlets.js
Original file line number Diff line number Diff line change
Expand Up @@ -3313,6 +3313,9 @@ function trustedSuppressNativeMethod(
if ( /^".*"$/.test(v) ) {
return { type: 'pattern', re: safe.patternToRegex(v.slice(1, -1)) };
}
if ( /^\/.+\/$/.test(v) ) {
return { type: 'pattern', re: safe.patternToRegex(v) };
}
if ( v === 'false' ) {
return { type: 'exact', value: false };
}
Expand Down

0 comments on commit cb6c11a

Please sign in to comment.