Title: [127323] trunk/LayoutTests
Revision
127323
Author
[email protected]
Date
2012-08-31 14:47:01 -0700 (Fri, 31 Aug 2012)

Log Message

Use one object instead of two for closures, eliminating ScopeChainNode
https://bugs.webkit.org/show_bug.cgi?id=95501

Reviewed by Sam Weinig.

Adding a test to demonstrate the behavior change in this patch.

* fast/js/function-constructor-this-value-expected.txt: Added.
* fast/js/function-constructor-this-value.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (127322 => 127323)


--- trunk/LayoutTests/ChangeLog	2012-08-31 21:34:39 UTC (rev 127322)
+++ trunk/LayoutTests/ChangeLog	2012-08-31 21:47:01 UTC (rev 127323)
@@ -1,3 +1,15 @@
+2012-08-31  Geoffrey Garen  <[email protected]>
+
+        Use one object instead of two for closures, eliminating ScopeChainNode
+        https://bugs.webkit.org/show_bug.cgi?id=95501
+
+        Reviewed by Sam Weinig.
+
+        Adding a test to demonstrate the behavior change in this patch.
+
+        * fast/js/function-constructor-this-value-expected.txt: Added.
+        * fast/js/function-constructor-this-value.html: Added.
+
 2012-08-31  Jon Lee  <[email protected]>
 
         ondisplay event handlers are not called

Added: trunk/LayoutTests/fast/js/function-constructor-this-value-expected.txt (0 => 127323)


--- trunk/LayoutTests/fast/js/function-constructor-this-value-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/js/function-constructor-this-value-expected.txt	2012-08-31 21:47:01 UTC (rev 127323)
@@ -0,0 +1,5 @@
+This tests verifies that the Function constructor creates functions with the correct 'this' and 'window' in scope.
+
+PASS: result['this'].location.href should be about:blank and is.
+PASS: result['window'].location.href should be about:blank and is.
+

Added: trunk/LayoutTests/fast/js/function-constructor-this-value.html (0 => 127323)


--- trunk/LayoutTests/fast/js/function-constructor-this-value.html	                        (rev 0)
+++ trunk/LayoutTests/fast/js/function-constructor-this-value.html	2012-08-31 21:47:01 UTC (rev 127323)
@@ -0,0 +1,37 @@
+<p>This tests verifies that the Function constructor creates functions
+	with the correct 'this' and 'window' in scope.
+</p>
+<pre id="console"></pre>
+
+<script>
+function log(s)
+{
+	document.getElementById("console").appendChild(document.createTextNode(s + "\n"));
+}
+
+function shouldBe(a, aDescription, b)
+{
+	if (a == b) {
+		log("PASS: " + aDescription + " should be " + b + " and is.");
+		return;
+	}
+	log("FAIL: " + aDescription + " should be " + b + " but instead is " + a + ".");
+}
+
+if (window.testRunner) {
+	testRunner.dumpAsText();
+	testRunner.waitUntilDone();
+    testRunner.setCanOpenWindows();
+    testRunner.setCloseRemainingWindowsWhenComplete(true);
+}
+
+var target = open("about:blank");
+var result = (target.Function("", "return { 'this': this, 'window': window };"))();
+target.close();
+
+shouldBe(result['this'].location.href, "result['this'].location.href", "about:blank");
+shouldBe(result['window'].location.href, "result['window'].location.href", "about:blank");
+
+if (window.testRunner)
+	testRunner.notifyDone();
+</script>
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to