From e009382f40cc92cc184c6d528b48929d877d76f4 Mon Sep 17 00:00:00 2001 From: Stephen Belanger Date: Thu, 27 Jul 2023 20:18:31 -0700 Subject: [PATCH] src: fix remaining tests --- src/async_context_frame.cc | 8 ++++++-- src/async_wrap.cc | 4 ++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/async_context_frame.cc b/src/async_context_frame.cc index 22e027c07b5f39..cdc166290723bd 100644 --- a/src/async_context_frame.cc +++ b/src/async_context_frame.cc @@ -67,7 +67,9 @@ AsyncContextFrame::AsyncContextFrame(Environment* env, } Local AsyncContextFrame::current(Environment* env) { - return env->context()->GetContinuationPreservedEmbedderData(); + return env->isolate() + ->GetEnteredOrMicrotaskContext() + ->GetContinuationPreservedEmbedderData(); } Local AsyncContextFrame::disable(Environment* env, Local key) { @@ -90,7 +92,9 @@ Local AsyncContextFrame::disable(Environment* env, Local key) { // but sometimes (such as enterWith) a direct exchange is needed. Local AsyncContextFrame::exchange(Environment* env, Local value) { auto prior = current(env); - env->context()->SetContinuationPreservedEmbedderData(value); + env->isolate() + ->GetEnteredOrMicrotaskContext() + ->SetContinuationPreservedEmbedderData(value); return prior; } diff --git a/src/async_wrap.cc b/src/async_wrap.cc index 2071f10fbff0c6..64ab8c426bf255 100644 --- a/src/async_wrap.cc +++ b/src/async_wrap.cc @@ -635,6 +635,10 @@ void AsyncWrap::AsyncReset(Local resource, double execution_async_id, UNREACHABLE(); } +#if defined(NODE_USE_NATIVE_ALS) && NODE_USE_NATIVE_ALS + context_frame_.Reset(env()->isolate(), AsyncContextFrame::current(env())); +#endif + if (silent) return; EmitAsyncInit(env(), resource,