WebCore:
authorandersca <andersca@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 2 May 2006 07:25:09 +0000 (07:25 +0000)
committerandersca <andersca@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 2 May 2006 07:25:09 +0000 (07:25 +0000)
2006-05-02  Anders Carlsson  <andersca@mac.com>

        Reviewed by Dave Hyatt.

        http://bugzilla.opendarwin.org/show_bug.cgi?id=8688
        file URLs aren't being serialized correctly when using window.location

        * platform/KURL.cpp:
        (KURL::prettyURL):
        Append "//" for file URLs.

LayoutTests:

2006-05-02  Anders Carlsson  <andersca@mac.com>

        Reviewed by Dave Hyatt.

        Test case for http://bugzilla.opendarwin.org/show_bug.cgi?id=8688
        file URLs aren't being serialized correctly when using window.location

        * fast/js/window-location-href-file-urls-expected.txt: Added.
        * fast/js/window-location-href-file-urls.html: Added.

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

LayoutTests/ChangeLog
LayoutTests/fast/js/window-location-href-file-urls-expected.txt [new file with mode: 0644]
LayoutTests/fast/js/window-location-href-file-urls.html [new file with mode: 0644]
WebCore/ChangeLog
WebCore/platform/KURL.cpp

index 2589846f6554444b029d7ee8f9fbe6067f121565..684684cb368f14391333e3b9a2bcf822feba0761 100644 (file)
@@ -1,3 +1,13 @@
+2006-05-02  Anders Carlsson  <andersca@mac.com>
+
+        Reviewed by Dave Hyatt.
+        
+        Test case for http://bugzilla.opendarwin.org/show_bug.cgi?id=8688
+        file URLs aren't being serialized correctly when using window.location
+        
+        * fast/js/window-location-href-file-urls-expected.txt: Added.
+        * fast/js/window-location-href-file-urls.html: Added.
+        
 2006-04-28  Justin Garcia  <justin.garcia@apple.com>
 
         Reviewed by darin
diff --git a/LayoutTests/fast/js/window-location-href-file-urls-expected.txt b/LayoutTests/fast/js/window-location-href-file-urls-expected.txt
new file mode 100644 (file)
index 0000000..83d5cad
--- /dev/null
@@ -0,0 +1,3 @@
+This tests that window.location.href serializes file urls correctly. If the test is successful, the text "SUCCESS" should be shown below.
+SUCCESS
+
diff --git a/LayoutTests/fast/js/window-location-href-file-urls.html b/LayoutTests/fast/js/window-location-href-file-urls.html
new file mode 100644 (file)
index 0000000..04dd76a
--- /dev/null
@@ -0,0 +1,28 @@
+<html>
+<head>
+<script>
+function debug(str) {
+       var d = document.getElementById('console');
+       d.appendChild(document.createTextNode(str));
+}
+
+function runTests() {
+       if (window.layoutTestController)
+               layoutTestController.dumpAsText();
+               
+       var str = window.location.href;
+       
+       if (str.substr(0, 17) == 'file://localhost/' ||
+           str.substr(0, 8) == 'file:///')
+               debug('SUCCESS');
+       else
+               debug('FAILURE. String is ' + str);
+}
+</script>
+</head>
+<body onload="runTests();">
+This tests that window.location.href serializes file urls correctly. If the test is successful, the text "SUCCESS" should be shown below.
+<pre id="console">
+</pre>
+</body>
+</html>
index 4656eabb23fa8f75b99ac1b273562cafe11d9391..d3ff1854d0e18d54b0c5404553cbedf36534d3a4 100644 (file)
@@ -1,3 +1,14 @@
+2006-05-02  Anders Carlsson  <andersca@mac.com>
+
+        Reviewed by Dave Hyatt.
+        
+        http://bugzilla.opendarwin.org/show_bug.cgi?id=8688
+        file URLs aren't being serialized correctly when using window.location
+        
+        * platform/KURL.cpp:
+        (KURL::prettyURL):
+        Append "//" for file URLs.
+        
 2006-05-01  David Hyatt  <hyatt@apple.com>
 
         Convert WebTextRenderer to be a C++ class.  Change the factory so
index 888139e9cf4dfa976a3c6e586ef69b49276ef3b0..763443275fce0ace48f98f74e8d84c18dff73f97 100644 (file)
@@ -694,9 +694,10 @@ DeprecatedString KURL::prettyURL() const
         }
     }
 
-    if (!authority.isEmpty()) {
+    if (!authority.isEmpty())
         result += "//" + authority;
-    }
+    else if (protocol() == "file")
+        result += "//";
 
     result += path();
     result += query();