Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit bf9a52c

Browse filesBrowse files
codebyteretargos
authored andcommitted
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: #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>
1 parent 9962459 commit bf9a52c
Copy full SHA for bf9a52c

File tree

Expand file treeCollapse file tree

2 files changed

+8
-3
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

2 files changed

+8
-3
lines changed
Open diff view settings
Collapse file

‎src/histogram.cc‎

Copy file name to clipboardExpand all lines: src/histogram.cc
+3-1Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -345,7 +345,8 @@ void HistogramBase::Initialize(IsolateData* isolate_data,
345345
SetConstructorFunction(isolate_data->isolate(),
346346
target,
347347
"Histogram",
348-
GetConstructorTemplate(isolate_data));
348+
GetConstructorTemplate(isolate_data),
349+
SetConstructorFunctionFlag::NONE);
349350
}
350351

351352
BaseObjectPtr<BaseObject> HistogramBase::HistogramTransferData::Deserialize(
@@ -371,6 +372,7 @@ Local<FunctionTemplate> IntervalHistogram::GetConstructorTemplate(
371372
Isolate* isolate = env->isolate();
372373
tmpl = NewFunctionTemplate(isolate, nullptr);
373374
tmpl->Inherit(HandleWrap::GetConstructorTemplate(env));
375+
tmpl->SetClassName(OneByteString(isolate, "Histogram"));
374376
tmpl->InstanceTemplate()->SetInternalFieldCount(
375377
HistogramBase::kInternalFieldCount);
376378
SetProtoMethodNoSideEffect(isolate, tmpl, "count", GetCount);
Collapse file

‎src/node_messaging.cc‎

Copy file name to clipboardExpand all lines: src/node_messaging.cc
+5-2Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1496,13 +1496,16 @@ static void InitMessaging(Local<Object> target,
14961496
NewFunctionTemplate(isolate, JSTransferable::New);
14971497
t->InstanceTemplate()->SetInternalFieldCount(
14981498
JSTransferable::kInternalFieldCount);
1499-
SetConstructorFunction(context, target, "JSTransferable", t);
1499+
t->SetClassName(OneByteString(isolate, "JSTransferable"));
1500+
SetConstructorFunction(
1501+
context, target, "JSTransferable", t, SetConstructorFunctionFlag::NONE);
15001502
}
15011503

15021504
SetConstructorFunction(context,
15031505
target,
15041506
env->message_port_constructor_string(),
1505-
GetMessagePortConstructorTemplate(env));
1507+
GetMessagePortConstructorTemplate(env),
1508+
SetConstructorFunctionFlag::NONE);
15061509

15071510
// These are not methods on the MessagePort prototype, because
15081511
// the browser equivalents do not provide them.

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.