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

Side by Side Diff: test/mjsunit/es6/debug-promises/try-throw-reject-in-constructor.js

Issue 2497973002: [debug-wrapper] Further extend the debug wrapper (Closed)
Patch Set: Address comments Created 4 years, 1 month 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
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 // Test debug events when we only listen to uncaught exceptions and
8 // an exception is thrown in the Promise constructor, but caught in an
9 // inner try-catch. The Promise is rejected afterwards.
10 // We expect an Exception debug event with a promise to be triggered.
11
12 Debug = debug.Debug;
13
14 var step = 0;
15 var exception = null;
16
17 function listener(event, exec_state, event_data, data) {
18 try {
19 if (event == Debug.DebugEvent.Exception) {
20 assertEquals(0, step);
21 assertEquals("uncaught", event_data.exception().message);
22 assertTrue(event_data.promise() instanceof Promise);
23 assertTrue(event_data.uncaught());
24 // Assert that the debug event is triggered at the throw site.
25 assertTrue(exec_state.frame(0).sourceLineText().indexOf("// event") > 0);
26 step++;
27 }
28 } catch (e) {
29 exception = e;
30 }
31 }
32
33 Debug.setBreakOnUncaughtException();
34 Debug.setListener(listener);
35
36 var p = new Promise(function(resolve, reject) {
37 try { // This try-catch must not prevent this uncaught reject event.
38 throw new Error("caught");
39 } catch (e) { }
40 reject(new Error("uncaught")); // event
41 });
42
43 assertEquals(1, step);
44 assertNull(exception);
OLDNEW
« no previous file with comments | « test/mjsunit/es6/debug-promises/try-reject-in-constructor.js ('k') | test/mjsunit/es6/debug-stepin-default-parameters.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698