Index: test/mjsunit/regress/regress-crbug-171715.js |
diff --git a/test/mjsunit/regress/regress-crbug-222893.js b/test/mjsunit/regress/regress-crbug-171715.js |
similarity index 55% |
copy from test/mjsunit/regress/regress-crbug-222893.js |
copy to test/mjsunit/regress/regress-crbug-171715.js |
index d5baa7b2579b9330231dc7e3329b42aa1a579a60..040c381e399385c556c4a2aa72fa4a78d2b85cde 100644 |
--- a/test/mjsunit/regress/regress-crbug-222893.js |
+++ b/test/mjsunit/regress/regress-crbug-171715.js |
@@ -30,13 +30,38 @@ |
Debug = debug.Debug |
var error = null; |
-var array = ["a", "b", "c"]; |
+var test = 0; |
+ |
+function check_v(expected, exec_state, frame_id) { |
+ assertEquals(expected, exec_state.frame(frame_id).evaluate('v').value()); |
+} |
function listener(event, exec_state, event_data, data) { |
try { |
- if (event == Debug.DebugEvent.Break) { |
- assertArrayEquals(array, |
+ if (event != Debug.DebugEvent.Break) return; |
+ test++; |
+ if (test == 1) { |
+ check_v('inner0', exec_state, 0); |
+ check_v('inner0', exec_state, 1); |
+ check_v('outer', exec_state, 2); |
+ assertArrayEquals(["a", "b", "c"], |
+ exec_state.frame(0).evaluate('arguments').value()); |
+ } else if (test == 2) { |
+ check_v('inner1', exec_state, 0); |
+ check_v('inner1', exec_state, 1); |
+ check_v('outer', exec_state, 2); |
+ assertArrayEquals(["a", "b", "c"], |
exec_state.frame(0).evaluate('arguments').value()); |
+ } else { |
+ assertEquals(3, test); |
+ check_v('inner2', exec_state, 0); |
+ check_v('inner1', exec_state, 1); |
+ check_v('inner1', exec_state, 2); |
+ check_v('outer', exec_state, 3); |
+ assertArrayEquals(["x", "y", "z"], |
+ exec_state.frame(0).evaluate('arguments').value()); |
+ assertArrayEquals(["a", "b", "c"], |
+ exec_state.frame(1).evaluate('arguments').value()); |
} |
} catch (e) { |
error = e; |
@@ -45,20 +70,18 @@ function listener(event, exec_state, event_data, data) { |
Debug.setListener(listener); |
- |
-function f(a, b) { |
- arguments; |
- debugger; // Arguments object is already materialized. |
-} |
- |
-f.apply(this, array); |
-f("a", "b", "c"); |
+var v = 'outer'; |
+(function() { // Test 1 and 2 |
+ var v = 'inner0'; |
+ eval("debugger; var v = 'inner1'; debugger;"); |
+ assertEquals('inner1', v); // Overwritten by local eval. |
+})("a", "b", "c"); |
assertNull(error); |
-function g(a, b) { |
- debugger; // Arguments object is not yet materialized. |
-} |
-g.apply(this, array); |
-g("a", "b", "c"); |
+(function() { // Test 3 |
+ var v = 'inner0'; // Local eval overwrites this value. |
+ eval("var v = 'inner1'; " + |
+ "(function() { var v = 'inner2'; debugger; })('x', 'y', 'z');"); |
+ assertEquals('inner1', v); // Overwritten by local eval. |
+})("a", "b", "c"); |
assertNull(error); |
- |