Skip to content

Commit

Permalink
Properly return inherited methods in property getter in spoof-css scr…
Browse files Browse the repository at this point in the history
…iptlet

Related feedback:
- uBlockOrigin/uBlock-issues#2618 (comment)
  • Loading branch information
gorhill committed May 24, 2023
1 parent 1d9ee00 commit d4fb87b
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions assets/resources/scriptlets.js
Original file line number Diff line number Diff line change
Expand Up @@ -2262,6 +2262,9 @@ function spoofCSS(
proxiedStyles.add(target);
const proxiedStyle = new Proxy(style, {
get(target, prop, receiver) {
if ( typeof target[prop] === 'function' ) {
return target[prop].bind(target);
}
return spoofStyle(prop, Reflect.get(target, prop, receiver));
},
});
Expand Down Expand Up @@ -2349,9 +2352,10 @@ function spoofCSS(
**/

builtinScriptlets.push({
name: 'sed.js',
name: 'replace-node-text.js',
requiresTrust: true,
fn: sed,
aliases: [ 'rnt.js', 'sed.js' /* to be removed */ ],
fn: replaceNodeText,
world: 'ISOLATED',
dependencies: [
'get-extra-args.fn',
Expand All @@ -2360,7 +2364,7 @@ builtinScriptlets.push({
'safe-self.fn',
],
});
function sed(
function replaceNodeText(
nodeName = '',
pattern = '',
replacement = ''
Expand Down

0 comments on commit d4fb87b

Please sign in to comment.