Skip to content

Commit

Permalink
tracing: do not attempt to call into JS when disallowed
Browse files Browse the repository at this point in the history
PR-URL: #32548
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: James M Snell <[email protected]>
  • Loading branch information
addaleax authored and targos committed Apr 11, 2020
1 parent f0a31e3 commit 4e5271a
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/env.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -228,8 +228,7 @@ void TrackingTraceStateObserver::UpdateTraceCategoryState() {
TryCatchScope try_catch(env_);
try_catch.SetVerbose(true);
Local<Value> 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<uint64_t> next_thread_id{0};
Expand Down

0 comments on commit 4e5271a

Please sign in to comment.