Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 // Flags: --expose-debug-as debug | |
| 6 | |
| 7 Debug = debug.Debug; | |
| 8 | |
| 9 var exception = null; | |
| 10 var promise, parentPromise; | |
| 11 var counter = 0; | |
| 12 | |
| 13 function listener(event, exec_state, event_data, data) { | |
| 14 if (!(event_data instanceof debug.UpdatePromiseParentEvent)) return; | |
| 15 try { | |
| 16 counter++; | |
| 17 | |
| 18 assertTrue(event_data.promise().isPromise()); | |
| 19 promise = event_data.promise().value(); | |
| 20 | |
| 21 assertTrue(event_data.parentPromise().isPromise()); | |
| 22 parentPromise = event_data.parentPromise().value(); | |
|
Yang
2014/07/24 08:43:58
how about, instead of using a single value for par
Alexandra Mikhaylova
2014/07/24 09:18:37
Thanks, done. Added an array of promise/parent pai
| |
| 23 } catch (e) { | |
| 24 print(e + e.stack); | |
| 25 exception = e; | |
| 26 } | |
| 27 } | |
| 28 | |
| 29 Debug.setListener(listener); | |
| 30 | |
| 31 var p1 = new Promise(function(resolve, reject) { resolve(1) }); | |
| 32 var p2 = p1.then().then(); | |
| 33 var p3 = p2.then(); | |
|
Yang
2014/07/24 08:43:58
Instead of a chain of promises, how about having a
Alexandra Mikhaylova
2014/07/24 09:18:37
Done.
| |
| 34 assertSame(parentPromise, p2); | |
| 35 assertSame(promise, p3); | |
| 36 assertEquals(3, counter); | |
| 37 | |
| 38 assertNull(exception); | |
| 39 Debug.setListener(null); | |
| OLD | NEW |