Skip to content

Commit 16310b2

Browse files
schuayCommit bot
authored andcommitted
[debugger] Ensure debug listeners do not throw
This exposes a couple of broken tests that used to silently throw within the listener. Mark these as failing for now BUG=v8:5330, v8:5581 Review-Url: https://codereview.chromium.org/2460833002 Cr-Commit-Position: refs/heads/master@{#40672}
1 parent 36f3f90 commit 16310b2

3 files changed

Lines changed: 19 additions & 9 deletions

File tree

src/d8.cc

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1808,11 +1808,9 @@ class InspectorFrontend final : public v8_inspector::V8Inspector::Channel {
18081808
if (callback->IsFunction()) {
18091809
v8::TryCatch try_catch(isolate_);
18101810
Local<Value> args[] = {message};
1811-
if (Local<Function>::Cast(callback)
1812-
->Call(context, Undefined(isolate_), 1, args)
1813-
.IsEmpty()) {
1814-
try_catch.ReThrow();
1815-
}
1811+
MaybeLocal<Value> result = Local<Function>::Cast(callback)->Call(
1812+
context, Undefined(isolate_), 1, args);
1813+
CHECK(!result.IsEmpty()); // Listeners may not throw.
18161814
}
18171815
}
18181816

src/debug/debug.cc

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1850,7 +1850,7 @@ void Debug::CallEventCallback(v8::DebugEvent event,
18501850
event_listener_data_,
18511851
client_data);
18521852
callback(event_details);
1853-
DCHECK(!isolate_->has_scheduled_exception());
1853+
CHECK(!isolate_->has_scheduled_exception());
18541854
} else {
18551855
// Invoke the JavaScript debug event listener.
18561856
DCHECK(event_listener_->IsJSFunction());
@@ -1859,8 +1859,10 @@ void Debug::CallEventCallback(v8::DebugEvent event,
18591859
event_data,
18601860
event_listener_data_ };
18611861
Handle<JSReceiver> global = isolate_->global_proxy();
1862-
Execution::TryCall(isolate_, Handle<JSFunction>::cast(event_listener_),
1863-
global, arraysize(argv), argv);
1862+
MaybeHandle<Object> result =
1863+
Execution::Call(isolate_, Handle<JSFunction>::cast(event_listener_),
1864+
global, arraysize(argv), argv);
1865+
CHECK(!result.is_null()); // Listeners may not throw.
18641866
}
18651867
in_debug_event_listener_ = previous;
18661868
}

test/mjsunit/mjsunit.status

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,6 @@
6969

7070
##############################################################################
7171
# Too slow in debug mode with --stress-opt mode.
72-
'regress/regress-2318': [PASS, ['mode == debug', SKIP]],
7372
'regress/regress-create-exception': [PASS, ['mode == debug', SKIP]],
7473

7574
##############################################################################
@@ -135,6 +134,17 @@
135134
'verify-check-false': [FAIL, NO_VARIANTS],
136135
'verify-assert-false': [NO_VARIANTS, ['mode == release and dcheck_always_on == False', PASS], ['mode == debug or dcheck_always_on == True', FAIL]],
137136

137+
##############################################################################
138+
# BUG(5581): Broken tests with exceptions thrown in debug listener.
139+
'es6/debug-step-into-constructor': [FAIL],
140+
'es6/default-parameters-debug': [FAIL],
141+
'regress/regress-2296': [FAIL],
142+
'regress/regress-2318': [FAIL],
143+
'regress/regress-4703': [FAIL],
144+
'regress/regress-5071': [FAIL],
145+
'regress/regress-998565': [FAIL],
146+
'regress/regress-crbug-107996': [FAIL],
147+
138148
##############################################################################
139149
# Tests with different versions for release and debug.
140150
'compiler/alloc-number': [PASS, ['mode == debug', SKIP]],

0 commit comments

Comments
 (0)