OLD | NEW |
| (Empty) |
1 // Copyright 2015 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 // Get the Debug object exposed from the debug context global object. | |
8 Debug = debug.Debug | |
9 | |
10 listenerComplete = false; | |
11 breakPointCount = 0; | |
12 exception = null; | |
13 | |
14 function listener(event, exec_state, event_data, data) { | |
15 if (event != Debug.DebugEvent.Break) return; | |
16 try { | |
17 breakPointCount++; | |
18 if (breakPointCount == 1) { | |
19 // Break point in initializer for parameter `a`, invoked by | |
20 // initializer for parameter `b` | |
21 assertEquals('default', exec_state.frame(0).evaluate('mode').value()); | |
22 assertTrue(exec_state.frame(1).evaluate('b').isUndefined()); | |
23 assertTrue(exec_state.frame(1).evaluate('c').isUndefined()); | |
24 } else if (breakPointCount == 2) { | |
25 // Break point in IIFE initializer for parameter `c` | |
26 assertEquals('modeFn', exec_state.frame(1).evaluate('a.name').value()); | |
27 assertEquals('default', exec_state.frame(1).evaluate('b').value()); | |
28 assertTrue(exec_state.frame(1).evaluate('c').isUndefined()); | |
29 } else if (breakPointCount == 3) { | |
30 // Break point in function body --- `c` parameter is shadowed | |
31 assertEquals('modeFn', exec_state.frame(0).evaluate('a.name').value()); | |
32 assertEquals('default', exec_state.frame(0).evaluate('b').value()); | |
33 assertEquals('local', exec_state.frame(0).evaluate('d').value()); | |
34 } | |
35 } catch (e) { | |
36 exception = e; | |
37 } | |
38 }; | |
39 | |
40 // Add the debug event listener. | |
41 Debug.setListener(listener); | |
42 | |
43 function f(a = function modeFn(mode) { debugger; return mode; }, | |
44 b = a("default"), | |
45 c = (function() { debugger; })()) { | |
46 var d = 'local'; | |
47 debugger; | |
48 }; | |
49 | |
50 f(); | |
51 | |
52 // Make sure that the debug event listener vas invoked. | |
53 assertEquals(3, breakPointCount); | |
54 assertNull(exception); | |
OLD | NEW |