| Index: src/debug/debug.cc | 
| diff --git a/src/debug/debug.cc b/src/debug/debug.cc | 
| index 6564726830609bc65d9ade701c8f3ba007064ff9..cb1f34f390e50b54eab226359e504ec39ca10c7b 100644 | 
| --- a/src/debug/debug.cc | 
| +++ b/src/debug/debug.cc | 
| @@ -1777,6 +1777,11 @@ void Debug::OnPromiseReject(Handle<Object> promise, Handle<Object> value) { | 
|  | 
|  | 
| void Debug::OnException(Handle<Object> exception, Handle<Object> promise) { | 
| +  // We cannot generate debug events when JS execution is disallowed. | 
| +  // TODO(5530): Reenable debug events within DisallowJSScopes once relevant | 
| +  // code (MakeExceptionEvent and ProcessDebugEvent) have been moved to C++. | 
| +  if (!AllowJavascriptExecution::IsAllowed(isolate_)) return; | 
| + | 
| Isolate::CatchType catch_type = isolate_->PredictExceptionCatcher(); | 
|  | 
| // Don't notify listener of exceptions that are internal to a desugaring. | 
|  |