-
Notifications
You must be signed in to change notification settings - Fork 30.3k
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
Symbol.dispose
is undefined when calling vm.runInNewContext
#50745
Comments
These symbols are polyfilled by Node.js so they are currently only available in Node.js contexts. I guess we can also polyfill it in the vm context, though I am not too fond of the idea of polyfilling something that should be implemented by V8 in the first place.. |
For reference, the V8 issue tracking this is https://bugs.chromium.org/p/v8/issues/detail?id=13559 |
This issue shows up also when running tests using jest – since tests run in a vm context. Note that for example |
@malthe is the disposable resource a resource created by your code or internally by node? |
The disposable resource is created by my code – it's a database connection. Now, in TypeScript 5.2, this actually works now because of polyfilling. However, in the VM context, this does not work because the symbols aren't defined. |
Please use a proper polyfill library like babel-polyfills or core-js explicit resource-management to get full feature polyfill. The I don't think there is anything we can do like hiding the feature with experimental flag or emit a warning as it could break existing pioneers depend on this symbol (#54329). Please follow https://issues.chromium.org/issues/42203506 for future implementation status in V8. |
Fixed in 9d7cd9b with cli flag |
Version
21.2.0
Platform
Microsoft Windows NT 10.0.19045.0 x64
Subsystem
vm
What steps will reproduce the bug?
How often does it reproduce? Is there a required condition?
Can be reproduced stably
What is the expected behavior? Why is that the expected behavior?
Symbol.dispose
should not be undefined. Because it is avaliable in globally, so it should also be avaliable in vm.What do you see instead?
vm.runInNewContext("Symbol.dispose")
outputsundefined
.Additional information
No response
The text was updated successfully, but these errors were encountered: