Chromium Code Reviews| Index: test/mjsunit/debug-scopes.js |
| diff --git a/test/mjsunit/debug-scopes.js b/test/mjsunit/debug-scopes.js |
| index c388a67196a2691427833ea962b081e3f87628dc..b2cce2d087a0acdb43c74c41c06aadc7adb43e37 100644 |
| --- a/test/mjsunit/debug-scopes.js |
| +++ b/test/mjsunit/debug-scopes.js |
| @@ -145,6 +145,20 @@ function CheckScopeChain(scopes, exec_state) { |
| } |
| +// Check that the scope chain contains the expected names of scopes. |
| +function CheckScopeChainNames(names, exec_state) { |
| + var all_scopes = exec_state.frame().allScopes(); |
| + assertEquals(names.length, exec_state.frame().scopeCount()); |
| + assertEquals(names.length, all_scopes.length, "FrameMirror.allScopes length"); |
| + for (var i = 0; i < names.length; i++) { |
| + var scope = exec_state.frame().scope(i); |
| + assertTrue(scope.isScope()); |
| + assertScopeMirrorEquals(all_scopes[i], scope); |
|
yurys
2015/09/29 08:24:00
I think we can omit this check here as it is unrel
kozy
2015/09/29 15:15:32
Done.
|
| + assertEquals(scope.details().name(), names[i]) |
| + } |
| +} |
| + |
| + |
| // Check that the content of the scope is as expected. For functions just check |
| // that there is a function. |
| function CheckScopeContent(content, number, exec_state) { |
| @@ -517,6 +531,7 @@ listener_delegate = function(exec_state) { |
| debug.ScopeType.Script, |
| debug.ScopeType.Global], exec_state); |
| CheckScopeContent({a:1}, 1, exec_state); |
| + CheckScopeChainNames([undefined, "closure_1", undefined, undefined], exec_state) |
| }; |
| closure_1(1)(); |
| EndTest(); |
| @@ -543,6 +558,7 @@ listener_delegate = function(exec_state) { |
| debug.ScopeType.Script, |
| debug.ScopeType.Global], exec_state); |
| CheckScopeContent({a:1,x:3}, 1, exec_state); |
| + CheckScopeChainNames([undefined, "closure_2", undefined, undefined], exec_state) |
| }; |
| closure_2(1, 2)(); |
| EndTest(); |
| @@ -570,6 +586,7 @@ listener_delegate = function(exec_state) { |
| debug.ScopeType.Script, |
| debug.ScopeType.Global], exec_state); |
| CheckScopeContent({a:1,b:2,x:3,y:4}, 1, exec_state); |
| + CheckScopeChainNames([undefined, "closure_3", undefined, undefined], exec_state) |
| }; |
| closure_3(1, 2)(); |
| EndTest(); |
| @@ -600,6 +617,7 @@ listener_delegate = function(exec_state) { |
| debug.ScopeType.Script, |
| debug.ScopeType.Global], exec_state); |
| CheckScopeContent({a:1,b:2,x:3,y:4,f:function(){}}, 1, exec_state); |
| + CheckScopeChainNames([undefined, "closure_4", undefined, undefined], exec_state) |
| }; |
| closure_4(1, 2)(); |
| EndTest(); |
| @@ -629,6 +647,7 @@ listener_delegate = function(exec_state) { |
| debug.ScopeType.Script, |
| debug.ScopeType.Global], exec_state); |
| CheckScopeContent({a:1,b:2,x:3,y:4,f:function(){}}, 1, exec_state); |
| + CheckScopeChainNames(["f", "closure_5", undefined, undefined], exec_state) |
| }; |
| closure_5(1, 2)(); |
| EndTest(); |
| @@ -660,6 +679,7 @@ listener_delegate = function(exec_state) { |
| debug.ScopeType.Global], exec_state); |
| CheckScopeContent({a:1}, 1, exec_state); |
| CheckScopeContent({f:function(){}}, 2, exec_state); |
| + CheckScopeChainNames([undefined, "f", "closure_6", undefined, undefined], exec_state) |
| }; |
| closure_6(1, 2)(); |
| EndTest(); |
| @@ -696,6 +716,7 @@ listener_delegate = function(exec_state) { |
| CheckScopeContent({}, 0, exec_state); |
| CheckScopeContent({a:1,b:2,x:3,y:4,i:5,j:6}, 1, exec_state); |
| CheckScopeContent({a:1,b:2,x:3,y:4,i:5,j:6,f:function(){}}, 2, exec_state); |
| + CheckScopeChainNames([undefined, "f", "closure_7", undefined, undefined], exec_state) |
| }; |
| closure_7(1, 2)(); |
| EndTest(); |
| @@ -714,6 +735,7 @@ listener_delegate = function(exec_state) { |
| debug.ScopeType.Script, |
| debug.ScopeType.Global], exec_state); |
| CheckScopeContent({x: 2}, 0, exec_state); |
| + CheckScopeChainNames([undefined, undefined, undefined], exec_state) |
| }; |
| closure_8(); |
| EndTest(); |
| @@ -735,6 +757,7 @@ listener_delegate = function(exec_state) { |
| debug.ScopeType.Closure, |
| debug.ScopeType.Script, |
| debug.ScopeType.Global], exec_state); |
| + CheckScopeChainNames([undefined, "closure_9", undefined, undefined], exec_state) |
| }; |
| closure_9(); |
| EndTest(); |
| @@ -783,6 +806,7 @@ listener_delegate = function(exec_state) { |
| CheckScopeContent({j:13}, 3, exec_state); |
| CheckScopeContent({a:1,b:2,x:9,y:10,i:11,j:12}, 4, exec_state); |
| CheckScopeContent({a:1,b:2,x:3,y:4,i:5,j:6,f:function(){}}, 5, exec_state); |
| + CheckScopeChainNames([undefined, undefined, undefined, "f", "f", "the_full_monty", undefined, undefined], exec_state) |
| }; |
| the_full_monty(1, 2)(); |
| EndTest(); |
| @@ -830,6 +854,7 @@ listener_delegate = function(exec_state) { |
| CheckScopeContent({x: 3}, 0, exec_state); |
| CheckScopeContent({x: 2}, 1, exec_state); |
| CheckScopeContent({x: 1}, 2, exec_state); |
| + CheckScopeChainNames(["inner", "inner", "closure_in_with_2", "closure_in_with_2", undefined, undefined], exec_state) |
| }; |
| closure_in_with_2(); |
| EndTest(); |
| @@ -860,6 +885,7 @@ listener_delegate = function(exec_state) { |
| debug.ScopeType.Closure, |
| debug.ScopeType.Script, |
| debug.ScopeType.Global], exec_state); |
| + CheckScopeChainNames(["inner", "inner", "closure", "createClosure", undefined, undefined], exec_state) |
| } |
| closure_in_with_3(); |
| EndTest(); |
| @@ -873,6 +899,7 @@ listener_delegate = function(exec_state) { |
| debug.ScopeType.Global], exec_state); |
| CheckScopeContent({x: 2}, 0, exec_state); |
| CheckScopeContent({x: 1}, 1, exec_state); |
| + CheckScopeChainNames([undefined, undefined, undefined, undefined], exec_state) |
| }; |
| with({x:1}) { |
| @@ -887,6 +914,7 @@ EndTest(); |
| BeginTest("Global"); |
| listener_delegate = function(exec_state) { |
| CheckScopeChain([debug.ScopeType.Script, debug.ScopeType.Global], exec_state); |
| + CheckScopeChainNames([undefined, undefined], exec_state) |
| }; |
| debugger; |
| EndTest(); |
| @@ -908,6 +936,7 @@ listener_delegate = function(exec_state) { |
| debug.ScopeType.Script, |
| debug.ScopeType.Global], exec_state); |
| CheckScopeContent({e:'Exception'}, 0, exec_state); |
| + CheckScopeChainNames(["catch_block_1", undefined, undefined, undefined], exec_state) |
| }; |
| catch_block_1(); |
| EndTest(); |
| @@ -933,6 +962,7 @@ listener_delegate = function(exec_state) { |
| debug.ScopeType.Global], exec_state); |
| CheckScopeContent({n:10}, 0, exec_state); |
| CheckScopeContent({e:'Exception'}, 1, exec_state); |
| + CheckScopeChainNames(["catch_block_2", "catch_block_2", "catch_block_2", undefined, undefined], exec_state) |
| }; |
| catch_block_2(); |
| EndTest(); |
| @@ -958,6 +988,7 @@ listener_delegate = function(exec_state) { |
| debug.ScopeType.Global], exec_state); |
| CheckScopeContent({e:'Exception'}, 0, exec_state); |
| CheckScopeContent({y:78}, 1, exec_state); |
| + CheckScopeChainNames(["catch_block_3", "catch_block_3", undefined, undefined], exec_state) |
| }; |
| catch_block_3(); |
| EndTest(); |
| @@ -986,6 +1017,7 @@ listener_delegate = function(exec_state) { |
| CheckScopeContent({n:10}, 0, exec_state); |
| CheckScopeContent({e:'Exception'}, 1, exec_state); |
| CheckScopeContent({y:98}, 2, exec_state); |
| + CheckScopeChainNames(["catch_block_4", "catch_block_4", "catch_block_4", undefined, undefined], exec_state) |
| }; |
| catch_block_4(); |
| EndTest(); |
| @@ -998,6 +1030,7 @@ listener_delegate = function(exec_state) { |
| debug.ScopeType.Script, |
| debug.ScopeType.Global], exec_state); |
| CheckScopeContent({e:'Exception'}, 0, exec_state); |
| + CheckScopeChainNames([undefined, undefined, undefined], exec_state) |
| }; |
| try { |
| @@ -1018,6 +1051,7 @@ listener_delegate = function(exec_state) { |
| debug.ScopeType.Global], exec_state); |
| CheckScopeContent({x: 2}, 0, exec_state); |
| CheckScopeContent({e:'Exception'}, 1, exec_state); |
| + CheckScopeChainNames([undefined, undefined, undefined, undefined], exec_state) |
| }; |
| try { |
| @@ -1048,6 +1082,7 @@ listener_delegate = function(exec_state) { |
| debug.ScopeType.Script, |
| debug.ScopeType.Global], exec_state); |
| CheckScopeContent({e:'Exception'}, 0, exec_state); |
| + CheckScopeChainNames(["catch_block_7", undefined, undefined, undefined], exec_state) |
| }; |
| catch_block_7(); |
| EndTest(); |
| @@ -1061,6 +1096,7 @@ listener_delegate = function(exec_state) { |
| debug.ScopeType.Script, |
| debug.ScopeType.Global], exec_state); |
| CheckScopeContent({}, 1, exec_state); |
| + CheckScopeChainNames([undefined, undefined, undefined], exec_state) |
| }; |
| (function() { |