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 --promise-extra | 5 // Flags: --expose-debug-as debug --allow-natives-syntax --promise-extra |
6 | 6 |
7 // Test debug events when an exception is thrown inside a Promise, which is | 7 // Test debug events when an exception is thrown inside a Promise, which is |
8 // caught by a custom promise, which has no reject handler. | 8 // caught by a custom promise, which has no reject handler. |
9 // We expect two Exception debug events: | 9 // We expect two Exception debug events: |
10 // 1) when the exception is thrown in the promise q. | 10 // 1) when the exception is thrown in the promise q. |
(...skipping 30 matching lines...) Expand all Loading... |
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 if (expected_events == 1) { | 44 if (expected_events == 1) { |
45 assertTrue( | 45 assertTrue( |
46 exec_state.frame(0).sourceLineText().indexOf('// event') > 0); | 46 exec_state.frame(0).sourceLineText().indexOf('// event') > 0); |
47 assertEquals("caught", event_data.exception().message); | 47 assertEquals("caught", event_data.exception().message); |
48 } else if (expected_events == 0) { | 48 } else if (expected_events == 0) { |
49 // All of the frames on the stack are from native Javascript. | 49 // All of the frames on the stack are from native Javascript. |
50 assertEquals(0, exec_state.frameCount()); | 50 assertEquals(0, exec_state.frameCount()); |
51 assertEquals("undefined is not a function", | 51 assertEquals("(var).reject is not a function", |
52 event_data.exception().message); | 52 event_data.exception().message); |
53 } else { | 53 } else { |
54 assertUnreachable(); | 54 assertUnreachable(); |
55 } | 55 } |
56 assertSame(q, event_data.promise()); | 56 assertSame(q, event_data.promise()); |
57 } | 57 } |
58 } catch (e) { | 58 } catch (e) { |
59 %AbortJS(e + "\n" + e.stack); | 59 %AbortJS(e + "\n" + e.stack); |
60 } | 60 } |
61 } | 61 } |
(...skipping 14 matching lines...) Expand all Loading... |
76 } | 76 } |
77 } catch (e) { | 77 } catch (e) { |
78 %AbortJS(e + "\n" + e.stack); | 78 %AbortJS(e + "\n" + e.stack); |
79 } | 79 } |
80 } | 80 } |
81 | 81 |
82 %EnqueueMicrotask(checkResult); | 82 %EnqueueMicrotask(checkResult); |
83 } | 83 } |
84 | 84 |
85 testDone(0); | 85 testDone(0); |
OLD | NEW |