Title: [213546] trunk
Revision
213546
Author
[email protected]
Date
2017-03-07 15:07:56 -0800 (Tue, 07 Mar 2017)

Log Message

[URLParser] Fix file URLs that are just file:// and a Windows drive letter
https://bugs.webkit.org/show_bug.cgi?id=169242

Patch by Alex Christensen <[email protected]> on 2017-03-07
Reviewed by Tim Horton.

LayoutTests/imported/w3c:

* 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:

Source/WebCore:

This is specified in https://url.spec.whatwg.org/#file-host-state and tested by a newly-passing
web platform test.  I added the check for the windows drive quirk in the FileHost state of the
parser but I forgot it when FileHost is the terminal state.

* platform/URLParser.cpp:
(WebCore::URLParser::parse):

Tools:

* TestWebKitAPI/Tests/WebCore/URLParser.cpp:
(TestWebKitAPI::TEST_F):

Modified Paths

Diff

Modified: trunk/LayoutTests/imported/w3c/ChangeLog (213545 => 213546)


--- trunk/LayoutTests/imported/w3c/ChangeLog	2017-03-07 23:05:57 UTC (rev 213545)
+++ trunk/LayoutTests/imported/w3c/ChangeLog	2017-03-07 23:07:56 UTC (rev 213546)
@@ -1,3 +1,14 @@
+2017-03-07  Alex Christensen  <[email protected]>
+
+        [URLParser] Fix file URLs that are just file:// and a Windows drive letter
+        https://bugs.webkit.org/show_bug.cgi?id=169242
+
+        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-07  Youenn Fablet  <[email protected]>
 
         W3C importer should be able to update the import expectations file

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/url/a-element-expected.txt (213545 => 213546)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/url/a-element-expected.txt	2017-03-07 23:05:57 UTC (rev 213545)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/url/a-element-expected.txt	2017-03-07 23:07:56 UTC (rev 213546)
@@ -386,7 +386,7 @@
 PASS Parsing: <..> against <file:///C:/> 
 PASS Parsing: <..> against <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: <//d:/..> against <file:///C:/a/b> 
 PASS Parsing: <..> against <file:///ab:/> 
 PASS Parsing: <..> against <file:///1:/> 

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/url/a-element-xhtml-expected.txt (213545 => 213546)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/url/a-element-xhtml-expected.txt	2017-03-07 23:05:57 UTC (rev 213545)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/url/a-element-xhtml-expected.txt	2017-03-07 23:07:56 UTC (rev 213546)
@@ -386,7 +386,7 @@
 PASS Parsing: <..> against <file:///C:/> 
 PASS Parsing: <..> against <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: <//d:/..> against <file:///C:/a/b> 
 PASS Parsing: <..> against <file:///ab:/> 
 PASS Parsing: <..> against <file:///1:/> 

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/url/url-constructor-expected.txt (213545 => 213546)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/url/url-constructor-expected.txt	2017-03-07 23:05:57 UTC (rev 213545)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/url/url-constructor-expected.txt	2017-03-07 23:07:56 UTC (rev 213546)
@@ -394,7 +394,7 @@
 PASS Parsing: <..> against <file:///C:/> 
 PASS Parsing: <..> against <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: <//d:/..> against <file:///C:/a/b> 
 PASS Parsing: <..> against <file:///ab:/> 
 PASS Parsing: <..> against <file:///1:/> 

Modified: trunk/Source/WebCore/ChangeLog (213545 => 213546)


--- trunk/Source/WebCore/ChangeLog	2017-03-07 23:05:57 UTC (rev 213545)
+++ trunk/Source/WebCore/ChangeLog	2017-03-07 23:07:56 UTC (rev 213546)
@@ -1,3 +1,17 @@
+2017-03-07  Alex Christensen  <[email protected]>
+
+        [URLParser] Fix file URLs that are just file:// and a Windows drive letter
+        https://bugs.webkit.org/show_bug.cgi?id=169242
+
+        Reviewed by Tim Horton.
+
+        This is specified in https://url.spec.whatwg.org/#file-host-state and tested by a newly-passing
+        web platform test.  I added the check for the windows drive quirk in the FileHost state of the
+        parser but I forgot it when FileHost is the terminal state.
+
+        * platform/URLParser.cpp:
+        (WebCore::URLParser::parse):
+
 2017-03-07  Chris Dumez  <[email protected]>
 
         Drop non-standard MessageEvent.webkitInitMessageEvent()

Modified: trunk/Source/WebCore/platform/URLParser.cpp (213545 => 213546)


--- trunk/Source/WebCore/platform/URLParser.cpp	2017-03-07 23:05:57 UTC (rev 213545)
+++ trunk/Source/WebCore/platform/URLParser.cpp	2017-03-07 23:07:56 UTC (rev 213546)
@@ -1957,6 +1957,18 @@
         break;
     case State::FileHost:
         LOG_FINAL_STATE("FileHost");
+        if (takesTwoAdvancesUntilEnd(CodePointIterator<CharacterType>(authorityOrHostBegin, c))
+            && isWindowsDriveLetter(authorityOrHostBegin)) {
+            syntaxViolation(authorityOrHostBegin);
+            appendToASCIIBuffer('/');
+            appendWindowsDriveLetter(authorityOrHostBegin);
+            m_url.m_pathAfterLastSlash = currentPosition(c);
+            m_url.m_pathEnd = m_url.m_pathAfterLastSlash;
+            m_url.m_queryEnd = m_url.m_pathAfterLastSlash;
+            m_url.m_fragmentEnd = m_url.m_pathAfterLastSlash;
+            break;
+        }
+        
         if (authorityOrHostBegin == c) {
             syntaxViolation(c);
             appendToASCIIBuffer('/');

Modified: trunk/Tools/ChangeLog (213545 => 213546)


--- trunk/Tools/ChangeLog	2017-03-07 23:05:57 UTC (rev 213545)
+++ trunk/Tools/ChangeLog	2017-03-07 23:07:56 UTC (rev 213546)
@@ -1,3 +1,13 @@
+2017-03-07  Alex Christensen  <[email protected]>
+
+        [URLParser] Fix file URLs that are just file:// and a Windows drive letter
+        https://bugs.webkit.org/show_bug.cgi?id=169242
+
+        Reviewed by Tim Horton.
+
+        * TestWebKitAPI/Tests/WebCore/URLParser.cpp:
+        (TestWebKitAPI::TEST_F):
+
 2017-03-07  Jonathan Bedard  <[email protected]>
 
         Standardize device/simulator naming conventions

Modified: trunk/Tools/TestWebKitAPI/Tests/WebCore/URLParser.cpp (213545 => 213546)


--- trunk/Tools/TestWebKitAPI/Tests/WebCore/URLParser.cpp	2017-03-07 23:05:57 UTC (rev 213545)
+++ trunk/Tools/TestWebKitAPI/Tests/WebCore/URLParser.cpp	2017-03-07 23:07:56 UTC (rev 213546)
@@ -584,6 +584,9 @@
     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"});
+    checkRelativeURL("//d:", "file:///C:/a/b", {"file", "", "", "", 0, "/d:", "", "", "file:///d:"}, TestTabs::No);
+    checkRelativeURL("//d|", "file:///C:/a/b", {"file", "", "", "", 0, "/d:", "", "", "file:///d:"}, TestTabs::No);
+    checkRelativeURL("//A|", "file:///C:/a/b", {"file", "", "", "", 0, "/A:", "", "", "file:///A:"}, TestTabs::No);
 
     // 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.
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to