Skip to content
This repository
Browse code

continueToLocation

  • Loading branch information...
commit 71839af61cff1d8e15a8ccdf78f74b800600a927 1 parent 7149245
Danny Coates authored

Showing 1 changed file with 48 additions and 7 deletions. Show diff stats Hide diff stats

  1. 55  lib/session2.js
55  lib/session2.js
@@ -20,6 +20,7 @@ function Session(debugPort) {
20 20
 	this.browser = nilBrowser
21 21
 	this.debugPort = debugPort
22 22
 	this.breakpointsActive = true
  23
+	this.tempBreakpointId = 0
23 24
 }
24 25
 inherits(Session, EventEmitter)
25 26
 
@@ -47,10 +48,46 @@ Session.prototype.setScriptSource = function (sourceID, newContent, preview, seq
47 48
 }
48 49
 
49 50
 Session.prototype.setPauseOnExceptions = function (state, seq) {
  51
+	//TODO not fully working
  52
+	switch (state) {
  53
+	case 'all':
  54
+		this.client.setExceptionBreak('all', true, function (err, body) {
  55
+			console.log(body)
  56
+		})
  57
+		break;
  58
+	case 'uncaught':
  59
+		this.client.setExceptionBreak('uncaught', true, function (err, body) {
  60
+			console.log(body)
  61
+		})
  62
+		break;
  63
+	case 'none':
  64
+		this.client.setExceptionBreak('all', false, function (err, body) {
  65
+			console.log(body)
  66
+		})
  67
+		break;
  68
+	}
50 69
 	this.browser.sendResponse(seq, true)
51 70
 }
52 71
 
53  
-Session.prototype.continueToLocation = function (location, id) {}
  72
+Session.prototype.continueToLocation = function (location, seq) {
  73
+	var self = this
  74
+	if (this.tempBreakpointId !== 0) {
  75
+		this.client.clearBreakpoint(this.tempBreakpointId, nop)
  76
+	}
  77
+	this.client.setBreakpoint(
  78
+		location.scriptId,
  79
+		location.lineNumber,
  80
+		location.columnNumber,
  81
+		true,
  82
+		null,
  83
+		function (err, body) {
  84
+			if (!err) {
  85
+				self.tempBreakpointId = body.breakpoint
  86
+			}
  87
+			self.resume()
  88
+		}
  89
+	)
  90
+}
54 91
 
55 92
 Session.prototype.stepOut = function () {
56 93
 	this.client.resume('out', 1, nop)
@@ -136,10 +173,6 @@ Session.prototype.getInspectorState = function (seq) {
136 173
 	})
137 174
 }
138 175
 
139  
-Session.prototype.populateScriptObjects = function (seq) {
140  
-	this.browser.sendResponse(seq, true)
141  
-}
142  
-
143 176
 Session.prototype.disableDebugger = nop
144 177
 
145 178
 Session.prototype.callFunctionOn = function (
@@ -309,8 +342,6 @@ Session.prototype.getBacktraceFlow = function () {
309 342
 	})
310 343
 }
311 344
 
312  
-Session.prototype.evaluateFlow = nop
313  
-
314 345
 Session.prototype.browserConnectedFlow = function () {
315 346
 	var self = this
316 347
 	async.waterfall(
@@ -367,6 +398,16 @@ Session.prototype.parsedScriptsFlow = function (body) {
367 398
 
368 399
 Session.prototype.breakEventFlow = function (msg) {
369 400
 	if (this.breakpointsActive) {
  401
+		var breakpoints = msg.body.breakpoints || []
  402
+		if (breakpoints.indexOf(this.tempBreakpointId) > -1) {
  403
+			var self = this
  404
+			this.client.clearBreakpoint(
  405
+				this.tempBreakpointId,
  406
+				function (err, body) {
  407
+					self.tempBreakpointId = 0
  408
+				}
  409
+			)
  410
+		}
370 411
 		this.getBacktraceFlow()
371 412
 	}
372 413
 	else {

0 notes on commit 71839af

Please sign in to comment.
Something went wrong with that request. Please try again.