Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1818)

Unified Diff: src/isolate.cc

Issue 630373003: Add stack trace to the promise reject callback. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: addressed comments Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « include/v8.h ('k') | test/cctest/test-api.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/isolate.cc
diff --git a/src/isolate.cc b/src/isolate.cc
index 7cf525d3e157a052dd78f21e25df1432518ee9c1..a5ee021b142dff0194fdec61c70c944f1790afcf 100644
--- a/src/isolate.cc
+++ b/src/isolate.cc
@@ -2272,8 +2272,16 @@ void Isolate::ReportPromiseReject(Handle<JSObject> promise,
Handle<Object> value,
v8::PromiseRejectEvent event) {
if (promise_reject_callback_ == NULL) return;
- promise_reject_callback_(v8::Utils::PromiseToLocal(promise),
- v8::Utils::ToLocal(value), event);
+ Handle<JSArray> stack_trace;
+ if (event == v8::kPromiseRejectWithNoHandler && value->IsJSObject()) {
+ Handle<JSObject> error_obj = Handle<JSObject>::cast(value);
+ Handle<Name> key = factory()->detailed_stack_trace_symbol();
+ Handle<Object> property = JSObject::GetDataProperty(error_obj, key);
+ if (property->IsJSArray()) stack_trace = Handle<JSArray>::cast(property);
+ }
+ promise_reject_callback_(v8::PromiseRejectMessage(
+ v8::Utils::PromiseToLocal(promise), event, v8::Utils::ToLocal(value),
+ v8::Utils::StackTraceToLocal(stack_trace)));
}
« no previous file with comments | « include/v8.h ('k') | test/cctest/test-api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698