Changeset 207301 in webkit
- Timestamp:
- Oct 13, 2016 12:21:35 PM (7 years ago)
- Location:
- trunk
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r207300 r207301 1 2016-10-13 Ryan Haddad <ryanhaddad@apple.com> 2 3 Unreviewed, rolling out r207297. 4 5 This change broke the iOS build. 6 7 Reverted changeset: 8 9 "Disable URLParser for non-Safari iOS and Mac apps for now" 10 https://bugs.webkit.org/show_bug.cgi?id=163397 11 http://trac.webkit.org/changeset/207297 12 1 13 2016-10-13 Anders Carlsson <andersca@apple.com> 2 14 -
trunk/Source/WebCore/platform/URLParser.cpp
r207297 r207301 1129 1129 void URLParser::parse(const CharacterType* input, const unsigned length, const URL& base, const TextEncoding& encoding) 1130 1130 { 1131 #if PLATFORM(MAC) 1132 static bool isMail = MacApplication::isAppleMail(); 1133 #else 1134 static bool isMail = false; 1135 #endif 1136 1131 1137 URL_PARSER_LOG("Parsing URL <%s> base <%s> encoding <%s>", String(input, length).utf8().data(), base.string().utf8().data(), encoding.name()); 1132 1138 m_url = { }; … … 1455 1461 m_url.m_userEnd = currentPosition(authorityOrHostBegin); 1456 1462 m_url.m_passwordEnd = m_url.m_userEnd; 1457 if (!parseHostAndPort(iterator )) {1463 if (!parseHostAndPort(iterator, isMail)) { 1458 1464 failure(); 1459 1465 return; … … 1477 1483 LOG_STATE("Host"); 1478 1484 if (*c == '/' || *c == '?' || *c == '#') { 1479 if (!parseHostAndPort(CodePointIterator<CharacterType>(authorityOrHostBegin, c) )) {1485 if (!parseHostAndPort(CodePointIterator<CharacterType>(authorityOrHostBegin, c), isMail)) { 1480 1486 failure(); 1481 1487 return; … … 1648 1654 break; 1649 1655 } 1650 if (!parseHostAndPort(CodePointIterator<CharacterType>(authorityOrHostBegin, c) )) {1656 if (!parseHostAndPort(CodePointIterator<CharacterType>(authorityOrHostBegin, c), isMail)) { 1651 1657 failure(); 1652 1658 return; … … 1868 1874 m_url.m_portEnd = m_url.m_userStart; 1869 1875 m_url.m_pathEnd = m_url.m_userStart + 2; 1870 } else if (!parseHostAndPort(authorityOrHostBegin )) {1876 } else if (!parseHostAndPort(authorityOrHostBegin, isMail)) { 1871 1877 failure(); 1872 1878 return; 1873 1879 } else { 1874 syntaxViolation(c); 1875 appendToASCIIBuffer('/'); 1876 m_url.m_pathEnd = m_url.m_portEnd + 1; 1880 if (LIKELY(!isMail || m_urlIsSpecial)) { 1881 syntaxViolation(c); 1882 appendToASCIIBuffer('/'); 1883 m_url.m_pathEnd = m_url.m_portEnd + 1; 1884 } else 1885 m_url.m_pathEnd = m_url.m_portEnd; 1877 1886 } 1878 1887 m_url.m_pathAfterLastSlash = m_url.m_pathEnd; … … 1882 1891 case State::Host: 1883 1892 LOG_FINAL_STATE("Host"); 1884 if (!parseHostAndPort(authorityOrHostBegin )) {1893 if (!parseHostAndPort(authorityOrHostBegin, isMail)) { 1885 1894 failure(); 1886 1895 return; 1887 1896 } 1888 syntaxViolation(c); 1889 appendToASCIIBuffer('/'); 1890 m_url.m_pathEnd = m_url.m_portEnd + 1; 1897 if (LIKELY(!isMail || m_urlIsSpecial)) { 1898 syntaxViolation(c); 1899 appendToASCIIBuffer('/'); 1900 m_url.m_pathEnd = m_url.m_portEnd + 1; 1901 } else 1902 m_url.m_pathEnd = m_url.m_portEnd; 1891 1903 m_url.m_pathAfterLastSlash = m_url.m_pathEnd; 1892 1904 m_url.m_queryEnd = m_url.m_pathEnd; … … 1942 1954 } 1943 1955 1944 if (!parseHostAndPort(CodePointIterator<CharacterType>(authorityOrHostBegin, c) )) {1956 if (!parseHostAndPort(CodePointIterator<CharacterType>(authorityOrHostBegin, c), isMail)) { 1945 1957 failure(); 1946 1958 return; … … 2557 2569 2558 2570 template<typename CharacterType> 2559 bool URLParser::parseHostAndPort(CodePointIterator<CharacterType> iterator )2571 bool URLParser::parseHostAndPort(CodePointIterator<CharacterType> iterator, const bool& isMail) 2560 2572 { 2561 2573 if (iterator.atEnd()) … … 2607 2619 for (; hostIterator != iterator; ++hostIterator) { 2608 2620 if (LIKELY(!isTabOrNewline(*hostIterator))) { 2609 if (UNLIKELY(isASCIIUpper(*hostIterator))) 2610 syntaxViolation(hostIterator); 2611 appendToASCIIBuffer(toASCIILower(*hostIterator)); 2621 if (UNLIKELY(isMail && !m_urlIsSpecial)) 2622 appendToASCIIBuffer(*hostIterator); 2623 else { 2624 if (UNLIKELY(isASCIIUpper(*hostIterator))) 2625 syntaxViolation(hostIterator); 2626 appendToASCIIBuffer(toASCIILower(*hostIterator)); 2627 } 2612 2628 } else 2613 2629 syntaxViolation(hostIterator); … … 2788 2804 } 2789 2805 2790 enum class URLParserEnabled { 2791 Undetermined, 2792 Yes, 2793 No 2794 }; 2795 2796 static URLParserEnabled urlParserEnabled = URLParserEnabled::Undetermined; 2806 static bool urlParserEnabled = true; 2797 2807 2798 2808 void URLParser::setEnabled(bool enabled) 2799 2809 { 2800 urlParserEnabled = enabled ? URLParserEnabled::Yes : URLParserEnabled::No;2810 urlParserEnabled = enabled; 2801 2811 } 2802 2812 2803 2813 bool URLParser::enabled() 2804 2814 { 2805 if (urlParserEnabled == URLParserEnabled::Undetermined) { 2806 #if PLATFORM(MAC) 2807 urlParserEnabled = MacApplication::isSafari() ? URLParserEnabled::Yes : URLParserEnabled::No; 2808 #elif PLATFORM(IOS) 2809 urlParserEnabled = IOSApplication::isMobileSafari() ? URLParserEnabled::Yes : URLParserEnabled::No; 2810 #else 2811 urlParserEnabled = URLParserEnabled::Yes; 2812 #endif 2813 } 2814 return urlParserEnabled == URLParserEnabled::Yes; 2815 return urlParserEnabled; 2815 2816 } 2816 2817 -
trunk/Source/WebCore/platform/URLParser.h
r207297 r207301 61 61 template<typename CharacterType> void parse(const CharacterType*, const unsigned length, const URL&, const TextEncoding&); 62 62 template<typename CharacterType> void parseAuthority(CodePointIterator<CharacterType>); 63 template<typename CharacterType> bool parseHostAndPort(CodePointIterator<CharacterType> );63 template<typename CharacterType> bool parseHostAndPort(CodePointIterator<CharacterType>, const bool& isMail); 64 64 template<typename CharacterType> bool parsePort(CodePointIterator<CharacterType>&); 65 65 -
trunk/Tools/ChangeLog
r207297 r207301 1 2016-10-13 Ryan Haddad <ryanhaddad@apple.com> 2 3 Unreviewed, rolling out r207297. 4 5 This change broke the iOS build. 6 7 Reverted changeset: 8 9 "Disable URLParser for non-Safari iOS and Mac apps for now" 10 https://bugs.webkit.org/show_bug.cgi?id=163397 11 http://trac.webkit.org/changeset/207297 12 1 13 2016-10-13 Alex Christensen <achristensen@webkit.org> 2 14 -
trunk/Tools/DumpRenderTree/mac/DumpRenderTree.mm
r207297 r207301 59 59 #import <JavaScriptCore/TestRunnerUtils.h> 60 60 #import <WebCore/LogInitialization.h> 61 #import <WebCore/URLParser.h>62 61 #import <WebKit/DOMElement.h> 63 62 #import <WebKit/DOMExtensions.h> … … 1411 1410 int DumpRenderTreeMain(int argc, const char *argv[]) 1412 1411 { 1413 WebCore::URLParser::setEnabled(true);1414 1412 atexit(atexitFunction); 1415 1413 -
trunk/Tools/WebKitTestRunner/ios/mainIOS.mm
r207297 r207301 30 30 #import "UIKitSPI.h" 31 31 #import <UIKit/UIKit.h> 32 #import <WebCore/URLParser.h>33 32 34 33 static int _argc; … … 66 65 int main(int argc, const char* argv[]) 67 66 { 68 WebCore::URLParser::setEnabled(true);69 67 _argc = argc; 70 68 _argv = argv; -
trunk/Tools/WebKitTestRunner/mac/main.mm
r207297 r207301 30 30 #import "PlatformWebView.h" 31 31 #import "TestController.h" 32 #import <WebCore/URLParser.h>33 32 34 33 static void setDefaultsToConsistentValuesForTesting() … … 57 56 int main(int argc, const char* argv[]) 58 57 { 59 WebCore::URLParser::setEnabled(true);60 58 NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; 61 59 [NSApplication sharedApplication];
Note: See TracChangeset
for help on using the changeset viewer.