mirror of
https://github.com/gorhill/uBlock.git
synced 2026-03-11 09:04:36 +00:00
Improve trusted-suppress-native-method scriptlet
Add `debug` as disposition option: if the `how` parameter is `debug`, the scriptlet will trigger a `debugger` statement and the target method won't be suppressed. Useful to find out how the method is being called by page code. To be used for investigation purpose only.
This commit is contained in:
parent
fd60f54a5f
commit
41616df866
1 changed files with 5 additions and 4 deletions
|
|
@ -4432,13 +4432,10 @@ function trustedSuppressNativeMethod(
|
|||
safe.uboLog(logPrefix, `Arguments:\n${callArgs.join('\n')}`);
|
||||
return context.reflect();
|
||||
}
|
||||
if ( callArgs.length < signatureArgs.length ) {
|
||||
return context.reflect();
|
||||
}
|
||||
for ( let i = 0; i < signatureArgs.length; i++ ) {
|
||||
const signatureArg = signatureArgs[i];
|
||||
if ( signatureArg === undefined ) { continue; }
|
||||
const targetArg = callArgs[i];
|
||||
const targetArg = i < callArgs.length ? callArgs[i] : undefined;
|
||||
if ( signatureArg.type === 'exact' ) {
|
||||
if ( targetArg !== signatureArg.value ) {
|
||||
return context.reflect();
|
||||
|
|
@ -4450,6 +4447,10 @@ function trustedSuppressNativeMethod(
|
|||
}
|
||||
}
|
||||
}
|
||||
if ( how === 'debug' ) {
|
||||
debugger; // eslint-disable-line no-debugger
|
||||
return context.reflect();
|
||||
}
|
||||
safe.uboLog(logPrefix, `Suppressed:\n${callArgs.join('\n')}`);
|
||||
if ( how === 'abort' ) {
|
||||
throw new ReferenceError();
|
||||
|
|
|
|||
Loading…
Reference in a new issue