Changeset 205668 in webkit
- Timestamp:
- Sep 8, 2016, 3:16:49 PM (9 years ago)
- Location:
- trunk
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r205667 r205668 1 2016-09-08 Alex Christensen <achristensen@webkit.org> 2 3 URLParser should correctly handle \ in path 4 https://bugs.webkit.org/show_bug.cgi?id=161762 5 6 Reviewed by Brady Eidson. 7 8 Covered by new API tests. 9 10 * platform/URLParser.cpp: 11 (WebCore::isSpecialScheme): 12 (WebCore::bufferView): 13 (WebCore::URLParser::parse): 14 Treat \ as / in the path of special URLs as described in the spec and tested in web platform tests. 15 Also a slight performance improvement using StringViews instead of copied Strings. 16 1 17 2016-09-08 Alex Christensen <achristensen@webkit.org> 2 18 -
trunk/Source/WebCore/platform/URLParser.cpp
r205667 r205668 140 140 } 141 141 142 static bool isSpecialScheme( const String&scheme)142 static bool isSpecialScheme(StringView scheme) 143 143 { 144 144 return scheme == "ftp" … … 149 149 || scheme == "ws" 150 150 || scheme == "wss"; 151 } 152 153 static StringView bufferView(const StringBuilder& builder) 154 { 155 if (builder.is8Bit()) 156 return StringView(builder.characters8(), builder.length()); 157 return StringView(builder.characters16(), builder.length()); 151 158 } 152 159 … … 395 402 #define LOG_FINAL_STATE(x) LOG(URLParser, "Final State: %s", x) 396 403 404 bool urlIsSpecial = false; 397 405 State state = State::SchemeStart; 398 406 while (c != end) { … … 418 426 else if (*c == ':') { 419 427 m_url.m_schemeEnd = m_buffer.length(); 420 String urlScheme = m_buffer.toString(); // FIXME: Find a way to do this without shrinking the m_buffer.428 StringView urlScheme = bufferView(m_buffer); 421 429 m_url.m_protocolIsInHTTPFamily = urlScheme == "http" || urlScheme == "https"; 422 430 if (urlScheme == "file") { 431 urlIsSpecial = true; 423 432 state = State::File; 424 433 m_buffer.append(':'); … … 427 436 } 428 437 if (isSpecialScheme(urlScheme)) { 438 urlIsSpecial = true; 429 439 if (base.protocol() == urlScheme) 430 440 state = State::SpecialRelativeOrAuthority; … … 747 757 case State::Path: 748 758 LOG_STATE("Path"); 749 if (*c == '/' ) {759 if (*c == '/' || (urlIsSpecial && *c == '\\')) { 750 760 m_buffer.append('/'); 751 761 m_url.m_pathAfterLastSlash = m_buffer.length(); -
trunk/Tools/ChangeLog
r205667 r205668 1 2016-09-08 Alex Christensen <achristensen@webkit.org> 2 3 URLParser should correctly handle \ in path 4 https://bugs.webkit.org/show_bug.cgi?id=161762 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
r205667 r205668 238 238 checkRelativeURL("http://@host", "about:blank", {"http", "", "", "host", 0, "/", "", "", "http://host/"}); 239 239 checkRelativeURL("http://:@host", "about:blank", {"http", "", "", "host", 0, "/", "", "", "http://host/"}); 240 checkRelativeURL("http://foo.com/\\@", "http://example.org/foo/bar", {"http", "", "", "foo.com", 0, "//@", "", "", "http://foo.com//@"}); 241 checkRelativeURL("\\@", "http://example.org/foo/bar", {"http", "", "", "example.org", 0, "/@", "", "", "http://example.org/@"}); 240 242 } 241 243
Note:
See TracChangeset
for help on using the changeset viewer.