Chromium Code Reviews| Index: src/debug.cc |
| diff --git a/src/debug.cc b/src/debug.cc |
| index b41375b825a0286c7450a9829188202cd419ec96..d3cf89543e3401813694805e19f1de517b4b2793 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,26 @@ void Debugger::OnException(Handle<Object> exception, bool uncaught) { |
| // Clear all current stepping setup. |
| debug->ClearStepping(); |
| + |
| + // Determine event; |
| + DebugEvent event; |
| + if (promise.is_null()) { |
| + event = v8::Exception; |
| + promise = isolate_->factory()->undefined_value(); |
|
aandrey
2014/04/24 11:04:59
maybe set undefined to promise by default instead
Yang
2014/04/24 11:13:48
Done.
|
| + } else { |
| + event = 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. |
| } |