OLD | NEW |
(Empty) | |
| 1 // Copyright 2014 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 // Flags: --expose-debug-as debug |
| 6 |
| 7 function get() { |
| 8 return 3; // Break |
| 9 } // Break |
| 10 |
| 11 function set(x) { |
| 12 this.x = x; // Break |
| 13 } // Break |
| 14 |
| 15 var o = {}; |
| 16 Object.defineProperty(o, "get", { get : get }); |
| 17 Object.defineProperty(o, "set", { set : set }); |
| 18 |
| 19 function f() { |
| 20 for (var i = 0; i < 10; i++) { // Break |
| 21 o.get; // Break |
| 22 o.set = 1; // Break |
| 23 } |
| 24 } // Break |
| 25 |
| 26 var break_count = 0; |
| 27 var exception = null; |
| 28 |
| 29 function listener(event, exec_state, event_data, data) { |
| 30 if (event != Debug.DebugEvent.Break) return; |
| 31 try { |
| 32 var source_line = exec_state.frame(0).sourceLineText(); |
| 33 assertTrue(source_line.indexOf("// Break") > 0); |
| 34 exec_state.prepareStep(Debug.StepAction.StepIn, 1); |
| 35 break_count++; |
| 36 } catch (e) { |
| 37 exception = e; |
| 38 } |
| 39 } |
| 40 |
| 41 var Debug = debug.Debug; |
| 42 Debug.setListener(listener); |
| 43 |
| 44 debugger; // Break |
| 45 f(); // Break |
| 46 |
| 47 Debug.setListener(null); // Break |
| 48 assertEquals(86, break_count); |
| 49 assertNull(exception); |
OLD | NEW |