Skip to content

Commit

Permalink
added max properties limit to show
Browse files Browse the repository at this point in the history
  • Loading branch information
dannycoates committed Oct 29, 2010
1 parent 0fc0580 commit 9e4a0b4
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 12 deletions.
2 changes: 1 addition & 1 deletion bin/inspector.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,4 @@ ds.on('close', function () {
console.log('session closed');
process.exit();
});
console.log('visit http://127.0.0.1:' + ds.webPort + ' to start debugging');
console.log('visit http://127.0.0.1:' + ds.webPort + '/debug?port=5858 to start debugging');
31 changes: 20 additions & 11 deletions lib/session.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,12 @@ var http = require('http'),

exports.createSession = function (conn, debuggerPort) {
var debug = null,
//map from sourceID:lineNumber to breakpointID
//map from sourceID:lineNumber to breakpoint
breakpoints = {},
//map from sourceID to filename
sourceIDs = {};
sourceIDs = {},
//limit on the number of properties able to show
MAX_PROPERTIES = 256;

function wrapperObject(type, description, hasChildren, frame, scope, ref) {
return {
Expand Down Expand Up @@ -271,7 +273,7 @@ exports.createSession = function (conn, debuggerPort) {
var objProps = obj.properties;
var proto = obj.protoObject;
//Lame guard against objects that are too big to show
if (msg.refs.length > 256 || objProps.length > 256) {
if (msg.refs.length > MAX_PROPERTIES || objProps.length > MAX_PROPERTIES) {
props.push({name: 'sorry', value: wrapperObject('string', 'object too big to show', false, 0,0,0)});
}
else {
Expand All @@ -297,17 +299,24 @@ exports.createSession = function (conn, debuggerPort) {

}
else if (methodName === 'getCompletions') {
evaluate(args[0], args[2], function(msg) {
var data = {
var expr = args[0];
var data = {
result: {},
isException: false
};
if(msg.success && msg.body.properties) {
var result = {};
msg.body.properties.forEach(function(p) {
result[p.name] = true;
});
data.result = result;
// expr looks to be empty "" a lot so skip evaluate
if (expr === '') {
sendResponse(seq, true, data);
return;
}
evaluate(expr, args[2], function(msg) {
if(msg.success &&
msg.body.properties &&
msg.body.properties.length < MAX_PROPERTIES) {

msg.body.properties.forEach(function(p) {
data.result[p.name] = true;
});
}
sendResponse(seq, true, data);
});
Expand Down

0 comments on commit 9e4a0b4

Please sign in to comment.