| 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 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 throws a new exception in its reject | 8 // caught by a custom promise, which throws a new exception in its reject |
| 9 // handler. We expect two Exception debug events: | 9 // handler. 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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 assertTrue(expected_events >= 0); | 46 assertTrue(expected_events >= 0); |
| 47 if (expected_events == 1) { | 47 if (expected_events == 1) { |
| 48 assertEquals(["resolve", "construct", "end main", | 48 assertEquals(["resolve", "construct", "end main", |
| 49 "throw caught"], log); | 49 "throw caught"], log); |
| 50 assertEquals("caught", event_data.exception().message); | 50 assertEquals("caught", event_data.exception().message); |
| 51 } else if (expected_events == 0) { | 51 } else if (expected_events == 0) { |
| 52 assertEquals("reject", event_data.exception().message); | 52 assertEquals("reject", event_data.exception().message); |
| 53 } else { | 53 } else { |
| 54 assertUnreachable(); | 54 assertUnreachable(); |
| 55 } | 55 } |
| 56 assertEquals(q, event_data.promise()); | 56 assertSame(q, event_data.promise()); |
| 57 assertTrue(exec_state.frame(0).sourceLineText().indexOf('// event') > 0); | 57 assertTrue(exec_state.frame(0).sourceLineText().indexOf('// event') > 0); |
| 58 } | 58 } |
| 59 } catch (e) { | 59 } catch (e) { |
| 60 %AbortJS(e + "\n" + e.stack); | 60 %AbortJS(e + "\n" + e.stack); |
| 61 } | 61 } |
| 62 } | 62 } |
| 63 | 63 |
| 64 Debug.setBreakOnUncaughtException(); | 64 Debug.setBreakOnUncaughtException(); |
| 65 Debug.setListener(listener); | 65 Debug.setListener(listener); |
| 66 | 66 |
| (...skipping 14 matching lines...) Expand all Loading... |
| 81 } | 81 } |
| 82 } | 82 } |
| 83 | 83 |
| 84 // Run testDone through the Object.observe processing loop. | 84 // Run testDone through the Object.observe processing loop. |
| 85 var dummy = {}; | 85 var dummy = {}; |
| 86 Object.observe(dummy, checkResult); | 86 Object.observe(dummy, checkResult); |
| 87 dummy.dummy = dummy; | 87 dummy.dummy = dummy; |
| 88 } | 88 } |
| 89 | 89 |
| 90 testDone(0); | 90 testDone(0); |
| OLD | NEW |