| 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: --expose-debug-as debug --allow-natives-syntax --promise-extra | 5 // Flags: --expose-debug-as debug --allow-natives-syntax |
| 6 | 6 |
| 7 // Test debug events when we listen to all exceptions and | 7 // Test debug events when we listen to all exceptions and |
| 8 // there is a catch handler for the exception thrown in a Promise, first | 8 // there is a catch handler for the exception thrown in a Promise, first |
| 9 // caught by a try-finally, and immediately rethrown. | 9 // caught by a try-finally, and immediately rethrown. |
| 10 // We expect a normal Exception debug event to be triggered. | 10 // We expect a normal Exception debug event to be triggered. |
| 11 | 11 |
| 12 Debug = debug.Debug; | 12 Debug = debug.Debug; |
| 13 | 13 |
| 14 var expected_events = 1; | 14 var expected_events = 1; |
| 15 var log = []; | 15 var log = []; |
| 16 | 16 |
| 17 var p = new Promise(function(resolve, reject) { | 17 var p = new Promise(function(resolve, reject) { |
| 18 log.push("resolve"); | 18 log.push("resolve"); |
| 19 resolve(); | 19 resolve(); |
| 20 }); | 20 }); |
| 21 | 21 |
| 22 var q = p.chain( | 22 var q = p.then( |
| 23 function() { | 23 function() { |
| 24 log.push("throw"); | 24 log.push("throw"); |
| 25 try { | 25 try { |
| 26 throw new Error("caught"); | 26 throw new Error("caught"); |
| 27 } finally { | 27 } finally { |
| 28 } | 28 } |
| 29 }); | 29 }); |
| 30 | 30 |
| 31 q.catch( | 31 q.catch( |
| 32 function(e) { | 32 function(e) { |
| (...skipping 30 matching lines...) Expand all Loading... |
| 63 } | 63 } |
| 64 } catch (e) { | 64 } catch (e) { |
| 65 %AbortJS(e + "\n" + e.stack); | 65 %AbortJS(e + "\n" + e.stack); |
| 66 } | 66 } |
| 67 } | 67 } |
| 68 | 68 |
| 69 %EnqueueMicrotask(checkResult); | 69 %EnqueueMicrotask(checkResult); |
| 70 } | 70 } |
| 71 | 71 |
| 72 testDone(0); | 72 testDone(0); |
| OLD | NEW |