You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Refactor Worker and NodeMainInstance class to reuse code #29925
Opening an issue to discuss about how to refactor the Worker and NodeMainInstance class to reuse code.
My current plan is to create a base class NodeInstance and try to strip out common code in WorkerData/Worker as well as NodeMainInstance in there, and then make Worker and NodeMainInstance inherit from NodeInstance.
This is useful in adding support for startup snapshots in workers and ContextifyContext - otherwise we need to repeat e.g. snapshot availability detection code in multiple places which can be tricky to maintain.
I realized that we cannot actually deserialize the default context from the snapshot if the user uses the sandbox argument of vm.createContext, since the context would be different from the one we have for our own Node.js instances. We could still do this for contexts created without the sandbox argument and the users can work around the limitation by setting up the sandbox though property setters after the call to vm.createContext, though.
This issue has been marked as stale due to 210 days of inactivity.
It will be automatically closed in 30 days if no further activity occurs. If this is still relevant, please leave a comment or update it to keep it open.
This issue has been automatically closed after 30 days of inactivity following its stale status (no activity for a total of 120 days).
If this is still relevant, feel free to reopen it or leave a comment with additional details so we can continue the discussion.
Activity
joyeecheung commentedon Oct 11, 2019
cc @addaleax
joyeecheung commentedon Jan 6, 2020
I realized that we cannot actually deserialize the default context from the snapshot if the user uses the
sandboxargument ofvm.createContext, since the context would be different from the one we have for our own Node.js instances. We could still do this for contexts created without thesandboxargument and the users can work around the limitation by setting up the sandbox though property setters after the call tovm.createContext, though.github-actions commentedon Jun 27, 2026
This issue has been marked as stale due to 210 days of inactivity.
It will be automatically closed in 30 days if no further activity occurs. If this is still relevant, please leave a comment or update it to keep it open.
github-actions commentedon Jul 28, 2026
This issue has been automatically closed after 30 days of inactivity following its stale status (no activity for a total of 120 days).
If this is still relevant, feel free to reopen it or leave a comment with additional details so we can continue the discussion.