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 --allow-natives-syntax | |
6 | 5 |
7 // Test debug events when we listen to all exceptions and | 6 // Test debug events when we listen to all exceptions and |
8 // there is a catch handler for the exception thrown in a Promise, first | 7 // there is a catch handler for the exception thrown in a Promise, first |
9 // caught by a try-finally, and immediately rethrown. | 8 // caught by a try-finally, and immediately rethrown. |
10 // We expect a normal Exception debug event to be triggered. | 9 // We expect a normal Exception debug event to be triggered. |
11 | 10 |
12 Debug = debug.Debug; | 11 Debug = debug.Debug; |
13 | 12 |
14 var expected_events = 1; | 13 var expected_events = 1; |
15 var log = []; | 14 var log = []; |
(...skipping 16 matching lines...) Expand all Loading... |
32 function(e) { | 31 function(e) { |
33 assertEquals("caught", e.message); | 32 assertEquals("caught", e.message); |
34 }); | 33 }); |
35 | 34 |
36 function listener(event, exec_state, event_data, data) { | 35 function listener(event, exec_state, event_data, data) { |
37 try { | 36 try { |
38 if (event == Debug.DebugEvent.Exception) { | 37 if (event == Debug.DebugEvent.Exception) { |
39 expected_events--; | 38 expected_events--; |
40 assertTrue(expected_events >= 0); | 39 assertTrue(expected_events >= 0); |
41 assertEquals("caught", event_data.exception().message); | 40 assertEquals("caught", event_data.exception().message); |
42 assertSame(q, event_data.promise()); | |
43 assertFalse(event_data.uncaught()); | 41 assertFalse(event_data.uncaught()); |
44 } | 42 } |
45 } catch (e) { | 43 } catch (e) { |
46 %AbortJS(e + "\n" + e.stack); | 44 %AbortJS(e + "\n" + e.stack); |
47 } | 45 } |
48 } | 46 } |
49 | 47 |
50 Debug.setBreakOnException(); | 48 Debug.setBreakOnException(); |
51 Debug.setListener(listener); | 49 Debug.setListener(listener); |
52 | 50 |
(...skipping 10 matching lines...) Expand all Loading... |
63 } | 61 } |
64 } catch (e) { | 62 } catch (e) { |
65 %AbortJS(e + "\n" + e.stack); | 63 %AbortJS(e + "\n" + e.stack); |
66 } | 64 } |
67 } | 65 } |
68 | 66 |
69 %EnqueueMicrotask(checkResult); | 67 %EnqueueMicrotask(checkResult); |
70 } | 68 } |
71 | 69 |
72 testDone(0); | 70 testDone(0); |
OLD | NEW |