Index: src/debug.cc |
diff --git a/src/debug.cc b/src/debug.cc |
index b41375b825a0286c7450a9829188202cd419ec96..c6a224e36597f313df3a97eb79eca2fc0cddc07f 100644 |
--- a/src/debug.cc |
+++ b/src/debug.cc |
@@ -2628,13 +2628,15 @@ MaybeHandle<Object> Debugger::MakeBreakEvent(Handle<Object> break_points_hit) { |
MaybeHandle<Object> Debugger::MakeExceptionEvent(Handle<Object> exception, |
- bool uncaught) { |
+ bool uncaught, |
+ Handle<Object> promise) { |
Handle<Object> exec_state; |
if (!MakeExecutionState().ToHandle(&exec_state)) return MaybeHandle<Object>(); |
// Create the new exception event object. |
Handle<Object> argv[] = { exec_state, |
exception, |
- isolate_->factory()->ToBoolean(uncaught) }; |
+ isolate_->factory()->ToBoolean(uncaught), |
+ promise }; |
return MakeJSObject(CStrVector("MakeExceptionEvent"), ARRAY_SIZE(argv), argv); |
} |
@@ -2664,7 +2666,9 @@ MaybeHandle<Object> Debugger::MakeScriptCollectedEvent(int id) { |
} |
-void Debugger::OnException(Handle<Object> exception, bool uncaught) { |
+void Debugger::OnException(Handle<Object> exception, |
+ bool uncaught, |
+ Handle<Object> promise) { |
HandleScope scope(isolate_); |
Debug* debug = isolate_->debug(); |
@@ -2688,13 +2692,21 @@ void Debugger::OnException(Handle<Object> exception, bool uncaught) { |
// Clear all current stepping setup. |
debug->ClearStepping(); |
+ |
+ // Determine event; |
+ DebugEvent event = promise->IsUndefined() |
+ ? v8::Exception : v8::UncaughtExceptionInPromise; |
+ |
// Create the event data object. |
Handle<Object> event_data; |
// Bail out and don't call debugger if exception. |
- if (!MakeExceptionEvent(exception, uncaught).ToHandle(&event_data)) return; |
+ if (!MakeExceptionEvent( |
+ exception, uncaught, promise).ToHandle(&event_data)) { |
+ return; |
+ } |
// Process debug event. |
- ProcessDebugEvent(v8::Exception, Handle<JSObject>::cast(event_data), false); |
+ ProcessDebugEvent(event, Handle<JSObject>::cast(event_data), false); |
// Return to continue execution from where the exception was thrown. |
} |