Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3)

Side by Side Diff: test/mjsunit/regress/regress-crbug-582051.js

Issue 1648263002: [debugger] correctly find function context. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: addressed comments Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « test/mjsunit/mjsunit.status ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(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 var test_y = false;
8
9 function foo(a = 1) {
10 var x = 2;
11 debugger;
12 eval("var y = 3");
13 test_y = true;
14 debugger;
15 }
16
17 var exception = null;
18 var break_count = 0;
19 var Debug = debug.Debug;
20 var ScopeType = debug.ScopeType;
21
22 function listener(event, exec_state) {
23 if (event != Debug.DebugEvent.Break) return;
24 try {
25 var scopes = exec_state.frame(0).allScopes();
26 var expectation = [ ScopeType.Block,
27 ScopeType.Local,
28 ScopeType.Script,
29 ScopeType.Global ];
30 assertEquals(expectation, scopes.map(x => x.scopeType()));
31 assertEquals(2, scopes[0].scopeObject().value().x);
32 if (test_y) assertEquals(3, scopes[0].scopeObject().value().y);
33 assertEquals(1, scopes[1].scopeObject().value().a);
34 break_count++;
35 } catch (e) {
36 print(e);
37 exception = e;
38 }
39 }
40 Debug.setListener(listener);
41 foo();
42
43 assertNull(exception);
44 assertEquals(2, break_count);
OLDNEW
« no previous file with comments | « test/mjsunit/mjsunit.status ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698