1
0
mirror of https://github.com/gorhill/uBlock.git synced 2024-09-29 06:07:11 +02:00

Code review of scriptlet helper

This commit is contained in:
Raymond Hill 2024-08-18 09:12:54 -04:00
parent 2c60b331e3
commit 5287f6e029
No known key found for this signature in database
GPG Key ID: 25E1490B761470C2

View File

@ -1462,10 +1462,8 @@ function proxyApplyFn(
} }
const fn = context[prop]; const fn = context[prop];
if ( typeof fn !== 'function' ) { return; } if ( typeof fn !== 'function' ) { return; }
const fnname = fn.name; const fnStr = fn.toString();
const toString = (function toString() { const toString = (function toString() { return fnStr; }).bind(null);
return `function ${fnname}() { [native code] }`;
}).bind(null);
if ( fn.prototype && fn.prototype.constructor === fn ) { if ( fn.prototype && fn.prototype.constructor === fn ) {
context[prop] = new Proxy(fn, { context[prop] = new Proxy(fn, {
construct: handler, construct: handler,