Commit eaf46fc7a99 for nodejs
commit eaf46fc7a9949a37950bd3d37089148054a00804
Author: Joyee Cheung <joyeec9h3@gmail.com>
Date: Thu Nov 5 15:52:03 2026 +0100
src: migrate to SetEmbedderDataV3
V8 16.0 removes Context::SetEmbedderData() and
Context::SetEmbedderDataV2().
Refs: https://crrev.com/c/8687878
Co-Authored-By: Chengzhong Wu <cwu631@bloomberg.net>
Signed-off-by: Joyee Cheung <joyeec9h3@gmail.com>
Signed-off-by: Chengzhong Wu <cwu631@bloomberg.net>
PR-URL: https://github.com/nodejs/node/pull/67755
Refs: https://issues.chromium.org/issues/570436596
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: James M Snell <jasnell@gmail.com>
diff --git a/src/api/environment.cc b/src/api/environment.cc
index 841cb805acc..7e8d95690c2 100644
--- a/src/api/environment.cc
+++ b/src/api/environment.cc
@@ -847,7 +847,7 @@ Maybe<void> InitializeContextRuntime(Local<Context> context) {
bool is_code_generation_from_strings_allowed =
context->IsCodeGenerationFromStringsAllowed();
context->AllowCodeGenerationFromStrings(false);
- context->SetEmbedderData(
+ context->SetEmbedderDataV3(
ContextEmbedderIndex::kAllowCodeGenerationFromStrings,
Boolean::New(isolate, is_code_generation_from_strings_allowed));
@@ -943,9 +943,9 @@ Maybe<void> InitializeMainContextForSnapshot(Local<Context> context) {
HandleScope handle_scope(isolate);
// Initialize the default values.
- context->SetEmbedderData(ContextEmbedderIndex::kAllowWasmCodeGeneration,
- True(isolate));
- context->SetEmbedderData(
+ context->SetEmbedderDataV3(ContextEmbedderIndex::kAllowWasmCodeGeneration,
+ True(isolate));
+ context->SetEmbedderDataV3(
ContextEmbedderIndex::kAllowCodeGenerationFromStrings, True(isolate));
if (InitializeBaseContextForSnapshot(context).IsNothing()) {
diff --git a/src/node_contextify.cc b/src/node_contextify.cc
index d60c40d12e4..eda58ee2e64 100644
--- a/src/node_contextify.cc
+++ b/src/node_contextify.cc
@@ -292,21 +292,21 @@ ContextifyContext* ContextifyContext::New(Local<Context> v8_context,
// to the ContextifyContext wrapper which in turn internally references
// the context from its constructor.
if (sandbox_obj.IsEmpty()) {
- v8_context->SetEmbedderData(ContextEmbedderIndex::kSandboxObject,
- v8::Undefined(env->isolate()));
+ v8_context->SetEmbedderDataV3(ContextEmbedderIndex::kSandboxObject,
+ v8::Undefined(env->isolate()));
} else {
- v8_context->SetEmbedderData(ContextEmbedderIndex::kSandboxObject,
- sandbox_obj);
+ v8_context->SetEmbedderDataV3(ContextEmbedderIndex::kSandboxObject,
+ sandbox_obj);
}
// Delegate the code generation validation to
// node::ModifyCodeGenerationFromStrings.
v8_context->AllowCodeGenerationFromStrings(false);
- v8_context->SetEmbedderData(
+ v8_context->SetEmbedderDataV3(
ContextEmbedderIndex::kAllowCodeGenerationFromStrings,
options->allow_code_gen_strings);
- v8_context->SetEmbedderData(ContextEmbedderIndex::kAllowWasmCodeGeneration,
- options->allow_code_gen_wasm);
+ v8_context->SetEmbedderDataV3(ContextEmbedderIndex::kAllowWasmCodeGeneration,
+ options->allow_code_gen_wasm);
Utf8Value name_val(env->isolate(), options->name);
ContextInfo info(name_val.ToString());