1
0
mirror of https://github.com/gorhill/uBlock.git synced 2024-10-02 15:47:10 +02:00

Reset g regexes before use in rmnt/rpnt scriptlets

This commit is contained in:
Raymond Hill 2023-11-05 20:34:11 -05:00
parent bf001f4796
commit cdc3f66a6b
No known key found for this signature in database
GPG Key ID: 25E1490B761470C2

View File

@ -574,8 +574,11 @@ function replaceNodeTextFn(
let sedCount = extraArgs.sedCount || 0;
const handleNode = node => {
const before = node.textContent;
if ( safe.RegExp_test.call(rePattern, before) === false ) { return true; }
reCondition.lastIndex = 0;
if ( safe.RegExp_test.call(reCondition, before) === false ) { return true; }
rePattern.lastIndex = 0;
if ( safe.RegExp_test.call(rePattern, before) === false ) { return true; }
rePattern.lastIndex = 0;
const after = pattern !== ''
? before.replace(rePattern, replacement)
: replacement;