Source/WebCore/ChangeLog

 12016-09-09 Alex Christensen <achristensen@webkit.org>
 2
 3 Fix more URLParser quirks
 4 https://bugs.webkit.org/show_bug.cgi?id=161834
 5
 6 Reviewed by NOBODY (OOPS!).
 7
 8 Added new API tests.
 9
 10 * platform/URLParser.cpp:
 11 (WebCore::URLParser::parse):
 12 Skip some tabs and newlines. The spec says to remove them before processing the String,
 13 but to reduce allocations I am skipping them whenever we increment an iterator.
 14 Fix a few other quirks to be more web platform conformant.
 15
1162016-09-09 Alex Christensen <achristensen@webkit.org>
217
318 URLParser: Keep track of cannot-be-a-base-url according to spec
205782

Source/WebCore/platform/URLParser.cpp

@@URL URLParser::parse(const String& input
468468 m_url.m_portEnd = m_url.m_userStart;
469469 auto maybeSlash = c;
470470 ++maybeSlash;
 471 while (maybeSlash != end && isTabOrNewline(*maybeSlash))
 472 ++maybeSlash;
471473 if (maybeSlash != end && *maybeSlash == '/') {
472474 m_buffer.append('/');
473475 m_url.m_pathAfterLastSlash = m_url.m_userStart + 1;
474476 state = State::PathOrAuthority;
475  ++c;
 477 c = maybeSlash;
476478 ASSERT(*c == '/');
477479 } else {
478480 m_url.m_pathAfterLastSlash = m_url.m_userStart;

@@URL URLParser::parse(const String& input
586588 case State::SpecialAuthoritySlashes:
587589 LOG_STATE("SpecialAuthoritySlashes");
588590 m_buffer.append("//");
589  if (*c == '/') {
 591 if (*c == '/' || *c == '\\') {
590592 ++c;
591593 while (c != end && isTabOrNewline(*c))
592594 ++c;
593595 if (c == end)
594596 return failure(input);
595  if (*c == '/')
 597 if (*c == '/' || *c == '\\')
596598 ++c;
597599 }
598600 state = State::SpecialAuthorityIgnoreSlashes;

@@URL URLParser::parse(const String& input
834836 m_url.m_queryEnd = m_url.m_pathEnd;
835837 state = State::Fragment;
836838 } else {
837  m_buffer.append(*c);
 839 utf8PercentEncode(*c, m_buffer, isInSimpleEncodeSet);
838840 ++c;
839841 }
840842 break;
205782

Tools/ChangeLog

 12016-09-09 Alex Christensen <achristensen@webkit.org>
 2
 3 Fix more URLParser quirks
 4 https://bugs.webkit.org/show_bug.cgi?id=161834
 5
 6 Reviewed by NOBODY (OOPS!).
 7
 8 * TestWebKitAPI/Tests/WebCore/URLParser.cpp:
 9 (TestWebKitAPI::TEST_F):
 10
1112016-09-09 Tim Horton <timothy_horton@apple.com>
212
313 WKThumbnailView should expose a mode where it can be reparented without resnapshotting
205783

Tools/TestWebKitAPI/Tests/WebCore/URLParser.cpp

@@TEST_F(URLParserTest, ParseRelative)
272272 checkRelativeURL("http:\\\\foo.com/", "http://example.org/foo/bar", {"http", "", "", "foo.com", 0, "/", "", "", "http://foo.com/"});
273273 checkRelativeURL("http:\\\\foo.com", "http://example.org/foo/bar", {"http", "", "", "foo.com", 0, "/", "", "", "http://foo.com/"});
274274 checkRelativeURL("http://ExAmPlE.CoM", "http://other.com", {"http", "", "", "example.com", 0, "/", "", "", "http://example.com/"});
 275
 276 // The checking of slashes in SpecialAuthoritySlashes needed to get this to pass contradicts what is in the spec,
 277 // but it is included in the web platform tests.
 278 checkRelativeURL("http:\\\\host\\foo", "about:blank", {"http", "", "", "host", 0, "/foo", "", "", "http://host/foo"});
275279}
276280
277281static void checkURLDifferences(const String& urlString, const ExpectedParts& partsNew, const ExpectedParts& partsOld)

@@TEST_F(URLParserTest, ParserFailures)
571575 shouldFail("?i", "sc:sd/sd");
572576}
573577
 578// These are in the spec but not in the web platform tests.
 579TEST_F(URLParserTest, AdditionalTests)
 580{
 581 checkURL("about:\a\aabc", {"about", "", "", "", 0, "%07%07abc", "", "", "about:%07%07abc"});
 582 checkURL("notspecial:\t\t\n\t", {"notspecial", "", "", "", 0, "", "", "", "notspecial:"});
 583 checkURLDifferences("notspecial\t\t\n\t:\t\t\n\t/\t\t\n\t/\t\t\n\thost",
 584 {"notspecial", "", "", "host", 0, "/", "", "", "notspecial://host/"},
 585 {"notspecial", "", "", "host", 0, "", "", "", "notspecial://host"});
 586}
 587
574588} // namespace TestWebKitAPI
205782