Modified: releases/WebKitGTK/webkit-2.14/Tools/TestWebKitAPI/Tests/WebCore/URLParser.cpp (205588 => 205589)
--- releases/WebKitGTK/webkit-2.14/Tools/TestWebKitAPI/Tests/WebCore/URLParser.cpp 2016-09-08 06:42:02 UTC (rev 205588)
+++ releases/WebKitGTK/webkit-2.14/Tools/TestWebKitAPI/Tests/WebCore/URLParser.cpp 2016-09-08 06:44:42 UTC (rev 205589)
@@ -132,6 +132,7 @@
checkRelativeURL("/index.html", "http://webkit.org/path1/path2/", {"http", "", "", "webkit.org", 0, "/index.html", "", "", "http://webkit.org/index.html"});
checkRelativeURL("http://whatwg.org/index.html", "http://webkit.org/path1/path2/", {"http", "", "", "whatwg.org", 0, "/index.html", "", "", "http://whatwg.org/index.html"});
checkRelativeURL("index.html", "http://webkit.org/path1/path2/page.html?query#fragment", {"http", "", "", "webkit.org", 0, "/path1/path2/index.html", "", "", "http://webkit.org/path1/path2/index.html"});
+ checkRelativeURL("//whatwg.org/index.html", "https://www.webkit.org/path", {"https", "", "", "whatwg.org", 0, "/index.html", "", "", "https://whatwg.org/index.html"});
}
static void checkURLDifferences(const String& urlString, const ExpectedParts& partsNew, const ExpectedParts& partsOld)
@@ -162,6 +163,37 @@
EXPECT_FALSE(URLParser::allValuesEqual(url, oldURL));
}
+static void checkRelativeURLDifferences(const String& urlString, const String& baseURLString, const ExpectedParts& partsNew, const ExpectedParts& partsOld)
+{
+ URLParser baseParser;
+ auto base = baseParser.parse(baseURLString);
+
+ URLParser parser;
+ auto url = "" base);
+ EXPECT_TRUE(eq(partsNew.protocol, url.protocol()));
+ EXPECT_TRUE(eq(partsNew.user, url.user()));
+ EXPECT_TRUE(eq(partsNew.password, url.pass()));
+ EXPECT_TRUE(eq(partsNew.host, url.host()));
+ EXPECT_EQ(partsNew.port, url.port());
+ EXPECT_TRUE(eq(partsNew.path, url.path()));
+ EXPECT_TRUE(eq(partsNew.query, url.query()));
+ EXPECT_TRUE(eq(partsNew.fragment, url.fragmentIdentifier()));
+ EXPECT_TRUE(eq(partsNew.string, url.string()));
+
+ auto oldURL = URL(URL(URL(), baseURLString), urlString);
+ EXPECT_TRUE(eq(partsOld.protocol, oldURL.protocol()));
+ EXPECT_TRUE(eq(partsOld.user, oldURL.user()));
+ EXPECT_TRUE(eq(partsOld.password, oldURL.pass()));
+ EXPECT_TRUE(eq(partsOld.host, oldURL.host()));
+ EXPECT_EQ(partsOld.port, oldURL.port());
+ EXPECT_TRUE(eq(partsOld.path, oldURL.path()));
+ EXPECT_TRUE(eq(partsOld.query, oldURL.query()));
+ EXPECT_TRUE(eq(partsOld.fragment, oldURL.fragmentIdentifier()));
+ EXPECT_TRUE(eq(partsOld.string, oldURL.string()));
+
+ EXPECT_FALSE(URLParser::allValuesEqual(url, oldURL));
+}
+
TEST_F(URLParserTest, ParserDifferences)
{
checkURLDifferences("http://127.0.1",
@@ -170,6 +202,12 @@
checkURLDifferences("http://011.11.0X11.0x011",
{"http", "", "", "9.11.17.17", 0, "/", "", "", "http://9.11.17.17/"},
{"http", "", "", "011.11.0x11.0x011", 0, "/", "", "", "http://011.11.0x11.0x011/"});
+
+ // 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.
+ checkRelativeURLDifferences("//", "https://www.webkit.org/path",
+ {"https", "", "", "", 0, "", "", "", "https://"},
+ {"https", "", "", "", 0, "/", "", "", "https:/"});
}
static void shouldFail(const String& urlString)