 Chromium Code Reviews
 Chromium Code Reviews Issue 249503002:
  Trigger debug event on not yet caught exception in promises.  (Closed) 
  Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
    
  
    Issue 249503002:
  Trigger debug event on not yet caught exception in promises.  (Closed) 
  Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge| Index: src/debug.cc | 
| diff --git a/src/debug.cc b/src/debug.cc | 
| index b41375b825a0286c7450a9829188202cd419ec96..4d1f7823e74339cae4d1e9317c82e3bd39c59ace 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> deferred_promise) { | 
| 
rossberg
2014/04/24 07:27:36
And here.
 | 
| 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 (deferred_promise.is_null()) { | 
| + event = v8::Exception; | 
| + deferred_promise = isolate_->factory()->undefined_value(); | 
| + } 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, deferred_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. | 
| } |