| @@ -4906,14 +4906,17 @@ builtinScriptlets.push({ |
|
|
| 4906 |
4906 |
}); |
| 4907 |
4907 |
function trustedReplaceOutboundText( |
| 4908 |
4908 |
propChain = '', |
| 4909 |
|
-pattern = '', |
| 4910 |
|
-replacement = '', |
|
4909 |
+rawPattern = '', |
|
4910 |
+rawReplacement = '', |
| 4911 |
4911 |
...args |
| 4912 |
4912 |
) { |
| 4913 |
4913 |
if ( propChain === '' ) { return; } |
| 4914 |
4914 |
const safe = safeSelf(); |
| 4915 |
|
-const logPrefix = safe.makeLogPrefix('trusted-replace-outbound-text', propChain, pattern, replacement, ...args); |
| 4916 |
|
-const rePattern = safe.patternToRegex(pattern); |
|
4915 |
+const logPrefix = safe.makeLogPrefix('trusted-replace-outbound-text', propChain, rawPattern, rawReplacement, ...args); |
|
4916 |
+const rePattern = safe.patternToRegex(rawPattern); |
|
4917 |
+const replacement = rawReplacement.startsWith('json:') |
|
4918 |
+ ? safe.JSON_parse(rawReplacement.slice(5)) |
|
4919 |
+ : rawReplacement; |
| 4917 |
4920 |
const extraArgs = safe.getExtraArgs(args); |
| 4918 |
4921 |
const reCondition = safe.patternToRegex(extraArgs.condition | |
| 4919 |
4922 |
const reflector = proxyApplyFn(propChain, function(...args) { |
| @@ -4923,7 +4926,7 @@ function trustedReplaceOutboundText( |
|
|
| 4923 |
4926 |
try { textBefore = self.atob(encodedTextBefore); } |
| 4924 |
4927 |
catch(ex) { return encodedTextBefore; } |
| 4925 |
4928 |
} |
| 4926 |
|
-if ( pattern === '' ) { |
|
4929 |
+if ( rawPattern === '' ) { |
| 4927 |
4930 |
safe.uboLog(logPrefix, 'Decoded outbound text:\n', textBefore); |
| 4928 |
4931 |
return encodedTextBefore; |
| 4929 |
4932 |
} |