node-chakracore icon indicating copy to clipboard operation
node-chakracore copied to clipboard

this === global yields false in node-chakracore

Open alexlamsl opened this issue 8 years ago • 5 comments

this === global gives true on Node.js (tested 7.4.0) where as node-chakracore gives false (tested 7.0.0-pre9 and v8.0.0-nightly201701238e66382a18)

This breaks vows as it decides what to pass on as context object.

alexlamsl avatar Jan 23 '17 12:01 alexlamsl

Reproducible on 8.4.0

alexlamsl avatar Aug 27 '17 17:08 alexlamsl

Looks like the issue is that this === global.__proto__ rather than this === global.

MSLaguana avatar Aug 28 '17 16:08 MSLaguana

The workaround I tried with vows was this.global === global, but your version should also work.

(This won't address the disparity between node and node-chakracore, however.)

alexlamsl avatar Aug 29 '17 15:08 alexlamsl

Still an issue as of v10.1.0

$ nvs use node
PATH = node\10.2.1\x64

$ echo 'console.log(function(){return this === global}())' | node
true
$ nvs use chakracore
PATH = chakracore\10.1.0\x64

$ echo 'console.log(function(){return this === global}())' | node
false

alexlamsl avatar May 26 '18 06:05 alexlamsl

Still an issue as of v10.6.0

alexlamsl avatar Jul 26 '18 13:07 alexlamsl