Index: test/mjsunit/debug-stepout-scope.js |
diff --git a/test/mjsunit/debug-stepout-scope-part8.js b/test/mjsunit/debug-stepout-scope.js |
similarity index 58% |
rename from test/mjsunit/debug-stepout-scope-part8.js |
rename to test/mjsunit/debug-stepout-scope.js |
index f91fab5e4df0220abc84dcf60e2bf50e19ba1b6e..9c040da93242e35e52796806bf6aaff8ac4af08d 100644 |
--- a/test/mjsunit/debug-stepout-scope-part8.js |
+++ b/test/mjsunit/debug-stepout-scope.js |
@@ -53,6 +53,191 @@ function listener(event, exec_state, event_data, data) { |
Debug.setListener(listener); |
+function test1() { |
+ debugger; |
+ with ({x:1}) { |
+ x = 2; |
+ } |
+} |
+test1(); |
+ |
+ |
+function test2() { |
+ if (true) { |
+ with ({}) { |
+ debugger; |
+ } |
+ } else { |
+ with ({}) { |
+ return 10; |
+ } |
+ } |
+} |
+test2(); |
+ |
+ |
+function test3() { |
+ if (true) { |
+ debugger; |
+ } else { |
+ with ({}) { |
+ return 10; |
+ } |
+ } |
+} |
+test3(); |
+ |
+ |
+function test4() { |
+ debugger; |
+ with ({x:1}) x = 1 |
+} |
+test4(); |
+ |
+ |
+function test5() { |
+ debugger; |
+ var dummy = 1; |
+ with ({}) { |
+ with ({}) { |
+ dummy = 2; |
+ } |
+ } |
+ dummy = 3; |
+} |
+test5(); |
+ |
+ |
+function test6() { |
+ debugger; |
+ try { |
+ throw 'stuff'; |
+ } catch (e) { |
+ e = 1; |
+ } |
+} |
+test6(); |
+ |
+ |
+function test7() { |
+ debugger; |
+ function foo() {} |
+} |
+test7(); |
+ |
+ |
+function test8() { |
+ debugger; |
+ (function foo() {})(); |
+} |
+test8(); |
+ |
+ |
+var q = 42; |
+var prefixes = [ "debugger; ", |
+ "if (false) { try { throw 0; } catch(x) { return x; } }; debugger; " ]; |
+var bodies = [ "1", |
+ "1 ", |
+ "1;", |
+ "1; ", |
+ "q", |
+ "q ", |
+ "q;", |
+ "q; ", |
+ "try { throw 'stuff' } catch (e) { e = 1; }", |
+ "try { throw 'stuff' } catch (e) { e = 1; } ", |
+ "try { throw 'stuff' } catch (e) { e = 1; };", |
+ "try { throw 'stuff' } catch (e) { e = 1; }; " ]; |
+var with_bodies = [ "with ({}) {}", |
+ "with ({x:1}) x", |
+ "with ({x:1}) x = 1", |
+ "with ({x:1}) x ", |
+ "with ({x:1}) x = 1 ", |
+ "with ({x:1}) x;", |
+ "with ({x:1}) x = 1;", |
+ "with ({x:1}) x; ", |
+ "with ({x:1}) x = 1; " ]; |
+ |
+ |
+function test9() { |
+ debugger; |
+ for (var i = 0; i < prefixes.length; ++i) { |
+ var pre = prefixes[i]; |
+ for (var j = 0; j < bodies.length; ++j) { |
+ var body = bodies[j]; |
+ eval(pre + body); |
+ eval("'use strict'; " + pre + body); |
+ } |
+ for (var j = 0; j < with_bodies.length; ++j) { |
+ var body = with_bodies[j]; |
+ eval(pre + body); |
+ } |
+ } |
+} |
+test9(); |
+ |
+ |
+function test10() { |
+ debugger; |
+ with ({}) { |
+ return 10; |
+ } |
+} |
+test10(); |
+ |
+ |
+function test11() { |
+ debugger; |
+ try { |
+ throw 'stuff'; |
+ } catch (e) { |
+ return 10; |
+ } |
+} |
+test11(); |
+ |
+ |
+// Test global eval and function constructor. |
+for (var i = 0; i < prefixes.length; ++i) { |
+ var pre = prefixes[i]; |
+ for (var j = 0; j < bodies.length; ++j) { |
+ var body = bodies[j]; |
+ eval(pre + body); |
+ eval("'use strict'; " + pre + body); |
+ Function(pre + body)(); |
+ } |
+ for (var j = 0; j < with_bodies.length; ++j) { |
+ var body = with_bodies[j]; |
+ eval(pre + body); |
+ Function(pre + body)(); |
+ } |
+} |
+ |
+ |
+try { |
+ with({}) { |
+ debugger; |
+ eval("{}$%:^"); |
+ } |
+} catch(e) { |
+ nop(); |
+} |
+ |
+// Return from function constructed with Function constructor. |
+var anon = 12; |
+for (var i = 0; i < prefixes.length; ++i) { |
+ var pre = prefixes[i]; |
+ Function(pre + "return 42")(); |
+ Function(pre + "return 42 ")(); |
+ Function(pre + "return 42;")(); |
+ Function(pre + "return 42; ")(); |
+ Function(pre + "return anon")(); |
+ Function(pre + "return anon ")(); |
+ Function(pre + "return anon;")(); |
+ Function(pre + "return anon; ")(); |
+} |
+ |
+ |
function nop() {} |
@@ -232,3 +417,7 @@ function stress() { |
} |
stress(); |
+ |
+ |
+// With block as the last(!) statement in global code. |
+with ({}) { debugger; } |