Repository navigation
vm.runInContext Function Prototype Issue #56413
Description
Activity
- addedfeature requestIssues requesting new Node.js features.Issues requesting new Node.js features.
on Dec 30, 2024 This is expected, because things created syntactically (like
test) don't use globals (like your injectedFunction).- marked vm.runInContext Function Prototype Issue #56412 as a duplicate of this issue
on Dec 30, 2024 Thank you for your response and explanation!
I understand that functions created syntactically do not use the globals, including the Function constructor that I inject into the context. This indeed explains why my previous attempts have not been successful.
To further address this issue, I am looking for a way to ensure that all functions defined within vm.runInContext, regardless of whether they are created syntactically or through other means, share the same Function.prototype. If there are any suggestions or alternative approaches to achieve this, I would greatly appreciate it.
Thank you once again for your help and time!
There's no way to do that -
Function.prototypeis what's called "undeniable" which makes it unvirtualizable. In other words, you can't change its object identity.What's the overarching goal of this?
😃
There has been no activity on this feature request for 5 months. To help maintain relevant open issues, please add the never-stale
Issues and PRs exempt from automated stale handling. label or close this issue if it should be closed. If not, the issue will be automatically closed 6 months after the last non-automated comment.
For more information on how the project manages feature requests, please consult the feature request management document.- addedstaleIssues and PRs marked stale due to inactivity and scheduled for automatic closure.Issues and PRs marked stale due to inactivity and scheduled for automatic closure.
on Jul 1, 2025
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsAwaiting Triage
What is the problem this feature will solve?
I'm having an issue with the vm module in Node.js.The function prototypes defined within a script using vm.runInContext do not match Function.prototype.
What is the feature you are proposing to solve the problem?
Tried using proxies, manual prototype setting, custom constructors, but none worked.
What alternatives have you considered?
No response