URLParser should not consider path of URLs with no host to start at the first slash...
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 10 Nov 2016 00:30:31 +0000 (00:30 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 10 Nov 2016 00:30:31 +0000 (00:30 +0000)
https://bugs.webkit.org/show_bug.cgi?id=164555

Patch by Alex Christensen <achristensen@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:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@208508 268f45cc-cd09-0410-ab3c-d52691b4dbfc

13 files changed:
LayoutTests/ChangeLog
LayoutTests/fast/loader/url-parse-1-expected.txt
LayoutTests/fast/url/segments-expected.txt
LayoutTests/fast/url/segments-from-data-url-expected.txt
LayoutTests/fetch/fetch-url-serialization-expected.txt
LayoutTests/imported/w3c/ChangeLog
LayoutTests/imported/w3c/web-platform-tests/url/a-element-expected.txt
LayoutTests/imported/w3c/web-platform-tests/url/a-element-xhtml-expected.txt
LayoutTests/imported/w3c/web-platform-tests/url/url-constructor-expected.txt
Source/WebCore/ChangeLog
Source/WebCore/platform/URLParser.cpp
Tools/ChangeLog
Tools/TestWebKitAPI/Tests/WebCore/URLParser.cpp

index f706e3b..6ebce91 100644 (file)
@@ -1,3 +1,15 @@
+2016-11-09  Alex Christensen  <achristensen@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.fraser@apple.com>
 
         Implement visual-viewport based position:fixed handling for Mac async scrolling
index f3f7341..aae1964 100644 (file)
@@ -40,7 +40,7 @@ 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://    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
index f8175de..ccb9a1d 100644 (file)
@@ -39,7 +39,7 @@ PASS segments('/:23') is '["http:","example.org","","/:23","",""]'
 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:\\\\foo.com\\') is '["http:","foo.com","","/","",""]'
 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"]'
index cc83442..1c4ca32 100644 (file)
@@ -39,7 +39,7 @@ FAIL segments('/:23') should be ["data:","","","/:23","",""]. Was [":","","","",
 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:\\\\foo.com\\') is '["http:","foo.com","","/","",""]'
 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"]'
index 7a45cdc..1d42d82 100644 (file)
@@ -294,7 +294,7 @@ 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' 
 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' 
index 41d45a8..8cd033b 100644 (file)
@@ -1,3 +1,14 @@
+2016-11-09  Alex Christensen  <achristensen@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  <beidson@apple.com>
 
         IndexedDB 2.0: W3C test IndexedDB/idbtransaction_objectStoreNames.html fails.
index d8ce3aa..47b3751 100644 (file)
@@ -50,9 +50,9 @@ PASS Parsing: <http:\\foo.com\> against <http://example.org/foo/bar>
 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>
 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> 
index d8ce3aa..47b3751 100644 (file)
@@ -50,9 +50,9 @@ PASS Parsing: <http:\\foo.com\> against <http://example.org/foo/bar>
 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>
 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> 
index 6aa601a..315e137 100644 (file)
@@ -54,9 +54,9 @@ PASS Parsing: <http:\\foo.com\> against <http://example.org/foo/bar>
 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>
 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> 
index 2748edd..eec81b3 100644 (file)
@@ -1,5 +1,22 @@
 2016-11-09  Alex Christensen  <achristensen@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  <achristensen@webkit.org>
+
         Simplify logic of SecurityOrigin::databaseIdentifier
         https://bugs.webkit.org/show_bug.cgi?id=164565
 
index 9a94b5a..7151e9e 100644 (file)
@@ -1427,17 +1427,11 @@ void URLParser::parse(const CharacterType* input, const unsigned length, const U
                 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 @@ void URLParser::parse(const CharacterType* input, const unsigned length, const U
         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;
index 89fde43..2a6a6d1 100644 (file)
@@ -1,3 +1,13 @@
+2016-11-09  Alex Christensen  <achristensen@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  <jbedard@apple.com>
 
         test-webkitpy failing test_create_patch_is_full_patch unit test
index eea9b91..4c3fe81 100644 (file)
@@ -511,20 +511,38 @@ TEST_F(URLParserTest, Basic)
     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 @@ TEST_F(URLParserTest, ParseRelative)
     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 @@ TEST_F(URLParserTest, ParserDifferences)
         {"", "", "", "", 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"},