Skip to content
This repository was archived by the owner on Apr 22, 2023. It is now read-only.

Commit da30c00

Browse files
deanmindutny
authored andcommitted
src: pass the v8::Context to CreateEnvironment
Pass in the v8::Context, instead of creating it within CreateEnvironment. This allows callers to use a pre-existing context. Signed-off-by: Fedor Indutny <[email protected]>
1 parent c4e5fde commit da30c00

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

src/node.cc

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3527,13 +3527,13 @@ int EmitExit(Environment* env) {
35273527

35283528

35293529
Environment* CreateEnvironment(Isolate* isolate,
3530+
Handle<Context> context,
35303531
int argc,
35313532
const char* const* argv,
35323533
int exec_argc,
35333534
const char* const* exec_argv) {
35343535
HandleScope handle_scope(isolate);
35353536

3536-
Local<Context> context = Context::New(isolate);
35373537
Context::Scope context_scope(context);
35383538
Environment* env = Environment::New(context);
35393539

@@ -3605,8 +3605,10 @@ int Start(int argc, char** argv) {
36053605
V8::Initialize();
36063606
{
36073607
Locker locker(node_isolate);
3608-
Environment* env =
3609-
CreateEnvironment(node_isolate, argc, argv, exec_argc, exec_argv);
3608+
HandleScope handle_scope(node_isolate);
3609+
Local<Context> context = Context::New(node_isolate);
3610+
Environment* env = CreateEnvironment(
3611+
node_isolate, context, argc, argv, exec_argc, exec_argv);
36103612
// Assign env to the debugger's context
36113613
if (debugger_running) {
36123614
HandleScope scope(env->isolate());

0 commit comments

Comments
 (0)