Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3)

Side by Side Diff: test/mjsunit/es6/debug-promises-update-parent-event.js

Issue 393283007: Introduce more debug events for promises. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Fix calling promise parent event Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(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
12 function listener(event, exec_state, event_data, data) {
13 if (event != Debug.DebugEvent.PromiseEvent) return;
14 try {
15 if (event_data instanceof debug.UpdatePromiseParentEvent) {
16 assertTrue(event_data.promise().isPromise());
17 promise = event_data.promise().value();
18
19 assertTrue(event_data.parentPromise().isPromise());
20 parentPromise = event_data.parentPromise().value();
21 }
22 } catch (e) {
23 print(e + e.stack);
24 exception = e;
25 }
26 }
27
28 Debug.setListener(listener);
29
30 var p1 = new Promise(function(resolve, reject) { resolve(1) });
31 var p2 = p1.then().then();
32 var p3 = p2.then();
33 assertSame(parentPromise, p2);
34 assertSame(promise, p3);
35
36 assertNull(exception);
37 Debug.setListener(null);
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698