2009-02-23 Gustavo Noronha Silva <gns@gnome.org>
authorkov@webkit.org <kov@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 23 Feb 2009 15:08:10 +0000 (15:08 +0000)
committerkov@webkit.org <kov@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 23 Feb 2009 15:08:10 +0000 (15:08 +0000)
        Reviewed by Alexey Proskuryakov.

        https://bugs.webkit.org/show_bug.cgi?id=24011
        KURL's setPort doesn't unset port if 0 is given

        Adding regression tests for change done on KURL's setPort in
        r41076. It is worth noting that Firefox doesn't render this test
        correctly since it raises an exception when javascript tries to
        change the iframe's contentWindow.location.port, though other
        properties are modifiable.

        * fast/loader/location-port-expected.txt: Added.
        * fast/loader/location-port.html: Added.
        * fast/loader/resources/location-port-iframe.html: Added.

Also added bug URL to the WebCore entry for the r41076 change.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@41146 268f45cc-cd09-0410-ab3c-d52691b4dbfc

LayoutTests/ChangeLog
LayoutTests/fast/loader/location-port-expected.txt [new file with mode: 0644]
LayoutTests/fast/loader/location-port.html [new file with mode: 0644]
LayoutTests/fast/loader/resources/location-port-iframe.html [new file with mode: 0644]
WebCore/ChangeLog

index d06c896..fa8e81b 100644 (file)
@@ -1,3 +1,20 @@
+2009-02-23  Gustavo Noronha Silva  <gns@gnome.org>
+
+        Reviewed by Alexey Proskuryakov.
+
+        https://bugs.webkit.org/show_bug.cgi?id=24011
+        KURL's setPort doesn't unset port if 0 is given
+
+        Adding regression tests for change done on KURL's setPort in
+        r41076. It is worth noting that Firefox doesn't render this test
+        correctly since it raises an exception when javascript tries to
+        change the iframe's contentWindow.location.port, though other
+        properties are modifiable.
+
+        * fast/loader/location-port-expected.txt: Added.
+        * fast/loader/location-port.html: Added.
+        * fast/loader/resources/location-port-iframe.html: Added.
+
 2009-02-23  Alexey Proskuryakov  <ap@webkit.org>
 
         Rubber-stamped by Mark Rowe.
diff --git a/LayoutTests/fast/loader/location-port-expected.txt b/LayoutTests/fast/loader/location-port-expected.txt
new file mode 100644 (file)
index 0000000..32fab6e
--- /dev/null
@@ -0,0 +1,6 @@
+This tests that modifying location.port works as it should
+
+PASS: internalFrame.contentWindow.location.port == "" should be true and is.
+PASS: internalFrame.contentWindow.location.port == "88" should be true and is.
+PASS: internalFrame.contentWindow.location.port == "" should be true and is.
+PASS: internalFrame.contentWindow.location.port == "80" should be true and is.
diff --git a/LayoutTests/fast/loader/location-port.html b/LayoutTests/fast/loader/location-port.html
new file mode 100644 (file)
index 0000000..23fa7cf
--- /dev/null
@@ -0,0 +1,74 @@
+<html>
+<head>
+<script>
+    function print(message, color)
+    {
+        var paragraph = document.createElement("div");
+        paragraph.appendChild(document.createTextNode(message));
+        paragraph.style.fontFamily = "monospace";
+        if (color)
+            paragraph.style.color = color;
+            document.getElementById("console").appendChild(paragraph);
+    }
+
+    function shouldBe(a, b)
+    {
+        var internalFrame = document.getElementById ('internal');
+
+        var evalA = eval(a);
+        if (evalA == b)
+            print("PASS: " + a + " should be " + b + " and is.", "green");
+        else {
+            print("FAIL: " + a + " should be " + b + " but instead is " + evalA + ".", "red");
+        }
+    }
+
+    function checkTest1() {
+        var internalFrame = document.getElementById ('internal');
+        shouldBe('internalFrame.contentWindow.location.port == "88"', true);
+
+        internalFrame.contentWindow.location.port = 0;
+        setTimeout(checkTest2, 300);
+    }
+
+    function checkTest2() {
+        var internalFrame = document.getElementById ('internal');
+        shouldBe('internalFrame.contentWindow.location.port == ""', true);
+
+        internalFrame.contentWindow.location.port = 80;
+        setTimeout(checkTest3, 300);
+    }
+
+    function checkTest3() {
+        var internalFrame = document.getElementById ('internal');
+        shouldBe('internalFrame.contentWindow.location.port == "80"', true);
+
+        if (window.layoutTestController)
+            layoutTestController.notifyDone();
+    }
+
+    function runTests() {
+        if (window.layoutTestController) {
+            layoutTestController.clearBackForwardList();
+            layoutTestController.dumpAsText();
+            layoutTestController.waitUntilDone();
+        }
+
+        var internalFrame = document.getElementById ('internal');
+        shouldBe('internalFrame.contentWindow.location.port == ""', true);
+
+        internalFrame.contentWindow.location.port = 88;
+        setTimeout(checkTest1, 300);
+    };
+    </script>
+</head>
+<body onload="runTests();">
+<p>This tests that modifying location.port works as it should</p>
+
+<iframe id="internal" style="display: none;" src="resources/location-port-iframe.html" width="0" height="0">
+</iframe>
+
+<div id="console">
+</div>
+</body>
+</html>
diff --git a/LayoutTests/fast/loader/resources/location-port-iframe.html b/LayoutTests/fast/loader/resources/location-port-iframe.html
new file mode 100644 (file)
index 0000000..eb1350a
--- /dev/null
@@ -0,0 +1,5 @@
+<html>
+<head>
+<body>
+</body>
+</html>
index 961bc0f..fb2efab 100644 (file)
 
         Reviewed by Alexey Proskuryakov.
 
+        https://bugs.webkit.org/show_bug.cgi?id=24011
+        KURL's setPort doesn't unset port if 0 is given
+
         Make setPort remove port if 0 is given to it, as promised by the
         comment in KURL's header.