src: don't overwrite non-writable vm globals
Check that the property doesn't have the read-only flag set before overwriting it. This is Ben Noordhuis previous commit, but keeping is_contextual_store. is_contextual_store describes whether this.foo = 42 or foo = 42 was called. The second is contextual and will fail in strict mode if foo is used without declaration. Therefore only do an early return if it is a contextual store. In particular, don't do an early return for Object.defineProperty(this, ...). Fixes: https://github.com/nodejs/node/issues/10223 Refs: https://github.com/nodejs/node/pull/10227 PR-URL: https://github.com/nodejs/node/pull/11109 Reviewed-By:Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By:
James M Snell <jasnell@gmail.com> Reviewed-By:
Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
parent
0101d77a
Please register or sign in to comment