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

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

Issue 6804015: Debugger: show local scope before with in scope chain for functions created inside with block (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 9 years, 8 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
===================================================================
--- test/mjsunit/debug-scopes.js (revision 7514)
+++ test/mjsunit/debug-scopes.js (working copy)
@@ -144,6 +144,10 @@
if (!scope.scopeObject().property('.catch-var').isUndefined()) {
scope_size--;
}
+ // Skip property with empty name.
+ if (!scope.scopeObject().property('').isUndefined()) {
+ scope_size--;
+ }
if (count != scope_size) {
print('Names found in scope:');
@@ -607,6 +611,43 @@
EndTest();
+// Closure that may be optimized out.
+BeginTest("Closure 8");
+function closure_8() {
+ (function inner(x) {
+ debugger;
+ })(2);
+}
+
+listener_delegate = function(exec_state) {
+ CheckScopeChain([debug.ScopeType.Local,
+ debug.ScopeType.Global], exec_state);
+ CheckScopeContent({x: 2}, 0, exec_state);
+}
+closure_8();
+EndTest();
+
+
+BeginTest("Closure 9");
+function closure_9() {
+ eval("var y = 1;");
+ eval("var z = 1;");
+ (function inner(x) {
+ y++;
+ z++;
+ debugger;
+ })(2);
+}
+
+listener_delegate = function(exec_state) {
+ CheckScopeChain([debug.ScopeType.Local,
+ debug.ScopeType.Closure,
+ debug.ScopeType.Global], exec_state);
+}
+closure_9();
+EndTest();
+
+
// Test a mixture of scopes.
BeginTest("The full monty");
function the_full_monty(a, b) {
@@ -653,6 +694,81 @@
the_full_monty(1, 2)()
EndTest();
+
+BeginTest("Closure inside With 1");
+function closure_in_with_1() {
+ with({x:1}) {
+ (function inner(x) {
+ debugger;
+ })(2);
+ }
+}
+
+listener_delegate = function(exec_state) {
+ CheckScopeChain([debug.ScopeType.Local,
+ debug.ScopeType.With,
+ debug.ScopeType.Closure,
+ debug.ScopeType.Global], exec_state);
+ CheckScopeContent({x: 2}, 0, exec_state);
+}
+closure_in_with_1();
+EndTest();
+
+
+BeginTest("Closure inside With 2");
+function closure_in_with_2() {
+ with({x:1}) {
+ (function inner(x) {
+ with({x:3}) {
+ debugger;
+ }
+ })(2);
+ }
+}
+
+listener_delegate = function(exec_state) {
+ CheckScopeChain([debug.ScopeType.With,
+ debug.ScopeType.Local,
+ debug.ScopeType.With,
+ debug.ScopeType.Closure,
+ debug.ScopeType.Global], exec_state);
+ CheckScopeContent({x: 3}, 0, exec_state);
+ CheckScopeContent({x: 2}, 1, exec_state);
+ CheckScopeContent({x: 1}, 2, exec_state);
+}
+closure_in_with_2();
+EndTest();
+
+
+BeginTest("Closure inside With 3");
+function createClosure(a) {
+ var b = a + 1;
+ return function closure() {
+ var c = b;
+ (function inner(x) {
+ with({x:c}) {
+ debugger;
+ }
+ })(2);
+ }
+}
+
+function closure_in_with_3() {
+ var f = createClosure(0);
+ f();
+}
+
+listener_delegate = function(exec_state) {
+ CheckScopeChain([debug.ScopeType.With,
+ debug.ScopeType.Local,
+ debug.ScopeType.Closure,
+ debug.ScopeType.Closure,
+ debug.ScopeType.Global], exec_state);
+}
+closure_in_with_3();
+EndTest();
+
+
// Test global scope.
BeginTest("Global");
listener_delegate = function(exec_state) {
« 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