Skip to content

Commit

Permalink
debugger: Correctly eval arrays and numbers
Browse files Browse the repository at this point in the history
  • Loading branch information
ry committed Jan 13, 2011
1 parent 533797a commit 0fa3f2f
Showing 1 changed file with 18 additions and 4 deletions.
22 changes: 18 additions & 4 deletions lib/_debugger.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 0fa3f2f

Please sign in to comment.