REGRESSION: for/in loop with var changes global variable instead of making local
* fast/js/for-in-var-scope.html: Added.
* fast/js/resources/for-in-var-scope.js: Added.
* fast/js/for-in-var-scope-expected.txt: Added.
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@12565
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2006-02-03 Darin Adler <darin@apple.com>
+
+ - test for http://bugzilla.opendarwin.org/show_bug.cgi?id=5210
+ REGRESSION: for/in loop with var changes global variable instead of making local
+
+ * fast/js/for-in-var-scope.html: Added.
+ * fast/js/resources/for-in-var-scope.js: Added.
+ * fast/js/for-in-var-scope-expected.txt: Added.
+
2006-02-03 Darin Adler <darin@apple.com>
- updated test result due to revised fix for <ol> number
--- /dev/null
+This tests that for/in statements properly scope a variable that's declared in one. In previous versions of JavaScriptCore there were two bugs that caused problems. First, the loop variable declaration would not be processed. Second, the code to set the loop variable would incorrectly walk the scope chain even after setting the loop variable.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS i is 'start i'
+PASS j is 'propName'
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
--- /dev/null
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<link rel="stylesheet" href="resources/js-test-style.css">
+<script src="resources/js-test-pre.js"></script>
+</head>
+<body>
+<p id="description"></p>
+<div id="console"></div>
+<script src="resources/for-in-var-scope.js"></script>
+<script src="resources/js-test-post.js"></script>
+</body>
+</html>
--- /dev/null
+description(
+"This tests that for/in statements properly scope a variable that's declared in one. "
++ "In previous versions of JavaScriptCore there were two bugs that caused problems. "
++ "First, the loop variable declaration would not be processed. "
++ "Second, the code to set the loop variable would incorrectly walk the scope chain even after setting the loop variable."
+);
+
+var i = "start i";
+var j = "start j";
+
+function func() {
+ var object = new Object;
+ object.propName = "propValue";
+ for (var i in object) { j = i; }
+}
+func();
+
+shouldBe("i", "'start i'");
+shouldBe("j", "'propName'");
+
+var successfullyParsed = true;