From 6d5c3cd7ac4a81d452e3455e362e7cb40ba2fd84 Mon Sep 17 00:00:00 2001 From: Anna Henningsen Date: Wed, 29 Jan 2020 17:42:26 +0000 Subject: [PATCH] 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 Reviewed-By: Gus Caplan Reviewed-By: Richard Lau Reviewed-By: David Carlier Reviewed-By: James M Snell Reviewed-By: Rich Trott --- src/heap_utils.cc | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/src/heap_utils.cc b/src/heap_utils.cc index b996f78aa4199b..b6c8c75c159846 100644 --- a/src/heap_utils.cc +++ b/src/heap_utils.cc @@ -385,15 +385,9 @@ void Initialize(Local 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 os = FunctionTemplate::New(env->isolate());