diff options
Diffstat (limited to 'deps/v8/test/mjsunit/debug-evaluate-nested.js')
-rw-r--r-- | deps/v8/test/mjsunit/debug-evaluate-nested.js | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/deps/v8/test/mjsunit/debug-evaluate-nested.js b/deps/v8/test/mjsunit/debug-evaluate-nested.js new file mode 100644 index 0000000000..da11b9001c --- /dev/null +++ b/deps/v8/test/mjsunit/debug-evaluate-nested.js @@ -0,0 +1,49 @@ +// Copyright 2016 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flags: --expose-debug-as debug + +Debug = debug.Debug; +ScopeType = debug.ScopeType; +var exception = null; +var nested = false; + +function bar() { + let a = 1; + (function foo() { + let b = a; + with (new Proxy({}, {})) { + debugger; + } + })(); +} + +function checkScopes(scopes, expectation) { + assertEquals(scopes.map(s => s.scopeType()), expectation); +} + +function listener(event, exec_state, event_data, data) { + if (event != Debug.DebugEvent.Break) return; + try { + if (!nested) { + nested = true; + checkScopes(exec_state.frame(0).allScopes(), + [ ScopeType.With, ScopeType.Local, ScopeType.Closure, + ScopeType.Script, ScopeType.Global ]); + exec_state.frame(0).evaluate("debugger;"); + } else { + checkScopes(exec_state.frame(0).allScopes(), + [ ScopeType.With, ScopeType.Closure, + ScopeType.Script, ScopeType.Global ]); + } + } catch (e) { + exception = e; + print(e + e.stack); + } +} + +Debug.setListener(listener); +bar(); +Debug.setListener(null); +assertNull(exception); |