Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

debugger: display array contents in repl #6448

Merged
merged 1 commit into from
May 2, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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: #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 committed May 2, 2016
commit d2eb9351775ae706146693274cbbde3a7020e3fc
4 changes: 2 additions & 2 deletions lib/_debugger.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

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' \} \]/
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: while it's not likely to change, it might be worthwhile making the whitespace in the regex optional, just in case. Something like /\[\s*\{\s*foo\:\s*'bar'\s*\}\s*\]/

]);