Browse Source

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 <anna@addaleax.net>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Fedor Indutny <fedor.indutny@gmail.com>
process-exit-stdio-flushing
cjihrig 9 years ago
parent
commit
d2eb935177
  1. 4
      lib/_debugger.js
  2. 4
      test/debugger/test-debugger-repl.js

4
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;
}

4
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' \} \]/
]);

Loading…
Cancel
Save