OLD | NEW |
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 only a default reject handler for the to-be-rejected Promise. | 8 // there is only a default reject handler for the to-be-rejected Promise. |
9 // We expect two Exception debug events: | 9 // We expect two Exception debug events: |
10 // - when the first Promise is rejected and only has default reject handlers. | 10 // - when the first Promise is rejected and only has default reject handlers. |
(...skipping 26 matching lines...) Expand all Loading... |
37 | 37 |
38 | 38 |
39 function listener(event, exec_state, event_data, data) { | 39 function listener(event, exec_state, event_data, data) { |
40 try { | 40 try { |
41 if (event == Debug.DebugEvent.Exception) { | 41 if (event == Debug.DebugEvent.Exception) { |
42 expected_events--; | 42 expected_events--; |
43 assertTrue(expected_events >= 0); | 43 assertTrue(expected_events >= 0); |
44 assertTrue(event_data.uncaught()); | 44 assertTrue(event_data.uncaught()); |
45 assertTrue(event_data.promise() instanceof Promise); | 45 assertTrue(event_data.promise() instanceof Promise); |
46 if (expected_events == 1) { | 46 if (expected_events == 1) { |
47 // p1 is rejected, uncaught except for its default reject handler. | 47 // p1 is rejected, uncaught, with the error from the Promise.reject line |
48 assertEquals(0, exec_state.frameCount()); | 48 assertNotNull(event_data.sourceLineText().match("Promise.reject")); |
49 assertSame(p1, event_data.promise()); | 49 assertSame(p1, event_data.promise()); |
50 } else { | 50 } else { |
51 // p2 is rejected by p1's default reject handler. | 51 // p2 is rejected by p1's default reject handler. |
52 assertEquals(0, exec_state.frameCount()); | 52 assertEquals(0, exec_state.frameCount()); |
53 assertSame(p2, event_data.promise()); | 53 assertSame(p2, event_data.promise()); |
54 } | 54 } |
55 } | 55 } |
56 } catch (e) { | 56 } catch (e) { |
57 %AbortJS(e + "\n" + e.stack); | 57 %AbortJS(e + "\n" + e.stack); |
58 } | 58 } |
(...skipping 15 matching lines...) Expand all Loading... |
74 } | 74 } |
75 } catch (e) { | 75 } catch (e) { |
76 %AbortJS(e + "\n" + e.stack); | 76 %AbortJS(e + "\n" + e.stack); |
77 } | 77 } |
78 } | 78 } |
79 | 79 |
80 %EnqueueMicrotask(checkResult); | 80 %EnqueueMicrotask(checkResult); |
81 } | 81 } |
82 | 82 |
83 testDone(0); | 83 testDone(0); |
OLD | NEW |