|
1 | 1 | // Hello, and welcome to hacking node.js! |
2 | 2 | // |
3 | | -// This file is invoked by `Realm::BootstrapNode()` in `src/node_realm.cc`, |
| 3 | +// This file is invoked by `Realm::BootstrapRealm()` in `src/node_realm.cc`, |
4 | 4 | // and is responsible for setting up Node.js core before main scripts |
5 | 5 | // under `lib/internal/main/` are executed. |
6 | 6 | // |
|
35 | 35 | // - `lib/internal/bootstrap/loaders.js`: this sets up internal binding and |
36 | 36 | // module loaders, including `process.binding()`, `process._linkedBinding()`, |
37 | 37 | // `internalBinding()` and `BuiltinModule`. |
| 38 | +// - `lib/internal/bootstrap/realm.js`: this sets up per-realm internal states |
| 39 | +// and callbacks, including `prepare_stack_trace_callback`. |
38 | 40 | // |
39 | 41 | // The initialization done in this script is included in both the main thread |
40 | 42 | // and the worker threads. After this, further initialization is done based |
|
52 | 54 | // passed by `BuiltinLoader::CompileAndCall()`. |
53 | 55 | /* global process, require, internalBinding, primordials */ |
54 | 56 |
|
55 | | -setupPrepareStackTrace(); |
56 | | - |
57 | 57 | const { |
58 | 58 | FunctionPrototypeCall, |
59 | 59 | JSONParse, |
@@ -336,25 +336,6 @@ process.emitWarning = emitWarning; |
336 | 336 | // Note: only after this point are the timers effective |
337 | 337 | } |
338 | 338 |
|
339 | | -function setupPrepareStackTrace() { |
340 | | - const { |
341 | | - setEnhanceStackForFatalException, |
342 | | - setPrepareStackTraceCallback, |
343 | | - } = internalBinding('errors'); |
344 | | - const { |
345 | | - prepareStackTrace, |
346 | | - fatalExceptionStackEnhancers: { |
347 | | - beforeInspector, |
348 | | - afterInspector, |
349 | | - }, |
350 | | - } = require('internal/errors'); |
351 | | - // Tell our PrepareStackTraceCallback passed to the V8 API |
352 | | - // to call prepareStackTrace(). |
353 | | - setPrepareStackTraceCallback(prepareStackTrace); |
354 | | - // Set the function used to enhance the error stack for printing |
355 | | - setEnhanceStackForFatalException(beforeInspector, afterInspector); |
356 | | -} |
357 | | - |
358 | 339 | function setupProcessObject() { |
359 | 340 | const EventEmitter = require('events'); |
360 | 341 | const origProcProto = ObjectGetPrototypeOf(process); |
|
0 commit comments