Changeset 205667 in webkit
- Timestamp:
- Sep 8, 2016 3:15:07 PM (8 years ago)
- Location:
- trunk
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r205665 r205667 1 2016-09-08 Alex Christensen <achristensen@webkit.org> 2 3 URLParser should handle URLs with empty authority 4 https://bugs.webkit.org/show_bug.cgi?id=161711 5 6 Reviewed by Brady Eidson. 7 8 Covered by new API tests. 9 10 * platform/URLParser.cpp: 11 (WebCore::URLParser::parse): 12 (WebCore::URLParser::parseAuthority): 13 1 14 2016-09-08 Chris Dumez <cdumez@apple.com> 2 15 -
trunk/Source/WebCore/platform/URLParser.cpp
r205650 r205667 858 858 case State::SpecialAuthorityIgnoreSlashes: 859 859 LOG_FINAL_STATE("SpecialAuthorityIgnoreSlashes"); 860 break;860 return { }; 861 861 case State::AuthorityOrHost: 862 862 LOG_FINAL_STATE("AuthorityOrHost"); … … 975 975 void URLParser::parseAuthority(StringView::CodePoints::Iterator& iterator, const StringView::CodePoints::Iterator& end) 976 976 { 977 if (iterator == end) { 978 m_url.m_userEnd = m_buffer.length(); 979 m_url.m_passwordEnd = m_url.m_userEnd; 980 return; 981 } 977 982 for (; iterator != end; ++iterator) { 978 m_buffer.append(*iterator);979 983 if (*iterator == ':') { 980 984 ++iterator; 981 m_url.m_userEnd = m_buffer.length() - 1; 982 break; 983 } 985 m_url.m_userEnd = m_buffer.length(); 986 if (iterator == end) { 987 m_url.m_passwordEnd = m_url.m_userEnd; 988 if (m_url.m_userEnd > m_url.m_userStart) 989 m_buffer.append('@'); 990 return; 991 } 992 m_buffer.append(':'); 993 break; 994 } 995 m_buffer.append(*iterator); 984 996 } 985 997 for (; iterator != end; ++iterator) -
trunk/Tools/ChangeLog
r205650 r205667 1 2016-09-08 Alex Christensen <achristensen@webkit.org> 2 3 URLParser should handle URLs with empty authority 4 https://bugs.webkit.org/show_bug.cgi?id=161711 5 6 Reviewed by Brady Eidson. 7 8 * TestWebKitAPI/Tests/WebCore/URLParser.cpp: 9 (TestWebKitAPI::TEST_F): 10 1 11 2016-09-08 Alex Christensen <achristensen@webkit.org> 2 12 -
trunk/Tools/TestWebKitAPI/Tests/WebCore/URLParser.cpp
r205650 r205667 179 179 checkURL("http://host/a%20B", {"http", "", "", "host", 0, "/a%20B", "", "", "http://host/a%20B"}); 180 180 checkURL("http://host?q=@ <>!#fragment", {"http", "", "", "host", 0, "/", "q=@%20%3C%3E!", "fragment", "http://host/?q=@%20%3C%3E!#fragment"}); 181 checkURL("http://user:@host", {"http", "user", "", "host", 0, "/", "", "", "http://user@host/"}); 182 183 // This disagrees with the web platform test for http://:@www.example.com but agrees with Chrome and URL::parse, 184 // and Firefox fails the web platform test differently. Maybe the web platform test ought to be changed. 185 checkURL("http://:@host", {"http", "", "", "host", 0, "/", "", "", "http://host/"}); 181 186 } 182 187 … … 231 236 checkRelativeURL("#?", "http://example.org/foo/bar", {"http", "", "", "example.org", 0, "/foo/bar", "", "?", "http://example.org/foo/bar#?"}); 232 237 checkRelativeURL("/", "http://example.org/foo/bar", {"http", "", "", "example.org", 0, "/", "", "", "http://example.org/"}); 238 checkRelativeURL("http://@host", "about:blank", {"http", "", "", "host", 0, "/", "", "", "http://host/"}); 239 checkRelativeURL("http://:@host", "about:blank", {"http", "", "", "host", 0, "/", "", "", "http://host/"}); 233 240 } 234 241 … … 355 362 {"http", "", "", "example.org", 0, "/foo/bar", "", wideString(L"β"), wideString(L"http://example.org/foo/bar#β")}, 356 363 {"http", "", "", "example.org", 0, "/foo/bar", "", "%CE%B2", "http://example.org/foo/bar#%CE%B2"}); 357 358 // FIXME: This behavior ought to be specified in the standard. 359 // With the existing URL::parse, WebKit returns "https:/", Firefox returns "https:///", and Chrome throws an error. 364 checkURLDifferences("http://@", 365 {"", "", "", "", 0, "", "", "", ""}, 366 {"", "", "", "", 0, "", "", "", "http://@"}); 367 checkURLDifferences("http://", 368 {"", "", "", "", 0, "", "", "", ""}, 369 {"http", "", "", "", 0, "/", "", "", "http:/"}); 360 370 checkRelativeURLDifferences("//", "https://www.webkit.org/path", 361 {" https", "", "", "", 0, "", "", "", "https://"},371 {"", "", "", "", 0, "", "", "", ""}, 362 372 {"https", "", "", "", 0, "/", "", "", "https:/"}); 363 373 … … 437 447 438 448 // FIXME: Fix and check unknown schemes with ports, as well as ftps. 449 450 // Firefox returns http://a:@/ Chrome fails, URL::parse fails 451 checkRelativeURLDifferences("http://a:@", "about:blank", 452 {"", "", "", "", 0, "", "", "", ""}, 453 {"", "", "", "", 0, "", "", "", "http://a:@"}); 454 455 checkRelativeURLDifferences("http://:@", "about:blank", 456 {"", "", "", "", 0, "", "", "", ""}, 457 {"", "", "", "", 0, "", "", "", "http://:@"}); 458 checkRelativeURLDifferences("http://:b@", "about:blank", 459 {"", "", "", "", 0, "", "", "", ""}, 460 {"", "", "", "", 0, "", "", "", "http://:b@"}); 461 checkURLDifferences("http://a:@", 462 {"", "", "", "", 0, "", "", "", ""}, 463 {"", "", "", "", 0, "", "", "", "http://a:@"}); 464 checkURLDifferences("http://:b@", 465 {"", "", "", "", 0, "", "", "", ""}, 466 {"", "", "", "", 0, "", "", "", "http://:b@"}); 439 467 } 440 468
Note: See TracChangeset
for help on using the changeset viewer.