1
0
mirror of https://github.com/gorhill/uBlock.git synced 2024-07-05 11:37:01 +02:00

Improve set-constant.js scriptlet

The scriptlet will now still try to trap a specific
property if a segment of the chain is not undefined
while yet not an object either.

For example, this now allows to set a value on
`document.body.onselectstart` when `document.body` has
not been instantiated yet by the browser parser,
whereas this would previously fail because
`document.body` would be `null` while the scriptlet
was testing against `undefined`.
This commit is contained in:
Raymond Hill 2020-03-07 14:16:54 -05:00
parent 04021424d0
commit 14ebfbea27
No known key found for this signature in database
GPG Key ID: 25E1490B761470C2

View File

@ -549,7 +549,7 @@
const prop = chain.slice(0, pos);
let v = owner[prop];
chain = chain.slice(pos + 1);
if ( v !== undefined ) {
if ( v instanceof Object ) {
makeProxy(v, chain);
return;
}