| OLD | NEW |
| 1 // Copyright 2017 the V8 project authors. All rights reserved. | 1 // Copyright 2017 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: --ignition --side-effect-free-debug-evaluate | 5 // Flags: --ignition |
| 6 | 6 |
| 7 Debug = debug.Debug | 7 Debug = debug.Debug |
| 8 | 8 |
| 9 var exception = null; | 9 var exception = null; |
| 10 | 10 |
| 11 var o = { p : 1 }; | 11 var o = { p : 1 }; |
| 12 | 12 |
| 13 var successes = [ | 13 var successes = [ |
| 14 [45, | 14 [45, |
| 15 `(function() { | 15 `(function() { |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 78 with (o) { | 78 with (o) { |
| 79 p = 2; | 79 p = 2; |
| 80 } | 80 } |
| 81 })()`, | 81 })()`, |
| 82 ]; | 82 ]; |
| 83 | 83 |
| 84 function listener(event, exec_state, event_data, data) { | 84 function listener(event, exec_state, event_data, data) { |
| 85 if (event != Debug.DebugEvent.Break) return; | 85 if (event != Debug.DebugEvent.Break) return; |
| 86 try { | 86 try { |
| 87 successes.forEach(function ([expectation, source]) { | 87 successes.forEach(function ([expectation, source]) { |
| 88 assertEquals(expectation, exec_state.frame(0).evaluate(source).value()); | 88 assertEquals(expectation, |
| 89 exec_state.frame(0).evaluate(source, true).value()); |
| 89 }); | 90 }); |
| 90 fails.forEach(function (test) { | 91 fails.forEach(function (test) { |
| 91 assertThrows(() => exec_state.frame(0).evaluate(test), EvalError); | 92 assertThrows(() => exec_state.frame(0).evaluate(test, true), EvalError); |
| 92 }); | 93 }); |
| 93 } catch (e) { | 94 } catch (e) { |
| 94 exception = e; | 95 exception = e; |
| 95 print(e, e.stack); | 96 print(e, e.stack); |
| 96 }; | 97 }; |
| 97 }; | 98 }; |
| 98 | 99 |
| 99 // Add the debug event listener. | 100 // Add the debug event listener. |
| 100 Debug.setListener(listener); | 101 Debug.setListener(listener); |
| 101 | 102 |
| 102 function f() { | 103 function f() { |
| 103 debugger; | 104 debugger; |
| 104 }; | 105 }; |
| 105 | 106 |
| 106 f(); | 107 f(); |
| 107 | 108 |
| 108 assertNull(exception); | 109 assertNull(exception); |
| OLD | NEW |