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

Side by Side Diff: test/mjsunit/es6/debug-promises/throw-eventually-caught.js

Issue 473803003: Fix PromiseHasRejectHandler. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: updated comments Created 6 years, 4 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
« no previous file with comments | « test/mjsunit/es6/debug-promises/throw-caught-by-default-reject-handler.js ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 --allow-natives-syntax 5 // Flags: --expose-debug-as debug --allow-natives-syntax
6 6
7 // Test debug events when we only listen to uncaught exceptions and 7 // Test debug events when we only listen to uncaught exceptions and
8 // there is a catch handler for the to-be-rejected Promise. 8 // there is a catch handler for the to-be-rejected Promise.
9 // We expect no debug event to be triggered. 9 // We expect no Exception debug events, since the default reject handler passes
10 // the rejection on to a user-defined reject handler.
10 11
11 Debug = debug.Debug; 12 Debug = debug.Debug;
12 13
13 var p = new Promise(function(resolve, reject) { 14 var resolve, reject;
14 resolve(); 15 var p0 = new Promise(function(res, rej) { resolve = res; reject = rej; });
16
17 var p1 = p0.then(function() {
18 throw new Error();
15 }); 19 });
16 20
17 var q = p.chain( 21 var p2 = p1.then(function() { });
18 function() { 22 var p3 = p2.catch(function() { });
19 return Promise.reject(Error("caught reject"));
20 });
21 23
22 q.catch( 24 var q = new Promise(function(res, rej) {
23 function(e) { 25 res();
24 assertEquals("caught reject", e.message); 26 });
25 }); 27
28 q.then(function() {
29 resolve();
30 })
31
26 32
27 function listener(event, exec_state, event_data, data) { 33 function listener(event, exec_state, event_data, data) {
28 try { 34 try {
29 assertTrue(event != Debug.DebugEvent.Exception); 35 assertTrue(event != Debug.DebugEvent.Exception);
30 } catch (e) { 36 } catch (e) {
31 %AbortJS(e + "\n" + e.stack); 37 %AbortJS(e + "\n" + e.stack);
32 } 38 }
33 } 39 }
34 40
35 Debug.setBreakOnUncaughtException(); 41 Debug.setBreakOnUncaughtException();
36 Debug.setListener(listener); 42 Debug.setListener(listener);
OLDNEW
« no previous file with comments | « test/mjsunit/es6/debug-promises/throw-caught-by-default-reject-handler.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698