Permalink
Browse files

debugger: Correctly eval arrays and numbers

  • Loading branch information...
1 parent 533797a commit 0fa3f2febdadb09d5cd0152b55c1c7b4f6a183fa @ry ry committed Jan 13, 2011
Showing with 18 additions and 4 deletions.
  1. +18 −4 lib/_debugger.js
View
@@ -406,18 +406,32 @@ Client.prototype.mirrorObject = function(handle, cb) {
return;
}
- var mirror = {};
+ var mirror;
+ if (handle.className == 'Array') {
+ mirror = [];
+ } else {
+ mirror = {};
+ }
+
for (var i = 0; i < handle.properties.length; i++) {
var value = res.body[handle.properties[i].ref];
- mirror[handle.properties[i].name] = value.text;
+ var mirrorValue = value.value ? value.value : value.text;
+
+ if (Array.isArray(mirror) &&
+ typeof handle.properties[i].name != 'number') {
+ // Skip the 'length' property.
+ continue;
+ }
+
+ mirror[handle.properties[i].name] = mirrorValue;
}
if (cb) cb(mirror);
});
- } else if (handle.type == 'string') {
+ } else if (handle.value) {
process.nextTick(function() {
- cb(handle.text);
+ cb(handle.value);
});
} else {

0 comments on commit 0fa3f2f

Please sign in to comment.