Title: [208508] trunk
Revision
208508
Author
commit-qu...@webkit.org
Date
2016-11-09 16:30:31 -0800 (Wed, 09 Nov 2016)

Log Message

URLParser should not consider path of URLs with no host to start at the first slash after the colon
https://bugs.webkit.org/show_bug.cgi?id=164555

Patch by Alex Christensen <achristen...@webkit.org> on 2016-11-09
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:

When we see a url that is only scheme:// we treated the // as the path.  Firefox did this with unrecognized schemes,
but based on https://github.com/whatwg/url/issues/148 they seem willing to change.  We had added similar behavior to
URL::parse, and I added this to URLParser in r206783 which this effectively reverts.

Covered by API and layout tests.

* platform/URLParser.cpp:
(WebCore::URLParser::parse):
Don't move m_userStart to m_pathStart back by two when we see an empty host.

Tools:

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

LayoutTests:

* fast/url/segments-expected.txt:
* fast/url/segments-from-data-url-expected.txt:
* fast/loader/url-parse-1-expected.txt:
* fetch/fetch-url-serialization-expected.txt:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (208507 => 208508)


--- trunk/LayoutTests/ChangeLog	2016-11-10 00:18:54 UTC (rev 208507)
+++ trunk/LayoutTests/ChangeLog	2016-11-10 00:30:31 UTC (rev 208508)
@@ -1,3 +1,15 @@
+2016-11-09  Alex Christensen  <achristen...@webkit.org>
+
+        URLParser should not consider path of URLs with no host to start at the first slash after the colon
+        https://bugs.webkit.org/show_bug.cgi?id=164555
+
+        Reviewed by Tim Horton.
+
+        * fast/url/segments-expected.txt:
+        * fast/url/segments-from-data-url-expected.txt:
+        * fast/loader/url-parse-1-expected.txt:
+        * fetch/fetch-url-serialization-expected.txt:
+
 2016-11-09  Simon Fraser  <simon.fra...@apple.com>
 
         Implement visual-viewport based position:fixed handling for Mac async scrolling

Modified: trunk/LayoutTests/fast/loader/url-parse-1-expected.txt (208507 => 208508)


--- trunk/LayoutTests/fast/loader/url-parse-1-expected.txt	2016-11-10 00:18:54 UTC (rev 208507)
+++ trunk/LayoutTests/fast/loader/url-parse-1-expected.txt	2016-11-10 00:30:31 UTC (rev 208508)
@@ -40,7 +40,7 @@
 x-webkit:test	x-webkit:test		test
 x-webkit:/	x-webkit:/		/
 x-webkit:/test	x-webkit:/test		/test
-x-webkit://	x-webkit://		//
+x-webkit://	x-webkit://		
 x-webkit://test	x-webkit://test	test	
-x-webkit:///	x-webkit:///		///
-x-webkit:///test	x-webkit:///test		///test
+x-webkit:///	x-webkit:///		/
+x-webkit:///test	x-webkit:///test		/test

Modified: trunk/LayoutTests/fast/url/segments-expected.txt (208507 => 208508)


--- trunk/LayoutTests/fast/url/segments-expected.txt	2016-11-10 00:18:54 UTC (rev 208507)
+++ trunk/LayoutTests/fast/url/segments-expected.txt	2016-11-10 00:30:31 UTC (rev 208508)
@@ -39,7 +39,7 @@
 PASS segments('//') is '[":","","","","",""]'
 PASS segments('::') is '["http:","example.org","","/foo/::","",""]'
 PASS segments('::23') is '["http:","example.org","","/foo/::23","",""]'
-PASS segments('foo://') is '["foo:","","","//","",""]'
+FAIL segments('foo://') should be ["foo:","","","//","",""]. Was ["foo:","","","","",""].
 PASS segments('http://a:b@c:29/d') is '["http:","c","29","/d","",""]'
 PASS segments('http::@c:29') is '["http:","example.org","","/foo/:@c:29","",""]'
 PASS segments('http://&a:foo(b]c@d:2/') is '["http:","d","2","/","",""]'
@@ -50,9 +50,9 @@
 PASS segments('http:\\\\a\\b:c\\d...@foo.com\\') is '["http:","a","","/b:c/d...@foo.com/","",""]'
 PASS segments('foo:/') is '["foo:","","","/","",""]'
 PASS segments('foo:/bar.com/') is '["foo:","","","/bar.com/","",""]'
-PASS segments('foo://///////') is '["foo:","","","/////////","",""]'
-PASS segments('foo://///////bar.com/') is '["foo:","","","/////////bar.com/","",""]'
-PASS segments('foo:////://///') is '["foo:","","","////://///","",""]'
+FAIL segments('foo://///////') should be ["foo:","","","/////////","",""]. Was ["foo:","","","///////","",""].
+FAIL segments('foo://///////bar.com/') should be ["foo:","","","/////////bar.com/","",""]. Was ["foo:","","","///////bar.com/","",""].
+FAIL segments('foo:////://///') should be ["foo:","","","////://///","",""]. Was ["foo:","","","//://///","",""].
 PASS segments('c:/foo') is '["c:","","","/foo","",""]'
 PASS segments('//foo/bar') is '["http:","foo","","/bar","",""]'
 PASS segments('http://foo/path;a??e#f#g') is '["http:","foo","","/path;a","??e","#f#g"]'

Modified: trunk/LayoutTests/fast/url/segments-from-data-url-expected.txt (208507 => 208508)


--- trunk/LayoutTests/fast/url/segments-from-data-url-expected.txt	2016-11-10 00:18:54 UTC (rev 208507)
+++ trunk/LayoutTests/fast/url/segments-from-data-url-expected.txt	2016-11-10 00:30:31 UTC (rev 208508)
@@ -39,7 +39,7 @@
 PASS segments('//') is '[":","","","","",""]'
 PASS segments('::') is '[":","","","","",""]'
 PASS segments('::23') is '[":","","","","",""]'
-PASS segments('foo://') is '["foo:","","","//","",""]'
+FAIL segments('foo://') should be ["foo:","","","//","",""]. Was ["foo:","","","","",""].
 PASS segments('http://a:b@c:29/d') is '["http:","c","29","/d","",""]'
 PASS segments('http::@c:29') is '["http:","c","29","/","",""]'
 PASS segments('http://&a:foo(b]c@d:2/') is '["http:","d","2","/","",""]'
@@ -50,9 +50,9 @@
 PASS segments('http:\\\\a\\b:c\\d...@foo.com\\') is '["http:","a","","/b:c/d...@foo.com/","",""]'
 PASS segments('foo:/') is '["foo:","","","/","",""]'
 PASS segments('foo:/bar.com/') is '["foo:","","","/bar.com/","",""]'
-PASS segments('foo://///////') is '["foo:","","","/////////","",""]'
-PASS segments('foo://///////bar.com/') is '["foo:","","","/////////bar.com/","",""]'
-PASS segments('foo:////://///') is '["foo:","","","////://///","",""]'
+FAIL segments('foo://///////') should be ["foo:","","","/////////","",""]. Was ["foo:","","","///////","",""].
+FAIL segments('foo://///////bar.com/') should be ["foo:","","","/////////bar.com/","",""]. Was ["foo:","","","///////bar.com/","",""].
+FAIL segments('foo:////://///') should be ["foo:","","","////://///","",""]. Was ["foo:","","","//://///","",""].
 PASS segments('c:/foo') is '["c:","","","/foo","",""]'
 PASS segments('//foo/bar') is '[":","","","","",""]'
 PASS segments('http://foo/path;a??e#f#g') is '["http:","foo","","/path;a","??e","#f#g"]'

Modified: trunk/LayoutTests/fetch/fetch-url-serialization-expected.txt (208507 => 208508)


--- trunk/LayoutTests/fetch/fetch-url-serialization-expected.txt	2016-11-10 00:18:54 UTC (rev 208507)
+++ trunk/LayoutTests/fetch/fetch-url-serialization-expected.txt	2016-11-10 00:30:31 UTC (rev 208508)
@@ -294,7 +294,7 @@
 PASS Testing Request url '/i' with base 'sc:sd/sd' 
 PASS Testing Request url '/i' with base 'sc:/pa/pa' 
 PASS Testing Request url '/i' with base 'sc://ho/pa' 
-FAIL Testing Request url '/i' with base 'sc:///pa/pa' assert_equals: expected "sc:///i" but got "sc:/i"
+PASS Testing Request url '/i' with base 'sc:///pa/pa' 
 PASS Testing Request url '?i' with base 'sc:sd' 
 PASS Testing Request url '?i' with base 'sc:sd/sd' 
 PASS Testing Request url '?i' with base 'sc:/pa/pa' 

Modified: trunk/LayoutTests/imported/w3c/ChangeLog (208507 => 208508)


--- trunk/LayoutTests/imported/w3c/ChangeLog	2016-11-10 00:18:54 UTC (rev 208507)
+++ trunk/LayoutTests/imported/w3c/ChangeLog	2016-11-10 00:30:31 UTC (rev 208508)
@@ -1,3 +1,14 @@
+2016-11-09  Alex Christensen  <achristen...@webkit.org>
+
+        URLParser should not consider path of URLs with no host to start at the first slash after the colon
+        https://bugs.webkit.org/show_bug.cgi?id=164555
+
+        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:
+
 2016-11-09  Brady Eidson  <beid...@apple.com>
 
         IndexedDB 2.0: W3C test IndexedDB/idbtransaction_objectStoreNames.html fails.

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


--- trunk/LayoutTests/imported/w3c/web-platform-tests/url/a-element-expected.txt	2016-11-10 00:18:54 UTC (rev 208507)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/url/a-element-expected.txt	2016-11-10 00:30:31 UTC (rev 208508)
@@ -50,9 +50,9 @@
 PASS Parsing: <http:\\a\b:c\d...@foo.com\> against <http://example.org/foo/bar> 
 PASS Parsing: <foo:/> against <http://example.org/foo/bar> 
 PASS Parsing: <foo:/bar.com/> against <http://example.org/foo/bar> 
-FAIL Parsing: <foo://///////> against <http://example.org/foo/bar> assert_equals: pathname expected "///////" but got "/////////"
-FAIL Parsing: <foo://///////bar.com/> against <http://example.org/foo/bar> assert_equals: pathname expected "///////bar.com/" but got "/////////bar.com/"
-FAIL Parsing: <foo:////://///> against <http://example.org/foo/bar> assert_equals: pathname expected "//://///" but got "////://///"
+PASS Parsing: <foo://///////> against <http://example.org/foo/bar> 
+PASS Parsing: <foo://///////bar.com/> against <http://example.org/foo/bar> 
+PASS Parsing: <foo:////://///> against <http://example.org/foo/bar> 
 PASS Parsing: <c:/foo> against <http://example.org/foo/bar> 
 PASS Parsing: <//foo/bar> against <http://example.org/foo/bar> 
 PASS Parsing: <http://foo/path;a??e#f#g> against <http://example.org/foo/bar> 
@@ -288,27 +288,27 @@
 PASS Parsing: <i> against <sc:sd/sd> 
 PASS Parsing: <i> against <sc:/pa/pa> 
 PASS Parsing: <i> against <sc://ho/pa> 
-FAIL Parsing: <i> against <sc:///pa/pa> assert_equals: pathname expected "/pa/i" but got "///pa/i"
+PASS Parsing: <i> against <sc:///pa/pa> 
 PASS Parsing: <../i> against <sc:sd> 
 PASS Parsing: <../i> against <sc:sd/sd> 
 PASS Parsing: <../i> against <sc:/pa/pa> 
 PASS Parsing: <../i> against <sc://ho/pa> 
-FAIL Parsing: <../i> against <sc:///pa/pa> assert_equals: pathname expected "/i" but got "///i"
+PASS Parsing: <../i> against <sc:///pa/pa> 
 PASS Parsing: </i> against <sc:sd> 
 PASS Parsing: </i> against <sc:sd/sd> 
 PASS Parsing: </i> against <sc:/pa/pa> 
 PASS Parsing: </i> against <sc://ho/pa> 
-FAIL Parsing: </i> against <sc:///pa/pa> assert_equals: href expected "sc:///i" but got "sc:/i"
+PASS Parsing: </i> against <sc:///pa/pa> 
 PASS Parsing: <?i> against <sc:sd> 
 PASS Parsing: <?i> against <sc:sd/sd> 
 PASS Parsing: <?i> against <sc:/pa/pa> 
 PASS Parsing: <?i> against <sc://ho/pa> 
-FAIL Parsing: <?i> against <sc:///pa/pa> assert_equals: pathname expected "/pa/pa" but got "///pa/pa"
+PASS Parsing: <?i> against <sc:///pa/pa> 
 PASS Parsing: <#i> against <sc:sd> 
 PASS Parsing: <#i> against <sc:sd/sd> 
 PASS Parsing: <#i> against <sc:/pa/pa> 
 PASS Parsing: <#i> against <sc://ho/pa> 
-FAIL Parsing: <#i> against <sc:///pa/pa> assert_equals: pathname expected "/pa/pa" but got "///pa/pa"
+PASS Parsing: <#i> against <sc:///pa/pa> 
 PASS Parsing: <about:/../> against <about:blank> 
 PASS Parsing: <data:/../> against <about:blank> 
 PASS Parsing: <_javascript_:/../> against <about:blank> 

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


--- trunk/LayoutTests/imported/w3c/web-platform-tests/url/a-element-xhtml-expected.txt	2016-11-10 00:18:54 UTC (rev 208507)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/url/a-element-xhtml-expected.txt	2016-11-10 00:30:31 UTC (rev 208508)
@@ -50,9 +50,9 @@
 PASS Parsing: <http:\\a\b:c\d...@foo.com\> against <http://example.org/foo/bar> 
 PASS Parsing: <foo:/> against <http://example.org/foo/bar> 
 PASS Parsing: <foo:/bar.com/> against <http://example.org/foo/bar> 
-FAIL Parsing: <foo://///////> against <http://example.org/foo/bar> assert_equals: pathname expected "///////" but got "/////////"
-FAIL Parsing: <foo://///////bar.com/> against <http://example.org/foo/bar> assert_equals: pathname expected "///////bar.com/" but got "/////////bar.com/"
-FAIL Parsing: <foo:////://///> against <http://example.org/foo/bar> assert_equals: pathname expected "//://///" but got "////://///"
+PASS Parsing: <foo://///////> against <http://example.org/foo/bar> 
+PASS Parsing: <foo://///////bar.com/> against <http://example.org/foo/bar> 
+PASS Parsing: <foo:////://///> against <http://example.org/foo/bar> 
 PASS Parsing: <c:/foo> against <http://example.org/foo/bar> 
 PASS Parsing: <//foo/bar> against <http://example.org/foo/bar> 
 PASS Parsing: <http://foo/path;a??e#f#g> against <http://example.org/foo/bar> 
@@ -288,27 +288,27 @@
 PASS Parsing: <i> against <sc:sd/sd> 
 PASS Parsing: <i> against <sc:/pa/pa> 
 PASS Parsing: <i> against <sc://ho/pa> 
-FAIL Parsing: <i> against <sc:///pa/pa> assert_equals: pathname expected "/pa/i" but got "///pa/i"
+PASS Parsing: <i> against <sc:///pa/pa> 
 PASS Parsing: <../i> against <sc:sd> 
 PASS Parsing: <../i> against <sc:sd/sd> 
 PASS Parsing: <../i> against <sc:/pa/pa> 
 PASS Parsing: <../i> against <sc://ho/pa> 
-FAIL Parsing: <../i> against <sc:///pa/pa> assert_equals: pathname expected "/i" but got "///i"
+PASS Parsing: <../i> against <sc:///pa/pa> 
 PASS Parsing: </i> against <sc:sd> 
 PASS Parsing: </i> against <sc:sd/sd> 
 PASS Parsing: </i> against <sc:/pa/pa> 
 PASS Parsing: </i> against <sc://ho/pa> 
-FAIL Parsing: </i> against <sc:///pa/pa> assert_equals: href expected "sc:///i" but got "sc:/i"
+PASS Parsing: </i> against <sc:///pa/pa> 
 PASS Parsing: <?i> against <sc:sd> 
 PASS Parsing: <?i> against <sc:sd/sd> 
 PASS Parsing: <?i> against <sc:/pa/pa> 
 PASS Parsing: <?i> against <sc://ho/pa> 
-FAIL Parsing: <?i> against <sc:///pa/pa> assert_equals: pathname expected "/pa/pa" but got "///pa/pa"
+PASS Parsing: <?i> against <sc:///pa/pa> 
 PASS Parsing: <#i> against <sc:sd> 
 PASS Parsing: <#i> against <sc:sd/sd> 
 PASS Parsing: <#i> against <sc:/pa/pa> 
 PASS Parsing: <#i> against <sc://ho/pa> 
-FAIL Parsing: <#i> against <sc:///pa/pa> assert_equals: pathname expected "/pa/pa" but got "///pa/pa"
+PASS Parsing: <#i> against <sc:///pa/pa> 
 PASS Parsing: <about:/../> against <about:blank> 
 PASS Parsing: <data:/../> against <about:blank> 
 PASS Parsing: <_javascript_:/../> against <about:blank> 

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


--- trunk/LayoutTests/imported/w3c/web-platform-tests/url/url-constructor-expected.txt	2016-11-10 00:18:54 UTC (rev 208507)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/url/url-constructor-expected.txt	2016-11-10 00:30:31 UTC (rev 208508)
@@ -54,9 +54,9 @@
 PASS Parsing: <http:\\a\b:c\d...@foo.com\> against <http://example.org/foo/bar> 
 PASS Parsing: <foo:/> against <http://example.org/foo/bar> 
 PASS Parsing: <foo:/bar.com/> against <http://example.org/foo/bar> 
-FAIL Parsing: <foo://///////> against <http://example.org/foo/bar> assert_equals: pathname expected "///////" but got "/////////"
-FAIL Parsing: <foo://///////bar.com/> against <http://example.org/foo/bar> assert_equals: pathname expected "///////bar.com/" but got "/////////bar.com/"
-FAIL Parsing: <foo:////://///> against <http://example.org/foo/bar> assert_equals: pathname expected "//://///" but got "////://///"
+PASS Parsing: <foo://///////> against <http://example.org/foo/bar> 
+PASS Parsing: <foo://///////bar.com/> against <http://example.org/foo/bar> 
+PASS Parsing: <foo:////://///> against <http://example.org/foo/bar> 
 PASS Parsing: <c:/foo> against <http://example.org/foo/bar> 
 PASS Parsing: <//foo/bar> against <http://example.org/foo/bar> 
 PASS Parsing: <http://foo/path;a??e#f#g> against <http://example.org/foo/bar> 
@@ -293,27 +293,27 @@
 PASS Parsing: <i> against <sc:sd/sd> 
 PASS Parsing: <i> against <sc:/pa/pa> 
 PASS Parsing: <i> against <sc://ho/pa> 
-FAIL Parsing: <i> against <sc:///pa/pa> assert_equals: pathname expected "/pa/i" but got "///pa/i"
+PASS Parsing: <i> against <sc:///pa/pa> 
 PASS Parsing: <../i> against <sc:sd> 
 PASS Parsing: <../i> against <sc:sd/sd> 
 PASS Parsing: <../i> against <sc:/pa/pa> 
 PASS Parsing: <../i> against <sc://ho/pa> 
-FAIL Parsing: <../i> against <sc:///pa/pa> assert_equals: pathname expected "/i" but got "///i"
+PASS Parsing: <../i> against <sc:///pa/pa> 
 PASS Parsing: </i> against <sc:sd> 
 PASS Parsing: </i> against <sc:sd/sd> 
 PASS Parsing: </i> against <sc:/pa/pa> 
 PASS Parsing: </i> against <sc://ho/pa> 
-FAIL Parsing: </i> against <sc:///pa/pa> assert_equals: href expected "sc:///i" but got "sc:/i"
+PASS Parsing: </i> against <sc:///pa/pa> 
 PASS Parsing: <?i> against <sc:sd> 
 PASS Parsing: <?i> against <sc:sd/sd> 
 PASS Parsing: <?i> against <sc:/pa/pa> 
 PASS Parsing: <?i> against <sc://ho/pa> 
-FAIL Parsing: <?i> against <sc:///pa/pa> assert_equals: pathname expected "/pa/pa" but got "///pa/pa"
+PASS Parsing: <?i> against <sc:///pa/pa> 
 PASS Parsing: <#i> against <sc:sd> 
 PASS Parsing: <#i> against <sc:sd/sd> 
 PASS Parsing: <#i> against <sc:/pa/pa> 
 PASS Parsing: <#i> against <sc://ho/pa> 
-FAIL Parsing: <#i> against <sc:///pa/pa> assert_equals: pathname expected "/pa/pa" but got "///pa/pa"
+PASS Parsing: <#i> against <sc:///pa/pa> 
 PASS Parsing: <about:/../> against <about:blank> 
 PASS Parsing: <data:/../> against <about:blank> 
 PASS Parsing: <_javascript_:/../> against <about:blank> 

Modified: trunk/Source/WebCore/ChangeLog (208507 => 208508)


--- trunk/Source/WebCore/ChangeLog	2016-11-10 00:18:54 UTC (rev 208507)
+++ trunk/Source/WebCore/ChangeLog	2016-11-10 00:30:31 UTC (rev 208508)
@@ -1,5 +1,22 @@
 2016-11-09  Alex Christensen  <achristen...@webkit.org>
 
+        URLParser should not consider path of URLs with no host to start at the first slash after the colon
+        https://bugs.webkit.org/show_bug.cgi?id=164555
+
+        Reviewed by Tim Horton.
+
+        When we see a url that is only scheme:// we treated the // as the path.  Firefox did this with unrecognized schemes,
+        but based on https://github.com/whatwg/url/issues/148 they seem willing to change.  We had added similar behavior to
+        URL::parse, and I added this to URLParser in r206783 which this effectively reverts.
+
+        Covered by API and layout tests.
+
+        * platform/URLParser.cpp:
+        (WebCore::URLParser::parse):
+        Don't move m_userStart to m_pathStart back by two when we see an empty host.
+
+2016-11-09  Alex Christensen  <achristen...@webkit.org>
+
         Simplify logic of SecurityOrigin::databaseIdentifier
         https://bugs.webkit.org/show_bug.cgi?id=164565
 

Modified: trunk/Source/WebCore/platform/URLParser.cpp (208507 => 208508)


--- trunk/Source/WebCore/platform/URLParser.cpp	2016-11-10 00:18:54 UTC (rev 208507)
+++ trunk/Source/WebCore/platform/URLParser.cpp	2016-11-10 00:30:31 UTC (rev 208508)
@@ -1427,17 +1427,11 @@
                 if (isSlash || *c == '?' || *c == '#') {
                     auto iterator = CodePointIterator<CharacterType>(authorityOrHostBegin, c);
                     if (iterator.atEnd()) {
-                        size_t position = currentPosition(c);
-                        ASSERT(m_url.m_userStart == position);
-                        RELEASE_ASSERT(position >= 2);
-                        position -= 2;
-                        ASSERT(parsedDataView(position, 2) == "//");
-                        m_url.m_userStart = position;
-                        m_url.m_userEnd = position;
-                        m_url.m_passwordEnd = position;
-                        m_url.m_hostEnd = position;
-                        m_url.m_portEnd = position;
-                        m_url.m_pathAfterLastSlash = position + 2;
+                        m_url.m_userEnd = currentPosition(c);
+                        m_url.m_passwordEnd = m_url.m_userEnd;
+                        m_url.m_hostEnd = m_url.m_userEnd;
+                        m_url.m_portEnd = m_url.m_userEnd;
+                        m_url.m_pathAfterLastSlash = m_url.m_userEnd;
                     } else {
                         m_url.m_userEnd = currentPosition(authorityOrHostBegin);
                         m_url.m_passwordEnd = m_url.m_userEnd;
@@ -1835,14 +1829,11 @@
         m_url.m_userEnd = currentPosition(authorityOrHostBegin);
         m_url.m_passwordEnd = m_url.m_userEnd;
         if (authorityOrHostBegin.atEnd()) {
-            RELEASE_ASSERT(m_url.m_userStart >= 2);
-            ASSERT(parsedDataView(m_url.m_userStart - 2, 2) == "//");
-            m_url.m_userStart -= 2;
             m_url.m_userEnd = m_url.m_userStart;
             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_pathEnd = m_url.m_userStart + 2;
+            m_url.m_pathEnd = m_url.m_userStart;
         } else if (!parseHostAndPort(authorityOrHostBegin)) {
             failure();
             return;

Modified: trunk/Tools/ChangeLog (208507 => 208508)


--- trunk/Tools/ChangeLog	2016-11-10 00:18:54 UTC (rev 208507)
+++ trunk/Tools/ChangeLog	2016-11-10 00:30:31 UTC (rev 208508)
@@ -1,3 +1,13 @@
+2016-11-09  Alex Christensen  <achristen...@webkit.org>
+
+        URLParser should not consider path of URLs with no host to start at the first slash after the colon
+        https://bugs.webkit.org/show_bug.cgi?id=164555
+
+        Reviewed by Tim Horton.
+
+        * TestWebKitAPI/Tests/WebCore/URLParser.cpp:
+        (TestWebKitAPI::TEST_F):
+
 2016-11-09  Jonathan Bedard  <jbed...@apple.com>
 
         test-webkitpy failing test_create_patch_is_full_patch unit test

Modified: trunk/Tools/TestWebKitAPI/Tests/WebCore/URLParser.cpp (208507 => 208508)


--- trunk/Tools/TestWebKitAPI/Tests/WebCore/URLParser.cpp	2016-11-10 00:18:54 UTC (rev 208507)
+++ trunk/Tools/TestWebKitAPI/Tests/WebCore/URLParser.cpp	2016-11-10 00:30:31 UTC (rev 208508)
@@ -511,20 +511,38 @@
     checkURL("http://host:123?query", {"http", "", "", "host", 123, "/", "query", "", "http://host:123/?query"});
     checkURL("http://host:123#", {"http", "", "", "host", 123, "/", "", "", "http://host:123/#"});
     checkURL("http://host:123#fragment", {"http", "", "", "host", 123, "/", "", "fragment", "http://host:123/#fragment"});
-    checkURL("foo:////", {"foo", "", "", "", 0, "////", "", "", "foo:////"});
-    checkURL("foo:///?", {"foo", "", "", "", 0, "///", "", "", "foo:///?"});
-    checkURL("foo:///#", {"foo", "", "", "", 0, "///", "", "", "foo:///#"});
-    checkURL("foo:///", {"foo", "", "", "", 0, "///", "", "", "foo:///"});
-    checkURL("foo://?", {"foo", "", "", "", 0, "//", "", "", "foo://?"});
-    checkURL("foo://#", {"foo", "", "", "", 0, "//", "", "", "foo://#"});
-    checkURL("foo://", {"foo", "", "", "", 0, "//", "", "", "foo://"});
+    checkURLDifferences("foo:////",
+        {"foo", "", "", "", 0, "//", "", "", "foo:////"},
+        {"foo", "", "", "", 0, "////", "", "", "foo:////"});
+    checkURLDifferences("foo:///?",
+        {"foo", "", "", "", 0, "/", "", "", "foo:///?"},
+        {"foo", "", "", "", 0, "///", "", "", "foo:///?"});
+    checkURLDifferences("foo:///#",
+        {"foo", "", "", "", 0, "/", "", "", "foo:///#"},
+        {"foo", "", "", "", 0, "///", "", "", "foo:///#"});
+    checkURLDifferences("foo:///",
+        {"foo", "", "", "", 0, "/", "", "", "foo:///"},
+        {"foo", "", "", "", 0, "///", "", "", "foo:///"});
+    checkURLDifferences("foo://?",
+        {"foo", "", "", "", 0, "", "", "", "foo://?"},
+        {"foo", "", "", "", 0, "//", "", "", "foo://?"});
+    checkURLDifferences("foo://#",
+        {"foo", "", "", "", 0, "", "", "", "foo://#"},
+        {"foo", "", "", "", 0, "//", "", "", "foo://#"});
+    checkURLDifferences("foo://",
+        {"foo", "", "", "", 0, "", "", "", "foo://"},
+        {"foo", "", "", "", 0, "//", "", "", "foo://"});
     checkURL("foo:/?", {"foo", "", "", "", 0, "/", "", "", "foo:/?"});
     checkURL("foo:/#", {"foo", "", "", "", 0, "/", "", "", "foo:/#"});
     checkURL("foo:/", {"foo", "", "", "", 0, "/", "", "", "foo:/"});
     checkURL("foo:?", {"foo", "", "", "", 0, "", "", "", "foo:?"});
     checkURL("foo:#", {"foo", "", "", "", 0, "", "", "", "foo:#"});
-    checkURL("A://", {"a", "", "", "", 0, "//", "", "", "a://"});
-    checkURL("aA://", {"aa", "", "", "", 0, "//", "", "", "aa://"});
+    checkURLDifferences("A://",
+        {"a", "", "", "", 0, "", "", "", "a://"},
+        {"a", "", "", "", 0, "//", "", "", "a://"});
+    checkURLDifferences("aA://",
+        {"aa", "", "", "", 0, "", "", "", "aa://"},
+        {"aa", "", "", "", 0, "//", "", "", "aa://"});
     checkURL(utf16String(u"foo://host/#ПП\u0007 a</"), {"foo", "", "", "host", 0, "/", "", "%D0%9F%D0%9F%07 a</", "foo://host/#%D0%9F%D0%9F%07 a</"});
     checkURL(utf16String(u"foo://host/#\u0007 a</"), {"foo", "", "", "host", 0, "/", "", "%07 a</", "foo://host/#%07 a</"});
     checkURL(utf16String(u"http://host?ß😍#ß😍"), {"http", "", "", "host", 0, "/", "%C3%9F%F0%9F%98%8D", "%C3%9F%F0%9F%98%8D", "http://host/?%C3%9F%F0%9F%98%8D#%C3%9F%F0%9F%98%8D"}, testTabsValueForSurrogatePairs);
@@ -612,7 +630,9 @@
     checkRelativeURL("  ", "http://host/#fragment", {"http", "", "", "host", 0, "/", "", "", "http://host/"});
     checkRelativeURL("  ", "http://host/path?query#fra#gment", {"http", "", "", "host", 0, "/path", "query", "", "http://host/path?query"});
     checkRelativeURL(" \a ", "http://host/#fragment", {"http", "", "", "host", 0, "/", "", "", "http://host/"});
-    checkRelativeURL("foo://", "http://example.org/foo/bar", {"foo", "", "", "", 0, "//", "", "", "foo://"});
+    checkRelativeURLDifferences("foo://", "http://example.org/foo/bar",
+        {"foo", "", "", "", 0, "", "", "", "foo://"},
+        {"foo", "", "", "", 0, "//", "", "", "foo://"});
     checkRelativeURL(utf16String(u"#β"), "http://example.org/foo/bar", {"http", "", "", "example.org", 0, "/foo/bar", "", "%CE%B2", "http://example.org/foo/bar#%CE%B2"});
 
     // The checking of slashes in SpecialAuthoritySlashes needed to get this to pass contradicts what is in the spec,
@@ -883,10 +903,10 @@
         {"", "", "", "", 0, "", "", "", "http://:"},
         {"http", "", "", "", 0, "/", "", "", "http://:/"});
     checkURLDifferences("http:##foo",
-        {"http", "", "", "", 0, "//", "", "#foo", "http://##foo"},
+        {"http", "", "", "", 0, "", "", "#foo", "http://##foo"},
         {"http", "", "", "", 0, "/", "", "#foo", "http:/##foo"});
     checkURLDifferences("http:??bar",
-        {"http", "", "", "", 0, "//", "?bar", "", "http://??bar"},
+        {"http", "", "", "", 0, "", "?bar", "", "http://??bar"},
         {"http", "", "", "", 0, "/", "?bar", "", "http:/??bar"});
     checkRelativeURLDifferences("//C|/foo/bar", "file:///tmp/mock/path",
         {"file", "", "", "", 0, "/C:/foo/bar", "", "", "file:///C:/foo/bar"},
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to