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

Side by Side Diff: test/mjsunit/debug-evaluate-locals-capturing.js

Issue 1513183003: [debugger] debug-evaluate should not not modify local values. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@arrowthis
Patch Set: addressed comments. Created 5 years 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
OLDNEW
1 // Copyright 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // Flags: --expose-debug-as debug 5 // Flags: --expose-debug-as debug --debug-eval-readonly-locals
6 6
7 Debug = debug.Debug 7 Debug = debug.Debug
8 var exception = null; 8 var exception = null;
9 var break_count = 0; 9 var break_count = 0;
10 10
11 var f = null; 11 var f = null;
12 var i = null; 12 var i = null;
13 function listener(event, exec_state, event_data, data) { 13 function listener(event, exec_state, event_data, data) {
14 try { 14 try {
15 if (event == Debug.DebugEvent.Break) { 15 if (event == Debug.DebugEvent.Break) {
16 var frameMirror = exec_state.frame(0); 16 var frameMirror = exec_state.frame(0);
17 17
18 f = frameMirror.evaluate('f = function() { i = 5; }, f(), f').value(); 18 var i = frameMirror.evaluate('f = function() { i = 5; }, f(), i').value();
19 print(f); 19 assertEquals(5, i);
20 } 20 }
21 } catch(e) { 21 } catch(e) {
22 exception = e; 22 exception = e;
23 print(e, e.stack); 23 print(e, e.stack);
24 } 24 }
25 }; 25 };
26 26
27 Debug.setListener(listener); 27 Debug.setListener(listener);
28 28
29 (function (){ 29 (function (){
30 30
31 var i = 0; 31 var i = 0;
32 32
33 try { 33 try {
34 throw new Error(); 34 throw new Error();
35 } catch (e) { 35 } catch (e) {
36 assertEquals(0, i); 36 assertEquals(0, i);
37 debugger; 37 debugger;
38 assertEquals(5, i); 38 assertEquals(0, i);
39 } 39 }
40 }()); 40 }());
41 41
42 assertNull(exception); 42 assertNull(exception);
43 43
44 assertNull(i); 44 assertNull(i);
45 f(); 45 f();
46 assertNull(i); 46 assertNull(i);
47 47
48 Debug.setListener(null); 48 Debug.setListener(null);
OLDNEW
« no previous file with comments | « test/mjsunit/debug-evaluate-locals.js ('k') | test/mjsunit/debug-evaluate-modify-catch-block-scope.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698