Log Message
URLParser: Correctly parse URLs that are just nonspecialscheme:/ https://bugs.webkit.org/show_bug.cgi?id=162340
Reviewed by Tim Horton. Source/WebCore: Covered by new API tests. * platform/URLParser.cpp: (WebCore::URLParser::parse): r206162 wasn't quite right. If a url is just nonspecialscheme:/ then the path should indeed be / Tools: * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::TEST_F):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (206218 => 206219)
--- trunk/Source/WebCore/ChangeLog 2016-09-21 18:00:19 UTC (rev 206218)
+++ trunk/Source/WebCore/ChangeLog 2016-09-21 18:02:52 UTC (rev 206219)
@@ -1,5 +1,18 @@
2016-09-21 Alex Christensen <achristen...@webkit.org>
+ URLParser: Correctly parse URLs that are just nonspecialscheme:/
+ https://bugs.webkit.org/show_bug.cgi?id=162340
+
+ Reviewed by Tim Horton.
+
+ Covered by new API tests.
+
+ * platform/URLParser.cpp:
+ (WebCore::URLParser::parse):
+ r206162 wasn't quite right. If a url is just nonspecialscheme:/ then the path should indeed be /
+
+2016-09-21 Alex Christensen <achristen...@webkit.org>
+
URLParser: correctly parse relative URLs that are just one character
https://bugs.webkit.org/show_bug.cgi?id=162344
Modified: trunk/Source/WebCore/platform/URLParser.cpp (206218 => 206219)
--- trunk/Source/WebCore/platform/URLParser.cpp 2016-09-21 18:00:19 UTC (rev 206218)
+++ trunk/Source/WebCore/platform/URLParser.cpp 2016-09-21 18:02:52 UTC (rev 206219)
@@ -1473,11 +1473,15 @@
break;
case State::PathOrAuthority:
LOG_FINAL_STATE("PathOrAuthority");
- m_url.m_userEnd = m_asciiBuffer.size();
- m_url.m_passwordEnd = m_url.m_userEnd;
- m_url.m_hostEnd = m_url.m_userEnd;
- m_url.m_portEnd = m_url.m_userEnd;
- m_url.m_pathAfterLastSlash = m_url.m_userEnd;
+ ASSERT(m_url.m_userStart);
+ ASSERT(m_url.m_userStart == m_asciiBuffer.size());
+ ASSERT(m_asciiBuffer.last() == '/');
+ m_url.m_userStart--;
+ m_url.m_userEnd = m_url.m_userStart;
+ m_url.m_passwordEnd = m_url.m_userStart;
+ m_url.m_hostEnd = m_url.m_userStart;
+ m_url.m_portEnd = m_url.m_userStart;
+ m_url.m_pathAfterLastSlash = m_url.m_userStart + 1;
m_url.m_pathEnd = m_url.m_pathAfterLastSlash;
m_url.m_queryEnd = m_url.m_pathAfterLastSlash;
m_url.m_fragmentEnd = m_url.m_pathAfterLastSlash;
Modified: trunk/Tools/ChangeLog (206218 => 206219)
--- trunk/Tools/ChangeLog 2016-09-21 18:00:19 UTC (rev 206218)
+++ trunk/Tools/ChangeLog 2016-09-21 18:02:52 UTC (rev 206219)
@@ -1,5 +1,15 @@
2016-09-21 Alex Christensen <achristen...@webkit.org>
+ URLParser: Correctly parse URLs that are just nonspecialscheme:/
+ https://bugs.webkit.org/show_bug.cgi?id=162340
+
+ Reviewed by Tim Horton.
+
+ * TestWebKitAPI/Tests/WebCore/URLParser.cpp:
+ (TestWebKitAPI::TEST_F):
+
+2016-09-21 Alex Christensen <achristen...@webkit.org>
+
URLParser: correctly parse relative URLs that are just one character
https://bugs.webkit.org/show_bug.cgi?id=162344
Modified: trunk/Tools/TestWebKitAPI/Tests/WebCore/URLParser.cpp (206218 => 206219)
--- trunk/Tools/TestWebKitAPI/Tests/WebCore/URLParser.cpp 2016-09-21 18:00:19 UTC (rev 206218)
+++ trunk/Tools/TestWebKitAPI/Tests/WebCore/URLParser.cpp 2016-09-21 18:02:52 UTC (rev 206219)
@@ -215,6 +215,7 @@
checkURL("http://123.256/", {"http", "", "", "123.256", 0, "/", "", "", "http://123.256/"});
checkURL("notspecial:/a", {"notspecial", "", "", "", 0, "/a", "", "", "notspecial:/a"});
checkURL("notspecial:", {"notspecial", "", "", "", 0, "", "", "", "notspecial:"});
+ checkURL("notspecial:/", {"notspecial", "", "", "", 0, "/", "", "", "notspecial:/"});
// This disagrees with the web platform test for http://:@www.example.com but agrees with Chrome and URL::parse,
// and Firefox fails the web platform test differently. Maybe the web platform test ought to be changed.
@@ -302,7 +303,10 @@
checkRelativeURL("i", "sc://ho/pa", {"sc", "", "", "ho", 0, "/i", "", "", "sc://ho/i"});
checkRelativeURL("!", "sc://ho/pa", {"sc", "", "", "ho", 0, "/!", "", "", "sc://ho/!"});
checkRelativeURL("!", "sc:/ho/pa", {"sc", "", "", "", 0, "/ho/!", "", "", "sc:/ho/!"});
-
+ checkRelativeURL("notspecial:/", "about:blank", {"notspecial", "", "", "", 0, "/", "", "", "notspecial:/"});
+ checkRelativeURL("notspecial:/", "http://host", {"notspecial", "", "", "", 0, "/", "", "", "notspecial:/"});
+ checkRelativeURL("foo:/", "http://example.org/foo/bar", {"foo", "", "", "", 0, "/", "", "", "foo:/"});
+
// The checking of slashes in SpecialAuthoritySlashes needed to get this to pass contradicts what is in the spec,
// but it is included in the web platform tests.
checkRelativeURL("http:\\\\host\\foo", "about:blank", {"http", "", "", "host", 0, "/foo", "", "", "http://host/foo"});
@@ -567,17 +571,6 @@
checkURLDifferences(wideString(L"http://host?ß😍#ß😍"),
{"http", "", "", "host", 0, "/", "%C3%9F%F0%9F%98%8D", wideString(L"ß😍"), wideString(L"http://host/?%C3%9F%F0%9F%98%8D#ß😍")},
{"http", "", "", "host", 0, "/", "%C3%9F%F0%9F%98%8D", "%C3%9F%F0%9F%98%8D", "http://host/?%C3%9F%F0%9F%98%8D#%C3%9F%F0%9F%98%8D"});
-
- // This matches the spec and web platform tests, but not Chrome, Firefox, or URL::parse.
- checkRelativeURLDifferences("notspecial:/", "about:blank",
- {"notspecial", "", "", "", 0, "", "", "", "notspecial:/"},
- {"notspecial", "", "", "", 0, "/", "", "", "notspecial:/"});
- checkRelativeURLDifferences("notspecial:/", "http://host",
- {"notspecial", "", "", "", 0, "", "", "", "notspecial:/"},
- {"notspecial", "", "", "", 0, "/", "", "", "notspecial:/"});
- checkURLDifferences("notspecial:/",
- {"notspecial", "", "", "", 0, "", "", "", "notspecial:/"},
- {"notspecial", "", "", "", 0, "/", "", "", "notspecial:/"});
}
TEST_F(URLParserTest, DefaultPort)
_______________________________________________ webkit-changes mailing list webkit-changes@lists.webkit.org https://lists.webkit.org/mailman/listinfo/webkit-changes