Skip to content

Commit d36ea89

Browse files
committed
Improve prevent-set[Timeout|Interval] scriptlets
1 parent 0e8de98 commit d36ea89

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

src/js/resources/prevent-settimeout.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,8 @@ export function preventSetTimeout(
9595
proxyApplyFn('setTimeout', function(context) {
9696
const { callArgs } = context;
9797
const a = callArgs[0] instanceof Function
98-
? String(safe.Function_toString(callArgs[0]))
99-
: String(callArgs[0]);
98+
? safe.String(safe.Function_toString(callArgs[0]))
99+
: safe.String(callArgs[0]);
100100
const b = callArgs[1];
101101
if ( needleRaw === '' && range.unbound() ) {
102102
safe.uboLog(logPrefix, `Called:\n${a}\n${b}`);
@@ -159,8 +159,8 @@ export function preventSetInterval(
159159
proxyApplyFn('setInterval', function(context) {
160160
const { callArgs } = context;
161161
const a = callArgs[0] instanceof Function
162-
? String(safe.Function_toString(callArgs[0]))
163-
: String(callArgs[0]);
162+
? safe.String(safe.Function_toString(callArgs[0]))
163+
: safe.String(callArgs[0]);
164164
const b = callArgs[1];
165165
if ( needleRaw === '' && range.unbound() ) {
166166
safe.uboLog(logPrefix, `Called:\n${a}\n${b}`);
@@ -212,8 +212,8 @@ export function preventRequestAnimationFrame(
212212
proxyApplyFn('requestAnimationFrame', function(context) {
213213
const { callArgs } = context;
214214
const a = callArgs[0] instanceof Function
215-
? String(safe.Function_toString(callArgs[0]))
216-
: String(callArgs[0]);
215+
? safe.String(safe.Function_toString(callArgs[0]))
216+
: safe.String(callArgs[0]);
217217
if ( needleRaw === '' ) {
218218
safe.uboLog(logPrefix, `Called:\n${a}`);
219219
} else if ( reNeedle.test(a) !== needleNot ) {

src/js/resources/safe-self.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ export function safeSelf() {
5050
'RegExp_test': self.RegExp.prototype.test,
5151
'RegExp_exec': self.RegExp.prototype.exec,
5252
'Request_clone': self.Request.prototype.clone,
53+
'String': self.String,
5354
'String_fromCharCode': String.fromCharCode,
5455
'String_split': String.prototype.split,
5556
'XMLHttpRequest': self.XMLHttpRequest,

0 commit comments

Comments
 (0)