electron/patches/node/fix_prevent_changing_functiontemplateinfo_after_publish.patch
electron-roller[bot] 1d9a4ab02c
chore: bump node to v18.13.0 (main) (#36818)
* chore: bump node in DEPS to v18.13.0

* child_process: validate arguments for null bytes

https://github.com/nodejs/node/pull/44782

* bootstrap: merge main thread and worker thread initializations

https://github.com/nodejs/node/pull/44869

* module: ensure relative requires work from deleted directories

https://github.com/nodejs/node/pull/42384

* src: add support for externally shared js builtins

https://github.com/nodejs/node/issues/44000

* lib: disambiguate `native module` to `binding`

https://github.com/nodejs/node/pull/45673

* test: convert test-debugger-pid to async/await

https://github.com/nodejs/node/pull/45179

* deps: upgrade to libuv 1.44.2

https://github.com/nodejs/node/pull/42340

* src: fix cppgc incompatibility in v8

https://github.com/nodejs/node/pull/43521

* src: use qualified `std::move` call in node_http2

https://github.com/nodejs/node/pull/45555

* build: fix env.h for cpp20

https://github.com/nodejs/node/pull/45516

* test: remove experimental-wasm-threads flag

https://github.com/nodejs/node/pull/45074

* src: iwyu in cleanup_queue.cc

https://github.com/nodejs/node/pull/44983

* src: add missing include for `std::all_of`

https://github.com/nodejs/node/pull/45541

* deps: update ICU to 72.1

https://github.com/nodejs/node/pull/45068

* chore: fixup patch indices

* chore: remove errant semicolons

- https://github.com/nodejs/node/pull/44179
- https://github.com/nodejs/node/pull/44193

* src: add support for externally shared js builtins

https://github.com/nodejs/node/pull/44376

* chore: add missing GN filenames

* deps: update nghttp2 to 1.51.0

https://github.com/nodejs/node/pull/45537

* chore: disable more Node.js snapshot tests

The Snapshot feature is currently disabled

* chore: disable ICU timezone tests

Node.js uses a different version of ICU than Electron so they
will often be out of sync.

* chore: disable threadpool event tracing test

Event tracing is not enabled in embedded Node.js

* chore: fixup patch indices

* chore: comments from review

Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2023-01-11 11:33:48 +01:00

61 lines
2.8 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Shelley Vohr <shelley.vohr@gmail.com>
Date: Sun, 23 Oct 2022 23:36:19 +0200
Subject: fix: prevent changing FunctionTemplateInfo after publish
Refs https://chromium-review.googlesource.com/c/v8/v8/+/2718147
Fixes an issue where Node.js would try to call SetClassName on a
FunctionTemplate twice in some cases. The above CL made it so that
V8 CHECKs when this occurs. It is fixed by ensuring SetClassName
is only called once.
This should be upstreamed.
diff --git a/src/histogram.cc b/src/histogram.cc
index 3a3228ddc9eb6b53efc0721466479a9f62cd8967..175a67840348ca507d6e8b29835e5ab3b6d3e71a 100644
--- a/src/histogram.cc
+++ b/src/histogram.cc
@@ -340,8 +340,9 @@ void HistogramBase::RegisterExternalReferences(
}
void HistogramBase::Initialize(Environment* env, Local<Object> target) {
- SetConstructorFunction(
- env->context(), target, "Histogram", GetConstructorTemplate(env));
+ SetConstructorFunction(env->context(), target, "Histogram",
+ GetConstructorTemplate(env),
+ SetConstructorFunctionFlag::NONE);
}
BaseObjectPtr<BaseObject> HistogramBase::HistogramTransferData::Deserialize(
@@ -367,6 +368,7 @@ Local<FunctionTemplate> IntervalHistogram::GetConstructorTemplate(
Isolate* isolate = env->isolate();
tmpl = NewFunctionTemplate(isolate, nullptr);
tmpl->Inherit(HandleWrap::GetConstructorTemplate(env));
+ tmpl->SetClassName(OneByteString(isolate, "Histogram"));
tmpl->InstanceTemplate()->SetInternalFieldCount(
HistogramBase::kInternalFieldCount);
SetProtoMethodNoSideEffect(isolate, tmpl, "count", GetCount);
diff --git a/src/node_messaging.cc b/src/node_messaging.cc
index 009ac0056c5486a3f94889f70b592e26827d86a0..ba497064de834c4ea565bb267d1e95e4647b79eb 100644
--- a/src/node_messaging.cc
+++ b/src/node_messaging.cc
@@ -1495,13 +1495,16 @@ static void InitMessaging(Local<Object> target,
t->Inherit(BaseObject::GetConstructorTemplate(env));
t->InstanceTemplate()->SetInternalFieldCount(
JSTransferable::kInternalFieldCount);
- SetConstructorFunction(context, target, "JSTransferable", t);
+ t->SetClassName(OneByteString(isolate, "JSTransferable"));
+ SetConstructorFunction(context, target, "JSTransferable", t,
+ SetConstructorFunctionFlag::NONE);
}
SetConstructorFunction(context,
target,
env->message_port_constructor_string(),
- GetMessagePortConstructorTemplate(env));
+ GetMessagePortConstructorTemplate(env),
+ SetConstructorFunctionFlag::NONE);
// These are not methods on the MessagePort prototype, because
// the browser equivalents do not provide them.