| OLD | NEW |
| 1 // Copyright 2016 the V8 project authors. All rights reserved. | 1 // Copyright 2016 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 | |
| 6 | 5 |
| 7 var Debug = debug.Debug; | 6 var Debug = debug.Debug; |
| 8 var steps = 0; | 7 var steps = 0; |
| 9 var exception = null; | 8 var exception = null; |
| 10 | 9 |
| 11 function listener(event, execState, eventData, data) { | 10 function listener(event, execState, eventData, data) { |
| 12 if (event != Debug.DebugEvent.Break) return; | 11 if (event != Debug.DebugEvent.Break) return; |
| 13 try { | 12 try { |
| 14 assertEquals([ debug.ScopeType.Local, | 13 assertEquals([ debug.ScopeType.Local, |
| 15 debug.ScopeType.Script, | 14 debug.ScopeType.Script, |
| 16 debug.ScopeType.Global], | 15 debug.ScopeType.Global], |
| 17 execState.frame().allScopes().map(s => s.scopeType())); | 16 execState.frame().allScopes().map(s => s.scopeType())); |
| 18 var x_value = execState.frame().evaluate("x").value(); | 17 var x_value = execState.frame().evaluate("String(x)").value(); |
| 19 if (steps < 2) { | 18 if (steps < 2) { |
| 20 assertEquals(undefined, x_value); | 19 assertEquals("undefined", x_value); |
| 21 execState.prepareStep(Debug.StepAction.StepIn); | 20 execState.prepareStep(Debug.StepAction.StepIn); |
| 22 } else { | 21 } else { |
| 23 assertEquals("l => l", x_value.toString()); | 22 assertEquals("l => l", x_value); |
| 24 } | 23 } |
| 25 steps++; | 24 steps++; |
| 26 } catch (e) { | 25 } catch (e) { |
| 27 exception = e; | 26 exception = e; |
| 28 } | 27 } |
| 29 } | 28 } |
| 30 | 29 |
| 31 Debug.setListener(listener); | 30 Debug.setListener(listener); |
| 32 | 31 |
| 33 (function() { | 32 (function() { |
| 34 debugger; | 33 debugger; |
| 35 var x = l => l; | 34 var x = l => l; |
| 36 })(); | 35 })(); |
| 37 | 36 |
| 38 Debug.setListener(null); | 37 Debug.setListener(null); |
| 39 assertNull(exception); | 38 assertNull(exception); |
| 40 assertEquals(3, steps); | 39 assertEquals(3, steps); |
| OLD | NEW |