Skip to content

Commit

Permalink
debugger: display array contents in repl
Browse files Browse the repository at this point in the history
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: #6444
PR-URL: #6448
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Fedor Indutny <fedor.indutny@gmail.com>
  • Loading branch information
cjihrig authored and Myles Borins committed Jun 24, 2016
1 parent dd8d82a commit 57c719f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/_debugger.js
Original file line number Diff line number Diff line change
Expand Up @@ -547,8 +547,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;
}

Expand Down
4 changes: 4 additions & 0 deletions test/debugger/test-debugger-repl.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,3 +75,7 @@ addTest('for (var i in process.env) delete process.env[i]', []);
addTest('process.env', [
/\{\}/
]);

addTest('arr = [{foo: "bar"}]', [
/\[ \{ foo: 'bar' \} \]/
]);

0 comments on commit 57c719f

Please sign in to comment.