OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 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 | 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 only listen to uncaught exceptions and | 6 // Test debug events when we only listen to uncaught exceptions and |
8 // there is a catch handler for the to-be-rejected Promise. | 7 // there is a catch handler for the to-be-rejected Promise. |
9 // We expect an Exception debug event with a promise to be triggered. | 8 // We expect an Exception debug event with a promise to be triggered. |
10 | 9 |
11 Debug = debug.Debug; | 10 Debug = debug.Debug; |
12 | 11 |
13 var expected_events = 1; | 12 var expected_events = 1; |
14 var log = []; | 13 var log = []; |
15 | 14 |
(...skipping 14 matching lines...) Expand all Loading... |
30 reject_closure(new Error("uncaught reject p")); // event | 29 reject_closure(new Error("uncaught reject p")); // event |
31 }) | 30 }) |
32 | 31 |
33 | 32 |
34 function listener(event, exec_state, event_data, data) { | 33 function listener(event, exec_state, event_data, data) { |
35 try { | 34 try { |
36 if (event == Debug.DebugEvent.Exception) { | 35 if (event == Debug.DebugEvent.Exception) { |
37 expected_events--; | 36 expected_events--; |
38 assertTrue(expected_events >= 0); | 37 assertTrue(expected_events >= 0); |
39 assertEquals("uncaught reject p", event_data.exception().message); | 38 assertEquals("uncaught reject p", event_data.exception().message); |
40 assertTrue(event_data.promise() instanceof Promise); | |
41 assertSame(p, event_data.promise()); | |
42 assertTrue(event_data.uncaught()); | 39 assertTrue(event_data.uncaught()); |
43 // Assert that the debug event is triggered at the throw site. | 40 // Assert that the debug event is triggered at the throw site. |
44 assertTrue(exec_state.frame(0).sourceLineText().indexOf("// event") > 0); | 41 assertTrue(exec_state.frame(0).sourceLineText().indexOf("// event") > 0); |
45 } | 42 } |
46 } catch (e) { | 43 } catch (e) { |
47 %AbortJS(e + "\n" + e.stack); | 44 %AbortJS(e + "\n" + e.stack); |
48 } | 45 } |
49 } | 46 } |
50 | 47 |
51 Debug.setBreakOnUncaughtException(); | 48 Debug.setBreakOnUncaughtException(); |
(...skipping 12 matching lines...) Expand all Loading... |
64 } | 61 } |
65 } catch (e) { | 62 } catch (e) { |
66 %AbortJS(e + "\n" + e.stack); | 63 %AbortJS(e + "\n" + e.stack); |
67 } | 64 } |
68 } | 65 } |
69 | 66 |
70 %EnqueueMicrotask(checkResult); | 67 %EnqueueMicrotask(checkResult); |
71 } | 68 } |
72 | 69 |
73 testDone(0); | 70 testDone(0); |
OLD | NEW |