-
Notifications
You must be signed in to change notification settings - Fork 16.2k
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
44 changes: 44 additions & 0 deletions
44
patches/node/allow_preventing_preparestacktracecallback.patch
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 | ||
From: Shelley Vohr <shelley.vohr@gmail.com> | ||
Date: Mon, 7 Dec 2020 16:54:23 -0800 | ||
Subject: Allow preventing PrepareStackTraceCallback | ||
|
||
Node.js sets a stack trace handler specific to the v8::Context | ||
corresponding to the current Environment. When we're running in a | ||
non-Node.js v8::Context, 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. | ||
|
||
diff --git a/src/api/environment.cc b/src/api/environment.cc | ||
index e42416b4807fcc9d35a93399b916968b45ed0c7a..adf033f2e1855ad1c9738f9746677566aabedd87 100644 | ||
--- a/src/api/environment.cc | ||
+++ b/src/api/environment.cc | ||
@@ -226,9 +226,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 : Environment::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 : Environment::PrepareStackTraceCallback; | ||
+ isolate->SetPrepareStackTraceCallback(prepare_stack_trace_cb); | ||
+ } | ||
} | ||
|
||
void SetIsolateMiscHandlers(v8::Isolate* isolate, const IsolateSettings& s) { | ||
diff --git a/src/node.h b/src/node.h | ||
index 4c4e55e338d7b42c36818a45f6b41170c495adde..ad2727fbab366df0dcc60d7562951c953f952ae3 100644 | ||
--- a/src/node.h | ||
+++ b/src/node.h | ||
@@ -305,7 +305,8 @@ class NODE_EXTERN MultiIsolatePlatform : public v8::Platform { | ||
enum IsolateSettingsFlags { | ||
MESSAGE_LISTENER_WITH_ERROR_LEVEL = 1 << 0, | ||
DETAILED_SOURCE_POSITIONS_FOR_PROFILING = 1 << 1, | ||
- SHOULD_SET_PROMISE_REJECTION_CALLBACK = 1 << 2 | ||
+ SHOULD_SET_PROMISE_REJECTION_CALLBACK = 1 << 2, | ||
+ SHOULD_NOT_SET_PREPARE_STACK_TRACE_CALLBACK = 1 << 3 | ||
}; | ||
|
||
struct IsolateSettings { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
fix: stack traces in non-Node.js contexts #26997
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Uh oh!
There was an error while loading. Please reload this page.
fix: stack traces in non-Node.js contexts #26997
Changes from all commits
767d93b
e9f1439
File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Uh oh!
There was an error while loading. Please reload this page.