Skip to content

Commit

Permalink
continueToLocation
Browse files Browse the repository at this point in the history
  • Loading branch information
dannycoates committed Jan 29, 2012
1 parent 7149245 commit 71839af
Showing 1 changed file with 48 additions and 7 deletions.
55 changes: 48 additions & 7 deletions lib/session2.js
Expand Up @@ -20,6 +20,7 @@ function Session(debugPort) {
this.browser = nilBrowser
this.debugPort = debugPort
this.breakpointsActive = true
this.tempBreakpointId = 0
}
inherits(Session, EventEmitter)

Expand Down Expand Up @@ -47,10 +48,46 @@ Session.prototype.setScriptSource = function (sourceID, newContent, preview, seq
}

Session.prototype.setPauseOnExceptions = function (state, seq) {
//TODO not fully working
switch (state) {
case 'all':
this.client.setExceptionBreak('all', true, function (err, body) {
console.log(body)
})
break;
case 'uncaught':
this.client.setExceptionBreak('uncaught', true, function (err, body) {
console.log(body)
})
break;
case 'none':
this.client.setExceptionBreak('all', false, function (err, body) {
console.log(body)
})
break;
}
this.browser.sendResponse(seq, true)
}

Session.prototype.continueToLocation = function (location, id) {}
Session.prototype.continueToLocation = function (location, seq) {
var self = this
if (this.tempBreakpointId !== 0) {
this.client.clearBreakpoint(this.tempBreakpointId, nop)
}
this.client.setBreakpoint(
location.scriptId,
location.lineNumber,
location.columnNumber,
true,
null,
function (err, body) {
if (!err) {
self.tempBreakpointId = body.breakpoint
}
self.resume()
}
)
}

Session.prototype.stepOut = function () {
this.client.resume('out', 1, nop)
Expand Down Expand Up @@ -136,10 +173,6 @@ Session.prototype.getInspectorState = function (seq) {
})
}

Session.prototype.populateScriptObjects = function (seq) {
this.browser.sendResponse(seq, true)
}

Session.prototype.disableDebugger = nop

Session.prototype.callFunctionOn = function (
Expand Down Expand Up @@ -309,8 +342,6 @@ Session.prototype.getBacktraceFlow = function () {
})
}

Session.prototype.evaluateFlow = nop

Session.prototype.browserConnectedFlow = function () {
var self = this
async.waterfall(
Expand Down Expand Up @@ -367,6 +398,16 @@ Session.prototype.parsedScriptsFlow = function (body) {

Session.prototype.breakEventFlow = function (msg) {
if (this.breakpointsActive) {
var breakpoints = msg.body.breakpoints || []
if (breakpoints.indexOf(this.tempBreakpointId) > -1) {
var self = this
this.client.clearBreakpoint(
this.tempBreakpointId,
function (err, body) {
self.tempBreakpointId = 0
}
)
}
this.getBacktraceFlow()
}
else {
Expand Down

0 comments on commit 71839af

Please sign in to comment.