@@ -3265,21 +3265,27 @@ void LoadEnvironment(Environment* env) {
3265
3265
env->isolate ()->SetFatalErrorHandler (node::OnFatalError);
3266
3266
env->isolate ()->AddMessageListener (OnMessage);
3267
3267
3268
- // Compile, execute the src/node.js file. (Which was included as static C
3269
- // string in node_natives.h. 'native_node' is the string containing that
3270
- // source code.)
3271
-
3272
- // The node.js file returns a function 'f'
3273
3268
atexit (AtExit);
3274
3269
3270
+ // Compile ./lib/internal/bootstrap_node.js as `Local<Function> f`.
3271
+ // We call `f` at the end of this block with the 'process' variable
3272
+ // built up with all our bindings. Inside the script we take care of
3273
+ // assigning things to their places.
3274
+
3275
+ // We start the process this way in order to be more modular. Developers
3276
+ // who do not like how bootrap_node.js sets up the module system but do like
3277
+ // Node's I/O bindings may want to replace 'f' with their own function.
3278
+
3275
3279
TryCatch try_catch (env->isolate ());
3276
3280
3277
3281
// Disable verbose mode to stop FatalException() handler from trying
3278
3282
// to handle the exception. Errors this early in the start-up phase
3279
3283
// are not safe to ignore.
3280
3284
try_catch.SetVerbose (false );
3281
3285
3282
- Local<String> script_name = FIXED_ONE_BYTE_STRING (env->isolate (), " node.js" );
3286
+ Local<String> script_name = FIXED_ONE_BYTE_STRING (env->isolate (),
3287
+ " bootstrap_node.js" );
3288
+
3283
3289
Local<Value> f_value = ExecuteString (env, MainSource (env), script_name);
3284
3290
if (try_catch.HasCaught ()) {
3285
3291
ReportException (env, try_catch);
@@ -3288,14 +3294,6 @@ void LoadEnvironment(Environment* env) {
3288
3294
CHECK (f_value->IsFunction ());
3289
3295
Local<Function> f = Local<Function>::Cast (f_value);
3290
3296
3291
- // Now we call 'f' with the 'process' variable that we've built up with
3292
- // all our bindings. Inside node.js we'll take care of assigning things to
3293
- // their places.
3294
-
3295
- // We start the process this way in order to be more modular. Developers
3296
- // who do not like how 'src/node.js' setups the module system but do like
3297
- // Node's I/O bindings may want to replace 'f' with their own function.
3298
-
3299
3297
// Add a reference to the global object
3300
3298
Local<Object> global = env->context ()->Global ();
3301
3299
@@ -4301,8 +4299,8 @@ static void StartNodeInstance(void* arg) {
4301
4299
v8::platform::PumpMessageLoop (default_platform, isolate);
4302
4300
EmitBeforeExit (env);
4303
4301
4304
- // Emit `beforeExit` if the loop became alive either after emitting
4305
- // event, or after running some callbacks.
4302
+ // Check if the loop became alive either after emitting
4303
+ // `beforeExit` event, or after running some callbacks.
4306
4304
more = uv_loop_alive (env->event_loop ());
4307
4305
if (uv_run (env->event_loop (), UV_RUN_NOWAIT) != 0 )
4308
4306
more = true ;
0 commit comments