From 2d503b1d4b322383d633ee59205568e68d55b790 Mon Sep 17 00:00:00 2001 From: cjihrig Date: Thu, 28 Apr 2016 12:26:29 -0400 Subject: [PATCH] debugger: display array contents in repl This commit allows all array properties to be printed except for "length". Previously, this filter was applied by checking the type of each property. However, something changed in V8, and array elements started coming through as numeric strings, which stopped them from being displayed. Fixes: https://github.com/nodejs/node/issues/6444 PR-URL: https://github.com/nodejs/node/pull/6448 Reviewed-By: Anna Henningsen Reviewed-By: James M Snell Reviewed-By: Fedor Indutny --- lib/_debugger.js | 4 ++-- test/debugger/test-debugger-repl.js | 4 ++++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/_debugger.js b/lib/_debugger.js index 7b3abec27da277..e872d77ea55962 100644 --- a/lib/_debugger.js +++ b/lib/_debugger.js @@ -548,8 +548,8 @@ Client.prototype.mirrorObject = function(handle, depth, cb) { mirrorValue = '[?]'; } - if (Array.isArray(mirror) && typeof prop.name !== 'number') { - // Skip the 'length' property. + // Skip the 'length' property. + if (Array.isArray(mirror) && prop.name === 'length') { return; } diff --git a/test/debugger/test-debugger-repl.js b/test/debugger/test-debugger-repl.js index 4919955273607a..8a87d40d163af7 100644 --- a/test/debugger/test-debugger-repl.js +++ b/test/debugger/test-debugger-repl.js @@ -75,3 +75,7 @@ addTest('for (var i in process.env) delete process.env[i]', []); addTest('process.env', [ /\{\}/ ]); + +addTest('arr = [{foo: "bar"}]', [ + /\[ \{ foo: 'bar' \} \]/ +]);