Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nodejs/node.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/src/api
diff options
context:
space:
mode:
authorShelley Vohr <shelley.vohr@gmail.com>2020-12-08 20:51:31 +0300
committerShelley Vohr <shelley.vohr@gmail.com>2020-12-12 02:05:17 +0300
commit743ee9d2c05efefe8a88997fd832de0e206a04f6 (patch)
tree53c739c2ee83feab980eac66e7b3ceab32bda7e7 /src/api
parentf51a0e4b85370c00710cda961d040a0fbd70892a (diff)
src: allow preventing SetPrepareStackTraceCallback
Node.js sets a stack trace handler specific to the v8::Context corresponding to the current Environment. When Electron is running in a non-Node.js v8::Context (e.g in the renderer process with contextIsolation enabled), there will be no correspondent Environment - we therefore need to prevent this handler being set so that Blink falls back to its default handling and displays the correct stacktrace. PR-URL: https://github.com/nodejs/node/pull/36447 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Gus Caplan <me@gus.host> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Rich Trott <rtrott@gmail.com>
Diffstat (limited to 'src/api')
-rw-r--r--src/api/environment.cc8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/api/environment.cc b/src/api/environment.cc
index 68395a61675..648f0184c35 100644
--- a/src/api/environment.cc
+++ b/src/api/environment.cc
@@ -231,9 +231,11 @@ void SetIsolateErrorHandlers(v8::Isolate* isolate, const IsolateSettings& s) {
s.fatal_error_callback : OnFatalError;
isolate->SetFatalErrorHandler(fatal_error_cb);
- auto* prepare_stack_trace_cb = s.prepare_stack_trace_callback ?
- s.prepare_stack_trace_callback : PrepareStackTraceCallback;
- isolate->SetPrepareStackTraceCallback(prepare_stack_trace_cb);
+ if ((s.flags & SHOULD_NOT_SET_PREPARE_STACK_TRACE_CALLBACK) == 0) {
+ auto* prepare_stack_trace_cb = s.prepare_stack_trace_callback ?
+ s.prepare_stack_trace_callback : PrepareStackTraceCallback;
+ isolate->SetPrepareStackTraceCallback(prepare_stack_trace_cb);
+ }
}
void SetIsolateMiscHandlers(v8::Isolate* isolate, const IsolateSettings& s) {