OLD | NEW |
(Empty) | |
| 1 // Copyright 2015 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 // Flags: --expose-debug-as debug --allow-natives-syntax |
| 6 |
| 7 // Test debug events when we only listen to uncaught exceptions and a |
| 8 // Promise p3 created by Promise.race has a catch handler, and is rejected |
| 9 // because one of the Promises p2 passed to Promise.all is rejected. We |
| 10 // expect no Exception debug event to be triggered, since p3 and by |
| 11 // extension p2 have a catch handler. |
| 12 |
| 13 var Debug = debug.Debug; |
| 14 |
| 15 var expected_events = 2; |
| 16 |
| 17 var p1 = Promise.resolve(); |
| 18 p1.name = "p1"; |
| 19 |
| 20 var p2 = p1.then(function() { |
| 21 throw new Error("caught"); |
| 22 }); |
| 23 |
| 24 p2.name = "p2"; |
| 25 |
| 26 var p3 = Promise.all([p2]); |
| 27 p3.name = "p3"; |
| 28 |
| 29 p3.catch(function(e) {}); |
| 30 |
| 31 function listener(event, exec_state, event_data, data) { |
| 32 try { |
| 33 assertTrue(event != Debug.DebugEvent.Exception) |
| 34 } catch (e) { |
| 35 %AbortJS(e + "\n" + e.stack); |
| 36 } |
| 37 } |
| 38 |
| 39 Debug.setBreakOnUncaughtException(); |
| 40 Debug.setListener(listener); |
OLD | NEW |