| 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 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 114 Debug.setBreakOnUncaughtException(); | 114 Debug.setBreakOnUncaughtException(); |
| 115 | 115 |
| 116 log = []; | 116 log = []; |
| 117 Promise.resolve().then(() => Promise.reject()).catch(() => log.push("d")); // Ex
ception c | 117 Promise.resolve().then(() => Promise.reject()).catch(() => log.push("d")); // Ex
ception c |
| 118 %RunMicrotasks(); | 118 %RunMicrotasks(); |
| 119 assertEquals(["d"], log); | 119 assertEquals(["d"], log); |
| 120 assertNull(exception); | 120 assertNull(exception); |
| 121 | 121 |
| 122 Debug.clearBreakOnUncaughtException(); | 122 Debug.clearBreakOnUncaughtException(); |
| 123 Debug.setListener(null); | 123 Debug.setListener(null); |
| 124 |
| 125 // If devtools is turned on in the middle, then catch prediction |
| 126 // could be wrong (here, it mispredicts the exception as caught), |
| 127 // but shouldn't crash. |
| 128 |
| 129 log = []; |
| 130 |
| 131 var resolve; |
| 132 var turnOnListenerPromise = new Promise(r => resolve = r); |
| 133 async function confused() { |
| 134 await turnOnListenerPromise; |
| 135 throw foo |
| 136 } |
| 137 confused(); |
| 138 Promise.resolve().then(() => { |
| 139 Debug.setListener(listener); |
| 140 Debug.setBreakOnUncaughtException(); |
| 141 resolve(); |
| 142 }); |
| 143 |
| 144 assertEquals([], log); |
| OLD | NEW |