mirror of
https://github.com/gorhill/uBlock.git
synced 2026-03-11 09:04:36 +00:00
Improve prevent-set[Timeout|Interval] scriptlets
This commit is contained in:
parent
0e8de98411
commit
d36ea89a02
2 changed files with 7 additions and 6 deletions
|
|
@ -95,8 +95,8 @@ export function preventSetTimeout(
|
||||||
proxyApplyFn('setTimeout', function(context) {
|
proxyApplyFn('setTimeout', function(context) {
|
||||||
const { callArgs } = context;
|
const { callArgs } = context;
|
||||||
const a = callArgs[0] instanceof Function
|
const a = callArgs[0] instanceof Function
|
||||||
? String(safe.Function_toString(callArgs[0]))
|
? safe.String(safe.Function_toString(callArgs[0]))
|
||||||
: String(callArgs[0]);
|
: safe.String(callArgs[0]);
|
||||||
const b = callArgs[1];
|
const b = callArgs[1];
|
||||||
if ( needleRaw === '' && range.unbound() ) {
|
if ( needleRaw === '' && range.unbound() ) {
|
||||||
safe.uboLog(logPrefix, `Called:\n${a}\n${b}`);
|
safe.uboLog(logPrefix, `Called:\n${a}\n${b}`);
|
||||||
|
|
@ -159,8 +159,8 @@ export function preventSetInterval(
|
||||||
proxyApplyFn('setInterval', function(context) {
|
proxyApplyFn('setInterval', function(context) {
|
||||||
const { callArgs } = context;
|
const { callArgs } = context;
|
||||||
const a = callArgs[0] instanceof Function
|
const a = callArgs[0] instanceof Function
|
||||||
? String(safe.Function_toString(callArgs[0]))
|
? safe.String(safe.Function_toString(callArgs[0]))
|
||||||
: String(callArgs[0]);
|
: safe.String(callArgs[0]);
|
||||||
const b = callArgs[1];
|
const b = callArgs[1];
|
||||||
if ( needleRaw === '' && range.unbound() ) {
|
if ( needleRaw === '' && range.unbound() ) {
|
||||||
safe.uboLog(logPrefix, `Called:\n${a}\n${b}`);
|
safe.uboLog(logPrefix, `Called:\n${a}\n${b}`);
|
||||||
|
|
@ -212,8 +212,8 @@ export function preventRequestAnimationFrame(
|
||||||
proxyApplyFn('requestAnimationFrame', function(context) {
|
proxyApplyFn('requestAnimationFrame', function(context) {
|
||||||
const { callArgs } = context;
|
const { callArgs } = context;
|
||||||
const a = callArgs[0] instanceof Function
|
const a = callArgs[0] instanceof Function
|
||||||
? String(safe.Function_toString(callArgs[0]))
|
? safe.String(safe.Function_toString(callArgs[0]))
|
||||||
: String(callArgs[0]);
|
: safe.String(callArgs[0]);
|
||||||
if ( needleRaw === '' ) {
|
if ( needleRaw === '' ) {
|
||||||
safe.uboLog(logPrefix, `Called:\n${a}`);
|
safe.uboLog(logPrefix, `Called:\n${a}`);
|
||||||
} else if ( reNeedle.test(a) !== needleNot ) {
|
} else if ( reNeedle.test(a) !== needleNot ) {
|
||||||
|
|
|
||||||
|
|
@ -50,6 +50,7 @@ export function safeSelf() {
|
||||||
'RegExp_test': self.RegExp.prototype.test,
|
'RegExp_test': self.RegExp.prototype.test,
|
||||||
'RegExp_exec': self.RegExp.prototype.exec,
|
'RegExp_exec': self.RegExp.prototype.exec,
|
||||||
'Request_clone': self.Request.prototype.clone,
|
'Request_clone': self.Request.prototype.clone,
|
||||||
|
'String': self.String,
|
||||||
'String_fromCharCode': String.fromCharCode,
|
'String_fromCharCode': String.fromCharCode,
|
||||||
'String_split': String.prototype.split,
|
'String_split': String.prototype.split,
|
||||||
'XMLHttpRequest': self.XMLHttpRequest,
|
'XMLHttpRequest': self.XMLHttpRequest,
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue