Andrew Top | ef837fa | 2017-10-04 22:44:25 -0700 | [diff] [blame] | 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 | |
| 6 | function get() { |
| 7 | return 3; // Break |
| 8 | } // Break |
| 9 | |
| 10 | function set(x) { |
| 11 | this.x = x; // Break |
| 12 | } // Break |
| 13 | |
| 14 | var o = {}; |
| 15 | Object.defineProperty(o, "get", { get : get }); |
| 16 | Object.defineProperty(o, "set", { set : set }); |
| 17 | |
| 18 | function f() { |
| 19 | for (var i = 0; i < 10; i++) { // Break |
| 20 | o.get; // Break |
| 21 | o.set = 1; // Break |
| 22 | } |
| 23 | } // Break |
| 24 | |
| 25 | var break_count = 0; |
| 26 | var exception = null; |
| 27 | |
| 28 | function listener(event, exec_state, event_data, data) { |
| 29 | if (event != Debug.DebugEvent.Break) return; |
| 30 | try { |
| 31 | var source_line = exec_state.frame(0).sourceLineText(); |
| 32 | assertTrue(source_line.indexOf("// Break") > 0); |
| 33 | exec_state.prepareStep(Debug.StepAction.StepIn); |
| 34 | break_count++; |
| 35 | } catch (e) { |
| 36 | exception = e; |
| 37 | } |
| 38 | } |
| 39 | |
| 40 | var Debug = debug.Debug; |
| 41 | Debug.setListener(listener); |
| 42 | |
| 43 | debugger; // Break |
| 44 | f(); // Break |
| 45 | |
| 46 | Debug.setListener(null); // Break |
| 47 | assertEquals(86, break_count); |
| 48 | assertNull(exception); |