Index: test/mjsunit/debug-scopes.js |
=================================================================== |
--- test/mjsunit/debug-scopes.js (revision 2839) |
+++ test/mjsunit/debug-scopes.js (working copy) |
@@ -140,6 +140,11 @@ |
if (!scope.scopeObject().property('arguments').isUndefined()) { |
scope_size--; |
} |
+ // Also ignore synthetic variable from catch block. |
+ if (!scope.scopeObject().property('.catch-var').isUndefined()) { |
+ scope_size--; |
+ } |
+ |
if (count != scope_size) { |
print('Names found in scope:'); |
var names = scope.scopeObject().propertyNames(); |
@@ -656,5 +661,101 @@ |
debugger; |
EndTest(); |
+ |
+BeginTest("Catch block 1"); |
+function catch_block_1() { |
+ try { |
+ throw 'Exception'; |
+ } catch (e) { |
+ debugger; |
+ } |
+}; |
+ |
+ |
+listener_delegate = function(exec_state) { |
+ CheckScopeChain([debug.ScopeType.Catch, |
+ debug.ScopeType.Local, |
+ debug.ScopeType.Global], exec_state); |
+ CheckScopeContent({e:'Exception'}, 0, exec_state); |
+} |
+catch_block_1() |
+EndTest(); |
+ |
+ |
+BeginTest("Catch block 2"); |
+function catch_block_2() { |
+ try { |
+ throw 'Exception'; |
+ } catch (e) { |
+ with({n:10}) { |
+ debugger; |
+ } |
+ } |
+}; |
+ |
+ |
+listener_delegate = function(exec_state) { |
+ CheckScopeChain([debug.ScopeType.With, |
+ debug.ScopeType.Catch, |
+ debug.ScopeType.Local, |
+ debug.ScopeType.Global], exec_state); |
+ CheckScopeContent({n:10}, 0, exec_state); |
+ CheckScopeContent({e:'Exception'}, 1, exec_state); |
+} |
+catch_block_2() |
+EndTest(); |
+ |
+ |
+BeginTest("Catch block 3"); |
+function catch_block_1() { |
+ // Do eval to dynamically declare a local variable so that the context's |
+ // extension slot is initialized with JSContextExtensionObject. |
+ eval("var y = 78;"); |
+ try { |
+ throw 'Exception'; |
+ } catch (e) { |
+ debugger; |
+ } |
+}; |
+ |
+ |
+listener_delegate = function(exec_state) { |
+ CheckScopeChain([debug.ScopeType.Catch, |
+ debug.ScopeType.Local, |
+ debug.ScopeType.Global], exec_state); |
+ CheckScopeContent({e:'Exception'}, 0, exec_state); |
+ CheckScopeContent({y:78}, 1, exec_state); |
+} |
+catch_block_1() |
+EndTest(); |
+ |
+ |
+BeginTest("Catch block 4"); |
+function catch_block_2() { |
+ // Do eval to dynamically declare a local variable so that the context's |
+ // extension slot is initialized with JSContextExtensionObject. |
+ eval("var y = 98;"); |
+ try { |
+ throw 'Exception'; |
+ } catch (e) { |
+ with({n:10}) { |
+ debugger; |
+ } |
+ } |
+}; |
+ |
+listener_delegate = function(exec_state) { |
+ CheckScopeChain([debug.ScopeType.With, |
+ debug.ScopeType.Catch, |
+ debug.ScopeType.Local, |
+ debug.ScopeType.Global], exec_state); |
+ CheckScopeContent({n:10}, 0, exec_state); |
+ CheckScopeContent({e:'Exception'}, 1, exec_state); |
+ CheckScopeContent({y:98}, 2, exec_state); |
+} |
+catch_block_2() |
+EndTest(); |
+ |
+ |
assertEquals(begin_test_count, break_count, 'one or more tests did not enter the debugger'); |
assertEquals(begin_test_count, end_test_count, 'one or more tests did not have its result checked'); |