Skip to content

Commit

Permalink
Improve set-constant.js scriptlet
Browse files Browse the repository at this point in the history
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`.
  • Loading branch information
gorhill committed Mar 7, 2020
1 parent 0402142 commit 14ebfbe
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion assets/resources/scriptlets.js
Expand Up @@ -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;
}
Expand Down

0 comments on commit 14ebfbe

Please sign in to comment.