From d3a4865417e538d2d5ed9f9f517b83085d55d1cf Mon Sep 17 00:00:00 2001 From: Anna Henningsen Date: Sun, 29 Mar 2020 16:42:00 +0200 Subject: [PATCH] tracing: do not attempt to call into JS when disallowed PR-URL: https://github.com/nodejs/node/pull/32548 Reviewed-By: Colin Ihrig Reviewed-By: James M Snell --- src/env.cc | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/env.cc b/src/env.cc index 7d76ee8186ad28..9189343c5c439b 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)); } void Environment::CreateProperties() {