<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[206162] trunk</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/206162">206162</a></dd>
<dt>Author</dt> <dd>achristensen@apple.com</dd>
<dt>Date</dt> <dd>2016-09-20 11:46:26 -0700 (Tue, 20 Sep 2016)</dd>
</dl>
<h3>Log Message</h3>
<pre>Align URLParser with web platform tests when parsing non-special relative URLs ending in AuthorityOrHost state
https://bugs.webkit.org/show_bug.cgi?id=162251
Reviewed by Tim Horton.
Source/WebCore:
Covered by new and updated API tests.
* platform/URLParser.cpp:
(WebCore::URLParser::parse):
Fix parsing of non-special URLs that end after scheme:// with no authority.
We used to assume that parsing non-special schemes would never end with just scheme:// but a string can indeed end right there.
When a non-special relative URL contains just scheme:// we need the resulting URL to be valid to conform with the web platform tests.
(WebCore::URLParser::parseHostAndPort):
Renamed to reflect what the function actually does.
(WebCore::URLParser::internalValuesConsistent):
Add utility function for testing.
(WebCore::URLParser::parseHost): Deleted.
* platform/URLParser.h:
Tools:
* TestWebKitAPI/Tests/WebCore/URLParser.cpp:
(TestWebKitAPI::checkURL):
(TestWebKitAPI::TEST_F):
(TestWebKitAPI::checkRelativeURL):
(TestWebKitAPI::checkURLDifferences):
(TestWebKitAPI::checkRelativeURLDifferences):</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreplatformURLParsercpp">trunk/Source/WebCore/platform/URLParser.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformURLParserh">trunk/Source/WebCore/platform/URLParser.h</a></li>
<li><a href="#trunkToolsChangeLog">trunk/Tools/ChangeLog</a></li>
<li><a href="#trunkToolsTestWebKitAPITestsWebCoreURLParsercpp">trunk/Tools/TestWebKitAPI/Tests/WebCore/URLParser.cpp</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (206161 => 206162)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2016-09-20 18:41:43 UTC (rev 206161)
+++ trunk/Source/WebCore/ChangeLog        2016-09-20 18:46:26 UTC (rev 206162)
</span><span class="lines">@@ -1,3 +1,24 @@
</span><ins>+2016-09-20 Alex Christensen <achristensen@webkit.org>
+
+ Align URLParser with web platform tests when parsing non-special relative URLs ending in AuthorityOrHost state
+ https://bugs.webkit.org/show_bug.cgi?id=162251
+
+ Reviewed by Tim Horton.
+
+ Covered by new and updated API tests.
+
+ * platform/URLParser.cpp:
+ (WebCore::URLParser::parse):
+ Fix parsing of non-special URLs that end after scheme:// with no authority.
+ We used to assume that parsing non-special schemes would never end with just scheme:// but a string can indeed end right there.
+ When a non-special relative URL contains just scheme:// we need the resulting URL to be valid to conform with the web platform tests.
+ (WebCore::URLParser::parseHostAndPort):
+ Renamed to reflect what the function actually does.
+ (WebCore::URLParser::internalValuesConsistent):
+ Add utility function for testing.
+ (WebCore::URLParser::parseHost): Deleted.
+ * platform/URLParser.h:
+
</ins><span class="cx"> 2016-09-20 Javier Fernandez <jfernandez@igalia.com>
</span><span class="cx">
</span><span class="cx"> [css-grid] The 'grid' shorthand has a new syntax.
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformURLParsercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/URLParser.cpp (206161 => 206162)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/URLParser.cpp        2016-09-20 18:41:43 UTC (rev 206161)
+++ trunk/Source/WebCore/platform/URLParser.cpp        2016-09-20 18:46:26 UTC (rev 206162)
</span><span class="lines">@@ -999,20 +999,20 @@
</span><span class="cx"> else
</span><span class="cx"> state = State::SpecialAuthoritySlashes;
</span><span class="cx"> } else {
</span><del>- m_url.m_userStart = m_asciiBuffer.size();
- 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;
</del><span class="cx"> auto maybeSlash = c;
</span><span class="cx"> incrementIteratorSkippingTabAndNewLine<serialized>(maybeSlash);
</span><span class="cx"> if (!maybeSlash.atEnd() && *maybeSlash == '/') {
</span><span class="cx"> m_asciiBuffer.append('/');
</span><del>- m_url.m_pathAfterLastSlash = m_url.m_userStart + 1;
</del><ins>+ m_url.m_userStart = m_asciiBuffer.size();
</ins><span class="cx"> state = State::PathOrAuthority;
</span><span class="cx"> c = maybeSlash;
</span><span class="cx"> ASSERT(*c == '/');
</span><span class="cx"> } else {
</span><ins>+ m_url.m_userStart = m_asciiBuffer.size();
+ 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;
</ins><span class="cx"> m_url.m_pathAfterLastSlash = m_url.m_userStart;
</span><span class="cx"> m_url.m_cannotBeABaseURL = true;
</span><span class="cx"> state = State::CannotBeABaseURLPath;
</span><span class="lines">@@ -1076,8 +1076,16 @@
</span><span class="cx"> state = State::AuthorityOrHost;
</span><span class="cx"> ++c;
</span><span class="cx"> authorityOrHostBegin = c;
</span><del>- } else
</del><ins>+ } else {
+ ASSERT(m_asciiBuffer.last() == '/');
+ m_url.m_userStart = m_asciiBuffer.size() - 1;
+ 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;
</ins><span class="cx"> state = State::Path;
</span><ins>+ }
</ins><span class="cx"> break;
</span><span class="cx"> case State::Relative:
</span><span class="cx"> LOG_STATE("Relative");
</span><span class="lines">@@ -1162,7 +1170,7 @@
</span><span class="cx"> if (isSlash || *c == '?' || *c == '#') {
</span><span class="cx"> m_url.m_userEnd = m_asciiBuffer.size();
</span><span class="cx"> m_url.m_passwordEnd = m_url.m_userEnd;
</span><del>- if (!parseHost<serialized>(CodePointIterator<CharacterType>(authorityOrHostBegin, c)))
</del><ins>+ if (!parseHostAndPort<serialized>(CodePointIterator<CharacterType>(authorityOrHostBegin, c)))
</ins><span class="cx"> return failure(input, length);
</span><span class="cx"> if (!isSlash) {
</span><span class="cx"> m_asciiBuffer.append('/');
</span><span class="lines">@@ -1179,7 +1187,7 @@
</span><span class="cx"> case State::Host:
</span><span class="cx"> LOG_STATE("Host");
</span><span class="cx"> if (*c == '/' || *c == '?' || *c == '#') {
</span><del>- if (!parseHost<serialized>(CodePointIterator<CharacterType>(authorityOrHostBegin, c)))
</del><ins>+ if (!parseHostAndPort<serialized>(CodePointIterator<CharacterType>(authorityOrHostBegin, c)))
</ins><span class="cx"> return failure(input, length);
</span><span class="cx"> state = State::Path;
</span><span class="cx"> break;
</span><span class="lines">@@ -1309,7 +1317,7 @@
</span><span class="cx"> state = State::Path;
</span><span class="cx"> break;
</span><span class="cx"> }
</span><del>- if (!parseHost<serialized>(CodePointIterator<CharacterType>(authorityOrHostBegin, c)))
</del><ins>+ if (!parseHostAndPort<serialized>(CodePointIterator<CharacterType>(authorityOrHostBegin, c)))
</ins><span class="cx"> return failure(input, length);
</span><span class="cx">
</span><span class="cx"> if (StringView(m_asciiBuffer.data() + m_url.m_passwordEnd, m_asciiBuffer.size() - m_url.m_passwordEnd) == "localhost") {
</span><span class="lines">@@ -1433,6 +1441,11 @@
</span><span class="cx"> break;
</span><span class="cx"> case State::PathOrAuthority:
</span><span class="cx"> LOG_FINAL_STATE("PathOrAuthority");
</span><ins>+ 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;
</ins><span class="cx"> m_url.m_pathEnd = m_url.m_pathAfterLastSlash;
</span><span class="cx"> m_url.m_queryEnd = m_url.m_pathAfterLastSlash;
</span><span class="cx"> m_url.m_fragmentEnd = m_url.m_pathAfterLastSlash;
</span><span class="lines">@@ -1470,11 +1483,20 @@
</span><span class="cx"> LOG_FINAL_STATE("AuthorityOrHost");
</span><span class="cx"> m_url.m_userEnd = m_asciiBuffer.size();
</span><span class="cx"> m_url.m_passwordEnd = m_url.m_userEnd;
</span><del>- FALLTHROUGH;
</del><ins>+ if (authorityOrHostBegin.atEnd()) {
+ m_url.m_hostEnd = m_url.m_userEnd;
+ m_url.m_portEnd = m_url.m_userEnd;
+ } else if (!parseHostAndPort<serialized>(authorityOrHostBegin))
+ return failure(input, length);
+ m_asciiBuffer.append('/');
+ m_url.m_pathEnd = m_url.m_portEnd + 1;
+ m_url.m_pathAfterLastSlash = m_url.m_pathEnd;
+ m_url.m_queryEnd = m_url.m_pathEnd;
+ m_url.m_fragmentEnd = m_url.m_pathEnd;
+ break;
</ins><span class="cx"> case State::Host:
</span><del>- if (state == State::Host)
- LOG_FINAL_STATE("Host");
- if (!parseHost<serialized>(authorityOrHostBegin))
</del><ins>+ LOG_FINAL_STATE("Host");
+ if (!parseHostAndPort<serialized>(authorityOrHostBegin))
</ins><span class="cx"> return failure(input, length);
</span><span class="cx"> m_asciiBuffer.append('/');
</span><span class="cx"> m_url.m_pathEnd = m_url.m_portEnd + 1;
</span><span class="lines">@@ -1528,7 +1550,7 @@
</span><span class="cx"> break;
</span><span class="cx"> }
</span><span class="cx">
</span><del>- if (!parseHost<serialized>(CodePointIterator<CharacterType>(authorityOrHostBegin, c)))
</del><ins>+ if (!parseHostAndPort<serialized>(CodePointIterator<CharacterType>(authorityOrHostBegin, c)))
</ins><span class="cx"> return failure(input, length);
</span><span class="cx">
</span><span class="cx"> if (StringView(m_asciiBuffer.data() + m_url.m_passwordEnd, m_asciiBuffer.size() - m_url.m_passwordEnd) == "localhost") {
</span><span class="lines">@@ -1583,6 +1605,7 @@
</span><span class="cx"> }
</span><span class="cx"> m_url.m_isValid = true;
</span><span class="cx"> LOG(URLParser, "Parsed URL <%s>", m_url.m_string.utf8().data());
</span><ins>+ ASSERT(internalValuesConsistent(m_url));
</ins><span class="cx"> return m_url;
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -2006,7 +2029,7 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> template<bool serialized, typename CharacterType>
</span><del>-bool URLParser::parseHost(CodePointIterator<CharacterType> iterator)
</del><ins>+bool URLParser::parseHostAndPort(CodePointIterator<CharacterType> iterator)
</ins><span class="cx"> {
</span><span class="cx"> if (iterator.atEnd())
</span><span class="cx"> return false;
</span><span class="lines">@@ -2224,6 +2247,22 @@
</span><span class="cx"> && a.m_fragmentEnd == b.m_fragmentEnd;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+bool URLParser::internalValuesConsistent(const URL& url)
+{
+ return url.m_schemeEnd <= url.m_userStart
+ && url.m_userStart <= url.m_userEnd
+ && url.m_userEnd <= url.m_passwordEnd
+ && url.m_passwordEnd <= url.m_hostEnd
+ && url.m_hostEnd <= url.m_hostEnd
+ && url.m_portEnd <= url.m_pathAfterLastSlash
+ && url.m_pathAfterLastSlash <= url.m_pathEnd
+ && url.m_pathEnd <= url.m_queryEnd
+ && url.m_queryEnd <= url.m_fragmentEnd
+ && (url.m_isValid ? url.m_fragmentEnd == url.m_string.length() : !url.m_fragmentEnd);
+ // FIXME: Why do we even store m_fragmentEnd?
+ // It should be able to be deduced from m_isValid and m_string.length() to save memory.
+}
+
</ins><span class="cx"> static bool urlParserEnabled = false;
</span><span class="cx">
</span><span class="cx"> void URLParser::setEnabled(bool enabled)
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformURLParserh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/URLParser.h (206161 => 206162)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/URLParser.h        2016-09-20 18:41:43 UTC (rev 206161)
+++ trunk/Source/WebCore/platform/URLParser.h        2016-09-20 18:46:26 UTC (rev 206162)
</span><span class="lines">@@ -38,7 +38,9 @@
</span><span class="cx"> public:
</span><span class="cx"> WEBCORE_EXPORT URL parse(const String&, const URL& = { }, const TextEncoding& = UTF8Encoding());
</span><span class="cx"> WEBCORE_EXPORT URL parseSerializedURL(const String&);
</span><ins>+
</ins><span class="cx"> WEBCORE_EXPORT static bool allValuesEqual(const URL&, const URL&);
</span><ins>+ WEBCORE_EXPORT static bool internalValuesConsistent(const URL&);
</ins><span class="cx">
</span><span class="cx"> WEBCORE_EXPORT static bool enabled();
</span><span class="cx"> WEBCORE_EXPORT static void setEnabled(bool);
</span><span class="lines">@@ -56,7 +58,7 @@
</span><span class="cx">
</span><span class="cx"> template<bool serialized, typename CharacterType> URL parse(const CharacterType*, const unsigned length, const URL&, const TextEncoding&);
</span><span class="cx"> template<bool serialized, typename CharacterType> void parseAuthority(CodePointIterator<CharacterType>);
</span><del>- template<bool serialized, typename CharacterType> bool parseHost(CodePointIterator<CharacterType>);
</del><ins>+ template<bool serialized, typename CharacterType> bool parseHostAndPort(CodePointIterator<CharacterType>);
</ins><span class="cx"> template<bool serialized, typename CharacterType> bool parsePort(CodePointIterator<CharacterType>&);
</span><span class="cx"> template<typename CharacterType> URL failure(const CharacterType*, unsigned length);
</span><span class="cx">
</span></span></pre></div>
<a id="trunkToolsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Tools/ChangeLog (206161 => 206162)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/ChangeLog        2016-09-20 18:41:43 UTC (rev 206161)
+++ trunk/Tools/ChangeLog        2016-09-20 18:46:26 UTC (rev 206162)
</span><span class="lines">@@ -1,5 +1,19 @@
</span><span class="cx"> 2016-09-20 Alex Christensen <achristensen@webkit.org>
</span><span class="cx">
</span><ins>+ Align URLParser with web platform tests when parsing non-special relative URLs ending in AuthorityOrHost state
+ https://bugs.webkit.org/show_bug.cgi?id=162251
+
+ Reviewed by Tim Horton.
+
+ * TestWebKitAPI/Tests/WebCore/URLParser.cpp:
+ (TestWebKitAPI::checkURL):
+ (TestWebKitAPI::TEST_F):
+ (TestWebKitAPI::checkRelativeURL):
+ (TestWebKitAPI::checkURLDifferences):
+ (TestWebKitAPI::checkRelativeURLDifferences):
+
+2016-09-20 Alex Christensen <achristensen@webkit.org>
+
</ins><span class="cx"> URLParser should allow '@' in user
</span><span class="cx"> https://bugs.webkit.org/show_bug.cgi?id=162272
</span><span class="cx">
</span></span></pre></div>
<a id="trunkToolsTestWebKitAPITestsWebCoreURLParsercpp"></a>
<div class="modfile"><h4>Modified: trunk/Tools/TestWebKitAPI/Tests/WebCore/URLParser.cpp (206161 => 206162)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/TestWebKitAPI/Tests/WebCore/URLParser.cpp        2016-09-20 18:41:43 UTC (rev 206161)
+++ trunk/Tools/TestWebKitAPI/Tests/WebCore/URLParser.cpp        2016-09-20 18:46:26 UTC (rev 206162)
</span><span class="lines">@@ -82,6 +82,8 @@
</span><span class="cx"> EXPECT_TRUE(eq(parts.string, oldURL.string()));
</span><span class="cx">
</span><span class="cx"> EXPECT_TRUE(URLParser::allValuesEqual(url, oldURL));
</span><ins>+ EXPECT_TRUE(URLParser::internalValuesConsistent(url));
+ EXPECT_TRUE(URLParser::internalValuesConsistent(oldURL));
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> template<size_t length>
</span><span class="lines">@@ -201,9 +203,9 @@
</span><span class="cx"> checkURL("sc:/pa/pa", {"sc", "", "", "", 0, "/pa/pa", "", "", "sc:/pa/pa"});
</span><span class="cx"> checkURL("sc:/pa", {"sc", "", "", "", 0, "/pa", "", "", "sc:/pa"});
</span><span class="cx"> checkURL("sc:/pa/", {"sc", "", "", "", 0, "/pa/", "", "", "sc:/pa/"});
</span><ins>+ checkURL("notspecial:/notuser:notpassword@nothost", {"notspecial", "", "", "", 0, "/notuser:notpassword@nothost", "", "", "notspecial:/notuser:notpassword@nothost"});
</ins><span class="cx"> checkURL("sc://pa/", {"sc", "", "", "pa", 0, "/", "", "", "sc://pa/"});
</span><span class="cx"> checkURL("http://host \a ", {"http", "", "", "host", 0, "/", "", "", "http://host/"});
</span><del>- checkURL("notspecial:/", {"notspecial", "", "", "", 0, "/", "", "", "notspecial:/"});
</del><span class="cx"> checkURL("notspecial:/a", {"notspecial", "", "", "", 0, "/a", "", "", "notspecial:/a"});
</span><span class="cx"> checkURL("notspecial:", {"notspecial", "", "", "", 0, "", "", "", "notspecial:"});
</span><span class="cx"> checkURL("http:/a", {"http", "", "", "a", 0, "/", "", "", "http://a/"});
</span><span class="lines">@@ -210,6 +212,8 @@
</span><span class="cx"> checkURL("http://256/", {"http", "", "", "256", 0, "/", "", "", "http://256/"});
</span><span class="cx"> checkURL("http://256./", {"http", "", "", "256.", 0, "/", "", "", "http://256./"});
</span><span class="cx"> checkURL("http://123.256/", {"http", "", "", "123.256", 0, "/", "", "", "http://123.256/"});
</span><ins>+ checkURL("notspecial:/a", {"notspecial", "", "", "", 0, "/a", "", "", "notspecial:/a"});
+ checkURL("notspecial:", {"notspecial", "", "", "", 0, "", "", "", "notspecial:"});
</ins><span class="cx"> // FIXME: Fix and add a test with an invalid surrogate pair at the end with a space as the second code unit.
</span><span class="cx">
</span><span class="cx"> // This disagrees with the web platform test for http://:@www.example.com but agrees with Chrome and URL::parse,
</span><span class="lines">@@ -246,6 +250,8 @@
</span><span class="cx"> EXPECT_TRUE(eq(parts.string, oldURL.string()));
</span><span class="cx">
</span><span class="cx"> EXPECT_TRUE(URLParser::allValuesEqual(url, oldURL));
</span><ins>+ EXPECT_TRUE(URLParser::internalValuesConsistent(url));
+ EXPECT_TRUE(URLParser::internalValuesConsistent(oldURL));
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> TEST_F(URLParserTest, ParseRelative)
</span><span class="lines">@@ -287,9 +293,7 @@
</span><span class="cx"> checkRelativeURL(" foo.com ", "http://example.org/foo/bar", {"http", "", "", "example.org", 0, "/foo/foo.com", "", "", "http://example.org/foo/foo.com"});
</span><span class="cx"> checkRelativeURL(" \a baz", "http://example.org/foo/bar", {"http", "", "", "example.org", 0, "/foo/baz", "", "", "http://example.org/foo/baz"});
</span><span class="cx"> checkRelativeURL("~", "http://example.org", {"http", "", "", "example.org", 0, "/~", "", "", "http://example.org/~"});
</span><del>- checkRelativeURL("notspecial:/", "about:blank", {"notspecial", "", "", "", 0, "/", "", "", "notspecial:/"});
</del><span class="cx"> checkRelativeURL("notspecial:", "about:blank", {"notspecial", "", "", "", 0, "", "", "", "notspecial:"});
</span><del>- checkRelativeURL("notspecial:/", "http://host", {"notspecial", "", "", "", 0, "/", "", "", "notspecial:/"});
</del><span class="cx"> checkRelativeURL("notspecial:", "http://host", {"notspecial", "", "", "", 0, "", "", "", "notspecial:"});
</span><span class="cx"> checkRelativeURL("http:", "http://host", {"http", "", "", "host", 0, "/", "", "", "http://host/"});
</span><span class="cx">
</span><span class="lines">@@ -324,6 +328,8 @@
</span><span class="cx"> EXPECT_TRUE(eq(partsOld.string, oldURL.string()));
</span><span class="cx">
</span><span class="cx"> EXPECT_FALSE(URLParser::allValuesEqual(url, oldURL));
</span><ins>+ EXPECT_TRUE(URLParser::internalValuesConsistent(url));
+ EXPECT_TRUE(URLParser::internalValuesConsistent(oldURL));
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> static void checkRelativeURLDifferences(const String& urlString, const String& baseURLString, const ExpectedParts& partsNew, const ExpectedParts& partsOld)
</span><span class="lines">@@ -355,6 +361,8 @@
</span><span class="cx"> EXPECT_TRUE(eq(partsOld.string, oldURL.string()));
</span><span class="cx">
</span><span class="cx"> EXPECT_FALSE(URLParser::allValuesEqual(url, oldURL));
</span><ins>+ EXPECT_TRUE(URLParser::internalValuesConsistent(url));
+ EXPECT_TRUE(URLParser::internalValuesConsistent(oldURL));
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> // These are differences between the new URLParser and the old URL::parse which make URLParser more standards compliant.
</span><span class="lines">@@ -547,6 +555,20 @@
</span><span class="cx"> checkRelativeURLDifferences("https://@test@test@example:800/", "http://doesnotmatter/",
</span><span class="cx"> {"https", "@test@test", "", "example", 800, "/", "", "", "https://%40test%40test@example:800/"},
</span><span class="cx"> {"", "", "", "", 0, "", "", "", "https://@test@test@example:800/"});
</span><ins>+ checkRelativeURLDifferences("foo://", "http://example.org/foo/bar",
+ {"foo", "", "", "", 0, "/", "", "", "foo:///"},
+ {"foo", "", "", "", 0, "//", "", "", "foo://"});
+
+ // 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:/"});
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> TEST_F(URLParserTest, DefaultPort)
</span></span></pre>
</div>
</div>
</body>
</html>