Skip to content

Commit e009382

Browse files
author
Stephen Belanger
committed
src: fix remaining tests
1 parent 03ef27c commit e009382

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

src/async_context_frame.cc

+6-2
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,9 @@ AsyncContextFrame::AsyncContextFrame(Environment* env,
6767
}
6868

6969
Local<Value> AsyncContextFrame::current(Environment* env) {
70-
return env->context()->GetContinuationPreservedEmbedderData();
70+
return env->isolate()
71+
->GetEnteredOrMicrotaskContext()
72+
->GetContinuationPreservedEmbedderData();
7173
}
7274

7375
Local<Value> AsyncContextFrame::disable(Environment* env, Local<Value> key) {
@@ -90,7 +92,9 @@ Local<Value> AsyncContextFrame::disable(Environment* env, Local<Value> key) {
9092
// but sometimes (such as enterWith) a direct exchange is needed.
9193
Local<Value> AsyncContextFrame::exchange(Environment* env, Local<Value> value) {
9294
auto prior = current(env);
93-
env->context()->SetContinuationPreservedEmbedderData(value);
95+
env->isolate()
96+
->GetEnteredOrMicrotaskContext()
97+
->SetContinuationPreservedEmbedderData(value);
9498
return prior;
9599
}
96100

src/async_wrap.cc

+4
Original file line numberDiff line numberDiff line change
@@ -635,6 +635,10 @@ void AsyncWrap::AsyncReset(Local<Object> resource, double execution_async_id,
635635
UNREACHABLE();
636636
}
637637

638+
#if defined(NODE_USE_NATIVE_ALS) && NODE_USE_NATIVE_ALS
639+
context_frame_.Reset(env()->isolate(), AsyncContextFrame::current(env()));
640+
#endif
641+
638642
if (silent) return;
639643

640644
EmitAsyncInit(env(), resource,

0 commit comments

Comments
 (0)