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

Side by Side Diff: test/mjsunit/es6/debug-promises-update-status-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, status, value;
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.UpdatePromiseStatusEvent) {
16 assertTrue(event_data.promise().isPromise());
17 promise = event_data.promise().value();
18
19 status = event_data.status();
20
21 value = event_data.value().value();
22 }
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 assertSame(promise, p1);
33 assertEquals(status, 1);
34 assertEquals(value, 1);
35
36 var p2 = new Promise(function(resolve, reject) { reject(2) });
37 assertSame(promise, p2);
38 assertEquals(status, -1);
39 assertEquals(value, 2);
40
41 assertNull(exception);
42 Debug.setListener(null);
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698