| 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 | |
| 6 | 5 |
| 7 // Test debug events when an exception is thrown inside a Promise, which is | 6 // Test debug events when an exception is thrown inside a Promise, which is |
| 8 // caught by a custom promise, which throws a new exception in its reject | 7 // caught by a custom promise, which throws a new exception in its reject |
| 9 // handler. We expect two Exception debug events: | 8 // handler. We expect two Exception debug events: |
| 10 // 1) when the exception is thrown in the promise q. | 9 // 1) when the exception is thrown in the promise q. |
| 11 // 2) when the custom reject closure in MyPromise throws an exception. | 10 // 2) when the custom reject closure in MyPromise throws an exception. |
| 12 | 11 |
| 13 Debug = debug.Debug; | 12 Debug = debug.Debug; |
| 14 | 13 |
| 15 var expected_events = 1; | 14 var expected_events = 1; |
| (...skipping 29 matching lines...) Expand all Loading... |
| 45 if (event == Debug.DebugEvent.Exception) { | 44 if (event == Debug.DebugEvent.Exception) { |
| 46 expected_events--; | 45 expected_events--; |
| 47 assertTrue(expected_events >= 0); | 46 assertTrue(expected_events >= 0); |
| 48 if (expected_events == 0) { | 47 if (expected_events == 0) { |
| 49 assertEquals(["resolve", "construct", "end main", | 48 assertEquals(["resolve", "construct", "end main", |
| 50 "throw caught"], log); | 49 "throw caught"], log); |
| 51 assertEquals("caught", event_data.exception().message); | 50 assertEquals("caught", event_data.exception().message); |
| 52 } else { | 51 } else { |
| 53 assertUnreachable(); | 52 assertUnreachable(); |
| 54 } | 53 } |
| 55 assertSame(q, event_data.promise()); | |
| 56 assertTrue(exec_state.frame(0).sourceLineText().indexOf('// event') > 0); | 54 assertTrue(exec_state.frame(0).sourceLineText().indexOf('// event') > 0); |
| 57 } | 55 } |
| 58 } catch (e) { | 56 } catch (e) { |
| 59 %AbortJS(e + "\n" + e.stack); | 57 %AbortJS(e + "\n" + e.stack); |
| 60 } | 58 } |
| 61 } | 59 } |
| 62 | 60 |
| 63 Debug.setBreakOnUncaughtException(); | 61 Debug.setBreakOnUncaughtException(); |
| 64 Debug.setListener(listener); | 62 Debug.setListener(listener); |
| 65 | 63 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 77 } | 75 } |
| 78 } catch (e) { | 76 } catch (e) { |
| 79 %AbortJS(e + "\n" + e.stack); | 77 %AbortJS(e + "\n" + e.stack); |
| 80 } | 78 } |
| 81 } | 79 } |
| 82 | 80 |
| 83 %EnqueueMicrotask(checkResult); | 81 %EnqueueMicrotask(checkResult); |
| 84 } | 82 } |
| 85 | 83 |
| 86 testDone(0); | 84 testDone(0); |
| OLD | NEW |