-
Notifications
You must be signed in to change notification settings - Fork 29.8k
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
src: expose MaybeInitializeContext to allow existing contexts #28544
src: expose MaybeInitializeContext to allow existing contexts #28544
Conversation
Splits the node.js specific tweak intialization of NewContext into a new helper MaybeInitializeContext so that embedders with existing contexts can still use them in a node Environment now that primordials are initialized and required so early.
edddd5d
to
98b6cf5
Compare
src/node.h
Outdated
@@ -305,6 +305,12 @@ NODE_EXTERN v8::Local<v8::Context> NewContext( | |||
v8::Local<v8::ObjectTemplate> object_template = | |||
v8::Local<v8::ObjectTemplate>()); | |||
|
|||
// Runs Node.js-specific tweaks on an already constructed context | |||
NODE_EXTERN v8::Local<v8::Context> MaybeInitializeContext( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For legacy reasons NewContext still need to return a Local, but for a new API I think we should return a MaybeLocal here. I would drop the word Maybe in the function name in favor of a more practical signature.
Ping @MarshallOfSound |
Sorry @BridgeAR had PTO last week 🌴 I ended up with a slightly different approach here, I realized that |
9c6cacf
to
a954ce8
Compare
a954ce8
to
2dcfc04
Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Landed in 33ae95c |
Splits the node.js specific tweak intialization of NewContext into a new helper MaybeInitializeContext so that embedders with existing contexts can still use them in a Node.js Environment now that primordials are initialized and required so early. Update MaybeInitializeContext to return MaybeLocal, PR-URL: #28544 Reviewed-By: Joyee Cheung <[email protected]> Reviewed-By: James M Snell <[email protected]>
Splits the node.js specific tweak intialization of NewContext into a new helper MaybeInitializeContext so that embedders with existing contexts can still use them in a Node.js Environment now that primordials are initialized and required so early. Update MaybeInitializeContext to return MaybeLocal, PR-URL: #28544 Reviewed-By: Joyee Cheung <[email protected]> Reviewed-By: James M Snell <[email protected]>
Splits the node.js specific tweak intialization of NewContext into a new helper MaybeInitializeContext so that embedders with existing contexts can still use them in a Node.js Environment now that primordials are initialized and required so early. Update MaybeInitializeContext to return MaybeLocal, PR-URL: #28544 Reviewed-By: Joyee Cheung <[email protected]> Reviewed-By: James M Snell <[email protected]>
Splits the node.js specific tweak intialization of NewContext into a new helper MaybeInitializeContext so that embedders with existing contexts can still use them in a node Environment now that primordials are initialized and required so early.
Found this issue while upgrading Electron to node 12.4, now primordials are created in every context --> electron/node@3da36d0 we need to initialize a context the same way node does but we don't create the context so this method had to be split into two to allow folks with pre-created contexts to still use them in node Environments
Checklist
make -j4 test
(UNIX), orvcbuild test
(Windows) passes