diff --git a/src/d8/async-hooks-wrapper.cc b/src/d8/async-hooks-wrapper.cc index f96aad4123..1d160cdb0d 100644 --- a/src/d8/async-hooks-wrapper.cc +++ b/src/d8/async-hooks-wrapper.cc @@ -128,6 +128,7 @@ void AsyncHooks::ShellPromiseHook(PromiseHookType type, Local promise, HandleScope handle_scope(hooks->isolate_); Local currentContext = hooks->isolate_->GetCurrentContext(); + DCHECK(!currentContext.IsEmpty()); if (type == PromiseHookType::kInit) { ++hooks->current_async_id; diff --git a/src/execution/futex-emulation.cc b/src/execution/futex-emulation.cc index 78b2fd2df7..074cdb641c 100644 --- a/src/execution/futex-emulation.cc +++ b/src/execution/futex-emulation.cc @@ -749,6 +749,9 @@ void FutexEmulation::ResolveAsyncWaiterPromise(FutexWaitListNode* node) { USE(success); if (!node->promise_.IsEmpty()) { + DCHECK(!node->native_context_.IsEmpty()); + Local native_context = node->native_context_.Get(v8_isolate); + v8::Context::Scope contextScope(native_context); Handle promise = Handle::cast( Utils::OpenHandle(*node->promise_.Get(v8_isolate))); Handle result_string; diff --git a/src/objects/objects.cc b/src/objects/objects.cc index bce3fe748d..83a2a47462 100644 --- a/src/objects/objects.cc +++ b/src/objects/objects.cc @@ -5331,6 +5331,8 @@ static void MoveMessageToPromise(Isolate* isolate, Handle promise) { Handle JSPromise::Reject(Handle promise, Handle reason, bool debug_event) { Isolate* const isolate = promise->GetIsolate(); + DCHECK( + !reinterpret_cast(isolate)->GetCurrentContext().IsEmpty()); if (isolate->debug()->is_active()) MoveMessageToPromise(isolate, promise); @@ -5368,6 +5370,8 @@ Handle JSPromise::Reject(Handle promise, MaybeHandle JSPromise::Resolve(Handle promise, Handle resolution) { Isolate* const isolate = promise->GetIsolate(); + DCHECK( + !reinterpret_cast(isolate)->GetCurrentContext().IsEmpty()); isolate->RunPromiseHook(PromiseHookType::kResolve, promise, isolate->factory()->undefined_value());