summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorRuben Bridgewater <ruben@bridgewater.de>2019-09-21 21:26:02 +0200
committerRich Trott <rtrott@gmail.com>2019-09-23 23:42:10 -0700
commit1fa403762c035dca35bae9a18a4e4c3edf9d55f3 (patch)
tree413ff024a2271a0edf09414fb990df8ee85c3b8d /test
parent0c32ca96c878488c923022a8828bef541e0df9ae (diff)
downloadandroid-node-v8-1fa403762c035dca35bae9a18a4e4c3edf9d55f3.tar.gz
android-node-v8-1fa403762c035dca35bae9a18a4e4c3edf9d55f3.tar.bz2
android-node-v8-1fa403762c035dca35bae9a18a4e4c3edf9d55f3.zip
console,util: fix missing recursion end while inspecting prototypes
This makes sure prototypes won't be inspected infinitely for some obscure object creations. The depth is now taken into account and the recursion ends when the depth limit is reached. PR-URL: https://github.com/nodejs/node/pull/29647 Fixes: https://github.com/nodejs/node/issues/29646 Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com> Reviewed-By: Minwoo Jung <minwoo@nodesource.com>
Diffstat (limited to 'test')
-rw-r--r--test/parallel/test-util-inspect.js15
1 files changed, 15 insertions, 0 deletions
diff --git a/test/parallel/test-util-inspect.js b/test/parallel/test-util-inspect.js
index 64682d9c17..fc0bb345da 100644
--- a/test/parallel/test-util-inspect.js
+++ b/test/parallel/test-util-inspect.js
@@ -2114,6 +2114,21 @@ assert.strictEqual(
inspect(obj),
"Array <[Object: null prototype] {}> { '0': 1, '1': 2, '2': 3 }"
);
+
+ StorageObject.prototype = Object.create(null);
+ Object.setPrototypeOf(StorageObject.prototype, Object.create(null));
+ Object.setPrototypeOf(
+ Object.getPrototypeOf(StorageObject.prototype),
+ Object.create(null)
+ );
+ assert.strictEqual(
+ util.inspect(new StorageObject()),
+ 'StorageObject <Object <Object <[Object: null prototype] {}>>> {}'
+ );
+ assert.strictEqual(
+ util.inspect(new StorageObject(), { depth: 1 }),
+ 'StorageObject <Object <Object <Complex prototype>>> {}'
+ );
}
// Check that the fallback always works.