diff --git a/src/node_task_queue.cc b/src/node_task_queue.cc index 1a0cb082a2534f..0a5aba6e31fa79 100644 --- a/src/node_task_queue.cc +++ b/src/node_task_queue.cc @@ -43,28 +43,6 @@ static Maybe GetAssignedPromiseAsyncId(Environment* env, : v8::Just(AsyncWrap::kInvalidAsyncId); } -static Maybe GetAssignedPromiseWrapAsyncId(Environment* env, - Local promise, - Local id_symbol) { - // This check is imperfect. If the internal field is set, it should - // be an object. If it's not, we just ignore it. Ideally v8 would - // have had GetInternalField returning a MaybeLocal but this works - // for now. - Local promiseWrap = promise->GetInternalField(0).As(); - if (promiseWrap->IsObject()) { - Local maybe_async_id; - if (!promiseWrap.As()->Get(env->context(), id_symbol) - .ToLocal(&maybe_async_id)) { - return v8::Just(AsyncWrap::kInvalidAsyncId); - } - return maybe_async_id->IsNumber() - ? maybe_async_id->NumberValue(env->context()) - : v8::Just(AsyncWrap::kInvalidAsyncId); - } else { - return v8::Just(AsyncWrap::kInvalidAsyncId); - } -} - void PromiseRejectCallback(PromiseRejectMessage message) { static std::atomic unhandledRejections{0}; static std::atomic rejectionsHandledAfter{0}; @@ -122,17 +100,6 @@ void PromiseRejectCallback(PromiseRejectMessage message) { if (!GetAssignedPromiseAsyncId(env, promise, env->trigger_async_id_symbol()) .To(&trigger_async_id)) return; - if (async_id == AsyncWrap::kInvalidAsyncId && - trigger_async_id == AsyncWrap::kInvalidAsyncId) { - // That means that promise might be a PromiseWrap, so we'll - // check there as well. - if (!GetAssignedPromiseWrapAsyncId(env, promise, env->async_id_symbol()) - .To(&async_id)) return; - if (!GetAssignedPromiseWrapAsyncId( - env, promise, env->trigger_async_id_symbol()) - .To(&trigger_async_id)) return; - } - if (async_id != AsyncWrap::kInvalidAsyncId && trigger_async_id != AsyncWrap::kInvalidAsyncId) { env->async_hooks()->push_async_context(