Skip to content

Commit

Permalink
src: fix remaining tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Qard committed Jul 28, 2023
1 parent 03ef27c commit e009382
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/async_context_frame.cc
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,9 @@ AsyncContextFrame::AsyncContextFrame(Environment* env,
}

Local<Value> AsyncContextFrame::current(Environment* env) {
return env->context()->GetContinuationPreservedEmbedderData();
return env->isolate()
->GetEnteredOrMicrotaskContext()
->GetContinuationPreservedEmbedderData();
}

Local<Value> AsyncContextFrame::disable(Environment* env, Local<Value> key) {
Expand All @@ -90,7 +92,9 @@ Local<Value> AsyncContextFrame::disable(Environment* env, Local<Value> key) {
// but sometimes (such as enterWith) a direct exchange is needed.
Local<Value> AsyncContextFrame::exchange(Environment* env, Local<Value> value) {
auto prior = current(env);
env->context()->SetContinuationPreservedEmbedderData(value);
env->isolate()
->GetEnteredOrMicrotaskContext()
->SetContinuationPreservedEmbedderData(value);
return prior;
}

Expand Down
4 changes: 4 additions & 0 deletions src/async_wrap.cc
Original file line number Diff line number Diff line change
Expand Up @@ -635,6 +635,10 @@ void AsyncWrap::AsyncReset(Local<Object> 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,
Expand Down

0 comments on commit e009382

Please sign in to comment.