Title: [205526] trunk
Revision
205526
Author
achristen...@apple.com
Date
2016-09-06 17:10:21 -0700 (Tue, 06 Sep 2016)

Log Message

Fix query-only and fragment-only relative URLs when using URLParser
https://bugs.webkit.org/show_bug.cgi?id=161657

Reviewed by Tim Horton.

Source/WebCore:

Covered by new API tests and progress towards passing the web platform tests when using URLParser.

* platform/URLParser.cpp:
(WebCore::URLParser::parse):

Tools:

* TestWebKitAPI/Tests/WebCore/URLParser.cpp:
(TestWebKitAPI::TEST_F):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (205525 => 205526)


--- trunk/Source/WebCore/ChangeLog	2016-09-07 00:01:14 UTC (rev 205525)
+++ trunk/Source/WebCore/ChangeLog	2016-09-07 00:10:21 UTC (rev 205526)
@@ -1,3 +1,15 @@
+2016-09-06  Alex Christensen  <achristen...@webkit.org>
+
+        Fix query-only and fragment-only relative URLs when using URLParser
+        https://bugs.webkit.org/show_bug.cgi?id=161657
+
+        Reviewed by Tim Horton.
+
+        Covered by new API tests and progress towards passing the web platform tests when using URLParser.
+
+        * platform/URLParser.cpp:
+        (WebCore::URLParser::parse):
+
 2016-09-06  Chris Dumez  <cdu...@apple.com>
 
         Add support for input.minLength / textArea.minLength

Modified: trunk/Source/WebCore/platform/URLParser.cpp (205525 => 205526)


--- trunk/Source/WebCore/platform/URLParser.cpp	2016-09-07 00:01:14 UTC (rev 205525)
+++ trunk/Source/WebCore/platform/URLParser.cpp	2016-09-07 00:10:21 UTC (rev 205526)
@@ -517,11 +517,13 @@
                 break;
             case '?':
                 copyURLPartsUntil(base, URLPart::PathEnd);
+                m_buffer.append('?');
                 state = State::Query;
                 ++c;
                 break;
             case '#':
                 copyURLPartsUntil(base, URLPart::QueryEnd);
+                m_buffer.append('#');
                 state = State::Fragment;
                 ++c;
                 break;

Modified: trunk/Tools/ChangeLog (205525 => 205526)


--- trunk/Tools/ChangeLog	2016-09-07 00:01:14 UTC (rev 205525)
+++ trunk/Tools/ChangeLog	2016-09-07 00:10:21 UTC (rev 205526)
@@ -1,5 +1,15 @@
 2016-09-06  Alex Christensen  <achristen...@webkit.org>
 
+        Fix query-only and fragment-only relative URLs when using URLParser
+        https://bugs.webkit.org/show_bug.cgi?id=161657
+
+        Reviewed by Tim Horton.
+
+        * TestWebKitAPI/Tests/WebCore/URLParser.cpp:
+        (TestWebKitAPI::TEST_F):
+
+2016-09-06  Alex Christensen  <achristen...@webkit.org>
+
         Punycode encode non-ascii hosts in URLParser
         https://bugs.webkit.org/show_bug.cgi?id=161655
 

Modified: trunk/Tools/TestWebKitAPI/Tests/WebCore/URLParser.cpp (205525 => 205526)


--- trunk/Tools/TestWebKitAPI/Tests/WebCore/URLParser.cpp	2016-09-07 00:01:14 UTC (rev 205525)
+++ trunk/Tools/TestWebKitAPI/Tests/WebCore/URLParser.cpp	2016-09-07 00:10:21 UTC (rev 205526)
@@ -221,6 +221,14 @@
     checkRelativeURL("test", "file:///path1/path2", {"file", "", "", "", 0, "/path1/test", "", "", "file:///path1/test"});
     checkRelativeURL(wideString(L"http://www.foo。bar.com"), "http://other.com/", {"http", "", "", "www.foo.bar.com", 0, "/", "", "", "http://www.foo.bar.com/"});
     checkRelativeURL(wideString(L"sc://ñ.test/"), "about:blank", {"sc", "", "", "xn--ida.test", 0, "/", "", "", "sc://xn--ida.test/"});
+    checkRelativeURL("#fragment", "http://host/path", {"http", "", "", "host", 0, "/path", "", "fragment", "http://host/path#fragment"});
+    checkRelativeURL("?query", "http://host/path", {"http", "", "", "host", 0, "/path", "query", "", "http://host/path?query"});
+    checkRelativeURL("?query#fragment", "http://host/path", {"http", "", "", "host", 0, "/path", "query", "fragment", "http://host/path?query#fragment"});
+    checkRelativeURL(wideString(L"?β"), "http://example.org/foo/bar", {"http", "", "", "example.org", 0, "/foo/bar", "%CE%B2", "", "http://example.org/foo/bar?%CE%B2"});
+    checkRelativeURL("?", "http://example.org/foo/bar", {"http", "", "", "example.org", 0, "/foo/bar", "", "", "http://example.org/foo/bar?"});
+    checkRelativeURL("#", "http://example.org/foo/bar", {"http", "", "", "example.org", 0, "/foo/bar", "", "", "http://example.org/foo/bar#"});
+    checkRelativeURL("?#", "http://example.org/foo/bar", {"http", "", "", "example.org", 0, "/foo/bar", "", "", "http://example.org/foo/bar?#"});
+    checkRelativeURL("#?", "http://example.org/foo/bar", {"http", "", "", "example.org", 0, "/foo/bar", "", "?", "http://example.org/foo/bar#?"});
 }
 
 static void checkURLDifferences(const String& urlString, const ExpectedParts& partsNew, const ExpectedParts& partsOld)
@@ -342,6 +350,9 @@
     checkURLDifferences("file://[0:a:0:0:b:c:0:0]/path",
         {"file", "", "", "[0:a::b:c:0:0]", 0, "/path", "", "", "file://[0:a::b:c:0:0]/path"},
         {"file", "", "", "[0:a:0:0:b:c:0:0]", 0, "/path", "", "", "file://[0:a:0:0:b:c:0:0]/path"});
+    checkRelativeURLDifferences(wideString(L"#β"), "http://example.org/foo/bar",
+        {"http", "", "", "example.org", 0, "/foo/bar", "", wideString(L"β"), wideString(L"http://example.org/foo/bar#β")},
+        {"http", "", "", "example.org", 0, "/foo/bar", "", "%CE%B2", "http://example.org/foo/bar#%CE%B2"});
 
     // FIXME: This behavior ought to be specified in the standard.
     // With the existing URL::parse, WebKit returns "https:/", Firefox returns "https:///", and Chrome throws an error.
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to