Improve `trusted-prevent-dom-bypass` scriptlet · gorhill/uBlock@68a256b · GitHub | Latest TMZ Celebrity News & Gossip | Watch TMZ Live
Skip to content

Commit 68a256b

Browse files
committed
Improve trusted-prevent-dom-bypass scriptlet
1 parent 5e9737d commit 68a256b

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

src/js/resources/scriptlets.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2686,7 +2686,16 @@ function trustedPreventDomBypass(
26862686
}
26872687
}
26882688
if ( targetProp !== '' ) {
2689-
elem.contentWindow[targetProp] = self[targetProp];
2689+
let me = self, it = elem.contentWindow;
2690+
let chain = targetProp;
2691+
for (;;) {
2692+
const pos = chain.indexOf('.');
2693+
if ( pos === -1 ) { break; }
2694+
const prop = chain.slice(0, pos)
2695+
me = me[prop]; it = it[prop];
2696+
chain = chain.slice(pos+1);
2697+
}
2698+
it[chain] = me[chain];
26902699
} else {
26912700
Object.defineProperty(elem, 'contentWindow', { value: self });
26922701
}

0 commit comments

Comments
 (0)

TMZ Celebrity News – Breaking Stories, Videos & Gossip

Looking for the latest TMZ celebrity news? You've come to the right place. From shocking Hollywood scandals to exclusive videos, TMZ delivers it all in real time.

Whether it’s a red carpet slip-up, a viral paparazzi moment, or a legal drama involving your favorite stars, TMZ news is always first to break the story. Stay in the loop with daily updates, insider tips, and jaw-dropping photos.

🎥 Watch TMZ Live

TMZ Live brings you daily celebrity news and interviews straight from the TMZ newsroom. Don’t miss a beat—watch now and see what’s trending in Hollywood.