| OLD | NEW |
| (Empty) |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 // Flags: --expose-debug-as debug | |
| 6 | |
| 7 Debug = debug.Debug; | |
| 8 ScopeType = debug.ScopeType; | |
| 9 var exception = null; | |
| 10 var nested = false; | |
| 11 | |
| 12 function bar() { | |
| 13 let a = 1; | |
| 14 (function foo() { | |
| 15 let b = a; | |
| 16 with (new Proxy({}, {})) { | |
| 17 debugger; | |
| 18 } | |
| 19 })(); | |
| 20 } | |
| 21 | |
| 22 function checkScopes(scopes, expectation) { | |
| 23 assertEquals(scopes.map(s => s.scopeType()), expectation); | |
| 24 } | |
| 25 | |
| 26 function listener(event, exec_state, event_data, data) { | |
| 27 if (event != Debug.DebugEvent.Break) return; | |
| 28 try { | |
| 29 if (!nested) { | |
| 30 nested = true; | |
| 31 checkScopes(exec_state.frame(0).allScopes(), | |
| 32 [ ScopeType.With, ScopeType.Local, ScopeType.Closure, | |
| 33 ScopeType.Script, ScopeType.Global ]); | |
| 34 exec_state.frame(0).evaluate("debugger;"); | |
| 35 } else { | |
| 36 checkScopes(exec_state.frame(0).allScopes(), | |
| 37 [ ScopeType.Eval, ScopeType.With, ScopeType.Closure, | |
| 38 ScopeType.Script, ScopeType.Global ]); | |
| 39 } | |
| 40 } catch (e) { | |
| 41 exception = e; | |
| 42 print(e + e.stack); | |
| 43 } | |
| 44 } | |
| 45 | |
| 46 Debug.setListener(listener); | |
| 47 bar(); | |
| 48 Debug.setListener(null); | |
| 49 assertNull(exception); | |
| OLD | NEW |