src: remove preview for heap dump utilities

At least `createHeapSnapshotStream()` and `triggerHeapSnapshot()`
do have side effects, and more importantly, they should not be
run transparently. Without this, typing e.g. `v8.getHeapSnapshot()`
into the REPL will result in a crash or infinite loop while the REPL
evaluates the expression for a preview.

PR-URL: https://github.com/nodejs/node/pull/31570
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Gus Caplan <me@gus.host>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: David Carlier <devnexen@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
This commit is contained in:
Anna Henningsen
2020-01-29 17:42:26 +00:00
committed by Rich Trott
parent be6596352b
commit 023ecbccc8

View File

@@ -385,15 +385,9 @@ void Initialize(Local<Object> target,
void* priv) {
Environment* env = Environment::GetCurrent(context);
env->SetMethodNoSideEffect(target,
"buildEmbedderGraph",
BuildEmbedderGraph);
env->SetMethodNoSideEffect(target,
"triggerHeapSnapshot",
TriggerHeapSnapshot);
env->SetMethodNoSideEffect(target,
"createHeapSnapshotStream",
CreateHeapSnapshotStream);
env->SetMethod(target, "buildEmbedderGraph", BuildEmbedderGraph);
env->SetMethod(target, "triggerHeapSnapshot", TriggerHeapSnapshot);
env->SetMethod(target, "createHeapSnapshotStream", CreateHeapSnapshotStream);
// Create FunctionTemplate for HeapSnapshotStream
Local<FunctionTemplate> os = FunctionTemplate::New(env->isolate());