OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 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 | 5 // Flags: --expose-debug-as debug |
6 | 6 |
7 Debug = debug.Debug; | 7 Debug = debug.Debug; |
8 | 8 |
9 var base_id = -1; | 9 var base_id = -1; |
10 var exception = null; | 10 var exception = null; |
(...skipping 19 matching lines...) Expand all Loading... |
30 Debug.setListener(null); | 30 Debug.setListener(null); |
31 } | 31 } |
32 } | 32 } |
33 | 33 |
34 function listener(event, exec_state, event_data, data) { | 34 function listener(event, exec_state, event_data, data) { |
35 if (event != Debug.DebugEvent.AsyncTaskEvent) return; | 35 if (event != Debug.DebugEvent.AsyncTaskEvent) return; |
36 try { | 36 try { |
37 if (base_id < 0) | 37 if (base_id < 0) |
38 base_id = event_data.id(); | 38 base_id = event_data.id(); |
39 var id = event_data.id() - base_id + 1; | 39 var id = event_data.id() - base_id + 1; |
40 assertEquals("Promise.Resolved", event_data.name()); | 40 assertEquals("Promise.resolve", event_data.name()); |
41 assertLog(event_data.type() + " #" + id); | 41 assertLog(event_data.type() + " #" + id); |
42 } catch (e) { | 42 } catch (e) { |
43 print(e + e.stack) | 43 print(e + e.stack) |
44 exception = e; | 44 exception = e; |
45 } | 45 } |
46 } | 46 } |
47 | 47 |
48 Debug.setListener(listener); | 48 Debug.setListener(listener); |
49 | 49 |
50 var resolver; | 50 var resolver; |
51 var p = new Promise(function(resolve, reject) { | 51 var p = new Promise(function(resolve, reject) { |
52 resolver = resolve; | 52 resolver = resolve; |
53 }); | 53 }); |
54 p.then(function() { | 54 p.then(function() { |
55 assertLog("then #1"); | 55 assertLog("then #1"); |
56 }).then(function() { | 56 }).then(function() { |
57 assertLog("then #2"); | 57 assertLog("then #2"); |
58 }); | 58 }); |
59 resolver(); | 59 resolver(); |
60 | 60 |
61 assertNull(exception); | 61 assertNull(exception); |
OLD | NEW |