mirror of https://github.com/gorhill/uBlock.git
Properly return inherited methods in property getter in spoof-css scriptlet
Related feedback: - https://github.com/uBlockOrigin/uBlock-issues/issues/2618#issuecomment-1561451479
This commit is contained in:
parent
1d9ee00498
commit
d4fb87b6ba
|
@ -2262,6 +2262,9 @@ function spoofCSS(
|
||||||
proxiedStyles.add(target);
|
proxiedStyles.add(target);
|
||||||
const proxiedStyle = new Proxy(style, {
|
const proxiedStyle = new Proxy(style, {
|
||||||
get(target, prop, receiver) {
|
get(target, prop, receiver) {
|
||||||
|
if ( typeof target[prop] === 'function' ) {
|
||||||
|
return target[prop].bind(target);
|
||||||
|
}
|
||||||
return spoofStyle(prop, Reflect.get(target, prop, receiver));
|
return spoofStyle(prop, Reflect.get(target, prop, receiver));
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
@ -2349,9 +2352,10 @@ function spoofCSS(
|
||||||
**/
|
**/
|
||||||
|
|
||||||
builtinScriptlets.push({
|
builtinScriptlets.push({
|
||||||
name: 'sed.js',
|
name: 'replace-node-text.js',
|
||||||
requiresTrust: true,
|
requiresTrust: true,
|
||||||
fn: sed,
|
aliases: [ 'rnt.js', 'sed.js' /* to be removed */ ],
|
||||||
|
fn: replaceNodeText,
|
||||||
world: 'ISOLATED',
|
world: 'ISOLATED',
|
||||||
dependencies: [
|
dependencies: [
|
||||||
'get-extra-args.fn',
|
'get-extra-args.fn',
|
||||||
|
@ -2360,7 +2364,7 @@ builtinScriptlets.push({
|
||||||
'safe-self.fn',
|
'safe-self.fn',
|
||||||
],
|
],
|
||||||
});
|
});
|
||||||
function sed(
|
function replaceNodeText(
|
||||||
nodeName = '',
|
nodeName = '',
|
||||||
pattern = '',
|
pattern = '',
|
||||||
replacement = ''
|
replacement = ''
|
||||||
|
|
Loading…
Reference in New Issue