| 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 listen to all exceptions and | 6 // Test debug events when we listen to all 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 a normal Exception debug event to be triggered. | 8 // We expect a normal Exception debug event to be triggered. |
| 10 | 9 |
| 11 Debug = debug.Debug; | 10 Debug = debug.Debug; |
| 12 | 11 |
| 13 var log = []; | 12 var log = []; |
| 14 var expected_events = 1; | 13 var expected_events = 1; |
| 15 | 14 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 29 assertEquals("reject", e.message); | 28 assertEquals("reject", e.message); |
| 30 }); | 29 }); |
| 31 | 30 |
| 32 | 31 |
| 33 function listener(event, exec_state, event_data, data) { | 32 function listener(event, exec_state, event_data, data) { |
| 34 try { | 33 try { |
| 35 if (event == Debug.DebugEvent.Exception) { | 34 if (event == Debug.DebugEvent.Exception) { |
| 36 expected_events--; | 35 expected_events--; |
| 37 assertTrue(expected_events >= 0); | 36 assertTrue(expected_events >= 0); |
| 38 assertEquals("reject", event_data.exception().message); | 37 assertEquals("reject", event_data.exception().message); |
| 39 assertSame(q, event_data.promise()); | |
| 40 assertFalse(event_data.uncaught()); | 38 assertFalse(event_data.uncaught()); |
| 41 } | 39 } |
| 42 } catch (e) { | 40 } catch (e) { |
| 43 %AbortJS(e + "\n" + e.stack); | 41 %AbortJS(e + "\n" + e.stack); |
| 44 } | 42 } |
| 45 } | 43 } |
| 46 | 44 |
| 47 Debug.setBreakOnException(); | 45 Debug.setBreakOnException(); |
| 48 Debug.setListener(listener); | 46 Debug.setListener(listener); |
| 49 | 47 |
| (...skipping 10 matching lines...) Expand all Loading... |
| 60 } | 58 } |
| 61 } catch (e) { | 59 } catch (e) { |
| 62 %AbortJS(e + "\n" + e.stack); | 60 %AbortJS(e + "\n" + e.stack); |
| 63 } | 61 } |
| 64 } | 62 } |
| 65 | 63 |
| 66 %EnqueueMicrotask(checkResult); | 64 %EnqueueMicrotask(checkResult); |
| 67 } | 65 } |
| 68 | 66 |
| 69 testDone(0); | 67 testDone(0); |
| OLD | NEW |