| OLD | NEW |
| (Empty) | |
| 1 // Copyright 2017 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 Debug = debug.Debug |
| 6 |
| 7 var exception = null; |
| 8 |
| 9 function listener(event, exec_state, event_data, data) { |
| 10 if (event != Debug.DebugEvent.Exception) return; |
| 11 try { |
| 12 var line = exec_state.frame(0).sourceLineText(); |
| 13 var match = /Exception/.exec(line); |
| 14 assertNotNull(match); |
| 15 } catch (e) { |
| 16 exception = e; |
| 17 } |
| 18 } |
| 19 |
| 20 // Caught throw, events on any exception. |
| 21 Debug.setListener(listener); |
| 22 Debug.setBreakOnException(); |
| 23 |
| 24 var thenable = { |
| 25 get then() { |
| 26 throw new Error(); // Exception |
| 27 } |
| 28 }; |
| 29 |
| 30 var p = Promise.resolve(thenable); |
| 31 |
| 32 async function foo() { |
| 33 await thenable; |
| 34 } |
| 35 |
| 36 foo(); |
| 37 |
| 38 %RunMicrotasks(); |
| 39 |
| 40 Debug.setListener(null); |
| 41 Debug.clearBreakOnException(); |
| 42 assertNull(exception); |
| OLD | NEW |