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.all 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 13var Debug = debug.Debug; 14 15var expected_events = 2; 16 17var p1 = Promise.resolve(); 18p1.name = "p1"; 19 20var p2 = p1.then(function() { 21 throw new Error("caught"); 22}); 23 24p2.name = "p2"; 25 26var p3 = Promise.all([p2]); 27p3.name = "p3"; 28 29p3.catch(function(e) {}); 30 31function 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 39Debug.setBreakOnUncaughtException(); 40Debug.setListener(listener); 41