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

Unified Diff: test/mjsunit/debug-scopes.js

Issue 7890007: Fix scope iteration when debugging global code. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 9 years, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/runtime.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/mjsunit/debug-scopes.js
diff --git a/test/mjsunit/debug-scopes.js b/test/mjsunit/debug-scopes.js
index 40adf5b2d2a3f35b4e92f790144518a3043176c1..1c23b0bf998e777334d9d767bdc860c601e855e6 100644
--- a/test/mjsunit/debug-scopes.js
+++ b/test/mjsunit/debug-scopes.js
@@ -418,6 +418,27 @@ with_5();
EndTest();
+// Nested with blocks using existing object in global code.
+BeginTest("With 6");
+listener_delegate = function(exec_state) {
+ CheckScopeChain([debug.ScopeType.With,
+ debug.ScopeType.With,
+ debug.ScopeType.Global], exec_state);
+ CheckScopeContent(with_object, 0, exec_state);
+ CheckScopeContent(with_object, 1, exec_state);
+ assertEquals(exec_state.frame().scope(0).scopeObject(), exec_state.frame().scope(1).scopeObject());
+ assertEquals(with_object, exec_state.frame().scope(1).scopeObject().value());
+};
+
+var with_object = {c:3,d:4};
+with(with_object) {
+ with(with_object) {
+ debugger;
+ }
+}
+EndTest();
+
+
// Simple closure formed by returning an inner function referering the outer
// functions arguments.
BeginTest("Closure 1");
@@ -771,6 +792,23 @@ closure_in_with_3();
EndTest();
+BeginTest("Closure inside With 4");
+listener_delegate = function(exec_state) {
+ CheckScopeChain([debug.ScopeType.Local,
+ debug.ScopeType.With,
+ debug.ScopeType.Global], exec_state);
+ CheckScopeContent({x: 2}, 0, exec_state);
+ CheckScopeContent({x: 1}, 1, exec_state);
+};
+
+with({x:1}) {
+ (function(x) {
+ debugger;
+ })(2);
+}
+EndTest();
+
+
// Test global scope.
BeginTest("Global");
listener_delegate = function(exec_state) {
@@ -875,6 +913,43 @@ catch_block_4();
EndTest();
+// Test catch in global scope.
+BeginTest("Catch block 5");
+listener_delegate = function(exec_state) {
+ CheckScopeChain([debug.ScopeType.Catch,
+ debug.ScopeType.Global], exec_state);
+ CheckScopeContent({e:'Exception'}, 0, exec_state);
+};
+
+try {
+ throw 'Exception';
+} catch (e) {
+ debugger;
+}
+
+EndTest();
+
+
+// Closure inside catch in global code.
+BeginTest("Catch block 6");
+listener_delegate = function(exec_state) {
+ CheckScopeChain([debug.ScopeType.Local,
+ debug.ScopeType.Catch,
+ debug.ScopeType.Global], exec_state);
+ CheckScopeContent({x: 2}, 0, exec_state);
+ CheckScopeContent({e:'Exception'}, 1, exec_state);
+};
+
+try {
+ throw 'Exception';
+} catch (e) {
+ (function(x) {
+ debugger;
+ })(2);
+}
+EndTest();
+
+
assertEquals(begin_test_count, break_count,
'one or more tests did not enter the debugger');
assertEquals(begin_test_count, end_test_count,
« no previous file with comments | « src/runtime.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698