mirror of
https://github.com/nodejs/node.git
synced 2026-11-30 11:55:44 -05:00
src: add missing context scopes
Add scopes that ensure that the context associated with the current Environment is always entered when working with it. PR-URL: https://github.com/nodejs/node/pull/36413 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Gus Caplan <me@gus.host> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com>
This commit is contained in:
1 parent
023291b43c
commit
169406b7d7
2 files changed
+4
No files matched your search
@@ -547,6 +547,8 @@ void Environment::InitializeLibuv() {
|
||||
[](uv_async_t* async) {
|
||||
Environment* env = ContainerOf(
|
||||
&Environment::task_queues_async_, async);
|
||||
HandleScope handle_scope(env->isolate());
|
||||
Context::Scope context_scope(env->context());
|
||||
env->RunAndClearNativeImmediates();
|
||||
});
|
||||
uv_unref(reinterpret_cast<uv_handle_t*>(&task_queues_async_));
|
||||
|
||||
@@ -288,6 +288,7 @@ inline void FileHandle::Close() {
|
||||
void FileHandle::CloseReq::Resolve() {
|
||||
Isolate* isolate = env()->isolate();
|
||||
HandleScope scope(isolate);
|
||||
Context::Scope context_scope(env()->context());
|
||||
InternalCallbackScope callback_scope(this);
|
||||
Local<Promise> promise = promise_.Get(isolate);
|
||||
Local<Promise::Resolver> resolver = promise.As<Promise::Resolver>();
|
||||
@@ -297,6 +298,7 @@ void FileHandle::CloseReq::Resolve() {
|
||||
void FileHandle::CloseReq::Reject(Local<Value> reason) {
|
||||
Isolate* isolate = env()->isolate();
|
||||
HandleScope scope(isolate);
|
||||
Context::Scope context_scope(env()->context());
|
||||
InternalCallbackScope callback_scope(this);
|
||||
Local<Promise> promise = promise_.Get(isolate);
|
||||
Local<Promise::Resolver> resolver = promise.As<Promise::Resolver>();
|
||||
|
||||
Reference in new issue
Block a user