| OLD | NEW |
| 1 // Copyright 2016 the V8 project authors. All rights reserved. | 1 // Copyright 2016 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 Debug = debug.Debug | 6 Debug = debug.Debug |
| 8 | 7 |
| 9 var exception = null; | 8 var exception = null; |
| 10 var log = []; | 9 var log = []; |
| 11 | 10 |
| 12 function listener(event, exec_state, event_data, data) { | 11 function listener(event, exec_state, event_data, data) { |
| 13 if (event != Debug.DebugEvent.Exception) return; | 12 if (event != Debug.DebugEvent.Exception) return; |
| 14 try { | 13 try { |
| 15 var line = exec_state.frame(0).sourceLineText(); | 14 var line = exec_state.frame(0).sourceLineText(); |
| (...skipping 24 matching lines...) Expand all Loading... |
| 40 var g_obj = g(); | 39 var g_obj = g(); |
| 41 assertEquals(1, g_obj.next().value); | 40 assertEquals(1, g_obj.next().value); |
| 42 assertEquals(2, g_obj.throw("b").value); | 41 assertEquals(2, g_obj.throw("b").value); |
| 43 assertEquals(3, g_obj.next().value); | 42 assertEquals(3, g_obj.next().value); |
| 44 assertThrows(() => g_obj.throw("c")); | 43 assertThrows(() => g_obj.throw("c")); |
| 45 assertThrows(() => g_obj.throw("d")); // Closed generator. Exception d | 44 assertThrows(() => g_obj.throw("d")); // Closed generator. Exception d |
| 46 Debug.setListener(null); | 45 Debug.setListener(null); |
| 47 Debug.clearBreakOnException(); | 46 Debug.clearBreakOnException(); |
| 48 assertEquals(["a", "b", "c", "d"], log); | 47 assertEquals(["a", "b", "c", "d"], log); |
| 49 assertNull(exception); | 48 assertNull(exception); |
| OLD | NEW |