| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 // Flags: --expose-debug-as debug | |
| 6 | 5 |
| 7 var o = { | 6 var o = { |
| 8 f: function(x) { | 7 f: function(x) { |
| 9 var a = x + 1; | 8 var a = x + 1; |
| 10 o = 1; | 9 o = 1; |
| 11 } | 10 } |
| 12 } | 11 } |
| 13 | 12 |
| 14 function sentinel() {} | 13 function sentinel() {} |
| 15 | 14 |
| 16 var Debug = debug.Debug; | 15 var Debug = debug.Debug; |
| 17 | 16 |
| 18 Debug.setListener(function() {}); | 17 Debug.setListener(function() {}); |
| 19 | 18 |
| 20 var script = Debug.findScript(sentinel); | 19 var script = Debug.findScript(sentinel); |
| 21 | 20 |
| 22 // Used in Debug.setScriptBreakPointById. | 21 // Used in Debug.setScriptBreakPointById. |
| 23 var p = Debug.findScriptSourcePosition(script, 9, 0); | 22 var p = Debug.findScriptSourcePosition(script, 8, 0); |
| 24 var q = Debug.setBreakPointByScriptIdAndPosition(script.id, p).actual_position; | 23 var q = Debug.setBreakPointByScriptIdAndPosition(script.id, p).actual_position; |
| 25 var r = Debug.setBreakPointByScriptIdAndPosition(script.id, q).actual_position; | |
| 26 | |
| 27 assertEquals(q, r); | |
| 28 | 24 |
| 29 function assertLocation(p, l, c) { | 25 function assertLocation(p, l, c) { |
| 30 var location = script.locationFromPosition(p, false); | 26 var location = script.locationFromPosition(p, false); |
| 31 assertEquals(l, location.line); | 27 assertEquals(l, location.line); |
| 32 assertEquals(c, location.column); | 28 assertEquals(c, location.column); |
| 33 } | 29 } |
| 34 | 30 |
| 35 assertLocation(p, 9, 0); | 31 assertLocation(p, 8, 0); |
| 36 assertLocation(q, 9, 4); | 32 assertLocation(q, 8, 4); |
| 37 assertLocation(r, 9, 4); | |
| OLD | NEW |