Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
fixup! src: split LoadEnvironment() at startExecution()
  • Loading branch information
addaleax committed Jan 3, 2019
commit eb913cd3fd2faa9da99000920b4813840ef78070
13 changes: 9 additions & 4 deletions src/node.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1167,11 +1167,16 @@ void RunBootstrapping(Environment* env) {

void StartExecution(Environment* env) {
HandleScope handle_scope(env->isolate());
Local<Function> start_execution = env->start_execution_function();
if (start_execution.IsEmpty()) return;
start_execution->Call(
env->context(), Undefined(env->isolate()), 0, nullptr);
// We have to use Local<>::New because of the optimized way in which we access
// the object in the env->...() getters, which does not play well with
// resetting the handle while we're accessing the object through the Local<>.
Local<Function> start_execution =
Local<Function>::New(env->isolate(), env->start_execution_function());
env->set_start_execution_function(Local<Function>());
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe do this before the call to, er, Call() as an extra guard against recursive invocation?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done, but it requires some extra magic because of the way the env->...() getters work…


if (start_execution.IsEmpty()) return;
USE(start_execution->Call(
env->context(), Undefined(env->isolate()), 0, nullptr));
}

static void StartInspector(Environment* env, const char* path) {
Expand Down