Skip to content

Commit ddf7a78

Browse files
committed
node: fix comments and strings
Clarify comments re invoking bootstrap_node.js. Fix filename to bootstrap_node.js per #5103. Fix tests `node.js` -> `bootstrap_node.js` Fix comment on why we check the loop again before exiting. `context-inl.h` -> `env-inl.h`
1 parent 4039ef1 commit ddf7a78

13 files changed

+42
-44
lines changed

src/env.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,12 @@
1313
#include <stdint.h>
1414

1515
// Caveat emptor: we're going slightly crazy with macros here but the end
16-
// hopefully justifies the means. We have a lot of per-context properties
16+
// hopefully justifies the means. We have a lot of per-isolate properties
1717
// and adding and maintaining their getters and setters by hand would be
1818
// a nightmare so let's make the preprocessor generate them for us.
1919
//
2020
// Make sure that any macros defined here are undefined again at the bottom
21-
// of context-inl.h. The exceptions are NODE_CONTEXT_EMBEDDER_DATA_INDEX
21+
// of env-inl.h. The exceptions are NODE_CONTEXT_EMBEDDER_DATA_INDEX
2222
// and NODE_ISOLATE_SLOT, they may have been defined externally.
2323
namespace node {
2424

src/node.cc

+14-16
Original file line numberDiff line numberDiff line change
@@ -3265,21 +3265,27 @@ void LoadEnvironment(Environment* env) {
32653265
env->isolate()->SetFatalErrorHandler(node::OnFatalError);
32663266
env->isolate()->AddMessageListener(OnMessage);
32673267

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'
32733268
atexit(AtExit);
32743269

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+
32753279
TryCatch try_catch(env->isolate());
32763280

32773281
// Disable verbose mode to stop FatalException() handler from trying
32783282
// to handle the exception. Errors this early in the start-up phase
32793283
// are not safe to ignore.
32803284
try_catch.SetVerbose(false);
32813285

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+
32833289
Local<Value> f_value = ExecuteString(env, MainSource(env), script_name);
32843290
if (try_catch.HasCaught()) {
32853291
ReportException(env, try_catch);
@@ -3288,14 +3294,6 @@ void LoadEnvironment(Environment* env) {
32883294
CHECK(f_value->IsFunction());
32893295
Local<Function> f = Local<Function>::Cast(f_value);
32903296

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-
32993297
// Add a reference to the global object
33003298
Local<Object> global = env->context()->Global();
33013299

@@ -4301,8 +4299,8 @@ static void StartNodeInstance(void* arg) {
43014299
v8::platform::PumpMessageLoop(default_platform, isolate);
43024300
EmitBeforeExit(env);
43034301

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.
43064304
more = uv_loop_alive(env->event_loop());
43074305
if (uv_run(env->event_loop(), UV_RUN_NOWAIT) != 0)
43084306
more = true;

test/debugger/test-debugger-client.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ addTest(function(client, done) {
105105
var foundMainScript = false;
106106
for (var k in client.scripts) {
107107
var script = client.scripts[k];
108-
if (script && script.name === 'node.js') {
108+
if (script && script.name === 'bootstrap_node.js') {
109109
foundMainScript = true;
110110
break;
111111
}

test/message/core_line_numbers.out

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,5 @@ RangeError: Invalid input
1111
at Module.load (module.js:*:*)
1212
at Function.Module._load (module.js:*:*)
1313
at Function.Module.runMain (module.js:*:*)
14-
at startup (node.js:*:*)
15-
at node.js:*:*
14+
at startup (bootstrap_node.js:*:*)
15+
at bootstrap_node.js:*:*

test/message/error_exit.out

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,5 @@ AssertionError: 1 == 2
1010
at Module.load (module.js:*:*)
1111
at Function.Module._load (module.js:*:*)
1212
at Function.Module.runMain (module.js:*:*)
13-
at startup (node.js:*:*)
14-
at node.js:*:*
13+
at startup (bootstrap_node.js:*:*)
14+
at bootstrap_node.js:*:*

test/message/eval_messages.out

+4-4
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ SyntaxError: Strict mode code may not include a with statement
66
at Object.exports.runInThisContext (vm.js:*)
77
at Object.<anonymous> ([eval]-wrapper:*:*)
88
at Module._compile (module.js:*:*)
9-
at node.js:*:*
9+
at bootstrap_node.js:*:*
1010
at _combinedTickCallback (internal/process/next_tick.js:*:*)
1111
at process._tickCallback (internal/process/next_tick.js:*:*)
1212
42
@@ -19,7 +19,7 @@ Error: hello
1919
at Object.exports.runInThisContext (vm.js:*)
2020
at Object.<anonymous> ([eval]-wrapper:*:*)
2121
at Module._compile (module.js:*:*)
22-
at node.js:*:*
22+
at bootstrap_node.js:*:*
2323
at _combinedTickCallback (internal/process/next_tick.js:*:*)
2424
at process._tickCallback (internal/process/next_tick.js:*:*)
2525
[eval]:1
@@ -30,7 +30,7 @@ Error: hello
3030
at Object.exports.runInThisContext (vm.js:*)
3131
at Object.<anonymous> ([eval]-wrapper:*:*)
3232
at Module._compile (module.js:*:*)
33-
at node.js:*:*
33+
at bootstrap_node.js:*:*
3434
at _combinedTickCallback (internal/process/next_tick.js:*:*)
3535
at process._tickCallback (internal/process/next_tick.js:*:*)
3636
100
@@ -42,7 +42,7 @@ ReferenceError: y is not defined
4242
at Object.exports.runInThisContext (vm.js:*)
4343
at Object.<anonymous> ([eval]-wrapper:*:*)
4444
at Module._compile (module.js:*:*)
45-
at node.js:*:*
45+
at bootstrap_node.js:*:*
4646
at _combinedTickCallback (internal/process/next_tick.js:*:*)
4747
at process._tickCallback (internal/process/next_tick.js:*:*)
4848
[eval]:1

test/message/nexttick_throw.out

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,5 @@ ReferenceError: undefined_reference_error_maker is not defined
77
at _combinedTickCallback (internal/process/next_tick.js:*:*)
88
at process._tickCallback (internal/process/next_tick.js:*:*)
99
at Function.Module.runMain (module.js:*:*)
10-
at startup (node.js:*:*)
11-
at node.js:*:*
10+
at startup (bootstrap_node.js:*:*)
11+
at bootstrap_node.js:*:*

test/message/stdin_messages.out

+4-4
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ SyntaxError: Strict mode code may not include a with statement
77
at Object.exports.runInThisContext (vm.js:*)
88
at Object.<anonymous> ([stdin]-wrapper:*:*)
99
at Module._compile (module.js:*:*)
10-
at node.js:*:*
10+
at bootstrap_node.js:*:*
1111
at _combinedTickCallback (internal/process/next_tick.js:*:*)
1212
at process._tickCallback (internal/process/next_tick.js:*:*)
1313
42
@@ -21,7 +21,7 @@ Error: hello
2121
at Object.exports.runInThisContext (vm.js:*)
2222
at Object.<anonymous> ([stdin]-wrapper:*:*)
2323
at Module._compile (module.js:*:*)
24-
at node.js:*:*
24+
at bootstrap_node.js:*:*
2525
at _combinedTickCallback (internal/process/next_tick.js:*:*)
2626
at process._tickCallback (internal/process/next_tick.js:*:*)
2727

@@ -33,7 +33,7 @@ Error: hello
3333
at Object.exports.runInThisContext (vm.js:*)
3434
at Object.<anonymous> ([stdin]-wrapper:*:*)
3535
at Module._compile (module.js:*:*)
36-
at node.js:*:*
36+
at bootstrap_node.js:*:*
3737
at _combinedTickCallback (internal/process/next_tick.js:*:*)
3838
at process._tickCallback (internal/process/next_tick.js:*:*)
3939
100
@@ -46,7 +46,7 @@ ReferenceError: y is not defined
4646
at Object.exports.runInThisContext (vm.js:*)
4747
at Object.<anonymous> ([stdin]-wrapper:*:*)
4848
at Module._compile (module.js:*:*)
49-
at node.js:*:*
49+
at bootstrap_node.js:*:*
5050
at _combinedTickCallback (internal/process/next_tick.js:*:*)
5151
at process._tickCallback (internal/process/next_tick.js:*:*)
5252

test/message/undefined_reference_in_new_context.out

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@ ReferenceError: foo is not defined
1313
at Module.load (module.js:*)
1414
at Function.Module._load (module.js:*:*)
1515
at Function.Module.runMain (module.js:*:*)
16-
at startup (node.js:*:*)
16+
at startup (bootstrap_node.js:*:*)

test/message/vm_display_runtime_error.out

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,5 @@ Error: boo!
1212
at Module.load (module.js:*)
1313
at Function.Module._load (module.js:*)
1414
at Function.Module.runMain (module.js:*)
15-
at startup (node.js:*)
16-
at node.js:*
15+
at startup (bootstrap_node.js:*)
16+
at bootstrap_node.js:*

test/message/vm_display_syntax_error.out

+4-4
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ SyntaxError: Unexpected number
1111
at Module.load (module.js:*)
1212
at Function.Module._load (module.js:*)
1313
at Function.Module.runMain (module.js:*)
14-
at startup (node.js:*)
15-
at node.js:*
14+
at startup (bootstrap_node.js:*)
15+
at bootstrap_node.js:*
1616
test.vm:1
1717
var 5;
1818
^
@@ -24,5 +24,5 @@ SyntaxError: Unexpected number
2424
at Module.load (module.js:*)
2525
at Function.Module._load (module.js:*)
2626
at Function.Module.runMain (module.js:*)
27-
at startup (node.js:*)
28-
at node.js:*
27+
at startup (bootstrap_node.js:*)
28+
at bootstrap_node.js:*

test/message/vm_dont_display_runtime_error.out

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,5 @@ Error: boo!
1212
at Module.load (module.js:*)
1313
at Function.Module._load (module.js:*)
1414
at Function.Module.runMain (module.js:*)
15-
at startup (node.js:*)
16-
at node.js:*
15+
at startup (bootstrap_node.js:*)
16+
at bootstrap_node.js:*

test/message/vm_dont_display_syntax_error.out

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,5 @@ SyntaxError: Unexpected number
1111
at Module.load (module.js:*)
1212
at Function.Module._load (module.js:*)
1313
at Function.Module.runMain (module.js:*)
14-
at startup (node.js:*)
15-
at node.js:*
14+
at startup (bootstrap_node.js:*)
15+
at bootstrap_node.js:*

0 commit comments

Comments
 (0)