blob: da11b9001c02606cc2e6e000e9531b9f515d7ade [file] [log] [blame]
Ben Murdochda12d292016-06-02 14:46:10 +01001// 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
7Debug = debug.Debug;
8ScopeType = debug.ScopeType;
9var exception = null;
10var nested = false;
11
12function bar() {
13 let a = 1;
14 (function foo() {
15 let b = a;
16 with (new Proxy({}, {})) {
17 debugger;
18 }
19 })();
20}
21
22function checkScopes(scopes, expectation) {
23 assertEquals(scopes.map(s => s.scopeType()), expectation);
24}
25
26function 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.With, ScopeType.Closure,
38 ScopeType.Script, ScopeType.Global ]);
39 }
40 } catch (e) {
41 exception = e;
42 print(e + e.stack);
43 }
44}
45
46Debug.setListener(listener);
47bar();
48Debug.setListener(null);
49assertNull(exception);