Skip to content

Commit 8f22fce

Browse files
schuayCommit bot
authored andcommitted
[debug] Disable debug events if JS execution is disallowed
We cannot generate debug events if JS execution is disallowed since vital debugging logic is still implemented in JS. Return early from Debug::OnException if that is the case. BUG=chromium:662674 Review-Url: https://codereview.chromium.org/2491443002 Cr-Commit-Position: refs/heads/master@{#40858}
1 parent b621987 commit 8f22fce

2 files changed

Lines changed: 19 additions & 0 deletions

File tree

src/debug/debug.cc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1777,6 +1777,11 @@ void Debug::OnPromiseReject(Handle<Object> promise, Handle<Object> value) {
17771777

17781778

17791779
void Debug::OnException(Handle<Object> exception, Handle<Object> promise) {
1780+
// We cannot generate debug events when JS execution is disallowed.
1781+
// TODO(5530): Reenable debug events within DisallowJSScopes once relevant
1782+
// code (MakeExceptionEvent and ProcessDebugEvent) have been moved to C++.
1783+
if (!AllowJavascriptExecution::IsAllowed(isolate_)) return;
1784+
17801785
Isolate::CatchType catch_type = isolate_->PredictExceptionCatcher();
17811786

17821787
// Don't notify listener of exceptions that are internal to a desugaring.
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
// Copyright 2016 the V8 project authors. All rights reserved.
2+
// Use of this source code is governed by a BSD-style license that can be
3+
// found in the LICENSE file.
4+
5+
// Flags: --stack-size=100
6+
7+
Debug = debug.Debug
8+
9+
function overflow() {
10+
return overflow();
11+
}
12+
13+
Debug.setBreakOnException();
14+
assertThrows(overflow, RangeError);

0 commit comments

Comments
 (0)