Compare commits

...

3 Commits

Author SHA1 Message Date
Charles Kerr
e195ff32e5 chore: e patches all 2025-02-21 15:30:25 -06:00
Charles Kerr
df4229a89a chore: udpate fix_add_property_query_interceptors.patch
manually update patch due to context shear from patch removal in previous commit
2025-02-21 15:27:13 -06:00
Shelley Vohr
e3791311ab build: try removing embedder exception patch (#45429) 2025-02-21 15:22:02 -06:00
4 changed files with 20 additions and 104 deletions

View File

@@ -29,7 +29,6 @@ fix_add_trusted_space_and_trusted_lo_space_to_the_v8_heap.patch
win_process_avoid_assert_after_spawning_store_app_4152.patch
chore_remove_use_of_deprecated_kmaxlength.patch
src_update_default_v8_platform_to_override_functions_with_location.patch
fix_capture_embedder_exceptions_before_entering_v8.patch
spec_add_iterator_to_global_intrinsics.patch
test_make_test-node-output-v8-warning_generic.patch
test_match_wpt_streams_transferable_transform-stream-members_any_js.patch

View File

@@ -50,10 +50,10 @@ index 4bf80aa6cc6385dc376fd0a3538efc27fe5bd0a2..3e37aa8b0c9696cceb3f3cfab9721f38
BuiltinCodeCacheData cached_data{};
{
diff --git a/src/node_contextify.cc b/src/node_contextify.cc
index 6456d87d4202c013aafe071adbac06852b3ae2c1..28ba7dbe66a44a43c39e3d75edf0be9513bcf732 100644
index 8951cd378a9025f58fada47cf96f686d14639f95..87a05a56284cdfdb2ad849c56e32cb2eda90df77 100644
--- a/src/node_contextify.cc
+++ b/src/node_contextify.cc
@@ -877,16 +877,15 @@ void ContextifyScript::New(const FunctionCallbackInfo<Value>& args) {
@@ -869,16 +869,15 @@ void ContextifyScript::New(const FunctionCallbackInfo<Value>& args) {
host_defined_options->Set(
isolate, loader::HostDefinedOptions::kID, id_symbol);
@@ -79,7 +79,7 @@ index 6456d87d4202c013aafe071adbac06852b3ae2c1..28ba7dbe66a44a43c39e3d75edf0be95
host_defined_options);
ScriptCompiler::Source source(code, origin, cached_data);
ScriptCompiler::CompileOptions compile_options =
@@ -998,7 +997,7 @@ MaybeLocal<Function> CompileFunction(Local<Context> context,
@@ -990,7 +989,7 @@ MaybeLocal<Function> CompileFunction(Local<Context> context,
Local<String> filename,
Local<String> content,
std::vector<Local<String>>* parameters) {
@@ -88,7 +88,7 @@ index 6456d87d4202c013aafe071adbac06852b3ae2c1..28ba7dbe66a44a43c39e3d75edf0be95
ScriptCompiler::Source script_source(content, script_origin);
return ScriptCompiler::CompileFunction(context,
@@ -1108,7 +1107,6 @@ bool ContextifyScript::EvalMachine(Local<Context> context,
@@ -1100,7 +1099,6 @@ bool ContextifyScript::EvalMachine(Local<Context> context,
}
TryCatchScope try_catch(env);
@@ -96,7 +96,7 @@ index 6456d87d4202c013aafe071adbac06852b3ae2c1..28ba7dbe66a44a43c39e3d75edf0be95
ContextifyScript* wrapped_script;
ASSIGN_OR_RETURN_UNWRAP(&wrapped_script, args.This(), false);
Local<UnboundScript> unbound_script =
@@ -1286,8 +1284,7 @@ void ContextifyContext::CompileFunction(
@@ -1278,8 +1276,7 @@ void ContextifyContext::CompileFunction(
Local<PrimitiveArray> host_defined_options =
GetHostDefinedOptions(isolate, id_symbol);
ScriptCompiler::Source source =
@@ -106,7 +106,7 @@ index 6456d87d4202c013aafe071adbac06852b3ae2c1..28ba7dbe66a44a43c39e3d75edf0be95
filename,
line_offset,
column_offset,
@@ -1342,15 +1339,13 @@ void ContextifyContext::CompileFunction(
@@ -1334,15 +1331,13 @@ void ContextifyContext::CompileFunction(
}
ScriptCompiler::Source ContextifyContext::GetCommonJSSourceInstance(
@@ -123,7 +123,7 @@ index 6456d87d4202c013aafe071adbac06852b3ae2c1..28ba7dbe66a44a43c39e3d75edf0be95
line_offset, // line offset
column_offset, // column offset
true, // is cross origin
@@ -1528,7 +1523,7 @@ void ContextifyContext::ContainsModuleSyntax(
@@ -1520,7 +1515,7 @@ void ContextifyContext::ContainsModuleSyntax(
Local<PrimitiveArray> host_defined_options =
GetHostDefinedOptions(isolate, id_symbol);
ScriptCompiler::Source source = GetCommonJSSourceInstance(
@@ -132,7 +132,7 @@ index 6456d87d4202c013aafe071adbac06852b3ae2c1..28ba7dbe66a44a43c39e3d75edf0be95
ScriptCompiler::CompileOptions options = GetCompileOptions(source);
std::vector<Local<String>> params = GetCJSParameters(env->isolate_data());
@@ -1576,7 +1571,7 @@ void ContextifyContext::ContainsModuleSyntax(
@@ -1568,7 +1563,7 @@ void ContextifyContext::ContainsModuleSyntax(
code,
String::NewFromUtf8(isolate, "})();").ToLocalChecked());
ScriptCompiler::Source wrapped_source = GetCommonJSSourceInstance(
@@ -141,7 +141,7 @@ index 6456d87d4202c013aafe071adbac06852b3ae2c1..28ba7dbe66a44a43c39e3d75edf0be95
std::ignore = ScriptCompiler::CompileFunction(
context,
&wrapped_source,
@@ -1629,8 +1624,7 @@ static void CompileFunctionForCJSLoader(
@@ -1621,8 +1616,7 @@ static void CompileFunctionForCJSLoader(
Local<Symbol> symbol = env->vm_dynamic_import_default_internal();
Local<PrimitiveArray> hdo = GetHostDefinedOptions(isolate, symbol);

View File

@@ -13,7 +13,7 @@ CL: https://chromium-review.googlesource.com/c/v8/v8/+/5630388
This patch can be removed when the node change is incorporated into main.
diff --git a/src/node_contextify.cc b/src/node_contextify.cc
index 28ba7dbe66a44a43c39e3d75edf0be9513bcf732..0401b968916e5f45d148281c74b7e465e11439b8 100644
index 87a05a56284cdfdb2ad849c56e32cb2eda90df77..9c80f38e95155a123f2f15c6b12608abe26577d4 100644
--- a/src/node_contextify.cc
+++ b/src/node_contextify.cc
@@ -49,6 +49,7 @@ using v8::FunctionTemplate;
@@ -24,7 +24,7 @@ index 28ba7dbe66a44a43c39e3d75edf0be9513bcf732..0401b968916e5f45d148281c74b7e465
using v8::Isolate;
using v8::Just;
using v8::Local;
@@ -484,14 +485,15 @@ bool ContextifyContext::IsStillInitializing(const ContextifyContext* ctx) {
@@ -484,13 +485,14 @@ bool ContextifyContext::IsStillInitializing(const ContextifyContext* ctx) {
}
// static
@@ -33,7 +33,6 @@ index 28ba7dbe66a44a43c39e3d75edf0be9513bcf732..0401b968916e5f45d148281c74b7e465
- const PropertyCallbackInfo<Value>& args) {
+Intercepted ContextifyContext::PropertyGetterCallback(
+ Local<Name> property, const PropertyCallbackInfo<Value>& args) {
Environment* env = Environment::GetCurrent(args);
ContextifyContext* ctx = ContextifyContext::Get(args);
// Still initializing
@@ -44,7 +43,7 @@ index 28ba7dbe66a44a43c39e3d75edf0be9513bcf732..0401b968916e5f45d148281c74b7e465
Local<Context> context = ctx->context();
Local<Object> sandbox = ctx->sandbox();
@@ -515,18 +517,22 @@ void ContextifyContext::PropertyGetterCallback(
@@ -507,18 +509,22 @@ void ContextifyContext::PropertyGetterCallback(
rv = ctx->global_proxy();
args.GetReturnValue().Set(rv);
@@ -70,7 +69,7 @@ index 28ba7dbe66a44a43c39e3d75edf0be9513bcf732..0401b968916e5f45d148281c74b7e465
Local<Context> context = ctx->context();
PropertyAttribute attributes = PropertyAttribute::None;
@@ -544,8 +550,9 @@ void ContextifyContext::PropertySetterCallback(
@@ -536,8 +542,9 @@ void ContextifyContext::PropertySetterCallback(
(static_cast<int>(attributes) &
static_cast<int>(PropertyAttribute::ReadOnly));
@@ -82,7 +81,7 @@ index 28ba7dbe66a44a43c39e3d75edf0be9513bcf732..0401b968916e5f45d148281c74b7e465
// true for x = 5
// false for this.x = 5
@@ -564,11 +571,16 @@ void ContextifyContext::PropertySetterCallback(
@@ -556,11 +563,16 @@ void ContextifyContext::PropertySetterCallback(
bool is_declared = is_declared_on_global_proxy || is_declared_on_sandbox;
if (!is_declared && args.ShouldThrowOnError() && is_contextual_store &&
@@ -103,7 +102,7 @@ index 28ba7dbe66a44a43c39e3d75edf0be9513bcf732..0401b968916e5f45d148281c74b7e465
Local<Value> desc;
if (is_declared_on_sandbox &&
@@ -582,19 +594,23 @@ void ContextifyContext::PropertySetterCallback(
@@ -574,19 +586,23 @@ void ContextifyContext::PropertySetterCallback(
// We have to specify the return value for any contextual or get/set
// property
if (desc_obj->HasOwnProperty(context, env->get_string()).FromMaybe(false) ||
@@ -132,7 +131,7 @@ index 28ba7dbe66a44a43c39e3d75edf0be9513bcf732..0401b968916e5f45d148281c74b7e465
Local<Context> context = ctx->context();
@@ -604,19 +620,23 @@ void ContextifyContext::PropertyDescriptorCallback(
@@ -596,19 +612,23 @@ void ContextifyContext::PropertyDescriptorCallback(
Local<Value> desc;
if (sandbox->GetOwnPropertyDescriptor(context, property).ToLocal(&desc)) {
args.GetReturnValue().Set(desc);
@@ -159,7 +158,7 @@ index 28ba7dbe66a44a43c39e3d75edf0be9513bcf732..0401b968916e5f45d148281c74b7e465
Local<Context> context = ctx->context();
Isolate* isolate = context->GetIsolate();
@@ -635,7 +655,7 @@ void ContextifyContext::PropertyDefinerCallback(
@@ -627,7 +647,7 @@ void ContextifyContext::PropertyDefinerCallback(
// If the property is set on the global as neither writable nor
// configurable, don't change it on the global or sandbox.
if (is_declared && read_only && dont_delete) {
@@ -168,7 +167,7 @@ index 28ba7dbe66a44a43c39e3d75edf0be9513bcf732..0401b968916e5f45d148281c74b7e465
}
Local<Object> sandbox = ctx->sandbox();
@@ -658,6 +678,9 @@ void ContextifyContext::PropertyDefinerCallback(
@@ -650,6 +670,9 @@ void ContextifyContext::PropertyDefinerCallback(
desc.has_set() ? desc.set() : Undefined(isolate).As<Value>());
define_prop_on_sandbox(&desc_for_sandbox);
@@ -178,7 +177,7 @@ index 28ba7dbe66a44a43c39e3d75edf0be9513bcf732..0401b968916e5f45d148281c74b7e465
} else {
Local<Value> value =
desc.has_value() ? desc.value() : Undefined(isolate).As<Value>();
@@ -669,26 +692,32 @@ void ContextifyContext::PropertyDefinerCallback(
@@ -661,26 +684,32 @@ void ContextifyContext::PropertyDefinerCallback(
PropertyDescriptor desc_for_sandbox(value);
define_prop_on_sandbox(&desc_for_sandbox);
}
@@ -217,7 +216,7 @@ index 28ba7dbe66a44a43c39e3d75edf0be9513bcf732..0401b968916e5f45d148281c74b7e465
}
// static
@@ -708,76 +737,84 @@ void ContextifyContext::PropertyEnumeratorCallback(
@@ -700,76 +729,84 @@ void ContextifyContext::PropertyEnumeratorCallback(
}
// static

View File

@@ -1,82 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: deepak1556 <hop2deep@gmail.com>
Date: Tue, 26 Dec 2023 02:10:42 +0900
Subject: fix: capture embedder exceptions before entering V8
Upstrem bug: https://github.com/nodejs/node-v8/issues/274
The patch only addresses the callsites that triggered failing DCHECKS
in the nodejs test suite. Need to be followed-up with upstream
on the broader change as there maybe other callsites.
diff --git a/src/handle_wrap.cc b/src/handle_wrap.cc
index be02d4aaa04685cbd6a9ecfe082e38f179129ab5..277748a30bd97ae816d9ba1f2d73851a29b81010 100644
--- a/src/handle_wrap.cc
+++ b/src/handle_wrap.cc
@@ -148,6 +148,9 @@ void HandleWrap::OnClose(uv_handle_t* handle) {
wrap->OnClose();
wrap->handle_wrap_queue_.Remove();
+ if (env->isolate()->IsExecutionTerminating())
+ return;
+
if (!wrap->persistent().IsEmpty() &&
wrap->object()->Has(env->context(), env->handle_onclose_symbol())
.FromMaybe(false)) {
diff --git a/src/node_contextify.cc b/src/node_contextify.cc
index 8951cd378a9025f58fada47cf96f686d14639f95..6456d87d4202c013aafe071adbac06852b3ae2c1 100644
--- a/src/node_contextify.cc
+++ b/src/node_contextify.cc
@@ -487,6 +487,7 @@ bool ContextifyContext::IsStillInitializing(const ContextifyContext* ctx) {
void ContextifyContext::PropertyGetterCallback(
Local<Name> property,
const PropertyCallbackInfo<Value>& args) {
+ Environment* env = Environment::GetCurrent(args);
ContextifyContext* ctx = ContextifyContext::Get(args);
// Still initializing
@@ -494,6 +495,8 @@ void ContextifyContext::PropertyGetterCallback(
Local<Context> context = ctx->context();
Local<Object> sandbox = ctx->sandbox();
+
+ TryCatchScope try_catch(env);
MaybeLocal<Value> maybe_rv =
sandbox->GetRealNamedProperty(context, property);
if (maybe_rv.IsEmpty()) {
@@ -503,6 +506,11 @@ void ContextifyContext::PropertyGetterCallback(
Local<Value> rv;
if (maybe_rv.ToLocal(&rv)) {
+ if (try_catch.HasCaught() &&
+ !try_catch.HasTerminated()) {
+ try_catch.ReThrow();
+ }
+
if (rv == sandbox)
rv = ctx->global_proxy();
diff --git a/src/node_messaging.cc b/src/node_messaging.cc
index e7d2bfbafef13f04a73dcbefe7d6e90b37b904d1..31b870c5f003b62b848c00d6032ed98eb829778d 100644
--- a/src/node_messaging.cc
+++ b/src/node_messaging.cc
@@ -907,7 +907,7 @@ Maybe<bool> MessagePort::PostMessage(Environment* env,
const TransferList& transfer_v) {
Isolate* isolate = env->isolate();
Local<Object> obj = object(isolate);
-
+ TryCatchScope try_catch(env);
std::shared_ptr<Message> msg = std::make_shared<Message>();
// Per spec, we need to both check if transfer list has the source port, and
@@ -915,6 +915,10 @@ Maybe<bool> MessagePort::PostMessage(Environment* env,
Maybe<bool> serialization_maybe =
msg->Serialize(env, context, message_v, transfer_v, obj);
+ if (try_catch.HasCaught() &&
+ !try_catch.HasTerminated()) {
+ try_catch.ReThrow();
+ }
if (data_ == nullptr) {
return serialization_maybe;
}