-
Notifications
You must be signed in to change notification settings - Fork 29.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
vm.runInContext: eval a strict function #2245
Comments
Possibly related: #548 This is almost certainly a V8 bug. @trevnorris tracked down #548 to V8s after 3.28.22 failing. I'll go see if there's any obvious culprit... |
could be related to: nodejs/node-v0.x-archive#8721? |
How likely this can be fixed in soon time? Is there any ETA? We're blocked by this issue at the moment, and will have to restructure our tests to not to use |
@domenic this related to the fact we wrap all our scripts to prevent global variable pollution? |
@trevnorris, seems strict functions just don't capture the local scope at all (and see only global environment, similarly to the |
I does not seem to be confined to the Edit: and with |
@targos, the However, we run the non-strict mode, and only the function So I'd say it's still the issue of the |
OK, seems it's really Node/V8 generic evaluation issue, not limited to the The function main() {
var code = [
"var foo = {m: 1};",
"",
"function bar() {",
" 'use strict';",
" console.log(foo);", // foo isn't captured in 0.10
"}",
].join('\n');
eval(code);
bar(); // foo is not defined, since node 0.10, works in 0.8
}
main(); Tests:
|
Yeah, if this is related to nodejs/node-v0.x-archive#8721, it is more a Node issue than a V8 issue, as we were unable to reproduce the problem in D8 :-/. (I still believe the problem stems from a V8 bug though, given that it regressed in a V8 upgrade.) |
Yeah, seems it's the same issue. Would still be great to get some ETA of fixing it. |
#2245 (comment) works for me on 4.0.0. Could we close this? |
The issue in nodejs/node-v0.x-archive#8721 is also fixed in 4.0.0 |
Is there a regression test for this (in Node or V8)? Just seems like a subtle enough bug that it's worth checking for in the test suite. |
@ide Ah, adding a test and closing this would make sense. |
A test was added in #5250 and this now appears to be working in master. closing. |
See: nodejs/node#2245 Test Plan: I switched my Node version back to v4 and confirmed that I was able to run `render_component.js` without error. Auditors: emily, csilvers
Rename the test appropriately alongside mentioning the subsystem Also, make a few basic changes to make sure the test conforms to the standard test structure Refs: nodejs#19105 Refs: https://github.com/nodejs/node/blob/master/doc/guides/writing-tests.md#test-structure
Rename the tests appropriately alongside mentioning the subsystem. Also, make a few basic changes to make sure the test conforms to the standard test structure. This renames: - test-regress-nodejsGH-1531 - test-regress-nodejsGH-2245 - test-regress-nodejsGH-3238 - test-regress-nodejsGH-3542 - test-regress-nodejsGH-3739 - test-regress-nodejsGH-4256 PR-URL: nodejs#19212 Refs: nodejs#19105 Refs: https://github.com/nodejs/node/blob/master/doc/guides/writing-tests.md#test-structure Reviewed-By: Rich Trott <[email protected]> Reviewed-By: Ruben Bridgewater <[email protected]> Reviewed-By: James M Snell <[email protected]>
Rename the tests appropriately alongside mentioning the subsystem. Also, make a few basic changes to make sure the test conforms to the standard test structure. This renames: - test-regress-GH-1531 - test-regress-GH-2245 - test-regress-GH-3238 - test-regress-GH-3542 - test-regress-GH-3739 - test-regress-GH-4256 PR-URL: #19212 Refs: #19105 Refs: https://github.com/nodejs/node/blob/master/doc/guides/writing-tests.md#test-structure Reviewed-By: Rich Trott <[email protected]> Reviewed-By: Ruben Bridgewater <[email protected]> Reviewed-By: James M Snell <[email protected]>
Rename the tests appropriately alongside mentioning the subsystem. Also, make a few basic changes to make sure the test conforms to the standard test structure. This renames: - test-regress-GH-1531 - test-regress-GH-2245 - test-regress-GH-3238 - test-regress-GH-3542 - test-regress-GH-3739 - test-regress-GH-4256 PR-URL: #19212 Refs: #19105 Refs: https://github.com/nodejs/node/blob/master/doc/guides/writing-tests.md#test-structure Reviewed-By: Rich Trott <[email protected]> Reviewed-By: Ruben Bridgewater <[email protected]> Reviewed-By: James M Snell <[email protected]>
Rename the tests appropriately alongside mentioning the subsystem. Also, make a few basic changes to make sure the test conforms to the standard test structure. This renames: - test-regress-nodejsGH-1531 - test-regress-nodejsGH-2245 - test-regress-nodejsGH-3238 - test-regress-nodejsGH-3542 - test-regress-nodejsGH-3739 - test-regress-nodejsGH-4256 PR-URL: nodejs#19212 Refs: nodejs#19105 Refs: https://github.com/nodejs/node/blob/master/doc/guides/writing-tests.md#test-structure Reviewed-By: Rich Trott <[email protected]> Reviewed-By: Ruben Bridgewater <[email protected]> Reviewed-By: James M Snell <[email protected]>
Rename the tests appropriately alongside mentioning the subsystem. Also, make a few basic changes to make sure the test conforms to the standard test structure. This renames: - test-regress-GH-1531 - test-regress-GH-2245 - test-regress-GH-3238 - test-regress-GH-3542 - test-regress-GH-3739 - test-regress-GH-4256 PR-URL: #19212 Refs: #19105 Refs: https://github.com/nodejs/node/blob/master/doc/guides/writing-tests.md#test-structure Reviewed-By: Rich Trott <[email protected]> Reviewed-By: Ruben Bridgewater <[email protected]> Reviewed-By: James M Snell <[email protected]>
Evaluated strict functions, when ran inside
vm.ranInContext
do not capture environment.This works (file
test.js
):Node session:
This doesn't:
Node session:
Also the code works if there is no
"use strict"
forfoo
.The text was updated successfully, but these errors were encountered: