| 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 exception thrown in a Promise. | 7 // there is a catch handler for the exception thrown in a 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 expected_events = 1; | 12 var expected_events = 1; |
| 14 var log = []; | 13 var log = []; |
| 15 | 14 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 28 function(e) { | 27 function(e) { |
| 29 assertEquals("caught", e.message); | 28 assertEquals("caught", e.message); |
| 30 }); | 29 }); |
| 31 | 30 |
| 32 function listener(event, exec_state, event_data, data) { | 31 function listener(event, exec_state, event_data, data) { |
| 33 try { | 32 try { |
| 34 if (event == Debug.DebugEvent.Exception) { | 33 if (event == Debug.DebugEvent.Exception) { |
| 35 expected_events--; | 34 expected_events--; |
| 36 assertTrue(expected_events >= 0); | 35 assertTrue(expected_events >= 0); |
| 37 assertEquals("caught", event_data.exception().message); | 36 assertEquals("caught", event_data.exception().message); |
| 38 assertSame(q, event_data.promise()); | |
| 39 assertFalse(event_data.uncaught()); | 37 assertFalse(event_data.uncaught()); |
| 40 } | 38 } |
| 41 } catch (e) { | 39 } catch (e) { |
| 42 %AbortJS(e + "\n" + e.stack); | 40 %AbortJS(e + "\n" + e.stack); |
| 43 } | 41 } |
| 44 } | 42 } |
| 45 | 43 |
| 46 Debug.setBreakOnException(); | 44 Debug.setBreakOnException(); |
| 47 Debug.setListener(listener); | 45 Debug.setListener(listener); |
| 48 | 46 |
| (...skipping 10 matching lines...) Expand all Loading... |
| 59 } | 57 } |
| 60 } catch (e) { | 58 } catch (e) { |
| 61 %AbortJS(e + "\n" + e.stack); | 59 %AbortJS(e + "\n" + e.stack); |
| 62 } | 60 } |
| 63 } | 61 } |
| 64 | 62 |
| 65 %EnqueueMicrotask(checkResult); | 63 %EnqueueMicrotask(checkResult); |
| 66 } | 64 } |
| 67 | 65 |
| 68 testDone(0); | 66 testDone(0); |
| OLD | NEW |