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 | 9 |
11 var f = () => { debugger; } | 10 var f = () => { debugger; } |
12 var g = function() { debugger; } | 11 var g = function() { debugger; } |
13 var h = (function() { return () => { debugger; }; }).call({}); | 12 var h = (function() { return () => { debugger; }; }).call({}); |
14 | 13 |
15 function listener(event, exec_state, event_data, data) { | 14 function listener(event, exec_state, event_data, data) { |
16 if (event != Debug.DebugEvent.Break) return; | 15 if (event != Debug.DebugEvent.Break) return; |
17 try { | 16 try { |
18 assertThrows(() => exec_state.frame(0).evaluate("this = 2")); | 17 assertThrows(() => exec_state.frame(0).evaluate("this = 2")); |
19 } catch (e) { | 18 } catch (e) { |
20 exception = e; | 19 exception = e; |
21 print("Caught something. " + e + " " + e.stack); | 20 print("Caught something. " + e + " " + e.stack); |
22 }; | 21 }; |
23 }; | 22 }; |
24 | 23 |
25 Debug.setListener(listener); | 24 Debug.setListener(listener); |
26 | 25 |
27 f(); | 26 f(); |
28 g(); | 27 g(); |
29 g.call({}); | 28 g.call({}); |
30 h(); | 29 h(); |
31 | 30 |
32 Debug.setListener(null); | 31 Debug.setListener(null); |
33 assertNull(exception); | 32 assertNull(exception); |
OLD | NEW |