mirror of
https://github.com/nodejs/node.git
synced 2026-11-21 12:59:16 -05:00
src: ensure that SetImmediate()s have HandleScopes
Make sure that all native `SetImmediate()` functions have `HandleScope`s if they create handles. PR-URL: https://github.com/nodejs/node/pull/19470 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Tobias Nießen <tniessen@tnie.de>
This commit is contained in:
3 files changed
+6
No files matched your search
@@ -376,6 +376,9 @@ void Environment::RunAndClearNativeImmediates() {
|
||||
auto drain_list = [&]() {
|
||||
v8::TryCatch try_catch(isolate());
|
||||
for (auto it = list.begin(); it != list.end(); ++it) {
|
||||
#ifdef DEBUG
|
||||
v8::SealHandleScope seal_handle_scope(isolate());
|
||||
#endif
|
||||
it->cb_(this, it->data_);
|
||||
if (it->refed_)
|
||||
ref_count++;
|
||||
|
||||
@@ -178,6 +178,7 @@ inline void FileHandle::Close() {
|
||||
// it is being thrown from within the SetImmediate handler and
|
||||
// there is no JS stack to bubble it to. In other words, tearing
|
||||
// down the process is the only reasonable thing we can do here.
|
||||
HandleScope handle_scope(env->isolate());
|
||||
env->ThrowUVException(detail->ret, "close", msg);
|
||||
delete detail;
|
||||
}, detail);
|
||||
|
||||
@@ -520,6 +520,7 @@ void Http2Stream::EmitStatistics() {
|
||||
static_cast<Http2StreamPerformanceEntry*>(data) };
|
||||
if (!HasHttp2Observer(env))
|
||||
return;
|
||||
HandleScope handle_scope(env->isolate());
|
||||
AliasedBuffer<double, v8::Float64Array>& buffer =
|
||||
env->http2_state()->stream_stats_buffer;
|
||||
buffer[IDX_STREAM_STATS_ID] = entry->id();
|
||||
@@ -558,6 +559,7 @@ void Http2Session::EmitStatistics() {
|
||||
static_cast<Http2SessionPerformanceEntry*>(data) };
|
||||
if (!HasHttp2Observer(env))
|
||||
return;
|
||||
HandleScope handle_scope(env->isolate());
|
||||
AliasedBuffer<double, v8::Float64Array>& buffer =
|
||||
env->http2_state()->session_stats_buffer;
|
||||
buffer[IDX_SESSION_STATS_TYPE] = entry->type();
|
||||
|
||||
Reference in new issue
Block a user