Changeset 233789 in webkit
- Timestamp:
- Jul 12, 2018, 5:28:36 PM (8 years ago)
- Location:
- trunk
- Files:
-
- 9 edited
-
Source/WebCore/ChangeLog (modified) (1 diff)
-
Source/WebCore/platform/URL.cpp (modified) (10 diffs)
-
Source/WebCore/platform/URL.h (modified) (5 diffs)
-
Source/WebCore/platform/URLParser.cpp (modified) (42 diffs)
-
Source/WebCore/workers/service/server/RegistrationDatabase.cpp (modified) (1 diff)
-
Source/WebKit/ChangeLog (modified) (1 diff)
-
Source/WebKit/NetworkProcess/cache/NetworkCacheStorage.h (modified) (1 diff)
-
Tools/ChangeLog (modified) (1 diff)
-
Tools/TestWebKitAPI/Tests/WebCore/URLParser.cpp (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r233782 r233789 1 2018-07-12 Alex Christensen <achristensen@webkit.org> 2 3 Reduce size of WebCore::URL 4 https://bugs.webkit.org/show_bug.cgi?id=186820 5 6 Reviewed by Yusuke Suzuki and Youenn Fablet. 7 8 We were using 32 bits for the length of the port, which is always between 0 and 5 inclusive 9 because port numbers are missing or between 0 and 65535. Let's just use 3 bits here. 10 We were using 32 bits for the length of the scheme, which is usually 3-5 characters and can be 11 longer for some custom schemes, but I've never seen one more than 20 characters. If we assume 12 schemes are always less than 64MB, we can save 8 bytes per URL! 13 14 No change in behavior, just less memory use! 15 16 To restore the IPC encoding to how it was before r221165, I just encode the string and reparse it. 17 18 * platform/URL.cpp: 19 (WebCore::URL::invalidate): 20 (WebCore::URL::lastPathComponent const): 21 (WebCore::URL::port const): 22 (WebCore::URL::protocolHostAndPort const): 23 (WebCore::URL::path const): 24 (WebCore::URL::removePort): 25 (WebCore::URL::setPort): 26 (WebCore::URL::setHostAndPort): 27 (WebCore::URL::setPath): 28 * platform/URL.h: 29 (WebCore::URL::encode const): 30 (WebCore::URL::decode): 31 (WebCore::URL::hasPath const): 32 (WebCore::URL::pathStart const): 33 * platform/URLParser.cpp: 34 (WebCore::URLParser::copyBaseWindowsDriveLetter): 35 (WebCore::URLParser::urlLengthUntilPart): 36 (WebCore::URLParser::copyURLPartsUntil): 37 (WebCore::URLParser::shouldPopPath): 38 (WebCore::URLParser::popPath): 39 (WebCore::URLParser::parse): 40 (WebCore::URLParser::parsePort): 41 (WebCore::URLParser::parseHostAndPort): 42 (WebCore::URLParser::allValuesEqual): 43 (WebCore::URLParser::internalValuesConsistent): 44 * workers/service/server/RegistrationDatabase.cpp: 45 Increment the service worker registration schema version because of the URL encoding change. 46 1 47 2018-07-12 Youenn Fablet <youenn@apple.com> 2 48 -
trunk/Source/WebCore/platform/URL.cpp
r233755 r233789 85 85 m_passwordEnd = 0; 86 86 m_hostEnd = 0; 87 m_port End= 0;87 m_portLength = 0; 88 88 m_pathEnd = 0; 89 89 m_pathAfterLastSlash = 0; … … 145 145 146 146 size_t start = m_string.reverseFind('/', end); 147 if (start < static_cast<unsigned>(m_ portEnd))147 if (start < static_cast<unsigned>(m_hostEnd + m_portLength)) 148 148 return String(); 149 149 ++start; … … 165 165 std::optional<uint16_t> URL::port() const 166 166 { 167 if (!m_port End || m_hostEnd >= m_portEnd - 1)167 if (!m_portLength) 168 168 return std::nullopt; 169 169 … … 171 171 unsigned number; 172 172 if (m_string.is8Bit()) 173 number = charactersToUIntStrict(m_string.characters8() + m_hostEnd + 1, m_port End - m_hostEnd- 1, &ok);173 number = charactersToUIntStrict(m_string.characters8() + m_hostEnd + 1, m_portLength - 1, &ok); 174 174 else 175 number = charactersToUIntStrict(m_string.characters16() + m_hostEnd + 1, m_port End - m_hostEnd- 1, &ok);175 number = charactersToUIntStrict(m_string.characters16() + m_hostEnd + 1, m_portLength - 1, &ok); 176 176 if (!ok || number > std::numeric_limits<uint16_t>::max()) 177 177 return std::nullopt; … … 188 188 String URL::protocolHostAndPort() const 189 189 { 190 String result = m_string.substring(0, m_ portEnd);190 String result = m_string.substring(0, m_hostEnd + m_portLength); 191 191 192 192 if (m_passwordEnd - m_userStart > 0) { … … 371 371 String URL::path() const 372 372 { 373 return m_string.substring(m_portEnd, m_pathEnd - m_portEnd); 373 unsigned portEnd = m_hostEnd + m_portLength; 374 return m_string.substring(portEnd, m_pathEnd - portEnd); 374 375 } 375 376 … … 456 457 void URL::removePort() 457 458 { 458 if ( m_hostEnd == m_portEnd)459 return; 460 URLParser parser(m _string.left(m_hostEnd) + m_string.substring(m_portEnd));459 if (!m_portLength) 460 return; 461 URLParser parser(makeString(StringView(m_string).left(m_hostEnd), StringView(m_string).substring(m_hostEnd + m_portLength))); 461 462 *this = parser.result(); 462 463 } … … 467 468 return; 468 469 469 bool colonNeeded = m_portEnd == m_hostEnd;470 bool colonNeeded = !m_portLength; 470 471 unsigned portStart = (colonNeeded ? m_hostEnd : m_hostEnd + 1); 471 472 472 URLParser parser(makeString( m_string.left(portStart), (colonNeeded ? ":" : ""), String::number(i), m_string.substring(m_portEnd)));473 URLParser parser(makeString(StringView(m_string).left(portStart), (colonNeeded ? ":" : ""), String::number(i), StringView(m_string).substring(m_hostEnd + m_portLength))); 473 474 *this = parser.result(); 474 475 } … … 510 511 builder.append(port); 511 512 } 512 builder.append( m_string.substring(m_portEnd));513 builder.append(StringView(m_string).substring(m_hostEnd + m_portLength)); 513 514 514 515 URLParser parser(builder.toString()); … … 659 660 return character == '?' || character == '#'; 660 661 }; 661 URLParser parser(makeString(StringView(m_string).left(m_ portEnd), percentEncodeCharacters(path, questionMarkOrNumberSign), StringView(m_string).substring(m_pathEnd)));662 URLParser parser(makeString(StringView(m_string).left(m_hostEnd + m_portLength), percentEncodeCharacters(path, questionMarkOrNumberSign), StringView(m_string).substring(m_pathEnd))); 662 663 *this = parser.result(); 663 664 } -
trunk/Source/WebCore/platform/URL.h
r233755 r233789 220 220 221 221 String m_string; 222 bool m_isValid : 1; 223 bool m_protocolIsInHTTPFamily : 1; 224 bool m_cannotBeABaseURL : 1; 225 226 unsigned m_schemeEnd; 222 223 unsigned m_isValid : 1; 224 unsigned m_protocolIsInHTTPFamily : 1; 225 unsigned m_cannotBeABaseURL : 1; 226 227 // This is out of order to align the bits better. The port is after the host. 228 unsigned m_portLength : 3; 229 static constexpr unsigned maxPortLength = (1 << 3) - 1; 230 231 static constexpr unsigned maxSchemeLength = (1 << 26) - 1; 232 unsigned m_schemeEnd : 26; 227 233 unsigned m_userStart; 228 234 unsigned m_userEnd; 229 235 unsigned m_passwordEnd; 230 236 unsigned m_hostEnd; 231 unsigned m_portEnd;232 237 unsigned m_pathAfterLastSlash; 233 238 unsigned m_pathEnd; … … 235 240 }; 236 241 242 static_assert(sizeof(URL) == sizeof(String) + 8 * sizeof(unsigned), "URL should stay small"); 243 237 244 template <class Encoder> 238 245 void URL::encode(Encoder& encoder) const 239 246 { 240 247 encoder << m_string; 241 encoder << static_cast<bool>(m_isValid);242 if (!m_isValid)243 return;244 encoder << static_cast<bool>(m_protocolIsInHTTPFamily);245 encoder << m_schemeEnd;246 encoder << m_userStart;247 encoder << m_userEnd;248 encoder << m_passwordEnd;249 encoder << m_hostEnd;250 encoder << m_portEnd;251 encoder << m_pathAfterLastSlash;252 encoder << m_pathEnd;253 encoder << m_queryEnd;254 248 } 255 249 … … 267 261 std::optional<URL> URL::decode(Decoder& decoder) 268 262 { 269 URL url;270 if (!decoder.decode( url.m_string))263 String string; 264 if (!decoder.decode(string)) 271 265 return std::nullopt; 272 bool isValid; 273 if (!decoder.decode(isValid)) 274 return std::nullopt; 275 url.m_isValid = isValid; 276 if (!isValid) 277 return WTFMove(url); 278 bool protocolIsInHTTPFamily; 279 if (!decoder.decode(protocolIsInHTTPFamily)) 280 return std::nullopt; 281 url.m_protocolIsInHTTPFamily = protocolIsInHTTPFamily; 282 if (!decoder.decode(url.m_schemeEnd)) 283 return std::nullopt; 284 if (!decoder.decode(url.m_userStart)) 285 return std::nullopt; 286 if (!decoder.decode(url.m_userEnd)) 287 return std::nullopt; 288 if (!decoder.decode(url.m_passwordEnd)) 289 return std::nullopt; 290 if (!decoder.decode(url.m_hostEnd)) 291 return std::nullopt; 292 if (!decoder.decode(url.m_portEnd)) 293 return std::nullopt; 294 if (!decoder.decode(url.m_pathAfterLastSlash)) 295 return std::nullopt; 296 if (!decoder.decode(url.m_pathEnd)) 297 return std::nullopt; 298 if (!decoder.decode(url.m_queryEnd)) 299 return std::nullopt; 300 return WTFMove(url); 266 return URL(URL(), string); 301 267 } 302 268 … … 401 367 inline bool URL::hasPath() const 402 368 { 403 return m_pathEnd != m_ portEnd;369 return m_pathEnd != m_hostEnd + m_portLength; 404 370 } 405 371 … … 441 407 inline unsigned URL::pathStart() const 442 408 { 443 return m_ portEnd;409 return m_hostEnd + m_portLength; 444 410 } 445 411 -
trunk/Source/WebCore/platform/URLParser.cpp
r233755 r233789 503 503 { 504 504 if (base.protocolIs("file")) { 505 RELEASE_ASSERT(base.m_ portEnd< base.m_string.length());505 RELEASE_ASSERT(base.m_hostEnd + base.m_portLength < base.m_string.length()); 506 506 if (base.m_string.is8Bit()) { 507 507 const LChar* begin = base.m_string.characters8(); 508 CodePointIterator<LChar> c(begin + base.m_ portEnd+ 1, begin + base.m_string.length());508 CodePointIterator<LChar> c(begin + base.m_hostEnd + base.m_portLength + 1, begin + base.m_string.length()); 509 509 if (isWindowsDriveLetter(c)) { 510 510 appendWindowsDriveLetter(c); … … 513 513 } else { 514 514 const UChar* begin = base.m_string.characters16(); 515 CodePointIterator<UChar> c(begin + base.m_ portEnd+ 1, begin + base.m_string.length());515 CodePointIterator<UChar> c(begin + base.m_hostEnd + base.m_portLength + 1, begin + base.m_string.length()); 516 516 if (isWindowsDriveLetter(c)) { 517 517 appendWindowsDriveLetter(c); … … 847 847 return url.m_pathAfterLastSlash; 848 848 case URLPart::PortEnd: 849 return url.m_ portEnd;849 return url.m_hostEnd + url.m_portLength; 850 850 case URLPart::HostEnd: 851 851 return url.m_hostEnd; … … 899 899 FALLTHROUGH; 900 900 case URLPart::PortEnd: 901 m_url.m_port End = base.m_portEnd;901 m_url.m_portLength = base.m_portLength; 902 902 FALLTHROUGH; 903 903 case URLPart::HostEnd: … … 1044 1044 ASSERT(m_url.m_pathAfterLastSlash <= m_asciiBuffer.size()); 1045 1045 CodePointIterator<LChar> componentToPop(&m_asciiBuffer[newPathAfterLastSlash], &m_asciiBuffer[0] + m_url.m_pathAfterLastSlash); 1046 if (newPathAfterLastSlash == m_url.m_ portEnd+ 1 && isWindowsDriveLetter(componentToPop))1046 if (newPathAfterLastSlash == m_url.m_hostEnd + m_url.m_portLength + 1 && isWindowsDriveLetter(componentToPop)) 1047 1047 return false; 1048 1048 return true; … … 1052 1052 { 1053 1053 ASSERT(m_didSeeSyntaxViolation); 1054 if (m_url.m_pathAfterLastSlash > m_url.m_ portEnd+ 1) {1054 if (m_url.m_pathAfterLastSlash > m_url.m_hostEnd + m_url.m_portLength + 1) { 1055 1055 auto newPathAfterLastSlash = m_url.m_pathAfterLastSlash - 1; 1056 1056 if (m_asciiBuffer[newPathAfterLastSlash] == '/') 1057 1057 newPathAfterLastSlash--; 1058 while (newPathAfterLastSlash > m_url.m_ portEnd&& m_asciiBuffer[newPathAfterLastSlash] != '/')1058 while (newPathAfterLastSlash > m_url.m_hostEnd + m_url.m_portLength && m_asciiBuffer[newPathAfterLastSlash] != '/') 1059 1059 newPathAfterLastSlash--; 1060 1060 newPathAfterLastSlash++; … … 1272 1272 appendToASCIIBuffer(toASCIILower(*c)); 1273 1273 } else if (*c == ':') { 1274 m_url.m_schemeEnd = currentPosition(c); 1274 unsigned schemeEnd = currentPosition(c); 1275 if (schemeEnd > URL::maxSchemeLength) { 1276 failure(); 1277 return; 1278 } 1279 m_url.m_schemeEnd = schemeEnd; 1275 1280 StringView urlScheme = parsedDataView(0, m_url.m_schemeEnd); 1276 1281 appendToASCIIBuffer(':'); … … 1322 1327 m_url.m_passwordEnd = m_url.m_userStart; 1323 1328 m_url.m_hostEnd = m_url.m_userStart; 1324 m_url.m_port End = m_url.m_userStart;1329 m_url.m_portLength = 0; 1325 1330 m_url.m_pathAfterLastSlash = m_url.m_userStart; 1326 1331 m_url.m_cannotBeABaseURL = true; … … 1396 1401 m_url.m_passwordEnd = m_url.m_userStart; 1397 1402 m_url.m_hostEnd = m_url.m_userStart; 1398 m_url.m_port End = m_url.m_userStart;1403 m_url.m_portLength = 0; 1399 1404 m_url.m_pathAfterLastSlash = m_url.m_userStart + 1; 1400 1405 state = State::Path; … … 1452 1457 copyURLPartsUntil(base, URLPart::PortEnd, c, isUTF8Encoding); 1453 1458 appendToASCIIBuffer('/'); 1454 m_url.m_pathAfterLastSlash = base.m_ portEnd+ 1;1459 m_url.m_pathAfterLastSlash = base.m_hostEnd + base.m_portLength + 1; 1455 1460 state = State::Path; 1456 1461 } … … 1521 1526 m_url.m_passwordEnd = m_url.m_userEnd; 1522 1527 m_url.m_hostEnd = m_url.m_userEnd; 1523 m_url.m_port End = m_url.m_userEnd;1528 m_url.m_portLength = 0; 1524 1529 m_url.m_pathAfterLastSlash = m_url.m_userEnd; 1525 1530 } else { … … 1591 1596 m_url.m_passwordEnd = m_url.m_userStart; 1592 1597 m_url.m_hostEnd = m_url.m_userStart; 1593 m_url.m_port End = m_url.m_userStart;1598 m_url.m_portLength = 0; 1594 1599 m_url.m_pathAfterLastSlash = m_url.m_userStart + 1; 1595 1600 m_url.m_pathEnd = m_url.m_pathAfterLastSlash; … … 1613 1618 m_url.m_passwordEnd = m_url.m_userStart; 1614 1619 m_url.m_hostEnd = m_url.m_userStart; 1615 m_url.m_port End = m_url.m_userStart;1620 m_url.m_portLength = 0; 1616 1621 m_url.m_pathAfterLastSlash = m_url.m_userStart + 1; 1617 1622 m_url.m_pathEnd = m_url.m_pathAfterLastSlash; … … 1631 1636 m_url.m_passwordEnd = m_url.m_userStart; 1632 1637 m_url.m_hostEnd = m_url.m_userStart; 1633 m_url.m_port End = m_url.m_userStart;1638 m_url.m_portLength = 0; 1634 1639 m_url.m_pathAfterLastSlash = m_url.m_userStart + 1; 1635 1640 if (isWindowsDriveLetter(c)) … … 1651 1656 m_url.m_passwordEnd = m_url.m_userStart; 1652 1657 m_url.m_hostEnd = m_url.m_userStart; 1653 m_url.m_port End = m_url.m_userStart;1658 m_url.m_portLength = 0; 1654 1659 authorityOrHostBegin = c; 1655 1660 state = State::FileHost; … … 1662 1667 m_url.m_passwordEnd = m_url.m_userStart; 1663 1668 m_url.m_hostEnd = m_url.m_userStart; 1664 m_url.m_port End = m_url.m_userStart;1669 m_url.m_portLength = 0; 1665 1670 if (isWindowsDriveLetter(c)) { 1666 1671 appendWindowsDriveLetter(c); … … 1721 1726 m_asciiBuffer.shrink(m_url.m_passwordEnd); 1722 1727 m_url.m_hostEnd = currentPosition(c); 1723 m_url.m_port End = m_url.m_hostEnd;1728 m_url.m_portLength = 0; 1724 1729 } 1725 1730 … … 1876 1881 m_url.m_passwordEnd = m_url.m_userStart; 1877 1882 m_url.m_hostEnd = m_url.m_userStart; 1878 m_url.m_port End = m_url.m_userStart;1883 m_url.m_portLength = 0; 1879 1884 m_url.m_pathAfterLastSlash = m_url.m_userStart + 1; 1880 1885 m_url.m_pathEnd = m_url.m_pathAfterLastSlash; … … 1888 1893 copyURLPartsUntil(base, URLPart::PortEnd, c, isUTF8Encoding); 1889 1894 appendToASCIIBuffer('/'); 1890 m_url.m_pathAfterLastSlash = base.m_portEnd+ 1;1895 m_url.m_pathAfterLastSlash = m_url.m_hostEnd + m_url.m_portLength + 1; 1891 1896 m_url.m_pathEnd = m_url.m_pathAfterLastSlash; 1892 1897 m_url.m_queryEnd = m_url.m_pathAfterLastSlash; … … 1898 1903 m_url.m_passwordEnd = m_url.m_userStart; 1899 1904 m_url.m_hostEnd = m_url.m_userStart; 1900 m_url.m_port End = m_url.m_userStart;1905 m_url.m_portLength = 0; 1901 1906 m_url.m_pathAfterLastSlash = m_url.m_userStart; 1902 1907 m_url.m_pathEnd = m_url.m_userStart; … … 1915 1920 m_url.m_passwordEnd = m_url.m_userStart; 1916 1921 m_url.m_hostEnd = m_url.m_userStart; 1917 m_url.m_port End = m_url.m_userStart;1922 m_url.m_portLength = 0; 1918 1923 m_url.m_pathEnd = m_url.m_userStart; 1919 1924 } else if (!parseHostAndPort(authorityOrHostBegin)) { … … 1924 1929 syntaxViolation(c); 1925 1930 appendToASCIIBuffer('/'); 1926 m_url.m_pathEnd = m_url.m_ portEnd+ 1;1931 m_url.m_pathEnd = m_url.m_hostEnd + m_url.m_portLength + 1; 1927 1932 } else 1928 m_url.m_pathEnd = m_url.m_ portEnd;1933 m_url.m_pathEnd = m_url.m_hostEnd + m_url.m_portLength; 1929 1934 } 1930 1935 m_url.m_pathAfterLastSlash = m_url.m_pathEnd; … … 1940 1945 syntaxViolation(c); 1941 1946 appendToASCIIBuffer('/'); 1942 m_url.m_pathEnd = m_url.m_ portEnd+ 1;1947 m_url.m_pathEnd = m_url.m_hostEnd + m_url.m_portLength + 1; 1943 1948 } else 1944 m_url.m_pathEnd = m_url.m_ portEnd;1949 m_url.m_pathEnd = m_url.m_hostEnd + m_url.m_portLength; 1945 1950 m_url.m_pathAfterLastSlash = m_url.m_pathEnd; 1946 1951 m_url.m_queryEnd = m_url.m_pathEnd; … … 1958 1963 m_url.m_passwordEnd = m_url.m_userStart; 1959 1964 m_url.m_hostEnd = m_url.m_userStart; 1960 m_url.m_port End = m_url.m_userStart;1965 m_url.m_portLength = 0; 1961 1966 m_url.m_pathAfterLastSlash = m_url.m_userStart + 1; 1962 1967 m_url.m_pathEnd = m_url.m_pathAfterLastSlash; … … 1971 1976 m_url.m_passwordEnd = m_url.m_userStart; 1972 1977 m_url.m_hostEnd = m_url.m_userStart; 1973 m_url.m_port End = m_url.m_userStart;1978 m_url.m_portLength = 0; 1974 1979 if (copyBaseWindowsDriveLetter(base)) { 1975 1980 appendToASCIIBuffer('/'); … … 2000 2005 m_url.m_passwordEnd = m_url.m_userStart; 2001 2006 m_url.m_hostEnd = m_url.m_userStart; 2002 m_url.m_port End = m_url.m_userStart;2007 m_url.m_portLength = 0; 2003 2008 m_url.m_pathAfterLastSlash = m_url.m_userStart + 1; 2004 2009 m_url.m_pathEnd = m_url.m_pathAfterLastSlash; … … 2016 2021 m_asciiBuffer.shrink(m_url.m_passwordEnd); 2017 2022 m_url.m_hostEnd = currentPosition(c); 2018 m_url.m_port End = m_url.m_hostEnd;2023 m_url.m_portLength = 0; 2019 2024 } 2020 2025 appendToASCIIBuffer('/'); 2021 m_url.m_pathAfterLastSlash = m_url.m_ portEnd+ 1;2026 m_url.m_pathAfterLastSlash = m_url.m_hostEnd + m_url.m_portLength + 1; 2022 2027 m_url.m_pathEnd = m_url.m_pathAfterLastSlash; 2023 2028 m_url.m_queryEnd = m_url.m_pathAfterLastSlash; … … 2602 2607 uint32_t port = 0; 2603 2608 if (UNLIKELY(iterator.atEnd())) { 2604 m_url.m_portEnd = currentPosition(colonIterator); 2609 unsigned portLength = currentPosition(colonIterator) - m_url.m_hostEnd; 2610 RELEASE_ASSERT(portLength <= URL::maxPortLength); 2611 m_url.m_portLength = portLength; 2605 2612 syntaxViolation(colonIterator); 2606 2613 return true; … … 2639 2646 } 2640 2647 2641 m_url.m_portEnd = currentPosition(iterator); 2648 unsigned portLength = currentPosition(iterator) - m_url.m_hostEnd; 2649 RELEASE_ASSERT(portLength <= URL::maxPortLength); 2650 m_url.m_portLength = portLength; 2642 2651 return true; 2643 2652 } … … 2665 2674 } 2666 2675 m_url.m_hostEnd = currentPosition(ipv6End); 2667 m_url.m_port End = m_url.m_hostEnd;2676 m_url.m_portLength = 0; 2668 2677 return true; 2669 2678 } … … 2688 2697 m_url.m_hostEnd = currentPosition(iterator); 2689 2698 if (iterator.atEnd()) { 2690 m_url.m_port End = currentPosition(iterator);2699 m_url.m_portLength = 0; 2691 2700 return true; 2692 2701 } … … 2709 2718 m_url.m_hostEnd = currentPosition(iterator); 2710 2719 if (iterator.atEnd()) { 2711 m_url.m_port End = currentPosition(iterator);2720 m_url.m_portLength = 0; 2712 2721 return true; 2713 2722 } … … 2728 2737 if (!hostIterator.atEnd()) 2729 2738 return parsePort(hostIterator); 2730 m_url.m_portEnd = currentPosition(iterator); 2739 unsigned portLength = currentPosition(iterator) - m_url.m_hostEnd; 2740 RELEASE_ASSERT(portLength <= URL::maxPortLength); 2741 m_url.m_portLength = portLength; 2731 2742 return true; 2732 2743 } … … 2770 2781 m_url.m_hostEnd = currentPosition(iterator); 2771 2782 if (iterator.atEnd()) { 2772 m_url.m_port End = currentPosition(iterator);2783 m_url.m_portLength = 0; 2773 2784 return true; 2774 2785 } … … 2782 2793 if (!iterator.atEnd()) 2783 2794 return parsePort(iterator); 2784 m_url.m_port End = currentPosition(iterator);2795 m_url.m_portLength = 0; 2785 2796 return true; 2786 2797 } … … 2869 2880 bool URLParser::allValuesEqual(const URL& a, const URL& b) 2870 2881 { 2871 // FIXME: m_cannotBeABaseURL is not compared because the old URL::parse did not use it, 2872 // but once we get rid of URL::parse its value should be tested. 2873 URL_PARSER_LOG("%d %d %d %d %d %d %d %d %d %d %d %s\n%d %d %d %d %d %d %d %d %d %d %d %s", 2882 URL_PARSER_LOG("%d %d %d %d %d %d %d %d %d %d %d %d %s\n%d %d %d %d %d %d %d %d %d %d %d %d %s", 2874 2883 a.m_isValid, 2884 a.m_cannotBeABaseURL, 2875 2885 a.m_protocolIsInHTTPFamily, 2876 2886 a.m_schemeEnd, … … 2879 2889 a.m_passwordEnd, 2880 2890 a.m_hostEnd, 2881 a.m_ portEnd,2891 a.m_hostEnd + a.m_portLength, 2882 2892 a.m_pathAfterLastSlash, 2883 2893 a.m_pathEnd, … … 2885 2895 a.m_string.utf8().data(), 2886 2896 b.m_isValid, 2897 b.m_cannotBeABaseURL, 2887 2898 b.m_protocolIsInHTTPFamily, 2888 2899 b.m_schemeEnd, … … 2891 2902 b.m_passwordEnd, 2892 2903 b.m_hostEnd, 2893 b.m_ portEnd,2904 b.m_hostEnd + b.m_portLength, 2894 2905 b.m_pathAfterLastSlash, 2895 2906 b.m_pathEnd, … … 2899 2910 return a.m_string == b.m_string 2900 2911 && a.m_isValid == b.m_isValid 2912 && a.m_cannotBeABaseURL == b.m_cannotBeABaseURL 2901 2913 && a.m_protocolIsInHTTPFamily == b.m_protocolIsInHTTPFamily 2902 2914 && a.m_schemeEnd == b.m_schemeEnd … … 2905 2917 && a.m_passwordEnd == b.m_passwordEnd 2906 2918 && a.m_hostEnd == b.m_hostEnd 2907 && a.m_port End == b.m_portEnd2919 && a.m_portLength == b.m_portLength 2908 2920 && a.m_pathAfterLastSlash == b.m_pathAfterLastSlash 2909 2921 && a.m_pathEnd == b.m_pathEnd … … 2917 2929 && url.m_userEnd <= url.m_passwordEnd 2918 2930 && url.m_passwordEnd <= url.m_hostEnd 2919 && url.m_hostEnd <= url.m_portEnd 2920 && url.m_portEnd <= url.m_pathAfterLastSlash 2931 && url.m_hostEnd + url.m_portLength <= url.m_pathAfterLastSlash 2921 2932 && url.m_pathAfterLastSlash <= url.m_pathEnd 2922 2933 && url.m_pathEnd <= url.m_queryEnd -
trunk/Source/WebCore/workers/service/server/RegistrationDatabase.cpp
r233122 r233789 49 49 namespace WebCore { 50 50 51 static const uint64_t schemaVersion = 2;51 static const uint64_t schemaVersion = 3; 52 52 53 53 static const String recordsTableSchema(const String& tableName) -
trunk/Source/WebKit/ChangeLog
r233788 r233789 1 2018-07-12 Alex Christensen <achristensen@webkit.org> 2 3 Reduce size of WebCore::URL 4 https://bugs.webkit.org/show_bug.cgi?id=186820 5 6 Reviewed by Yusuke Suzuki and Youenn Fablet. 7 8 * NetworkProcess/cache/NetworkCacheStorage.h: 9 Increment cache version because of URL encoding change. 10 1 11 2018-07-12 Chris Dumez <cdumez@apple.com> 2 12 -
trunk/Source/WebKit/NetworkProcess/cache/NetworkCacheStorage.h
r232759 r233789 109 109 110 110 // Incrementing this number will delete all existing cache content for everyone. Do you really need to do it? 111 static const unsigned version = 1 2;111 static const unsigned version = 13; 112 112 #if PLATFORM(MAC) 113 113 /// Allow the last stable version of the cache to co-exist with the latest development one. -
trunk/Tools/ChangeLog
r233786 r233789 1 2018-07-12 Alex Christensen <achristensen@webkit.org> 2 3 Reduce size of WebCore::URL 4 https://bugs.webkit.org/show_bug.cgi?id=186820 5 6 Reviewed by Yusuke Suzuki and Youenn Fablet. 7 8 * TestWebKitAPI/Tests/WebCore/URLParser.cpp: 9 (TestWebKitAPI::TEST_F): 10 1 11 2018-07-12 Brady Eidson <beidson@apple.com> 2 12 -
trunk/Tools/TestWebKitAPI/Tests/WebCore/URLParser.cpp
r233755 r233789 1180 1180 {"", "", "", "", 0, "", "", "", "file://:0/path"}, 1181 1181 {"file", "", "", "", 0, "/path", "", "", "file://:0/path"}); 1182 1183 checkURL("http://example.com:0000000000000077", {"http", "", "", "example.com", 77, "/", "", "", "http://example.com:77/"}); 1184 checkURL("http://example.com:0000000000000080", {"http", "", "", "example.com", 0, "/", "", "", "http://example.com/"}); 1182 1185 } 1183 1186
Note:
See TracChangeset
for help on using the changeset viewer.