diff --git a/src/util-inl.h b/src/util-inl.h index ef00cabcde8383..9048a7ae1970b9 100644 --- a/src/util-inl.h +++ b/src/util-inl.h @@ -327,14 +327,14 @@ v8::Maybe FromV8Array(v8::Local context, std::vector>* out) { uint32_t count = js_array->Length(); out->reserve(count); - ArrayIterationData data{out, context->GetIsolate()}; + ArrayIterationData data{out, v8::Isolate::GetCurrent()}; return js_array->Iterate(context, PushItemToVector, &data); } v8::MaybeLocal ToV8Value(v8::Local context, std::string_view str, v8::Isolate* isolate) { - if (isolate == nullptr) isolate = context->GetIsolate(); + if (isolate == nullptr) isolate = v8::Isolate::GetCurrent(); if (str.size() >= static_cast(v8::String::kMaxLength)) [[unlikely]] { // V8 only has a TODO comment about adding an exception when the maximum // string size is exceeded. @@ -350,7 +350,7 @@ v8::MaybeLocal ToV8Value(v8::Local context, v8::MaybeLocal ToV8Value(v8::Local context, v8_inspector::StringView str, v8::Isolate* isolate) { - if (isolate == nullptr) isolate = context->GetIsolate(); + if (isolate == nullptr) isolate = v8::Isolate::GetCurrent(); if (str.length() >= static_cast(v8::String::kMaxLength)) [[unlikely]] { // V8 only has a TODO comment about adding an exception when the maximum @@ -377,7 +377,7 @@ template v8::MaybeLocal ToV8Value(v8::Local context, const std::vector& vec, v8::Isolate* isolate) { - if (isolate == nullptr) isolate = context->GetIsolate(); + if (isolate == nullptr) isolate = v8::Isolate::GetCurrent(); v8::EscapableHandleScope handle_scope(isolate); MaybeStackBuffer, 128> arr(vec.size()); @@ -394,7 +394,7 @@ template v8::MaybeLocal ToV8Value(v8::Local context, const std::set& set, v8::Isolate* isolate) { - if (isolate == nullptr) isolate = context->GetIsolate(); + if (isolate == nullptr) isolate = v8::Isolate::GetCurrent(); v8::Local set_js = v8::Set::New(isolate); v8::HandleScope handle_scope(isolate); @@ -413,7 +413,7 @@ template v8::MaybeLocal ToV8Value(v8::Local context, const std::ranges::elements_view& vec, v8::Isolate* isolate) { - if (isolate == nullptr) isolate = context->GetIsolate(); + if (isolate == nullptr) isolate = v8::Isolate::GetCurrent(); v8::EscapableHandleScope handle_scope(isolate); MaybeStackBuffer, 128> arr(vec.size()); @@ -432,7 +432,7 @@ template v8::MaybeLocal ToV8Value(v8::Local context, const std::unordered_map& map, v8::Isolate* isolate) { - if (isolate == nullptr) isolate = context->GetIsolate(); + if (isolate == nullptr) isolate = v8::Isolate::GetCurrent(); v8::EscapableHandleScope handle_scope(isolate); v8::Local ret = v8::Map::New(isolate); @@ -475,7 +475,7 @@ template v8::MaybeLocal ToV8Value(v8::Local context, const T& number, v8::Isolate* isolate) { - if (isolate == nullptr) isolate = context->GetIsolate(); + if (isolate == nullptr) isolate = v8::Isolate::GetCurrent(); return ConvertNumberToV8Value(isolate, number); } @@ -488,7 +488,7 @@ v8::Local ToV8ValuePrimitiveArray(v8::Local context, std::is_floating_point_v, "Only primitive types (bool, integral, floating-point) are supported."); - if (isolate == nullptr) isolate = context->GetIsolate(); + if (isolate == nullptr) isolate = v8::Isolate::GetCurrent(); v8::EscapableHandleScope handle_scope(isolate); v8::LocalVector elements(isolate);