src: expose node::RegisterContext to make a node managed context#62322
src: expose node::RegisterContext to make a node managed context#62322legendecas wants to merge 2 commits into
node::RegisterContext to make a node managed 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)
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #62322 +/- ##
==========================================
- Coverage 91.68% 90.06% -1.62%
==========================================
Files 361 714 +353
Lines 156230 225942 +69712
Branches 24021 42748 +18727
==========================================
+ Hits 143232 203490 +60258
- Misses 12729 14243 +1514
- Partials 269 8209 +7940
🚀 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 |
c6a39cf to
7a31490
Compare
|
Is this mostly for that I think alternatively we can consider just exposing an API that returns an opaque pointer to the |
7a31490 to
b4da0d8
Compare
node::MakeContextify to make a node managed vm contextnode::RegisterContext to make a node managed context
b4da0d8 to
3099a1a
Compare
|
Updated the PR to expose Embedders could compose @addaleax @joyeecheung would you mind taking a look again? Thank you! |
2473f26 to
bff753a
Compare
bff753a to
183cda0
Compare
Signed-off-by: Chengzhong Wu <cwu631@bloomberg.net>
183cda0 to
7c6662e
Compare
|
Updated the public API to use |
This allows addons to create a context, with Node.js inspector support.
The API exposed is intended to be minimum, to be used together with
node::NewContext.