mirror of
https://github.com/gorhill/uBlock.git
synced 2026-03-11 09:04:36 +00:00
Improve trusted-prevent-dom-bypass scriptlet
This commit is contained in:
parent
5e9737d38e
commit
68a256bdde
1 changed files with 10 additions and 1 deletions
|
|
@ -2686,7 +2686,16 @@ function trustedPreventDomBypass(
|
|||
}
|
||||
}
|
||||
if ( targetProp !== '' ) {
|
||||
elem.contentWindow[targetProp] = self[targetProp];
|
||||
let me = self, it = elem.contentWindow;
|
||||
let chain = targetProp;
|
||||
for (;;) {
|
||||
const pos = chain.indexOf('.');
|
||||
if ( pos === -1 ) { break; }
|
||||
const prop = chain.slice(0, pos)
|
||||
me = me[prop]; it = it[prop];
|
||||
chain = chain.slice(pos+1);
|
||||
}
|
||||
it[chain] = me[chain];
|
||||
} else {
|
||||
Object.defineProperty(elem, 'contentWindow', { value: self });
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue