Changeset 213469 in webkit
- Timestamp:
- Mar 6, 2017, 2:55:33 PM (8 years ago)
- Location:
- trunk
- Files:
-
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r213466 r213469 1 2017-03-06 Alex Christensen <achristensen@webkit.org> 2 3 Fix URLs relative to file URLs with paths beginning with Windows drive letters 4 https://bugs.webkit.org/show_bug.cgi?id=169178 5 6 Reviewed by Tim Horton. 7 8 * fast/url/relative-win-expected.txt: 9 Some tests pass now. localhost should indeed be removed according to the latest spec. 10 1 11 2017-03-06 Simon Fraser <simon.fraser@apple.com> 2 12 -
trunk/LayoutTests/fast/url/relative-win-expected.txt
r212953 r213469 7 7 PASS canonicalize('bar') is 'file:///C:/bar' 8 8 PASS canonicalize('../../../bar.html') is 'file:///C:/bar.html' 9 FAIL canonicalize('/../bar.html') should be file:///C:/bar.html. Was file:///bar.html. 9 PASS canonicalize('/../bar.html') is 'file:///C:/bar.html' 10 10 FAIL canonicalize('\\\\another\\path') should be . Was http://another/path. 11 11 FAIL canonicalize('//c:/foo') should be file:///C:/foo. Was file:///c:/foo. … … 15 15 FAIL canonicalize('c:\\foo') should be . Was c:\foo. 16 16 FAIL canonicalize('/z:/bar') should be file:///Z:/bar. Was file:///z:/bar. 17 FAIL canonicalize('/bar') should be file:///C:/bar. Was file:///bar. 18 FAIL canonicalize('/bar') should be file://localhost/C:/bar. Was file:/// bar.19 FAIL canonicalize('/bar') should be file:///C:/bar. Was file:///bar. 17 PASS canonicalize('/bar') is 'file:///C:/bar' 18 FAIL canonicalize('/bar') should be file://localhost/C:/bar. Was file:///C:/bar. 19 PASS canonicalize('/bar') is 'file:///C:/bar' 20 20 PASS canonicalize('//somehost/path') is 'file://somehost/path' 21 21 FAIL canonicalize('/\\//somehost/path') should be file://somehost/path. Was file:////somehost/path. -
trunk/LayoutTests/imported/w3c/ChangeLog
r213457 r213469 1 2017-03-06 Alex Christensen <achristensen@webkit.org> 2 3 Fix URLs relative to file URLs with paths beginning with Windows drive letters 4 https://bugs.webkit.org/show_bug.cgi?id=169178 5 6 Reviewed by Tim Horton. 7 8 * web-platform-tests/url/a-element-expected.txt: 9 * web-platform-tests/url/a-element-xhtml-expected.txt: 10 * web-platform-tests/url/url-constructor-expected.txt: 11 1 12 2017-03-06 Manuel Rego Casasnovas <rego@igalia.com> 2 13 -
trunk/LayoutTests/imported/w3c/web-platform-tests/url/a-element-expected.txt
r212977 r213469 386 386 PASS Parsing: <..> against <file:///C:/> 387 387 PASS Parsing: <..> against <file:///> 388 FAIL Parsing: </> against <file:///C:/a/b> assert_equals: href expected "file:///C:/" but got "file:///" 388 PASS Parsing: </> against <file:///C:/a/b> 389 389 FAIL Parsing: <//d:> against <file:///C:/a/b> assert_equals: href expected "file:///d:" but got "file://d/" 390 390 PASS Parsing: <//d:/..> against <file:///C:/a/b> -
trunk/LayoutTests/imported/w3c/web-platform-tests/url/a-element-xhtml-expected.txt
r212977 r213469 386 386 PASS Parsing: <..> against <file:///C:/> 387 387 PASS Parsing: <..> against <file:///> 388 FAIL Parsing: </> against <file:///C:/a/b> assert_equals: href expected "file:///C:/" but got "file:///" 388 PASS Parsing: </> against <file:///C:/a/b> 389 389 FAIL Parsing: <//d:> against <file:///C:/a/b> assert_equals: href expected "file:///d:" but got "file://d/" 390 390 PASS Parsing: <//d:/..> against <file:///C:/a/b> -
trunk/LayoutTests/imported/w3c/web-platform-tests/url/url-constructor-expected.txt
r212977 r213469 394 394 PASS Parsing: <..> against <file:///C:/> 395 395 PASS Parsing: <..> against <file:///> 396 FAIL Parsing: </> against <file:///C:/a/b> assert_equals: href expected "file:///C:/" but got "file:///" 396 PASS Parsing: </> against <file:///C:/a/b> 397 397 FAIL Parsing: <//d:> against <file:///C:/a/b> assert_equals: href expected "file:///d:" but got "file://d/" 398 398 PASS Parsing: <//d:/..> against <file:///C:/a/b> -
trunk/Source/WebCore/ChangeLog
r213466 r213469 1 2017-03-06 Alex Christensen <achristensen@webkit.org> 2 3 Fix URLs relative to file URLs with paths beginning with Windows drive letters 4 https://bugs.webkit.org/show_bug.cgi?id=169178 5 6 Reviewed by Tim Horton. 7 8 Windows drives in file URLs can begin with windows drive letters, such as file:///C:/ 9 which should not be removed when making other URLs relative to them. 10 See https://url.spec.whatwg.org/#file-slash-state 11 12 Covered by new API tests and newly passing web-platform-tests. 13 14 * platform/URLParser.cpp: 15 (WebCore::URLParser::copyBaseWindowsDriveLetter): 16 (WebCore::URLParser::copyASCIIStringUntil): 17 (WebCore::URLParser::parse): 18 * platform/URLParser.h: 19 1 20 2017-03-06 Simon Fraser <simon.fraser@apple.com> 2 21 -
trunk/Source/WebCore/platform/URLParser.cpp
r213384 r213469 488 488 } 489 489 490 bool URLParser::copyBaseWindowsDriveLetter(const URL& base) 491 { 492 if (base.protocolIs("file")) { 493 RELEASE_ASSERT(base.m_portEnd < base.m_string.length()); 494 if (base.m_string.is8Bit()) { 495 const LChar* begin = base.m_string.characters8(); 496 CodePointIterator<LChar> c(begin + base.m_portEnd + 1, begin + base.m_string.length()); 497 if (isWindowsDriveLetter(c)) { 498 appendWindowsDriveLetter(c); 499 return true; 500 } 501 } else { 502 const UChar* begin = base.m_string.characters16(); 503 CodePointIterator<UChar> c(begin + base.m_portEnd + 1, begin + base.m_string.length()); 504 if (isWindowsDriveLetter(c)) { 505 appendWindowsDriveLetter(c); 506 return true; 507 } 508 } 509 } 510 return false; 511 } 512 490 513 template<typename CharacterType> 491 514 bool URLParser::shouldCopyFileURL(CodePointIterator<CharacterType> iterator) … … 815 838 return; 816 839 ASSERT(m_asciiBuffer.isEmpty()); 817 if (string.is8Bit()) {840 if (string.is8Bit()) 818 841 appendToASCIIBuffer(string.characters8(), length); 819 }else {842 else { 820 843 const UChar* characters = string.characters16(); 821 844 for (size_t i = 0; i < length; ++i) { … … 1603 1626 break; 1604 1627 } 1605 if (base.isValid() && base.protocolIs("file")) {1606 // FIXME: This String copy is unnecessary.1607 String basePath = base.path();1608 if (basePath.length() >= 2) {1609 bool windowsQuirk = basePath.is8Bit()1610 ? isWindowsDriveLetter(CodePointIterator<LChar>(basePath.characters8(), basePath.characters8() + basePath.length()))1611 : isWindowsDriveLetter(CodePointIterator<UChar>(basePath.characters16(), basePath.characters16() + basePath.length()));1612 if (windowsQuirk) {1613 appendToASCIIBuffer(basePath[0]);1614 appendToASCIIBuffer(basePath[1]);1615 }1616 }1617 }1618 1628 syntaxViolation(c); 1619 1629 appendToASCIIBuffer("//", 2); … … 1623 1633 m_url.m_hostEnd = m_url.m_userStart; 1624 1634 m_url.m_portEnd = m_url.m_userStart; 1625 m_url.m_pathAfterLastSlash = m_url.m_userStart + 1; 1626 if (isWindowsDriveLetter(c)) 1635 if (isWindowsDriveLetter(c)) { 1627 1636 appendWindowsDriveLetter(c); 1637 m_url.m_pathAfterLastSlash = m_url.m_userStart + 1; 1638 } else if (copyBaseWindowsDriveLetter(base)) { 1639 appendToASCIIBuffer('/'); 1640 m_url.m_pathAfterLastSlash = m_url.m_userStart + 4; 1641 } else 1642 m_url.m_pathAfterLastSlash = m_url.m_userStart + 1; 1628 1643 state = State::Path; 1629 1644 break; … … 1932 1947 m_url.m_hostEnd = m_url.m_userStart; 1933 1948 m_url.m_portEnd = m_url.m_userStart; 1934 m_url.m_pathAfterLastSlash = m_url.m_userStart + 1; 1949 if (copyBaseWindowsDriveLetter(base)) { 1950 appendToASCIIBuffer('/'); 1951 m_url.m_pathAfterLastSlash = m_url.m_userStart + 4; 1952 } else 1953 m_url.m_pathAfterLastSlash = m_url.m_userStart + 1; 1935 1954 m_url.m_pathEnd = m_url.m_pathAfterLastSlash; 1936 1955 m_url.m_queryEnd = m_url.m_pathAfterLastSlash; -
trunk/Source/WebCore/platform/URLParser.h
r212953 r213469 105 105 template<typename CharacterType> void encodeQuery(const Vector<UChar>& source, const TextEncoding&, CodePointIterator<CharacterType>); 106 106 void copyASCIIStringUntil(const String&, size_t length); 107 bool copyBaseWindowsDriveLetter(const URL&); 107 108 StringView parsedDataView(size_t start, size_t length); 108 109 UChar parsedDataView(size_t position); -
trunk/Tools/ChangeLog
r213464 r213469 1 2017-03-06 Alex Christensen <achristensen@webkit.org> 2 3 Fix URLs relative to file URLs with paths beginning with Windows drive letters 4 https://bugs.webkit.org/show_bug.cgi?id=169178 5 6 Reviewed by Tim Horton. 7 8 * TestWebKitAPI/Tests/WebCore/URLParser.cpp: 9 (TestWebKitAPI::TEST_F): 10 1 11 2017-03-06 Myles C. Maxfield <mmaxfield@apple.com> 2 12 -
trunk/Tools/TestWebKitAPI/Tests/WebCore/URLParser.cpp
r213384 r213469 581 581 checkRelativeURL("http://something#", "file:////var//containers//stuff/", {"http", "", "", "something", 0, "/", "", "", "http://something/#"}, TestTabs::No); 582 582 checkRelativeURL("file:", "file:///path?query#fragment", {"file", "", "", "", 0, "/path", "query", "", "file:///path?query"}); 583 checkRelativeURL("/", "file:///C:/a/b", {"file", "", "", "", 0, "/C:/", "", "", "file:///C:/"}); 584 checkRelativeURL("/abc", "file:///C:/a/b", {"file", "", "", "", 0, "/C:/abc", "", "", "file:///C:/abc"}); 585 checkRelativeURL("/abc", "file:///C:", {"file", "", "", "", 0, "/C:/abc", "", "", "file:///C:/abc"}); 586 checkRelativeURL("/abc", "file:///", {"file", "", "", "", 0, "/abc", "", "", "file:///abc"}); 583 587 584 588 // The checking of slashes in SpecialAuthoritySlashes needed to get this to pass contradicts what is in the spec,
Note:
See TracChangeset
for help on using the changeset viewer.