Diff
Modified: trunk/LayoutTests/ChangeLog (213468 => 213469)
--- trunk/LayoutTests/ChangeLog 2017-03-06 22:46:57 UTC (rev 213468)
+++ trunk/LayoutTests/ChangeLog 2017-03-06 22:55:33 UTC (rev 213469)
@@ -1,3 +1,13 @@
+2017-03-06 Alex Christensen <[email protected]>
+
+ Fix URLs relative to file URLs with paths beginning with Windows drive letters
+ https://bugs.webkit.org/show_bug.cgi?id=169178
+
+ Reviewed by Tim Horton.
+
+ * fast/url/relative-win-expected.txt:
+ Some tests pass now. localhost should indeed be removed according to the latest spec.
+
2017-03-06 Simon Fraser <[email protected]>
Only use layer backing store which supports subpixel antialiased text if we know subpixel antialiased will be painted into it
Modified: trunk/LayoutTests/fast/url/relative-win-expected.txt (213468 => 213469)
--- trunk/LayoutTests/fast/url/relative-win-expected.txt 2017-03-06 22:46:57 UTC (rev 213468)
+++ trunk/LayoutTests/fast/url/relative-win-expected.txt 2017-03-06 22:55:33 UTC (rev 213469)
@@ -6,7 +6,7 @@
PASS canonicalize('http://host/') is 'http://host/'
PASS canonicalize('bar') is 'file:///C:/bar'
PASS canonicalize('../../../bar.html') is 'file:///C:/bar.html'
-FAIL canonicalize('/../bar.html') should be file:///C:/bar.html. Was file:///bar.html.
+PASS canonicalize('/../bar.html') is 'file:///C:/bar.html'
FAIL canonicalize('\\\\another\\path') should be . Was http://another/path.
FAIL canonicalize('//c:/foo') should be file:///C:/foo. Was file:///c:/foo.
FAIL canonicalize('//localhost/c:/foo') should be file:///C:/foo. Was file:///c:/foo.
@@ -14,9 +14,9 @@
FAIL canonicalize('c:/foo') should be . Was c:/foo.
FAIL canonicalize('c:\\foo') should be . Was c:\foo.
FAIL canonicalize('/z:/bar') should be file:///Z:/bar. Was file:///z:/bar.
-FAIL canonicalize('/bar') should be file:///C:/bar. Was file:///bar.
-FAIL canonicalize('/bar') should be file://localhost/C:/bar. Was file:///bar.
-FAIL canonicalize('/bar') should be file:///C:/bar. Was file:///bar.
+PASS canonicalize('/bar') is 'file:///C:/bar'
+FAIL canonicalize('/bar') should be file://localhost/C:/bar. Was file:///C:/bar.
+PASS canonicalize('/bar') is 'file:///C:/bar'
PASS canonicalize('//somehost/path') is 'file://somehost/path'
FAIL canonicalize('/\\//somehost/path') should be file://somehost/path. Was file:////somehost/path.
PASS successfullyParsed is true
Modified: trunk/LayoutTests/imported/w3c/ChangeLog (213468 => 213469)
--- trunk/LayoutTests/imported/w3c/ChangeLog 2017-03-06 22:46:57 UTC (rev 213468)
+++ trunk/LayoutTests/imported/w3c/ChangeLog 2017-03-06 22:55:33 UTC (rev 213469)
@@ -1,3 +1,14 @@
+2017-03-06 Alex Christensen <[email protected]>
+
+ Fix URLs relative to file URLs with paths beginning with Windows drive letters
+ https://bugs.webkit.org/show_bug.cgi?id=169178
+
+ Reviewed by Tim Horton.
+
+ * web-platform-tests/url/a-element-expected.txt:
+ * web-platform-tests/url/a-element-xhtml-expected.txt:
+ * web-platform-tests/url/url-constructor-expected.txt:
+
2017-03-06 Manuel Rego Casasnovas <[email protected]>
[css-grid] Import W3C Test Suite
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/url/a-element-expected.txt (213468 => 213469)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/url/a-element-expected.txt 2017-03-06 22:46:57 UTC (rev 213468)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/url/a-element-expected.txt 2017-03-06 22:55:33 UTC (rev 213469)
@@ -385,7 +385,7 @@
PASS Parsing: <pix/submit.gif> against <file:///C:/Users/Domenic/Dropbox/GitHub/tmpvar/jsdom/test/level2/html/files/anchor.html>
PASS Parsing: <..> against <file:///C:/>
PASS Parsing: <..> against <file:///>
-FAIL Parsing: </> against <file:///C:/a/b> assert_equals: href expected "file:///C:/" but got "file:///"
+PASS Parsing: </> against <file:///C:/a/b>
FAIL Parsing: <//d:> against <file:///C:/a/b> assert_equals: href expected "file:///d:" but got "file://d/"
PASS Parsing: <//d:/..> against <file:///C:/a/b>
PASS Parsing: <..> against <file:///ab:/>
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/url/a-element-xhtml-expected.txt (213468 => 213469)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/url/a-element-xhtml-expected.txt 2017-03-06 22:46:57 UTC (rev 213468)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/url/a-element-xhtml-expected.txt 2017-03-06 22:55:33 UTC (rev 213469)
@@ -385,7 +385,7 @@
PASS Parsing: <pix/submit.gif> against <file:///C:/Users/Domenic/Dropbox/GitHub/tmpvar/jsdom/test/level2/html/files/anchor.html>
PASS Parsing: <..> against <file:///C:/>
PASS Parsing: <..> against <file:///>
-FAIL Parsing: </> against <file:///C:/a/b> assert_equals: href expected "file:///C:/" but got "file:///"
+PASS Parsing: </> against <file:///C:/a/b>
FAIL Parsing: <//d:> against <file:///C:/a/b> assert_equals: href expected "file:///d:" but got "file://d/"
PASS Parsing: <//d:/..> against <file:///C:/a/b>
PASS Parsing: <..> against <file:///ab:/>
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/url/url-constructor-expected.txt (213468 => 213469)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/url/url-constructor-expected.txt 2017-03-06 22:46:57 UTC (rev 213468)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/url/url-constructor-expected.txt 2017-03-06 22:55:33 UTC (rev 213469)
@@ -393,7 +393,7 @@
PASS Parsing: <pix/submit.gif> against <file:///C:/Users/Domenic/Dropbox/GitHub/tmpvar/jsdom/test/level2/html/files/anchor.html>
PASS Parsing: <..> against <file:///C:/>
PASS Parsing: <..> against <file:///>
-FAIL Parsing: </> against <file:///C:/a/b> assert_equals: href expected "file:///C:/" but got "file:///"
+PASS Parsing: </> against <file:///C:/a/b>
FAIL Parsing: <//d:> against <file:///C:/a/b> assert_equals: href expected "file:///d:" but got "file://d/"
PASS Parsing: <//d:/..> against <file:///C:/a/b>
PASS Parsing: <..> against <file:///ab:/>
Modified: trunk/Source/WebCore/ChangeLog (213468 => 213469)
--- trunk/Source/WebCore/ChangeLog 2017-03-06 22:46:57 UTC (rev 213468)
+++ trunk/Source/WebCore/ChangeLog 2017-03-06 22:55:33 UTC (rev 213469)
@@ -1,3 +1,22 @@
+2017-03-06 Alex Christensen <[email protected]>
+
+ Fix URLs relative to file URLs with paths beginning with Windows drive letters
+ https://bugs.webkit.org/show_bug.cgi?id=169178
+
+ Reviewed by Tim Horton.
+
+ Windows drives in file URLs can begin with windows drive letters, such as file:///C:/
+ which should not be removed when making other URLs relative to them.
+ See https://url.spec.whatwg.org/#file-slash-state
+
+ Covered by new API tests and newly passing web-platform-tests.
+
+ * platform/URLParser.cpp:
+ (WebCore::URLParser::copyBaseWindowsDriveLetter):
+ (WebCore::URLParser::copyASCIIStringUntil):
+ (WebCore::URLParser::parse):
+ * platform/URLParser.h:
+
2017-03-06 Simon Fraser <[email protected]>
Only use layer backing store which supports subpixel antialiased text if we know subpixel antialiased will be painted into it
Modified: trunk/Source/WebCore/platform/URLParser.cpp (213468 => 213469)
--- trunk/Source/WebCore/platform/URLParser.cpp 2017-03-06 22:46:57 UTC (rev 213468)
+++ trunk/Source/WebCore/platform/URLParser.cpp 2017-03-06 22:55:33 UTC (rev 213469)
@@ -487,6 +487,29 @@
advance(iterator);
}
+bool URLParser::copyBaseWindowsDriveLetter(const URL& base)
+{
+ if (base.protocolIs("file")) {
+ RELEASE_ASSERT(base.m_portEnd < base.m_string.length());
+ if (base.m_string.is8Bit()) {
+ const LChar* begin = base.m_string.characters8();
+ CodePointIterator<LChar> c(begin + base.m_portEnd + 1, begin + base.m_string.length());
+ if (isWindowsDriveLetter(c)) {
+ appendWindowsDriveLetter(c);
+ return true;
+ }
+ } else {
+ const UChar* begin = base.m_string.characters16();
+ CodePointIterator<UChar> c(begin + base.m_portEnd + 1, begin + base.m_string.length());
+ if (isWindowsDriveLetter(c)) {
+ appendWindowsDriveLetter(c);
+ return true;
+ }
+ }
+ }
+ return false;
+}
+
template<typename CharacterType>
bool URLParser::shouldCopyFileURL(CodePointIterator<CharacterType> iterator)
{
@@ -814,9 +837,9 @@
if (string.isNull())
return;
ASSERT(m_asciiBuffer.isEmpty());
- if (string.is8Bit()) {
+ if (string.is8Bit())
appendToASCIIBuffer(string.characters8(), length);
- } else {
+ else {
const UChar* characters = string.characters16();
for (size_t i = 0; i < length; ++i) {
UChar c = characters[i];
@@ -1602,19 +1625,6 @@
state = State::FileHost;
break;
}
- if (base.isValid() && base.protocolIs("file")) {
- // FIXME: This String copy is unnecessary.
- String basePath = base.path();
- if (basePath.length() >= 2) {
- bool windowsQuirk = basePath.is8Bit()
- ? isWindowsDriveLetter(CodePointIterator<LChar>(basePath.characters8(), basePath.characters8() + basePath.length()))
- : isWindowsDriveLetter(CodePointIterator<UChar>(basePath.characters16(), basePath.characters16() + basePath.length()));
- if (windowsQuirk) {
- appendToASCIIBuffer(basePath[0]);
- appendToASCIIBuffer(basePath[1]);
- }
- }
- }
syntaxViolation(c);
appendToASCIIBuffer("//", 2);
m_url.m_userStart = currentPosition(c) - 1;
@@ -1622,9 +1632,14 @@
m_url.m_passwordEnd = m_url.m_userStart;
m_url.m_hostEnd = m_url.m_userStart;
m_url.m_portEnd = m_url.m_userStart;
- m_url.m_pathAfterLastSlash = m_url.m_userStart + 1;
- if (isWindowsDriveLetter(c))
+ if (isWindowsDriveLetter(c)) {
appendWindowsDriveLetter(c);
+ m_url.m_pathAfterLastSlash = m_url.m_userStart + 1;
+ } else if (copyBaseWindowsDriveLetter(base)) {
+ appendToASCIIBuffer('/');
+ m_url.m_pathAfterLastSlash = m_url.m_userStart + 4;
+ } else
+ m_url.m_pathAfterLastSlash = m_url.m_userStart + 1;
state = State::Path;
break;
case State::FileHost:
@@ -1931,7 +1946,11 @@
m_url.m_passwordEnd = m_url.m_userStart;
m_url.m_hostEnd = m_url.m_userStart;
m_url.m_portEnd = m_url.m_userStart;
- m_url.m_pathAfterLastSlash = m_url.m_userStart + 1;
+ if (copyBaseWindowsDriveLetter(base)) {
+ appendToASCIIBuffer('/');
+ m_url.m_pathAfterLastSlash = m_url.m_userStart + 4;
+ } else
+ m_url.m_pathAfterLastSlash = m_url.m_userStart + 1;
m_url.m_pathEnd = m_url.m_pathAfterLastSlash;
m_url.m_queryEnd = m_url.m_pathAfterLastSlash;
m_url.m_fragmentEnd = m_url.m_pathAfterLastSlash;
Modified: trunk/Source/WebCore/platform/URLParser.h (213468 => 213469)
--- trunk/Source/WebCore/platform/URLParser.h 2017-03-06 22:46:57 UTC (rev 213468)
+++ trunk/Source/WebCore/platform/URLParser.h 2017-03-06 22:55:33 UTC (rev 213469)
@@ -104,6 +104,7 @@
void appendToASCIIBuffer(const LChar* characters, size_t size) { appendToASCIIBuffer(reinterpret_cast<const char*>(characters), size); }
template<typename CharacterType> void encodeQuery(const Vector<UChar>& source, const TextEncoding&, CodePointIterator<CharacterType>);
void copyASCIIStringUntil(const String&, size_t length);
+ bool copyBaseWindowsDriveLetter(const URL&);
StringView parsedDataView(size_t start, size_t length);
UChar parsedDataView(size_t position);
Modified: trunk/Tools/ChangeLog (213468 => 213469)
--- trunk/Tools/ChangeLog 2017-03-06 22:46:57 UTC (rev 213468)
+++ trunk/Tools/ChangeLog 2017-03-06 22:55:33 UTC (rev 213469)
@@ -1,3 +1,13 @@
+2017-03-06 Alex Christensen <[email protected]>
+
+ Fix URLs relative to file URLs with paths beginning with Windows drive letters
+ https://bugs.webkit.org/show_bug.cgi?id=169178
+
+ Reviewed by Tim Horton.
+
+ * TestWebKitAPI/Tests/WebCore/URLParser.cpp:
+ (TestWebKitAPI::TEST_F):
+
2017-03-06 Myles C. Maxfield <[email protected]>
Expand font-weight and font-stretch to take any number
Modified: trunk/Tools/TestWebKitAPI/Tests/WebCore/URLParser.cpp (213468 => 213469)
--- trunk/Tools/TestWebKitAPI/Tests/WebCore/URLParser.cpp 2017-03-06 22:46:57 UTC (rev 213468)
+++ trunk/Tools/TestWebKitAPI/Tests/WebCore/URLParser.cpp 2017-03-06 22:55:33 UTC (rev 213469)
@@ -580,6 +580,10 @@
checkRelativeURL("http://something?", "file:////var//containers//stuff/", {"http", "", "", "something", 0, "/", "", "", "http://something/?"}, TestTabs::No);
checkRelativeURL("http://something#", "file:////var//containers//stuff/", {"http", "", "", "something", 0, "/", "", "", "http://something/#"}, TestTabs::No);
checkRelativeURL("file:", "file:///path?query#fragment", {"file", "", "", "", 0, "/path", "query", "", "file:///path?query"});
+ checkRelativeURL("/", "file:///C:/a/b", {"file", "", "", "", 0, "/C:/", "", "", "file:///C:/"});
+ checkRelativeURL("/abc", "file:///C:/a/b", {"file", "", "", "", 0, "/C:/abc", "", "", "file:///C:/abc"});
+ checkRelativeURL("/abc", "file:///C:", {"file", "", "", "", 0, "/C:/abc", "", "", "file:///C:/abc"});
+ checkRelativeURL("/abc", "file:///", {"file", "", "", "", 0, "/abc", "", "", "file:///abc"});
// The checking of slashes in SpecialAuthoritySlashes needed to get this to pass contradicts what is in the spec,
// but it is included in the web platform tests.