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: --allow-natives-syntax --harmony-async-await --expose-debug-as debug | 5 // Flags: --allow-natives-syntax --harmony-async-await --expose-debug-as debug |
6 | 6 |
7 Debug = debug.Debug | 7 Debug = debug.Debug |
8 | 8 |
9 var exception = null; | 9 var exception = null; |
10 var log; | 10 var log; |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 // Caught reject, events on uncaught exception. | 80 // Caught reject, events on uncaught exception. |
81 log = []; | 81 log = []; |
82 Debug.setListener(listener); | 82 Debug.setListener(listener); |
83 Debug.setBreakOnUncaughtException(); | 83 Debug.setBreakOnUncaughtException(); |
84 caught_reject(); | 84 caught_reject(); |
85 %RunMicrotasks(); | 85 %RunMicrotasks(); |
86 Debug.setListener(null); | 86 Debug.setListener(null); |
87 Debug.clearBreakOnUncaughtException(); | 87 Debug.clearBreakOnUncaughtException(); |
88 assertEquals([], log); | 88 assertEquals([], log); |
89 assertNull(exception); | 89 assertNull(exception); |
| 90 |
| 91 log = []; |
| 92 Debug.setListener(listener); |
| 93 Debug.setBreakOnException(); |
| 94 |
| 95 // "rethrown" uncaught exceptions in return don't cause another event |
| 96 async function propagate_inner() { return thrower(); } |
| 97 async function propagate_outer() { return propagate_inner(); } |
| 98 |
| 99 propagate_outer(); |
| 100 %RunMicrotasks(); |
| 101 assertEquals(["a"], log); |
| 102 assertNull(exception); |
| 103 |
| 104 // Also don't propagate if an await interceded |
| 105 log = []; |
| 106 async function propagate_await() { await 1; return thrower(); } |
| 107 async function propagate_await_outer() { return propagate_await(); } |
| 108 propagate_await_outer(); |
| 109 %RunMicrotasks(); |
| 110 assertEquals(["a"], log); |
| 111 assertNull(exception); |
| 112 |
| 113 Debug.clearBreakOnException(); |
| 114 Debug.setBreakOnUncaughtException(); |
| 115 |
| 116 log = []; |
| 117 Promise.resolve().then(() => Promise.reject()).catch(() => log.push("d")); // Ex
ception c |
| 118 %RunMicrotasks(); |
| 119 assertEquals(["d"], log); |
| 120 assertNull(exception); |
| 121 |
| 122 Debug.clearBreakOnUncaughtException(); |
| 123 Debug.setListener(null); |
OLD | NEW |