Changeset 205584 in webkit
- Timestamp:
- Sep 7, 2016 10:59:38 PM (8 years ago)
- Location:
- trunk
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r205583 r205584 1 2016-09-07 Alex Christensen <achristensen@webkit.org> 2 3 Roll out r205580 and r205582. 4 https://bugs.webkit.org/show_bug.cgi?id=161668 5 6 I need to figure out why this is failing on the bots before landing any more URLParser progress. 7 1 8 2016-09-07 Yusuke Suzuki <utatane.tea@gmail.com> 2 9 -
trunk/Source/WebCore/platform/URLParser.cpp
r205582 r205584 29 29 #include "Logging.h" 30 30 #include <array> 31 #include <unicode/uidna.h>32 31 #include <wtf/HashMap.h> 33 32 #include <wtf/NeverDestroyed.h> … … 452 451 LOG_STATE("SchemeEndCheckForSlashes"); 453 452 if (*c == '/') { 454 m_buffer.append("//"); 455 m_url.m_userStart = m_buffer.length(); 453 m_buffer.append('/'); 456 454 state = State::PathOrAuthority; 457 455 ++c; … … 518 516 case '?': 519 517 copyURLPartsUntil(base, URLPart::PathEnd); 520 m_buffer.append('?');521 518 state = State::Query; 522 519 ++c; … … 524 521 case '#': 525 522 copyURLPartsUntil(base, URLPart::QueryEnd); 526 m_buffer.append('#');527 523 state = State::Fragment; 528 524 ++c; … … 846 842 case State::RelativeSlash: 847 843 LOG_FINAL_STATE("RelativeSlash"); 848 copyURLPartsUntil(base, URLPart::PortEnd);849 m_buffer.append('/');850 m_url.m_pathAfterLastSlash = base.m_portEnd + 1;851 m_url.m_pathEnd = m_url.m_pathAfterLastSlash;852 m_url.m_queryEnd = m_url.m_pathAfterLastSlash;853 m_url.m_fragmentEnd = m_url.m_pathAfterLastSlash;854 844 break; 855 845 case State::SpecialAuthoritySlashes: … … 1280 1270 } 1281 1271 1282 static bool containsOnlyASCII(const String& string)1283 {1284 if (string.is8Bit())1285 return charactersAreAllASCII(string.characters8(), string.length());1286 return charactersAreAllASCII(string.characters16(), string.length());1287 }1288 1289 1272 static Optional<String> domainToASCII(const String& domain) 1290 1273 { 1291 const unsigned hostnameBufferLength = 2048; 1292 1293 if (containsOnlyASCII(domain)) { 1294 if (domain.is8Bit()) 1295 return domain; 1296 Vector<LChar, hostnameBufferLength> buffer; 1297 size_t length = domain.length(); 1298 buffer.reserveInitialCapacity(length); 1299 for (size_t i = 0; i < length; ++i) 1300 buffer.append(domain[i]); 1301 return String(buffer.data(), length); 1302 } 1303 1304 UChar hostnameBuffer[hostnameBufferLength]; 1305 1306 // FIXME: This is slow, but it covers up a mysterious bug on the bots when logging is disabled. 1307 // The URLParser should not be enabled until this bug is found and resolved. 1308 // See https://bugs.webkit.org/show_bug.cgi?id=161668 1309 memset(hostnameBuffer, 0, sizeof(hostnameBuffer)); 1310 1311 UErrorCode error = U_ZERO_ERROR; 1312 1313 int32_t numCharactersConverted = uidna_IDNToASCII(StringView(domain).upconvertedCharacters(), domain.length(), hostnameBuffer, hostnameBufferLength, UIDNA_ALLOW_UNASSIGNED, nullptr, &error); 1314 1315 if (error == U_ZERO_ERROR) { 1316 LChar buffer[hostnameBufferLength]; 1317 for (int32_t i = 0; i < numCharactersConverted; ++i) { 1318 ASSERT(isASCII(hostnameBuffer[i])); 1319 buffer[i] = hostnameBuffer[i]; 1320 } 1321 return String(buffer, numCharactersConverted); 1322 } 1323 1324 // FIXME: Check for U_BUFFER_OVERFLOW_ERROR and retry with an allocated buffer. 1325 return Nullopt; 1274 // FIXME: Implement correctly 1275 CString utf8 = domain.utf8(); 1276 return String(utf8.data(), utf8.length()); 1326 1277 } 1327 1278 -
trunk/Tools/ChangeLog
r205580 r205584 1 2016-09-07 Alex Christensen <achristensen@webkit.org> 2 3 Roll out r205580 and r205582. 4 https://bugs.webkit.org/show_bug.cgi?id=161668 5 6 I need to figure out why this is failing on the bots before landing any more URLParser progress. 7 1 8 2016-09-07 Alex Christensen <achristensen@webkit.org> 2 9 -
trunk/Tools/TestWebKitAPI/Tests/WebCore/URLParser.cpp
r205580 r205584 83 83 84 84 EXPECT_TRUE(URLParser::allValuesEqual(url, oldURL)); 85 }86 87 template<size_t length>88 static String wideString(const wchar_t (&url)[length])89 {90 StringBuilder builder;91 builder.reserveCapacity(length - 1);92 for (size_t i = 0; i < length - 1; ++i)93 builder.append(url[i]);94 return builder.toString();95 85 } 96 86 … … 220 210 checkRelativeURL("http://example\t.\norg", "http://example.org/foo/bar", {"http", "", "", "example.org", 0, "/", "", "", "http://example.org/"}); 221 211 checkRelativeURL("test", "file:///path1/path2", {"file", "", "", "", 0, "/path1/test", "", "", "file:///path1/test"}); 222 checkRelativeURL(wideString(L"http://www.foo。bar.com"), "http://other.com/", {"http", "", "", "www.foo.bar.com", 0, "/", "", "", "http://www.foo.bar.com/"});223 checkRelativeURL(wideString(L"sc://ñ.test/"), "about:blank", {"sc", "", "", "xn--ida.test", 0, "/", "", "", "sc://xn--ida.test/"});224 checkRelativeURL("#fragment", "http://host/path", {"http", "", "", "host", 0, "/path", "", "fragment", "http://host/path#fragment"});225 checkRelativeURL("?query", "http://host/path", {"http", "", "", "host", 0, "/path", "query", "", "http://host/path?query"});226 checkRelativeURL("?query#fragment", "http://host/path", {"http", "", "", "host", 0, "/path", "query", "fragment", "http://host/path?query#fragment"});227 checkRelativeURL(wideString(L"?β"), "http://example.org/foo/bar", {"http", "", "", "example.org", 0, "/foo/bar", "%CE%B2", "", "http://example.org/foo/bar?%CE%B2"});228 checkRelativeURL("?", "http://example.org/foo/bar", {"http", "", "", "example.org", 0, "/foo/bar", "", "", "http://example.org/foo/bar?"});229 checkRelativeURL("#", "http://example.org/foo/bar", {"http", "", "", "example.org", 0, "/foo/bar", "", "", "http://example.org/foo/bar#"});230 checkRelativeURL("?#", "http://example.org/foo/bar", {"http", "", "", "example.org", 0, "/foo/bar", "", "", "http://example.org/foo/bar?#"});231 checkRelativeURL("#?", "http://example.org/foo/bar", {"http", "", "", "example.org", 0, "/foo/bar", "", "?", "http://example.org/foo/bar#?"});232 checkRelativeURL("/", "http://example.org/foo/bar", {"http", "", "", "example.org", 0, "/", "", "", "http://example.org/"});233 212 } 234 213 … … 352 331 {"file", "", "", "[0:a::b:c:0:0]", 0, "/path", "", "", "file://[0:a::b:c:0:0]/path"}, 353 332 {"file", "", "", "[0:a:0:0:b:c:0:0]", 0, "/path", "", "", "file://[0:a:0:0:b:c:0:0]/path"}); 354 checkRelativeURLDifferences(wideString(L"#β"), "http://example.org/foo/bar",355 {"http", "", "", "example.org", 0, "/foo/bar", "", wideString(L"β"), wideString(L"http://example.org/foo/bar#β")},356 {"http", "", "", "example.org", 0, "/foo/bar", "", "%CE%B2", "http://example.org/foo/bar#%CE%B2"});357 333 358 334 // FIXME: This behavior ought to be specified in the standard. … … 376 352 377 353 // URLParser matches Chrome and the spec, but not URL::parse or Firefox. 378 checkURLDifferences(wideString(L"http://0Xc0.0250.01"),379 {"http", "", "", "192.168.0.1", 0, "/", "", "", "http://192.168.0.1/"},380 {"http", "", "", "0xc0.0250.01", 0, "/", "", "", "http://0xc0.0250.01/"});381 354 checkURLDifferences("http://host/path%2e.%2E", 382 355 {"http", "", "", "host", 0, "/path...", "", "", "http://host/path..."},
Note: See TracChangeset
for help on using the changeset viewer.