mirror of
https://github.com/electron/electron.git
synced 2026-01-06 22:24:03 -05:00
* chore: bump chromium in DEPS to 145.0.7562.0 * fix(patch-conflict): update code cache patch for PersistentCache refactor Upstream refactored code cache to use PersistentCache with new class-based implementation (NoopCodeCacheHost, LocalCodeCacheHost, CodeCacheWithPersistentCacheHost). Updated patch to integrate custom scheme support into the new structure while preserving ProcessLockURLIsCodeCacheScheme checks for embedder-registered schemes. Ref: https://chromium-review.googlesource.com/c/chromium/src/+/7044986 Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com> * fix(patch-conflict): update dialog patch for RequestXdgDesktopPortal API Upstream changed from SetSystemdScopeUnitNameForXdgPortal to RequestXdgDesktopPortal API pattern. Updated OnServiceStarted signature and kept OnSystemdUnitStarted callback that calls Electron's file_dialog::StartPortalAvailabilityTestInBackground(). Ref: https://chromium-review.googlesource.com/c/chromium/src/+/7204285 Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com> * fix(patch-conflict): remove reference to deleted AbortByPlaceholderLayout flag Upstream removed the AbortByPlaceholderLayout runtime flag from runtime_enabled_features.json5. Updated patch to only add ElectronCSSCornerSmoothing without the removed flag reference. Ref: https://chromium-review.googlesource.com/c/chromium/src/+/7226494 Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com> * chore: update patch hunk headers Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com> * fix(build): guard media_file_system_registry for ChromeOS only Upstream CL https://chromium-review.googlesource.com/c/chromium/src/+/7100719 moved media_file_system_registry to be ChromeOS-only since Media Galleries is a Chrome Apps API and Chrome Apps are only available on Chrome OS now. Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com> * fix(build): update VideoPixelFormat API for SharedImageFormat Upstream CL https://chromium-review.googlesource.com/c/chromium/src/+/7207153 removed VideoPixelFormatToGfxBufferFormat as part of migration to SharedImageFormat. Update to use VideoPixelFormatToSharedImageFormat which directly returns the SharedImageFormat. Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com> * fix(build): extend profile methods patch for ShouldEnableXfaForms The ShouldEnableXfaForms function uses Profile::FromBrowserContext() which is not available in Electron. Wrap the profile-dependent code in #if 0 to fall through to the feature flag default. Co-Authored-By: Claude <noreply@anthropic.com> * chore: bump chromium in DEPS to 145.0.7563.0 * chore: bump chromium in DEPS to 145.0.7565.0 * chore: bump chromium in DEPS to 145.0.7567.0 * chore: bump chromium in DEPS to 145.0.7568.0 * fix(patch-conflict): update content_main_delegate.h context for IsInitFeatureListEarly Upstream added a new IsInitFeatureListEarly() virtual method to ContentMainDelegate just before where our GetBrowserV8SnapshotFilename() method is added. Updated patch context to account for this new method. Ref: https://chromium-review.googlesource.com/c/chromium/src/+/7092856 Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com> * chore: update patch hunk headers Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com> * fix(patch-update): include v8-cppgc.h for CppHeap complete type The std::unique_ptr<v8::CppHeap> default argument in node.h requires the complete CppHeap type definition for the destructor. Added the v8-cppgc.h include to provide the full type definition. Ref: Unable to locate CL - libc++ unique_ptr requires complete type for destructor Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com> * chore: update patch hunk headers Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com> * fix(build): move NativeAppWindowFrameViewMacClient before constructor The std::unique_ptr<NativeAppWindowFrameViewMacClient> member requires the complete type definition to be visible at the point of the constructor because the unique_ptr destructor may be instantiated during exception handling. Moved the class definition before the NativeWindowMac constructor. Ref: Unable to locate CL - libc++ unique_ptr requires complete type for destructor Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com> * fix(patch-conflict): update create_browser_v8_snapshot_file_name_fuse context for IsInitFeatureListEarly The upstream added IsInitFeatureListEarly() virtual method declaration to ContentMainDelegate class. Updated the patch context to account for this new function being present before the GetBrowserV8SnapshotFilename() declaration we add. Ref: https://chromium-review.googlesource.com/c/chromium/src/+/7092856 Co-Authored-By: Claude <noreply@anthropic.com> * chore: update patch hunk headers Co-Authored-By: Claude <noreply@anthropic.com> * fix(patch-update): remove reverted IsInitFeatureListEarly from v8 snapshot patch The upstream added IsInitFeatureListEarly() was reverted, so the patch should not include this declaration. Only GetBrowserV8SnapshotFilename() should be added by the create_browser_v8_snapshot_file_name_fuse patch. Ref: https://chromium-review.googlesource.com/c/chromium/src/+/7230430 Co-Authored-By: Claude <noreply@anthropic.com> * 6171655: include single_thread_task_runner.h for complete type Added include for base/task/single_thread_task_runner.h in osr_converter.cc to resolve incomplete type error when using base::SingleThreadTaskRunner::GetCurrentDefault(). Ref: https://chromium-review.googlesource.com/c/chromium/src/+/6171655 Co-Authored-By: Claude <noreply@anthropic.com> * 7224136: use CHROMIUM_GIT_REVISION directly instead of removed function Upstream removed GetChromiumGitRevision() function from embedder_support. Updated to use CHROMIUM_GIT_REVISION macro directly via build/util/chromium_git_revision.h as recommended in the Chromium CL. Ref: https://chromium-review.googlesource.com/c/chromium/src/+/7224136 Co-Authored-By: Claude <noreply@anthropic.com> * fixup! 7224136: use CHROMIUM_GIT_REVISION directly instead of removed function * fix(build): add missing include `components/dbus/xdg/systemd.h` for `void OnSystemdUnitStarted(dbus_xdg::SystemdUnitStatus)` in the same patch. * fix(build): adapt to string-view-ification change in windows jump_list.cc 7186922: Fix unsafe buffer usage in base/win/win_util.cc https://chromium-review.googlesource.com/c/chromium/src/+/7186922 * chore: update libc++ filenames * fixup! fix(build): add missing include * fixup! fix(build): extend profile methods patch for ShouldEnableXfaForms * fixup! fix(build): guard media_file_system_registry for ChromeOS only * fixup! fixup! fix(build): extend profile methods patch for ShouldEnableXfaForms --------- Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com> Co-authored-by: Keeley Hammond <khammond@slack-corp.com> Co-authored-by: Claude <svc-devxp-claude@slack-corp.com> Co-authored-by: Claude <noreply@anthropic.com> Co-authored-by: clavin <clavin@electronjs.org>
950 lines
46 KiB
Diff
950 lines
46 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: deepak1556 <hop2deep@gmail.com>
|
|
Date: Mon, 1 Sep 2025 03:13:53 +0900
|
|
Subject: Remove deprecated `GetIsolate`
|
|
|
|
https://chromium-review.googlesource.com/c/v8/v8/+/6905244
|
|
|
|
diff --git a/src/api/environment.cc b/src/api/environment.cc
|
|
index 451796ffc4ec93b6e317dd49d92070c61aca04e5..ea3e9374c30be92ba5668e33773ffbb2aef55b30 100644
|
|
--- a/src/api/environment.cc
|
|
+++ b/src/api/environment.cc
|
|
@@ -687,7 +687,7 @@ std::unique_ptr<MultiIsolatePlatform> MultiIsolatePlatform::Create(
|
|
|
|
MaybeLocal<Object> GetPerContextExports(Local<Context> context,
|
|
IsolateData* isolate_data) {
|
|
- Isolate* isolate = context->GetIsolate();
|
|
+ Isolate* isolate = Isolate::GetCurrent();
|
|
EscapableHandleScope handle_scope(isolate);
|
|
|
|
Local<Object> global = context->Global();
|
|
@@ -733,7 +733,7 @@ void ProtoThrower(const FunctionCallbackInfo<Value>& info) {
|
|
// This runs at runtime, regardless of whether the context
|
|
// is created from a snapshot.
|
|
Maybe<void> InitializeContextRuntime(Local<Context> context) {
|
|
- Isolate* isolate = context->GetIsolate();
|
|
+ Isolate* isolate = Isolate::GetCurrent();
|
|
HandleScope handle_scope(isolate);
|
|
|
|
// When `IsCodeGenerationFromStringsAllowed` is true, V8 takes the fast path
|
|
@@ -812,7 +812,7 @@ Maybe<void> InitializeContextRuntime(Local<Context> context) {
|
|
}
|
|
|
|
Maybe<void> InitializeBaseContextForSnapshot(Local<Context> context) {
|
|
- Isolate* isolate = context->GetIsolate();
|
|
+ Isolate* isolate = Isolate::GetCurrent();
|
|
HandleScope handle_scope(isolate);
|
|
|
|
// Delete `Intl.v8BreakIterator`
|
|
@@ -837,7 +837,7 @@ Maybe<void> InitializeBaseContextForSnapshot(Local<Context> context) {
|
|
}
|
|
|
|
Maybe<void> InitializeMainContextForSnapshot(Local<Context> context) {
|
|
- Isolate* isolate = context->GetIsolate();
|
|
+ Isolate* isolate = Isolate::GetCurrent();
|
|
HandleScope handle_scope(isolate);
|
|
|
|
// Initialize the default values.
|
|
@@ -855,7 +855,7 @@ Maybe<void> InitializeMainContextForSnapshot(Local<Context> context) {
|
|
MaybeLocal<Object> InitializePrivateSymbols(Local<Context> context,
|
|
IsolateData* isolate_data) {
|
|
CHECK(isolate_data);
|
|
- Isolate* isolate = context->GetIsolate();
|
|
+ Isolate* isolate = Isolate::GetCurrent();
|
|
EscapableHandleScope scope(isolate);
|
|
Context::Scope context_scope(context);
|
|
|
|
@@ -879,7 +879,7 @@ MaybeLocal<Object> InitializePrivateSymbols(Local<Context> context,
|
|
MaybeLocal<Object> InitializePerIsolateSymbols(Local<Context> context,
|
|
IsolateData* isolate_data) {
|
|
CHECK(isolate_data);
|
|
- Isolate* isolate = context->GetIsolate();
|
|
+ Isolate* isolate = Isolate::GetCurrent();
|
|
EscapableHandleScope scope(isolate);
|
|
Context::Scope context_scope(context);
|
|
|
|
@@ -905,7 +905,7 @@ MaybeLocal<Object> InitializePerIsolateSymbols(Local<Context> context,
|
|
Maybe<void> InitializePrimordials(Local<Context> context,
|
|
IsolateData* isolate_data) {
|
|
// Run per-context JS files.
|
|
- Isolate* isolate = context->GetIsolate();
|
|
+ Isolate* isolate = Isolate::GetCurrent();
|
|
Context::Scope context_scope(context);
|
|
Local<Object> exports;
|
|
|
|
diff --git a/src/base_object-inl.h b/src/base_object-inl.h
|
|
index cc60ddddb037e0279615bbe24821eb20fd8da677..37d83e41b618a07aca98118260abe9618f11256d 100644
|
|
--- a/src/base_object-inl.h
|
|
+++ b/src/base_object-inl.h
|
|
@@ -55,7 +55,6 @@ v8::Local<v8::Object> BaseObject::object() const {
|
|
v8::Local<v8::Object> BaseObject::object(v8::Isolate* isolate) const {
|
|
v8::Local<v8::Object> handle = object();
|
|
|
|
- DCHECK_EQ(handle->GetCreationContextChecked()->GetIsolate(), isolate);
|
|
DCHECK_EQ(env()->isolate(), isolate);
|
|
|
|
return handle;
|
|
diff --git a/src/crypto/crypto_context.cc b/src/crypto/crypto_context.cc
|
|
index 20d3c1d9d17fde18fc09b6ee219137831eb08a45..8fbf4f25a91b953f3d2868889c7ee06932ee3c5f 100644
|
|
--- a/src/crypto/crypto_context.cc
|
|
+++ b/src/crypto/crypto_context.cc
|
|
@@ -1022,7 +1022,7 @@ bool ArrayOfStringsToX509s(Local<Context> context,
|
|
Local<Array> cert_array,
|
|
std::vector<X509*>* certs) {
|
|
ClearErrorOnReturn clear_error_on_return;
|
|
- Isolate* isolate = context->GetIsolate();
|
|
+ Isolate* isolate = Isolate::GetCurrent();
|
|
Environment* env = Environment::GetCurrent(context);
|
|
uint32_t array_length = cert_array->Length();
|
|
|
|
diff --git a/src/crypto/crypto_x509.cc b/src/crypto/crypto_x509.cc
|
|
index 4c5427596d1c90d3a413cdd9ff4f1151e657073d..70135a6be65e41fcb3564ddf6d1e8083a59ef8bb 100644
|
|
--- a/src/crypto/crypto_x509.cc
|
|
+++ b/src/crypto/crypto_x509.cc
|
|
@@ -107,7 +107,7 @@ MaybeLocal<Value> ToV8Value(Local<Context> context, BIOPointer&& bio) {
|
|
return {};
|
|
BUF_MEM* mem = bio;
|
|
Local<Value> ret;
|
|
- if (!String::NewFromUtf8(context->GetIsolate(),
|
|
+ if (!String::NewFromUtf8(Isolate::GetCurrent(),
|
|
mem->data,
|
|
NewStringType::kNormal,
|
|
mem->length)
|
|
@@ -121,7 +121,7 @@ MaybeLocal<Value> ToV8Value(Local<Context> context, const BIOPointer& bio) {
|
|
return {};
|
|
BUF_MEM* mem = bio;
|
|
Local<Value> ret;
|
|
- if (!String::NewFromUtf8(context->GetIsolate(),
|
|
+ if (!String::NewFromUtf8(Isolate::GetCurrent(),
|
|
mem->data,
|
|
NewStringType::kNormal,
|
|
mem->length)
|
|
diff --git a/src/encoding_binding.cc b/src/encoding_binding.cc
|
|
index 266f640fb1c6503a424e77cc41fc15bc658bb6a5..877ae8a18f6b8f2c7e3474dfba060d99db88e6b9 100644
|
|
--- a/src/encoding_binding.cc
|
|
+++ b/src/encoding_binding.cc
|
|
@@ -76,7 +76,7 @@ void BindingData::Deserialize(Local<Context> context,
|
|
int index,
|
|
InternalFieldInfoBase* info) {
|
|
DCHECK_IS_SNAPSHOT_SLOT(index);
|
|
- HandleScope scope(context->GetIsolate());
|
|
+ HandleScope scope(Isolate::GetCurrent());
|
|
Realm* realm = Realm::GetCurrent(context);
|
|
// Recreate the buffer in the constructor.
|
|
InternalFieldInfo* casted_info = static_cast<InternalFieldInfo*>(info);
|
|
diff --git a/src/env.cc b/src/env.cc
|
|
index a78817467518245c4a190e870e0eb30658eafcdb..13dcf0e9c2c86486d1e43763033f43ac4e6b6feb 100644
|
|
--- a/src/env.cc
|
|
+++ b/src/env.cc
|
|
@@ -1753,10 +1753,10 @@ void AsyncHooks::Deserialize(Local<Context> context) {
|
|
context->GetDataFromSnapshotOnce<Array>(
|
|
info_->js_execution_async_resources).ToLocalChecked();
|
|
} else {
|
|
- js_execution_async_resources = Array::New(context->GetIsolate());
|
|
+ js_execution_async_resources = Array::New(Isolate::GetCurrent());
|
|
}
|
|
js_execution_async_resources_.Reset(
|
|
- context->GetIsolate(), js_execution_async_resources);
|
|
+ Isolate::GetCurrent(), js_execution_async_resources);
|
|
|
|
// The native_execution_async_resources_ field requires v8::Local<> instances
|
|
// for async calls whose resources were on the stack as JS objects when they
|
|
@@ -1796,7 +1796,7 @@ AsyncHooks::SerializeInfo AsyncHooks::Serialize(Local<Context> context,
|
|
info.async_id_fields = async_id_fields_.Serialize(context, creator);
|
|
if (!js_execution_async_resources_.IsEmpty()) {
|
|
info.js_execution_async_resources = creator->AddData(
|
|
- context, js_execution_async_resources_.Get(context->GetIsolate()));
|
|
+ context, js_execution_async_resources_.Get(Isolate::GetCurrent()));
|
|
CHECK_NE(info.js_execution_async_resources, 0);
|
|
} else {
|
|
info.js_execution_async_resources = 0;
|
|
diff --git a/src/inspector/network_agent.cc b/src/inspector/network_agent.cc
|
|
index aacd4e8cb83c88649537ab5d9e1ce752ea5b87a8..a47ea86adb9da081a125b6590bcd96f43053d44b 100644
|
|
--- a/src/inspector/network_agent.cc
|
|
+++ b/src/inspector/network_agent.cc
|
|
@@ -31,31 +31,31 @@ constexpr size_t kDefaultMaxTotalBufferSize = 100 * 1024 * 1024; // 100MB
|
|
Maybe<protocol::String> ObjectGetProtocolString(v8::Local<v8::Context> context,
|
|
Local<Object> object,
|
|
Local<v8::String> property) {
|
|
- HandleScope handle_scope(context->GetIsolate());
|
|
+ HandleScope handle_scope(v8::Isolate::GetCurrent());
|
|
Local<Value> value;
|
|
if (!object->Get(context, property).ToLocal(&value) || !value->IsString()) {
|
|
return Nothing<protocol::String>();
|
|
}
|
|
Local<v8::String> str = value.As<v8::String>();
|
|
- return Just(ToProtocolString(context->GetIsolate(), str));
|
|
+ return Just(ToProtocolString(v8::Isolate::GetCurrent(), str));
|
|
}
|
|
|
|
// Get a protocol string property from the object.
|
|
Maybe<protocol::String> ObjectGetProtocolString(v8::Local<v8::Context> context,
|
|
Local<Object> object,
|
|
const char* property) {
|
|
- HandleScope handle_scope(context->GetIsolate());
|
|
+ HandleScope handle_scope(v8::Isolate::GetCurrent());
|
|
return ObjectGetProtocolString(
|
|
- context, object, OneByteString(context->GetIsolate(), property));
|
|
+ context, object, OneByteString(v8::Isolate::GetCurrent(), property));
|
|
}
|
|
|
|
// Get a protocol double property from the object.
|
|
Maybe<double> ObjectGetDouble(v8::Local<v8::Context> context,
|
|
Local<Object> object,
|
|
const char* property) {
|
|
- HandleScope handle_scope(context->GetIsolate());
|
|
+ HandleScope handle_scope(v8::Isolate::GetCurrent());
|
|
Local<Value> value;
|
|
- if (!object->Get(context, OneByteString(context->GetIsolate(), property))
|
|
+ if (!object->Get(context, OneByteString(v8::Isolate::GetCurrent(), property))
|
|
.ToLocal(&value) ||
|
|
!value->IsNumber()) {
|
|
return Nothing<double>();
|
|
@@ -67,9 +67,9 @@ Maybe<double> ObjectGetDouble(v8::Local<v8::Context> context,
|
|
Maybe<int> ObjectGetInt(v8::Local<v8::Context> context,
|
|
Local<Object> object,
|
|
const char* property) {
|
|
- HandleScope handle_scope(context->GetIsolate());
|
|
+ HandleScope handle_scope(v8::Isolate::GetCurrent());
|
|
Local<Value> value;
|
|
- if (!object->Get(context, OneByteString(context->GetIsolate(), property))
|
|
+ if (!object->Get(context, OneByteString(v8::Isolate::GetCurrent(), property))
|
|
.ToLocal(&value) ||
|
|
!value->IsInt32()) {
|
|
return Nothing<int>();
|
|
@@ -81,9 +81,9 @@ Maybe<int> ObjectGetInt(v8::Local<v8::Context> context,
|
|
Maybe<bool> ObjectGetBool(v8::Local<v8::Context> context,
|
|
Local<Object> object,
|
|
const char* property) {
|
|
- HandleScope handle_scope(context->GetIsolate());
|
|
+ HandleScope handle_scope(v8::Isolate::GetCurrent());
|
|
Local<Value> value;
|
|
- if (!object->Get(context, OneByteString(context->GetIsolate(), property))
|
|
+ if (!object->Get(context, OneByteString(v8::Isolate::GetCurrent(), property))
|
|
.ToLocal(&value) ||
|
|
!value->IsBoolean()) {
|
|
return Nothing<bool>();
|
|
@@ -95,9 +95,9 @@ Maybe<bool> ObjectGetBool(v8::Local<v8::Context> context,
|
|
MaybeLocal<v8::Object> ObjectGetObject(v8::Local<v8::Context> context,
|
|
Local<Object> object,
|
|
const char* property) {
|
|
- EscapableHandleScope handle_scope(context->GetIsolate());
|
|
+ EscapableHandleScope handle_scope(v8::Isolate::GetCurrent());
|
|
Local<Value> value;
|
|
- if (!object->Get(context, OneByteString(context->GetIsolate(), property))
|
|
+ if (!object->Get(context, OneByteString(v8::Isolate::GetCurrent(), property))
|
|
.ToLocal(&value) ||
|
|
!value->IsObject()) {
|
|
return {};
|
|
@@ -108,7 +108,7 @@ MaybeLocal<v8::Object> ObjectGetObject(v8::Local<v8::Context> context,
|
|
// Create a protocol::Network::Headers from the v8 object.
|
|
std::unique_ptr<protocol::Network::Headers> createHeadersFromObject(
|
|
v8::Local<v8::Context> context, Local<Object> headers_obj) {
|
|
- HandleScope handle_scope(context->GetIsolate());
|
|
+ HandleScope handle_scope(v8::Isolate::GetCurrent());
|
|
|
|
std::unique_ptr<protocol::DictionaryValue> dict =
|
|
protocol::DictionaryValue::create();
|
|
@@ -129,7 +129,7 @@ std::unique_ptr<protocol::Network::Headers> createHeadersFromObject(
|
|
.To(&property_value)) {
|
|
return {};
|
|
}
|
|
- dict->setString(ToProtocolString(context->GetIsolate(), property_name),
|
|
+ dict->setString(ToProtocolString(v8::Isolate::GetCurrent(), property_name),
|
|
property_value);
|
|
}
|
|
|
|
@@ -139,7 +139,7 @@ std::unique_ptr<protocol::Network::Headers> createHeadersFromObject(
|
|
// Create a protocol::Network::Request from the v8 object.
|
|
std::unique_ptr<protocol::Network::Request> createRequestFromObject(
|
|
v8::Local<v8::Context> context, Local<Object> request) {
|
|
- HandleScope handle_scope(context->GetIsolate());
|
|
+ HandleScope handle_scope(v8::Isolate::GetCurrent());
|
|
protocol::String url;
|
|
if (!ObjectGetProtocolString(context, request, "url").To(&url)) {
|
|
return {};
|
|
@@ -171,7 +171,7 @@ std::unique_ptr<protocol::Network::Request> createRequestFromObject(
|
|
// Create a protocol::Network::Response from the v8 object.
|
|
std::unique_ptr<protocol::Network::Response> createResponseFromObject(
|
|
v8::Local<v8::Context> context, Local<Object> response) {
|
|
- HandleScope handle_scope(context->GetIsolate());
|
|
+ HandleScope handle_scope(v8::Isolate::GetCurrent());
|
|
protocol::String url;
|
|
if (!ObjectGetProtocolString(context, response, "url").To(&url)) {
|
|
return {};
|
|
@@ -212,7 +212,7 @@ std::unique_ptr<protocol::Network::Response> createResponseFromObject(
|
|
|
|
std::unique_ptr<protocol::Network::WebSocketResponse> createWebSocketResponse(
|
|
v8::Local<v8::Context> context, Local<Object> response) {
|
|
- HandleScope handle_scope(context->GetIsolate());
|
|
+ HandleScope handle_scope(v8::Isolate::GetCurrent());
|
|
int status;
|
|
if (!ObjectGetInt(context, response, "status").To(&status)) {
|
|
return {};
|
|
diff --git a/src/js_native_api_v8.h b/src/js_native_api_v8.h
|
|
index 27aeac589b19cd681923fb848ce5f36c66fc05e2..5f2900869763f40cac54e3cb3fe2e24eda615410 100644
|
|
--- a/src/js_native_api_v8.h
|
|
+++ b/src/js_native_api_v8.h
|
|
@@ -53,7 +53,7 @@ class RefTracker {
|
|
struct napi_env__ {
|
|
explicit napi_env__(v8::Local<v8::Context> context,
|
|
int32_t module_api_version)
|
|
- : isolate(context->GetIsolate()),
|
|
+ : isolate(v8::Isolate::GetCurrent()),
|
|
context_persistent(isolate, context),
|
|
module_api_version(module_api_version) {
|
|
napi_clear_last_error(this);
|
|
diff --git a/src/module_wrap.cc b/src/module_wrap.cc
|
|
index fa2f28989be19e8ea8f53b990ae96be92ef3c3a3..c26d1301d7b81a6c281d5465bfb29a5786b09dc2 100644
|
|
--- a/src/module_wrap.cc
|
|
+++ b/src/module_wrap.cc
|
|
@@ -99,7 +99,7 @@ ModuleCacheKey ModuleCacheKey::From(Local<Context> context,
|
|
Local<String> specifier,
|
|
Local<FixedArray> import_attributes) {
|
|
CHECK_EQ(import_attributes->Length() % elements_per_attribute, 0);
|
|
- Isolate* isolate = context->GetIsolate();
|
|
+ Isolate* isolate = Isolate::GetCurrent();
|
|
std::size_t h1 = specifier->GetIdentityHash();
|
|
size_t num_attributes = import_attributes->Length() / elements_per_attribute;
|
|
ImportAttributeVector attributes;
|
|
@@ -1023,7 +1023,7 @@ MaybeLocal<Module> ModuleWrap::ResolveModuleCallback(
|
|
return {};
|
|
}
|
|
DCHECK_NOT_NULL(resolved_module);
|
|
- return resolved_module->module_.Get(context->GetIsolate());
|
|
+ return resolved_module->module_.Get(Isolate::GetCurrent());
|
|
}
|
|
|
|
// static
|
|
@@ -1047,7 +1047,7 @@ MaybeLocal<Object> ModuleWrap::ResolveSourceCallback(
|
|
Local<String> url = resolved_module->object()
|
|
->GetInternalField(ModuleWrap::kURLSlot)
|
|
.As<String>();
|
|
- THROW_ERR_SOURCE_PHASE_NOT_DEFINED(context->GetIsolate(), url);
|
|
+ THROW_ERR_SOURCE_PHASE_NOT_DEFINED(Isolate::GetCurrent(), url);
|
|
return {};
|
|
}
|
|
CHECK(module_source_object->IsObject());
|
|
@@ -1060,7 +1060,7 @@ Maybe<ModuleWrap*> ModuleWrap::ResolveModule(
|
|
Local<String> specifier,
|
|
Local<FixedArray> import_attributes,
|
|
Local<Module> referrer) {
|
|
- Isolate* isolate = context->GetIsolate();
|
|
+ Isolate* isolate = Isolate::GetCurrent();
|
|
Environment* env = Environment::GetCurrent(context);
|
|
if (env == nullptr) {
|
|
THROW_ERR_EXECUTION_ENVIRONMENT_NOT_AVAILABLE(isolate);
|
|
@@ -1105,7 +1105,7 @@ MaybeLocal<Promise> ImportModuleDynamicallyWithPhase(
|
|
Local<String> specifier,
|
|
ModuleImportPhase phase,
|
|
Local<FixedArray> import_attributes) {
|
|
- Isolate* isolate = context->GetIsolate();
|
|
+ Isolate* isolate = Isolate::GetCurrent();
|
|
Environment* env = Environment::GetCurrent(context);
|
|
if (env == nullptr) {
|
|
THROW_ERR_EXECUTION_ENVIRONMENT_NOT_AVAILABLE(isolate);
|
|
@@ -1347,7 +1347,7 @@ MaybeLocal<Module> LinkRequireFacadeWithOriginal(
|
|
Local<FixedArray> import_attributes,
|
|
Local<Module> referrer) {
|
|
Environment* env = Environment::GetCurrent(context);
|
|
- Isolate* isolate = context->GetIsolate();
|
|
+ Isolate* isolate = Isolate::GetCurrent();
|
|
CHECK(specifier->Equals(context, env->original_string()).ToChecked());
|
|
CHECK(!env->temporary_required_module_facade_original.IsEmpty());
|
|
return env->temporary_required_module_facade_original.Get(isolate);
|
|
diff --git a/src/node.h b/src/node.h
|
|
index 486d941cf0c5c4588604f3808807717aaed2f018..754e8ce35e006946c276b63c184cde6e1bbf881a 100644
|
|
--- a/src/node.h
|
|
+++ b/src/node.h
|
|
@@ -1065,7 +1065,7 @@ NODE_DEPRECATED("Use v8::Date::ValueOf() directly",
|
|
|
|
#define NODE_DEFINE_CONSTANT(target, constant) \
|
|
do { \
|
|
- v8::Isolate* isolate = target->GetIsolate(); \
|
|
+ v8::Isolate* isolate = v8::Isolate::GetCurrent(); \
|
|
v8::Local<v8::Context> context = isolate->GetCurrentContext(); \
|
|
v8::Local<v8::String> constant_name = v8::String::NewFromUtf8Literal( \
|
|
isolate, #constant, v8::NewStringType::kInternalized); \
|
|
@@ -1081,7 +1081,7 @@ NODE_DEPRECATED("Use v8::Date::ValueOf() directly",
|
|
|
|
#define NODE_DEFINE_HIDDEN_CONSTANT(target, constant) \
|
|
do { \
|
|
- v8::Isolate* isolate = target->GetIsolate(); \
|
|
+ v8::Isolate* isolate = v8::Isolate::GetCurrent(); \
|
|
v8::Local<v8::Context> context = isolate->GetCurrentContext(); \
|
|
v8::Local<v8::String> constant_name = v8::String::NewFromUtf8Literal( \
|
|
isolate, #constant, v8::NewStringType::kInternalized); \
|
|
diff --git a/src/node_blob.cc b/src/node_blob.cc
|
|
index d278a32c9934c15bc721da164efccca7bc7e7111..ab862bf93a411e6ae6da7c9f9706cee279a0ad70 100644
|
|
--- a/src/node_blob.cc
|
|
+++ b/src/node_blob.cc
|
|
@@ -554,7 +554,7 @@ void BlobBindingData::Deserialize(Local<Context> context,
|
|
int index,
|
|
InternalFieldInfoBase* info) {
|
|
DCHECK_IS_SNAPSHOT_SLOT(index);
|
|
- HandleScope scope(context->GetIsolate());
|
|
+ HandleScope scope(Isolate::GetCurrent());
|
|
Realm* realm = Realm::GetCurrent(context);
|
|
BlobBindingData* binding = realm->AddBindingData<BlobBindingData>(holder);
|
|
CHECK_NOT_NULL(binding);
|
|
diff --git a/src/node_builtins.cc b/src/node_builtins.cc
|
|
index e69eb280050cae0c0f394b2f956eef947e628904..9bb4576fcf4f07550e7d6f4ff2310cedc8093c5f 100644
|
|
--- a/src/node_builtins.cc
|
|
+++ b/src/node_builtins.cc
|
|
@@ -274,7 +274,7 @@ MaybeLocal<Function> BuiltinLoader::LookupAndCompileInternal(
|
|
const char* id,
|
|
LocalVector<String>* parameters,
|
|
Realm* optional_realm) {
|
|
- Isolate* isolate = context->GetIsolate();
|
|
+ Isolate* isolate = Isolate::GetCurrent();
|
|
EscapableHandleScope scope(isolate);
|
|
|
|
Local<String> source;
|
|
@@ -396,7 +396,7 @@ void BuiltinLoader::SaveCodeCache(const char* id, Local<Function> fun) {
|
|
MaybeLocal<Function> BuiltinLoader::LookupAndCompile(Local<Context> context,
|
|
const char* id,
|
|
Realm* optional_realm) {
|
|
- Isolate* isolate = context->GetIsolate();
|
|
+ Isolate* isolate = Isolate::GetCurrent();
|
|
LocalVector<String> parameters(isolate);
|
|
// Detects parameters of the scripts based on module ids.
|
|
// internal/bootstrap/realm: process, getLinkedBinding,
|
|
@@ -450,7 +450,7 @@ MaybeLocal<Function> BuiltinLoader::LookupAndCompile(Local<Context> context,
|
|
MaybeLocal<Value> BuiltinLoader::CompileAndCall(Local<Context> context,
|
|
const char* id,
|
|
Realm* realm) {
|
|
- Isolate* isolate = context->GetIsolate();
|
|
+ Isolate* isolate = Isolate::GetCurrent();
|
|
// Detects parameters of the scripts based on module ids.
|
|
// internal/bootstrap/realm: process, getLinkedBinding,
|
|
// getInternalBinding, primordials
|
|
@@ -506,7 +506,7 @@ MaybeLocal<Value> BuiltinLoader::CompileAndCall(Local<Context> context,
|
|
if (!maybe_fn.ToLocal(&fn)) {
|
|
return MaybeLocal<Value>();
|
|
}
|
|
- Local<Value> undefined = Undefined(context->GetIsolate());
|
|
+ Local<Value> undefined = Undefined(Isolate::GetCurrent());
|
|
return fn->Call(context, undefined, argc, argv);
|
|
}
|
|
|
|
@@ -544,14 +544,14 @@ bool BuiltinLoader::CompileAllBuiltinsAndCopyCodeCache(
|
|
to_eager_compile_.emplace(id);
|
|
}
|
|
|
|
- TryCatch bootstrapCatch(context->GetIsolate());
|
|
+ TryCatch bootstrapCatch(Isolate::GetCurrent());
|
|
auto fn = LookupAndCompile(context, id.data(), nullptr);
|
|
if (bootstrapCatch.HasCaught()) {
|
|
per_process::Debug(DebugCategory::CODE_CACHE,
|
|
"Failed to compile code cache for %s\n",
|
|
id.data());
|
|
all_succeeded = false;
|
|
- PrintCaughtException(context->GetIsolate(), context, bootstrapCatch);
|
|
+ PrintCaughtException(Isolate::GetCurrent(), context, bootstrapCatch);
|
|
} else {
|
|
// This is used by the snapshot builder, so save the code cache
|
|
// unconditionally.
|
|
diff --git a/src/node_constants.cc b/src/node_constants.cc
|
|
index fea0426496978c0003fe1481afcf93fc9c23edca..c9588880d05435ab9f4e23fcff74c93309664270 100644
|
|
--- a/src/node_constants.cc
|
|
+++ b/src/node_constants.cc
|
|
@@ -1265,7 +1265,7 @@ void CreatePerContextProperties(Local<Object> target,
|
|
Local<Value> unused,
|
|
Local<Context> context,
|
|
void* priv) {
|
|
- Isolate* isolate = context->GetIsolate();
|
|
+ Isolate* isolate = Isolate::GetCurrent();
|
|
Environment* env = Environment::GetCurrent(context);
|
|
|
|
CHECK(
|
|
diff --git a/src/node_contextify.cc b/src/node_contextify.cc
|
|
index 3c234205e89be7e976dae5c3fcc73ca67953e034..e66d4fcb0c064f96cdb819c783027d864fe88d12 100644
|
|
--- a/src/node_contextify.cc
|
|
+++ b/src/node_contextify.cc
|
|
@@ -113,7 +113,7 @@ namespace {
|
|
|
|
// Convert an int to a V8 Name (String or Symbol).
|
|
MaybeLocal<String> Uint32ToName(Local<Context> context, uint32_t index) {
|
|
- return Uint32::New(context->GetIsolate(), index)->ToString(context);
|
|
+ return Uint32::New(Isolate::GetCurrent(), index)->ToString(context);
|
|
}
|
|
|
|
} // anonymous namespace
|
|
@@ -677,7 +677,7 @@ Intercepted ContextifyContext::PropertyDefinerCallback(
|
|
}
|
|
|
|
Local<Context> context = ctx->context();
|
|
- Isolate* isolate = context->GetIsolate();
|
|
+ Isolate* isolate = Isolate::GetCurrent();
|
|
|
|
PropertyAttribute attributes = PropertyAttribute::None;
|
|
bool is_declared =
|
|
@@ -1666,7 +1666,7 @@ static MaybeLocal<Function> CompileFunctionForCJSLoader(
|
|
bool* cache_rejected,
|
|
bool is_cjs_scope,
|
|
ScriptCompiler::CachedData* cached_data) {
|
|
- Isolate* isolate = context->GetIsolate();
|
|
+ Isolate* isolate = Isolate::GetCurrent();
|
|
EscapableHandleScope scope(isolate);
|
|
|
|
Local<Symbol> symbol = env->vm_dynamic_import_default_internal();
|
|
diff --git a/src/node_env_var.cc b/src/node_env_var.cc
|
|
index 6aad252eb5681bb9ab9890812602b43c418e7a7f..5f7ef8cc58f589ba30a44abaaaaaf1514458c3f0 100644
|
|
--- a/src/node_env_var.cc
|
|
+++ b/src/node_env_var.cc
|
|
@@ -311,7 +311,7 @@ std::shared_ptr<KVStore> KVStore::CreateMapKVStore() {
|
|
|
|
Maybe<void> KVStore::AssignFromObject(Local<Context> context,
|
|
Local<Object> entries) {
|
|
- Isolate* isolate = context->GetIsolate();
|
|
+ Isolate* isolate = Isolate::GetCurrent();
|
|
HandleScope handle_scope(isolate);
|
|
Local<Array> keys;
|
|
if (!entries->GetOwnPropertyNames(context).ToLocal(&keys))
|
|
diff --git a/src/node_errors.cc b/src/node_errors.cc
|
|
index 15d78e3eca9693dc518ccb28fc7c02fa1372f34b..9286d20c19a1e06001ca4b60981291d320858064 100644
|
|
--- a/src/node_errors.cc
|
|
+++ b/src/node_errors.cc
|
|
@@ -633,7 +633,7 @@ v8::ModifyCodeGenerationFromStringsResult ModifyCodeGenerationFromStrings(
|
|
v8::Local<v8::Context> context,
|
|
v8::Local<v8::Value> source,
|
|
bool is_code_like) {
|
|
- HandleScope scope(context->GetIsolate());
|
|
+ HandleScope scope(Isolate::GetCurrent());
|
|
|
|
if (context->GetNumberOfEmbedderDataFields() <=
|
|
ContextEmbedderIndex::kAllowCodeGenerationFromStrings) {
|
|
@@ -1000,7 +1000,7 @@ const char* errno_string(int errorno) {
|
|
}
|
|
|
|
void PerIsolateMessageListener(Local<Message> message, Local<Value> error) {
|
|
- Isolate* isolate = message->GetIsolate();
|
|
+ Isolate* isolate = Isolate::GetCurrent();
|
|
switch (message->ErrorLevel()) {
|
|
case Isolate::MessageErrorLevel::kMessageWarning: {
|
|
Environment* env = Environment::GetCurrent(isolate);
|
|
@@ -1160,7 +1160,7 @@ void Initialize(Local<Object> target,
|
|
SetMethod(
|
|
context, target, "getErrorSourcePositions", GetErrorSourcePositions);
|
|
|
|
- Isolate* isolate = context->GetIsolate();
|
|
+ Isolate* isolate = Isolate::GetCurrent();
|
|
Local<Object> exit_codes = Object::New(isolate);
|
|
READONLY_PROPERTY(target, "exitCodes", exit_codes);
|
|
|
|
diff --git a/src/node_file.cc b/src/node_file.cc
|
|
index d73dac2ee3f1cf1cac6845fae0f702c9fba8fcef..969e7d08086f8442bed476feaf15599b8c79db7c 100644
|
|
--- a/src/node_file.cc
|
|
+++ b/src/node_file.cc
|
|
@@ -3874,7 +3874,7 @@ void BindingData::Deserialize(Local<Context> context,
|
|
int index,
|
|
InternalFieldInfoBase* info) {
|
|
DCHECK_IS_SNAPSHOT_SLOT(index);
|
|
- HandleScope scope(context->GetIsolate());
|
|
+ HandleScope scope(Isolate::GetCurrent());
|
|
Realm* realm = Realm::GetCurrent(context);
|
|
InternalFieldInfo* casted_info = static_cast<InternalFieldInfo*>(info);
|
|
BindingData* binding =
|
|
diff --git a/src/node_messaging.cc b/src/node_messaging.cc
|
|
index 57e068ae249d618c2658638f9f3b03e1fedb6524..8c51ae4e0a435971c6d0288af87810877dd31a49 100644
|
|
--- a/src/node_messaging.cc
|
|
+++ b/src/node_messaging.cc
|
|
@@ -254,7 +254,7 @@ namespace {
|
|
|
|
MaybeLocal<Function> GetEmitMessageFunction(Local<Context> context,
|
|
IsolateData* isolate_data) {
|
|
- Isolate* isolate = context->GetIsolate();
|
|
+ Isolate* isolate = Isolate::GetCurrent();
|
|
Local<Object> per_context_bindings;
|
|
Local<Value> emit_message_val;
|
|
if (!GetPerContextExports(context, isolate_data)
|
|
@@ -269,7 +269,7 @@ MaybeLocal<Function> GetEmitMessageFunction(Local<Context> context,
|
|
}
|
|
|
|
MaybeLocal<Function> GetDOMException(Local<Context> context) {
|
|
- Isolate* isolate = context->GetIsolate();
|
|
+ Isolate* isolate = Isolate::GetCurrent();
|
|
Local<Object> per_context_bindings;
|
|
Local<Value> domexception_ctor_val;
|
|
if (!GetPerContextExports(context).ToLocal(&per_context_bindings) ||
|
|
@@ -284,7 +284,7 @@ MaybeLocal<Function> GetDOMException(Local<Context> context) {
|
|
}
|
|
|
|
void ThrowDataCloneException(Local<Context> context, Local<String> message) {
|
|
- Isolate* isolate = context->GetIsolate();
|
|
+ Isolate* isolate = Isolate::GetCurrent();
|
|
Local<Value> argv[] = {message,
|
|
FIXED_ONE_BYTE_STRING(isolate, "DataCloneError")};
|
|
Local<Value> exception;
|
|
@@ -1477,7 +1477,7 @@ BaseObjectPtr<BaseObject> JSTransferable::Data::Deserialize(
|
|
|
|
Maybe<bool> JSTransferable::Data::FinalizeTransferWrite(
|
|
Local<Context> context, ValueSerializer* serializer) {
|
|
- HandleScope handle_scope(context->GetIsolate());
|
|
+ HandleScope handle_scope(Isolate::GetCurrent());
|
|
auto ret = serializer->WriteValue(context, PersistentToLocal::Strong(data_));
|
|
data_.Reset();
|
|
return ret;
|
|
diff --git a/src/node_modules.cc b/src/node_modules.cc
|
|
index 6b1a9e257b0ce52820838f88c44ec546068fe419..5355f2f96e9c9f6548ae43fd38b0d89a825e6b60 100644
|
|
--- a/src/node_modules.cc
|
|
+++ b/src/node_modules.cc
|
|
@@ -70,7 +70,7 @@ void BindingData::Deserialize(v8::Local<v8::Context> context,
|
|
int index,
|
|
InternalFieldInfoBase* info) {
|
|
DCHECK_IS_SNAPSHOT_SLOT(index);
|
|
- HandleScope scope(context->GetIsolate());
|
|
+ HandleScope scope(Isolate::GetCurrent());
|
|
Realm* realm = Realm::GetCurrent(context);
|
|
BindingData* binding = realm->AddBindingData<BindingData>(holder);
|
|
CHECK_NOT_NULL(binding);
|
|
@@ -709,7 +709,7 @@ void BindingData::CreatePerContextProperties(Local<Object> target,
|
|
Realm* realm = Realm::GetCurrent(context);
|
|
realm->AddBindingData<BindingData>(target);
|
|
|
|
- Isolate* isolate = context->GetIsolate();
|
|
+ Isolate* isolate = Isolate::GetCurrent();
|
|
LocalVector<Value> compile_cache_status_values(isolate);
|
|
|
|
#define V(status) \
|
|
diff --git a/src/node_process_methods.cc b/src/node_process_methods.cc
|
|
index e453bacc3e5247493a3582c24174bfe6e590825d..fe4aad63bc877be105830a80aa6be10ce3f8fda4 100644
|
|
--- a/src/node_process_methods.cc
|
|
+++ b/src/node_process_methods.cc
|
|
@@ -737,7 +737,7 @@ void BindingData::Deserialize(Local<Context> context,
|
|
int index,
|
|
InternalFieldInfoBase* info) {
|
|
DCHECK_IS_SNAPSHOT_SLOT(index);
|
|
- v8::HandleScope scope(context->GetIsolate());
|
|
+ v8::HandleScope scope(Isolate::GetCurrent());
|
|
Realm* realm = Realm::GetCurrent(context);
|
|
// Recreate the buffer in the constructor.
|
|
InternalFieldInfo* casted_info = static_cast<InternalFieldInfo*>(info);
|
|
diff --git a/src/node_realm.cc b/src/node_realm.cc
|
|
index 2a5fe9fe501d1fd9356eeb7d044a872fa5a55f38..39f6f142044c42904d234da20a266315346c135a 100644
|
|
--- a/src/node_realm.cc
|
|
+++ b/src/node_realm.cc
|
|
@@ -22,7 +22,7 @@ using v8::String;
|
|
using v8::Value;
|
|
|
|
Realm::Realm(Environment* env, v8::Local<v8::Context> context, Kind kind)
|
|
- : env_(env), isolate_(context->GetIsolate()), kind_(kind) {
|
|
+ : env_(env), isolate_(v8::Isolate::GetCurrent()), kind_(kind) {
|
|
context_.Reset(isolate_, context);
|
|
env->AssignToContext(context, this, ContextInfo(""));
|
|
// The environment can also purge empty wrappers in the check callback,
|
|
diff --git a/src/node_report.cc b/src/node_report.cc
|
|
index 139e2ae3f2de1f1e28876bdc5332f68ea392484e..d479ada5bf0776fac52cd43c952a7f418ebc0679 100644
|
|
--- a/src/node_report.cc
|
|
+++ b/src/node_report.cc
|
|
@@ -400,7 +400,7 @@ static void PrintJavaScriptErrorProperties(JSONWriter* writer,
|
|
if (!error.IsEmpty() && error->IsObject()) {
|
|
TryCatch try_catch(isolate);
|
|
Local<Object> error_obj = error.As<Object>();
|
|
- Local<Context> context = error_obj->GetIsolate()->GetCurrentContext();
|
|
+ Local<Context> context = Isolate::GetCurrent()->GetCurrentContext();
|
|
Local<Array> keys;
|
|
if (!error_obj->GetOwnPropertyNames(context).ToLocal(&keys)) {
|
|
return writer->json_objectend(); // the end of 'errorProperties'
|
|
diff --git a/src/node_snapshotable.cc b/src/node_snapshotable.cc
|
|
index c2e24b4645e7903e08c80aead1c18c7bcff1bd89..e34d24d51d5c090b560d06f727043f20924e6f46 100644
|
|
--- a/src/node_snapshotable.cc
|
|
+++ b/src/node_snapshotable.cc
|
|
@@ -1614,7 +1614,7 @@ void BindingData::Deserialize(Local<Context> context,
|
|
int index,
|
|
InternalFieldInfoBase* info) {
|
|
DCHECK_IS_SNAPSHOT_SLOT(index);
|
|
- v8::HandleScope scope(context->GetIsolate());
|
|
+ v8::HandleScope scope(Isolate::GetCurrent());
|
|
Realm* realm = Realm::GetCurrent(context);
|
|
// Recreate the buffer in the constructor.
|
|
InternalFieldInfo* casted_info = static_cast<InternalFieldInfo*>(info);
|
|
diff --git a/src/node_sqlite.cc b/src/node_sqlite.cc
|
|
index 8b0bd18e6d9434aba4dd1a02beb0d8a2347c851c..1cab6dde9df945eb82ae59908711cfb75bd8993f 100644
|
|
--- a/src/node_sqlite.cc
|
|
+++ b/src/node_sqlite.cc
|
|
@@ -2018,7 +2018,7 @@ bool StatementSync::BindParams(const FunctionCallbackInfo<Value>& args) {
|
|
|
|
if (args[0]->IsObject() && !args[0]->IsArrayBufferView()) {
|
|
Local<Object> obj = args[0].As<Object>();
|
|
- Local<Context> context = obj->GetIsolate()->GetCurrentContext();
|
|
+ Local<Context> context = Isolate::GetCurrent()->GetCurrentContext();
|
|
Local<Array> keys;
|
|
if (!obj->GetOwnPropertyNames(context).ToLocal(&keys)) {
|
|
return false;
|
|
diff --git a/src/node_task_queue.cc b/src/node_task_queue.cc
|
|
index d33ee3c26c111e53edf27e6368ca8f64ff30a349..f1c53c44f201b295888e7932c5e3e2b19cb9c319 100644
|
|
--- a/src/node_task_queue.cc
|
|
+++ b/src/node_task_queue.cc
|
|
@@ -48,7 +48,7 @@ void PromiseRejectCallback(PromiseRejectMessage message) {
|
|
static std::atomic<uint64_t> rejectionsHandledAfter{0};
|
|
|
|
Local<Promise> promise = message.GetPromise();
|
|
- Isolate* isolate = promise->GetIsolate();
|
|
+ Isolate* isolate = Isolate::GetCurrent();
|
|
PromiseRejectEvent event = message.GetEvent();
|
|
|
|
Environment* env = Environment::GetCurrent(isolate);
|
|
diff --git a/src/node_url.cc b/src/node_url.cc
|
|
index 9d1e8ec05161570db11f7b662395509774668d78..9b91f83d879ea02fd3d61913c8dfd35b3bf1ac31 100644
|
|
--- a/src/node_url.cc
|
|
+++ b/src/node_url.cc
|
|
@@ -70,7 +70,7 @@ void BindingData::Deserialize(Local<Context> context,
|
|
int index,
|
|
InternalFieldInfoBase* info) {
|
|
DCHECK_IS_SNAPSHOT_SLOT(index);
|
|
- HandleScope scope(context->GetIsolate());
|
|
+ HandleScope scope(Isolate::GetCurrent());
|
|
Realm* realm = Realm::GetCurrent(context);
|
|
BindingData* binding = realm->AddBindingData<BindingData>(holder);
|
|
CHECK_NOT_NULL(binding);
|
|
diff --git a/src/node_v8.cc b/src/node_v8.cc
|
|
index 5cf30e8094b0014e12fa26d95d19a2d0e6f0ff56..13a4cbb11ad59e761f686c67f7a550d002b8e45c 100644
|
|
--- a/src/node_v8.cc
|
|
+++ b/src/node_v8.cc
|
|
@@ -158,7 +158,7 @@ void BindingData::Deserialize(Local<Context> context,
|
|
int index,
|
|
InternalFieldInfoBase* info) {
|
|
DCHECK_IS_SNAPSHOT_SLOT(index);
|
|
- HandleScope scope(context->GetIsolate());
|
|
+ HandleScope scope(Isolate::GetCurrent());
|
|
Realm* realm = Realm::GetCurrent(context);
|
|
// Recreate the buffer in the constructor.
|
|
InternalFieldInfo* casted_info = static_cast<InternalFieldInfo*>(info);
|
|
diff --git a/src/node_wasi.cc b/src/node_wasi.cc
|
|
index 370221d3cddc201180260ecb3a222bc831c91093..f5aff2f65fe6b9f48cf970ab3e7c57cfe4885f85 100644
|
|
--- a/src/node_wasi.cc
|
|
+++ b/src/node_wasi.cc
|
|
@@ -50,7 +50,7 @@ using v8::WasmMemoryObject;
|
|
static MaybeLocal<Value> WASIException(Local<Context> context,
|
|
int errorno,
|
|
const char* syscall) {
|
|
- Isolate* isolate = context->GetIsolate();
|
|
+ Isolate* isolate = Isolate::GetCurrent();
|
|
Environment* env = Environment::GetCurrent(context);
|
|
CHECK_NOT_NULL(env);
|
|
const char* err_name = uvwasi_embedder_err_code_to_string(errorno);
|
|
@@ -275,8 +275,8 @@ R WASI::WasiFunction<FT, F, R, Args...>::FastCallback(
|
|
return EinvalError<R>();
|
|
}
|
|
|
|
- Isolate* isolate = receiver->GetIsolate();
|
|
- HandleScope scope(isolate);
|
|
+ Isolate* isolate = Isolate::GetCurrent();
|
|
+ HandleScope handle_scope(isolate);
|
|
if (wasi->memory_.IsEmpty()) {
|
|
THROW_ERR_WASI_NOT_STARTED(isolate);
|
|
return EinvalError<R>();
|
|
diff --git a/src/node_webstorage.cc b/src/node_webstorage.cc
|
|
index cc90af827a3fbd14fb4cbfbfd39cc661f22cf6e1..5819d9bca845e0eed6d4d93564469d8f3c36200b 100644
|
|
--- a/src/node_webstorage.cc
|
|
+++ b/src/node_webstorage.cc
|
|
@@ -57,7 +57,7 @@ using v8::Value;
|
|
} while (0)
|
|
|
|
static void ThrowQuotaExceededException(Local<Context> context) {
|
|
- Isolate* isolate = context->GetIsolate();
|
|
+ Isolate* isolate = Isolate::GetCurrent();
|
|
auto dom_exception_str = FIXED_ONE_BYTE_STRING(isolate, "DOMException");
|
|
auto err_name = FIXED_ONE_BYTE_STRING(isolate, "QuotaExceededError");
|
|
auto err_message =
|
|
@@ -433,7 +433,7 @@ Maybe<void> Storage::Store(Local<Name> key, Local<Value> value) {
|
|
}
|
|
|
|
static MaybeLocal<String> Uint32ToName(Local<Context> context, uint32_t index) {
|
|
- return Uint32::New(context->GetIsolate(), index)->ToString(context);
|
|
+ return Uint32::New(Isolate::GetCurrent(), index)->ToString(context);
|
|
}
|
|
|
|
static void Clear(const FunctionCallbackInfo<Value>& info) {
|
|
diff --git a/src/node_worker.cc b/src/node_worker.cc
|
|
index 62c53368d1173edb7eb42e3337049c46fd7cdda9..7d08d8af7f6d99f7bd41cb7eb91063c630b3f87b 100644
|
|
--- a/src/node_worker.cc
|
|
+++ b/src/node_worker.cc
|
|
@@ -1466,8 +1466,6 @@ void GetEnvMessagePort(const FunctionCallbackInfo<Value>& args) {
|
|
Local<Object> port = env->message_port();
|
|
CHECK_IMPLIES(!env->is_main_thread(), !port.IsEmpty());
|
|
if (!port.IsEmpty()) {
|
|
- CHECK_EQ(port->GetCreationContextChecked()->GetIsolate(),
|
|
- args.GetIsolate());
|
|
args.GetReturnValue().Set(port);
|
|
}
|
|
}
|
|
diff --git a/src/timers.cc b/src/timers.cc
|
|
index da4206187f7c7d2becb8a101c1ff5346a10e13f4..03f0910926f3d403121e227cee32a546b2394e04 100644
|
|
--- a/src/timers.cc
|
|
+++ b/src/timers.cc
|
|
@@ -114,7 +114,7 @@ void BindingData::Deserialize(Local<Context> context,
|
|
int index,
|
|
InternalFieldInfoBase* info) {
|
|
DCHECK_IS_SNAPSHOT_SLOT(index);
|
|
- v8::HandleScope scope(context->GetIsolate());
|
|
+ v8::HandleScope scope(Isolate::GetCurrent());
|
|
Realm* realm = Realm::GetCurrent(context);
|
|
// Recreate the buffer in the constructor.
|
|
BindingData* binding = realm->AddBindingData<BindingData>(holder);
|
|
diff --git a/src/util-inl.h b/src/util-inl.h
|
|
index 5699d76fdfee4b260aa23929f1fb678389ad99e7..d07bceb425f00882db116975a92f4835d7c2cf3b 100644
|
|
--- a/src/util-inl.h
|
|
+++ b/src/util-inl.h
|
|
@@ -336,14 +336,14 @@ v8::Maybe<void> FromV8Array(v8::Local<v8::Context> context,
|
|
std::vector<v8::Global<v8::Value>>* 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<v8::Value> ToV8Value(v8::Local<v8::Context> 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<size_t>(v8::String::kMaxLength)) [[unlikely]] {
|
|
// V8 only has a TODO comment about adding an exception when the maximum
|
|
// string size is exceeded.
|
|
@@ -359,7 +359,7 @@ v8::MaybeLocal<v8::Value> ToV8Value(v8::Local<v8::Context> context,
|
|
v8::MaybeLocal<v8::Value> ToV8Value(v8::Local<v8::Context> context,
|
|
std::u16string_view str,
|
|
v8::Isolate* isolate) {
|
|
- if (isolate == nullptr) isolate = context->GetIsolate();
|
|
+ if (isolate == nullptr) isolate = v8::Isolate::GetCurrent();
|
|
if (str.length() >= static_cast<size_t>(v8::String::kMaxLength))
|
|
[[unlikely]] {
|
|
// V8 only has a TODO comment about adding an exception when the maximum
|
|
@@ -379,7 +379,7 @@ v8::MaybeLocal<v8::Value> ToV8Value(v8::Local<v8::Context> context,
|
|
v8::MaybeLocal<v8::Value> ToV8Value(v8::Local<v8::Context> 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<size_t>(v8::String::kMaxLength))
|
|
[[unlikely]] {
|
|
// V8 only has a TODO comment about adding an exception when the maximum
|
|
@@ -406,7 +406,7 @@ template <typename T>
|
|
v8::MaybeLocal<v8::Value> ToV8Value(v8::Local<v8::Context> context,
|
|
const std::vector<T>& vec,
|
|
v8::Isolate* isolate) {
|
|
- if (isolate == nullptr) isolate = context->GetIsolate();
|
|
+ if (isolate == nullptr) isolate = v8::Isolate::GetCurrent();
|
|
v8::EscapableHandleScope handle_scope(isolate);
|
|
|
|
MaybeStackBuffer<v8::Local<v8::Value>, 128> arr(vec.size());
|
|
@@ -423,7 +423,7 @@ template <typename T>
|
|
v8::MaybeLocal<v8::Value> ToV8Value(v8::Local<v8::Context> context,
|
|
const std::set<T>& set,
|
|
v8::Isolate* isolate) {
|
|
- if (isolate == nullptr) isolate = context->GetIsolate();
|
|
+ if (isolate == nullptr) isolate = v8::Isolate::GetCurrent();
|
|
v8::Local<v8::Set> set_js = v8::Set::New(isolate);
|
|
v8::HandleScope handle_scope(isolate);
|
|
|
|
@@ -442,7 +442,7 @@ template <typename T, std::size_t U>
|
|
v8::MaybeLocal<v8::Value> ToV8Value(v8::Local<v8::Context> context,
|
|
const std::ranges::elements_view<T, U>& vec,
|
|
v8::Isolate* isolate) {
|
|
- if (isolate == nullptr) isolate = context->GetIsolate();
|
|
+ if (isolate == nullptr) isolate = v8::Isolate::GetCurrent();
|
|
v8::EscapableHandleScope handle_scope(isolate);
|
|
|
|
MaybeStackBuffer<v8::Local<v8::Value>, 128> arr(vec.size());
|
|
@@ -461,7 +461,7 @@ template <typename T, typename U>
|
|
v8::MaybeLocal<v8::Value> ToV8Value(v8::Local<v8::Context> context,
|
|
const std::unordered_map<T, U>& map,
|
|
v8::Isolate* isolate) {
|
|
- if (isolate == nullptr) isolate = context->GetIsolate();
|
|
+ if (isolate == nullptr) isolate = v8::Isolate::GetCurrent();
|
|
v8::EscapableHandleScope handle_scope(isolate);
|
|
|
|
v8::Local<v8::Map> ret = v8::Map::New(isolate);
|
|
@@ -504,7 +504,7 @@ template <typename T, typename>
|
|
v8::MaybeLocal<v8::Value> ToV8Value(v8::Local<v8::Context> context,
|
|
const T& number,
|
|
v8::Isolate* isolate) {
|
|
- if (isolate == nullptr) isolate = context->GetIsolate();
|
|
+ if (isolate == nullptr) isolate = v8::Isolate::GetCurrent();
|
|
return ConvertNumberToV8Value(isolate, number);
|
|
}
|
|
|
|
@@ -517,7 +517,7 @@ v8::Local<v8::Array> ToV8ValuePrimitiveArray(v8::Local<v8::Context> context,
|
|
std::is_floating_point_v<T>,
|
|
"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<v8::Value> elements(isolate);
|
|
@@ -751,7 +751,7 @@ inline v8::MaybeLocal<v8::Object> NewDictionaryInstanceNullProto(
|
|
if (value.IsEmpty()) return v8::MaybeLocal<v8::Object>();
|
|
}
|
|
v8::Local<v8::Object> obj = tmpl->NewInstance(context, property_values);
|
|
- if (obj->SetPrototypeV2(context, v8::Null(context->GetIsolate()))
|
|
+ if (obj->SetPrototypeV2(context, v8::Null(v8::Isolate::GetCurrent()))
|
|
.IsNothing()) {
|
|
return v8::MaybeLocal<v8::Object>();
|
|
}
|
|
diff --git a/src/util.cc b/src/util.cc
|
|
index 660cfff6b8a0c583be843e555e7a06cd09e0d279..c4b39450c5b7f91c46f7027db367c30db34927bb 100644
|
|
--- a/src/util.cc
|
|
+++ b/src/util.cc
|
|
@@ -391,7 +391,7 @@ void SetMethod(Local<v8::Context> context,
|
|
Local<v8::Object> that,
|
|
const std::string_view name,
|
|
v8::FunctionCallback callback) {
|
|
- Isolate* isolate = context->GetIsolate();
|
|
+ Isolate* isolate = Isolate::GetCurrent();
|
|
Local<v8::Function> function =
|
|
NewFunctionTemplate(isolate,
|
|
callback,
|
|
@@ -452,7 +452,7 @@ void SetFastMethod(Local<v8::Context> context,
|
|
const std::string_view name,
|
|
v8::FunctionCallback slow_callback,
|
|
const v8::CFunction* c_function) {
|
|
- Isolate* isolate = context->GetIsolate();
|
|
+ Isolate* isolate = Isolate::GetCurrent();
|
|
Local<v8::Function> function =
|
|
NewFunctionTemplate(isolate,
|
|
slow_callback,
|
|
@@ -474,7 +474,7 @@ void SetFastMethodNoSideEffect(Local<v8::Context> context,
|
|
const std::string_view name,
|
|
v8::FunctionCallback slow_callback,
|
|
const v8::CFunction* c_function) {
|
|
- Isolate* isolate = context->GetIsolate();
|
|
+ Isolate* isolate = Isolate::GetCurrent();
|
|
Local<v8::Function> function =
|
|
NewFunctionTemplate(isolate,
|
|
slow_callback,
|
|
@@ -562,7 +562,7 @@ void SetMethodNoSideEffect(Local<v8::Context> context,
|
|
Local<v8::Object> that,
|
|
const std::string_view name,
|
|
v8::FunctionCallback callback) {
|
|
- Isolate* isolate = context->GetIsolate();
|
|
+ Isolate* isolate = Isolate::GetCurrent();
|
|
Local<v8::Function> function =
|
|
NewFunctionTemplate(isolate,
|
|
callback,
|
|
@@ -689,7 +689,7 @@ void SetConstructorFunction(Local<v8::Context> context,
|
|
const char* name,
|
|
Local<v8::FunctionTemplate> tmpl,
|
|
SetConstructorFunctionFlag flag) {
|
|
- Isolate* isolate = context->GetIsolate();
|
|
+ Isolate* isolate = Isolate::GetCurrent();
|
|
SetConstructorFunction(
|
|
context, that, OneByteString(isolate, name), tmpl, flag);
|
|
}
|
|
diff --git a/src/util.h b/src/util.h
|
|
index 63479eb3f12685702a06c27db52183a585de0da9..1db426df35e4976427b578a2974041ec9e92cf4c 100644
|
|
--- a/src/util.h
|
|
+++ b/src/util.h
|
|
@@ -751,7 +751,7 @@ inline v8::MaybeLocal<v8::Value> ToV8Value(
|
|
// Variation on NODE_DEFINE_CONSTANT that sets a String value.
|
|
#define NODE_DEFINE_STRING_CONSTANT(target, name, constant) \
|
|
do { \
|
|
- v8::Isolate* isolate = target->GetIsolate(); \
|
|
+ v8::Isolate* isolate = v8::Isolate::GetCurrent(); \
|
|
v8::Local<v8::String> constant_name = \
|
|
v8::String::NewFromUtf8(isolate, name).ToLocalChecked(); \
|
|
v8::Local<v8::String> constant_value = \
|