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

Unified Diff: src/debug.cc

Issue 249503002: Trigger debug event on not yet caught exception in promises. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: always use original exception Created 6 years, 8 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 | « src/debug.h ('k') | src/debug-debugger.js » ('j') | src/debug-debugger.js » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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.
}
« no previous file with comments | « src/debug.h ('k') | src/debug-debugger.js » ('j') | src/debug-debugger.js » ('J')

Powered by Google App Engine
This is Rietveld 408576698