summaryrefslogtreecommitdiff
path: root/src/env.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/env.cc')
-rw-r--r--src/env.cc5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/env.cc b/src/env.cc
index 5f9a6acb46..da253fac6d 100644
--- a/src/env.cc
+++ b/src/env.cc
@@ -527,6 +527,9 @@ void Environment::RegisterHandleCleanups() {
}
void Environment::CleanupHandles() {
+ Isolate::DisallowJavascriptExecutionScope disallow_js(isolate(),
+ Isolate::DisallowJavascriptExecutionScope::THROW_ON_FAILURE);
+
for (ReqWrapBase* request : req_wrap_queue_)
request->Cancel();
@@ -661,7 +664,7 @@ void Environment::RunAndClearNativeImmediates() {
head->Call(this);
if (UNLIKELY(try_catch.HasCaught())) {
- if (!try_catch.HasTerminated())
+ if (!try_catch.HasTerminated() && can_call_into_js())
errors::TriggerUncaughtException(isolate(), try_catch);
// We are done with the current callback. Move one iteration along,