Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

list breakpoints on connect

  • Loading branch information...
commit 290caa225a73ec9a1a23038509b76cc9a9b65ba8 1 parent dcd344f
@dannycoates dannycoates authored
Showing with 29 additions and 10 deletions.
  1. +28 −8 lib/session.js
  2. +1 −2  test/hello.js
View
36 lib/session.js
@@ -117,7 +117,7 @@ exports.createSession = function (conn) {
function parsedScripts(msg) {
msg.body.forEach(function(s) {
- sourceIDs[s.id] = true;
+ sourceIDs[s.id] = { url: s.name };
var data = {
sourceID: s.id.toString(),
url: s.name,
@@ -250,7 +250,24 @@ exports.createSession = function (conn) {
sendEvent('showPanel', { name: 'scripts' });
sendEvent('debuggerWasEnabled');
var args = { arguments: { includeSource: true, types: 4 }};
- debugRequest('scripts', args, parsedScripts);
+ debugRequest('scripts', args, function(msg) {
+ parsedScripts(msg);
+ debugRequest('listbreakpoints', {},
+ function(msg) {
+ msg.body.breakpoints.forEach(function(bp) {
+ if (bp.type === 'scriptId') {
+ var data = {
+ sourceID: bp.script_id,
+ url: sourceIDs[bp.script_id].url,
+ line: bp.line + 1,
+ enabled: bp.active,
+ condition: bp.condition
+ };
+ sendEvent('restoredBreakpoint', data);
+ }
+ });
+ });
+ });
}
},
getSettings: {
@@ -396,10 +413,10 @@ exports.createSession = function (conn) {
value: function(sourceID, lineNumber, enabled, condition, seq) {
var bp = breakpoints[sourceID + ':' + lineNumber];
var handleResponse = function(msg) {
- if (msg.arguments) {
- var a = msg.arguments;
- breakpoints[a.target + ':' + (a.line + 1)] = msg.body.breakpoint;
- var data = { success: true, actualLineNumber: a.line + 1 };
+ if (msg.success) {
+ var b = msg.body;
+ breakpoints[b.script_id + ':' + (b.line + 1)] = b.breakpoint;
+ var data = { success: true, actualLineNumber: b.line + 1 };
sendResponse(seq, true, data);
}
};
@@ -409,8 +426,11 @@ exports.createSession = function (conn) {
arguments: {
breakpoint: bp,
enabled: enabled,
- condition: condition,
- id: sourceID + ':' + lineNumber}}, handleResponse);
+ condition: condition
+ }}, function(msg) {
+ var data = { success: true, actualLineNumber: lineNumber };
+ sendResponse(seq, true, data);
+ });
}
else {
debugRequest('setbreakpoint',{
View
3  test/hello.js
@@ -1,5 +1,4 @@
-var http = require('http'),
- sys = require('sys');
+var http = require('http');
var x = 0;
http.createServer(function (req, res) {
Please sign in to comment.
Something went wrong with that request. Please try again.