mirror of
https://github.com/zebrajr/node.git
synced 2025-12-06 00:20:08 +01:00
src: prevent changing FunctionTemplateInfo after publish
Refs https://chromium-review.googlesource.com/c/v8/v8/+/2718147 Fixes an issue where Node.js tries 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. PR-URL: https://github.com/nodejs/node/pull/46979 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Juan José Arboleda <soyjuanarbol@gmail.com> Reviewed-By: Minwoo Jung <nodecorelab@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
This commit is contained in:
parent
a437bb9e6d
commit
146b613941
|
|
@ -345,7 +345,8 @@ void HistogramBase::Initialize(IsolateData* isolate_data,
|
|||
SetConstructorFunction(isolate_data->isolate(),
|
||||
target,
|
||||
"Histogram",
|
||||
GetConstructorTemplate(isolate_data));
|
||||
GetConstructorTemplate(isolate_data),
|
||||
SetConstructorFunctionFlag::NONE);
|
||||
}
|
||||
|
||||
BaseObjectPtr<BaseObject> HistogramBase::HistogramTransferData::Deserialize(
|
||||
|
|
@ -371,6 +372,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);
|
||||
|
|
|
|||
|
|
@ -1496,13 +1496,16 @@ static void InitMessaging(Local<Object> target,
|
|||
NewFunctionTemplate(isolate, JSTransferable::New);
|
||||
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.
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user