OLD | NEW |
(Empty) | |
| 1 // Copyright 2015 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 f(x) { |
| 8 // This function compiles into code that only throws a redeclaration |
| 9 // error. It contains no stack check and has no function body. |
| 10 const x = 0; |
| 11 return x; |
| 12 } |
| 13 |
| 14 function g() { |
| 15 f(0); |
| 16 } |
| 17 |
| 18 var exception = null; |
| 19 var called = false; |
| 20 var Debug = debug.Debug; |
| 21 Debug.setBreakOnException(); |
| 22 |
| 23 function listener(event, exec_state, event_data, data) { |
| 24 if (event != Debug.DebugEvent.Exception) return; |
| 25 try { |
| 26 called = true; |
| 27 Debug.setBreakPoint(f, 1); |
| 28 } catch (e) { |
| 29 exception = e; |
| 30 } |
| 31 } |
| 32 |
| 33 Debug.setListener(listener); |
| 34 |
| 35 assertThrows(g); |
| 36 assertNull(exception); |
| 37 assertTrue(called); |
OLD | NEW |