src: expose node::MakeContextify to make a node managed vm context#62322
src: expose node::MakeContextify to make a node managed vm context#62322legendecas wants to merge 1 commit intonodejs:mainfrom
node::MakeContextify to make a node managed vm context#62322Conversation
|
Review requested:
|
b97e910 to
5690323
Compare
addaleax
left a comment
There was a problem hiding this comment.
The created context is identicaly to the one created with vm.createContext
in node:vm. However, node:vm does not allow an addon to unwrap the
v8::Context out of the sandbox object.
The API exposed is intended to be minimum
That kinda sounds like what we primarily need/want is an API to unwrap the v8::Context from a sandbox object – couldn't we do that instead? (It's also not super difficult to do that tbh, you could run vm.runInContext('{}', context) and do obj->GetCreationContext() on the result)
| MicrotaskMode microtask_mode() { return microtask_mode_; } | ||
|
|
||
| private: | ||
| v8::Local<v8::String> name_; |
There was a problem hiding this comment.
I'd suggest adding a version field on this struct for easier ABI compatibility if we want to make changes at some point
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #62322 +/- ##
=======================================
Coverage 89.68% 89.68%
=======================================
Files 676 676
Lines 206578 206612 +34
Branches 39555 39560 +5
=======================================
+ Hits 185267 185301 +34
+ Misses 13446 13445 -1
- Partials 7865 7866 +1
🚀 New features to boost your workflow:
|
Yeah, that's the main purpose. We could expose an API to unwrap the |
5690323 to
c6a39cf
Compare
I still feel like that's both easier and a bit more powerful, but I'll leave it up to you 👍 |
I can add both. A |
This allows addons to create a context, with Node.js inspector support.
The created context is identicaly to the one created with
vm.createContextin
node:vm. However,node:vmdoes not allow an addon to unwrap thev8::Contextout of the sandbox object.The API exposed is intended to be minimum, so that it will not block
the pending vm Modules API.