diff --git a/src/env.cc b/src/env.cc index 66c3a386beefff..5551f36c1249e0 100644 --- a/src/env.cc +++ b/src/env.cc @@ -207,7 +207,7 @@ void InitThreadLocalOnce() { } void TrackingTraceStateObserver::UpdateTraceCategoryState() { - if (!env_->owns_process_state()) { + if (!env_->owns_process_state() || !env_->can_call_into_js()) { // Ideally, we’d have a consistent story that treats all threads/Environment // instances equally here. However, tracing is essentially global, and this // callback is called from whichever thread calls `StartTracing()` or @@ -228,8 +228,7 @@ void TrackingTraceStateObserver::UpdateTraceCategoryState() { TryCatchScope try_catch(env_); try_catch.SetVerbose(true); Local args[] = {Boolean::New(isolate, async_hooks_enabled)}; - cb->Call(env_->context(), Undefined(isolate), arraysize(args), args) - .ToLocalChecked(); + USE(cb->Call(env_->context(), Undefined(isolate), arraysize(args), args)); } static std::atomic next_thread_id{0};