OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 // |
| 5 // Flags: --noanalyze-environment-liveness |
4 | 6 |
5 | 7 |
6 'use strict'; | 8 'use strict'; |
7 var Debug = debug.Debug; | 9 var Debug = debug.Debug; |
8 var exception = null; | 10 var exception = null; |
9 | 11 |
10 function listener(event, exec_state, event_data, data) { | 12 function listener(event, exec_state, event_data, data) { |
11 if (event != Debug.DebugEvent.Break) return; | 13 if (event != Debug.DebugEvent.Break) return; |
12 try { | 14 try { |
13 var scopes = exec_state.frame(0).allScopes(); | 15 var scopes = exec_state.frame(0).allScopes(); |
14 assertEquals(debug.ScopeType.Eval, scopes[0].scopeType()); | 16 assertEquals(debug.ScopeType.Eval, scopes[0].scopeType()); |
15 assertEquals(1, scopes[0].scopeObject().value().a); | 17 assertEquals(1, scopes[0].scopeObject().value().a); |
16 assertEquals(debug.ScopeType.Script, scopes[1].scopeType()); | 18 assertEquals(debug.ScopeType.Script, scopes[1].scopeType()); |
17 assertEquals(undefined, scopes[1].scopeObject().value().a); | 19 assertEquals(undefined, scopes[1].scopeObject().value().a); |
18 assertEquals(debug.ScopeType.Global, scopes[2].scopeType()); | 20 assertEquals(debug.ScopeType.Global, scopes[2].scopeType()); |
19 assertEquals(undefined, scopes[2].scopeObject().value().a); | 21 assertEquals(undefined, scopes[2].scopeObject().value().a); |
20 } catch (e) { | 22 } catch (e) { |
21 exception = e; | 23 exception = e; |
22 } | 24 } |
23 } | 25 } |
24 | 26 |
25 Debug.setListener(listener); | 27 Debug.setListener(listener); |
26 // Eval inherits strict mode. | 28 // Eval inherits strict mode. |
27 eval("var a = 1; debugger;"); | 29 eval("var a = 1; debugger;"); |
28 Debug.setListener(null); | 30 Debug.setListener(null); |
29 assertNull(exception); | 31 assertNull(exception); |
OLD | NEW |