Title: [212470] trunk
Revision
212470
Author
achristen...@apple.com
Date
2017-02-16 15:13:45 -0800 (Thu, 16 Feb 2017)

Log Message

Special URLs without a host are invalid
https://bugs.webkit.org/show_bug.cgi?id=168461

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:

http://? should be invalid.  This matches Chrome and the spec and the intent of my implementation
of URLParser which already fails with urls like http:// and this was just an oversight.
Covered by newly passing web platform tests.  Updated API tests.

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

Tools:

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

LayoutTests:

* fast/dom/DOMURL/set-href-attribute-protocol.html:
* fast/dom/HTMLAnchorElement/script-tests/set-href-attribute-protocol.js:
Rebase tests.  The HTMLAnchorElement test is a little strange, but it'll be cleaned up once
url-setters.html in the web platform tests is cleaned up.

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (212469 => 212470)


--- trunk/LayoutTests/ChangeLog	2017-02-16 23:09:42 UTC (rev 212469)
+++ trunk/LayoutTests/ChangeLog	2017-02-16 23:13:45 UTC (rev 212470)
@@ -1,3 +1,15 @@
+2017-02-16  Alex Christensen  <achristen...@webkit.org>
+
+        Special URLs without a host are invalid
+        https://bugs.webkit.org/show_bug.cgi?id=168461
+
+        Reviewed by Tim Horton.
+
+        * fast/dom/DOMURL/set-href-attribute-protocol.html:
+        * fast/dom/HTMLAnchorElement/script-tests/set-href-attribute-protocol.js:
+        Rebase tests.  The HTMLAnchorElement test is a little strange, but it'll be cleaned up once
+        url-setters.html in the web platform tests is cleaned up.
+
 2017-02-16  Ryan Haddad  <ryanhad...@apple.com>
 
         Skip imported/w3c/web-platform-tests/resource-timing/rt-resource-ignored.html.

Modified: trunk/LayoutTests/fast/dom/DOMURL/set-href-attribute-protocol.html (212469 => 212470)


--- trunk/LayoutTests/fast/dom/DOMURL/set-href-attribute-protocol.html	2017-02-16 23:09:42 UTC (rev 212469)
+++ trunk/LayoutTests/fast/dom/DOMURL/set-href-attribute-protocol.html	2017-02-16 23:13:45 UTC (rev 212470)
@@ -72,7 +72,7 @@
 debug("Set protocol to http on malformed URL");
 a.href = ""
 a.protocol = "http";
-shouldBe("a.href", "'http://??bar'");
+shouldBe("a.href", "'foo:??bar'");
 
 // IE8 keeps the protocol if it is 'c:'.
 debug("Set protocol to a URL which points to a local file");

Modified: trunk/LayoutTests/fast/dom/HTMLAnchorElement/script-tests/set-href-attribute-protocol.js (212469 => 212470)


--- trunk/LayoutTests/fast/dom/HTMLAnchorElement/script-tests/set-href-attribute-protocol.js	2017-02-16 23:09:42 UTC (rev 212469)
+++ trunk/LayoutTests/fast/dom/HTMLAnchorElement/script-tests/set-href-attribute-protocol.js	2017-02-16 23:13:45 UTC (rev 212470)
@@ -63,7 +63,7 @@
 debug("Set protocol to http on malformed URL");
 a.href = ""
 a.protocol = "http";
-shouldBe("a.href", "'http://??bar'");
+shouldBe("a.href", "'http:??bar'");
 
 // IE8 keeps the protocol if it is 'c:'.
 debug("Set protocol to a URL which points to a local file");

Modified: trunk/LayoutTests/imported/w3c/ChangeLog (212469 => 212470)


--- trunk/LayoutTests/imported/w3c/ChangeLog	2017-02-16 23:09:42 UTC (rev 212469)
+++ trunk/LayoutTests/imported/w3c/ChangeLog	2017-02-16 23:13:45 UTC (rev 212470)
@@ -1,3 +1,14 @@
+2017-02-16  Alex Christensen  <achristen...@webkit.org>
+
+        Special URLs without a host are invalid
+        https://bugs.webkit.org/show_bug.cgi?id=168461
+
+        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-02-16  Joseph Pecoraro  <pecor...@apple.com>
 
         [Resource Timing] Support Resource Timing in Workers

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


--- trunk/LayoutTests/imported/w3c/web-platform-tests/url/a-element-expected.txt	2017-02-16 23:09:42 UTC (rev 212469)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/url/a-element-expected.txt	2017-02-16 23:13:45 UTC (rev 212470)
@@ -394,8 +394,8 @@
 PASS Parsing: <file:?q=v> against <about:blank> 
 PASS Parsing: <file:#frag> against <about:blank> 
 PASS Parsing: <http://[1:0::]> against <http://example.net/> 
-FAIL Parsing: <http://?> against <about:blank> assert_unreached: Expected URL to fail parsing Reached unreachable code
-FAIL Parsing: <http://#> against <about:blank> assert_unreached: Expected URL to fail parsing Reached unreachable code
+PASS Parsing: <http://?> against <about:blank> 
+PASS Parsing: <http://#> against <about:blank> 
 PASS Parsing: <sc://ñ> against <about:blank> 
 PASS Parsing: <sc://ñ?x> against <about:blank> 
 PASS Parsing: <sc://ñ#x> against <about:blank> 

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


--- trunk/LayoutTests/imported/w3c/web-platform-tests/url/a-element-xhtml-expected.txt	2017-02-16 23:09:42 UTC (rev 212469)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/url/a-element-xhtml-expected.txt	2017-02-16 23:13:45 UTC (rev 212470)
@@ -394,8 +394,8 @@
 PASS Parsing: <file:?q=v> against <about:blank> 
 PASS Parsing: <file:#frag> against <about:blank> 
 PASS Parsing: <http://[1:0::]> against <http://example.net/> 
-FAIL Parsing: <http://?> against <about:blank> assert_unreached: Expected URL to fail parsing Reached unreachable code
-FAIL Parsing: <http://#> against <about:blank> assert_unreached: Expected URL to fail parsing Reached unreachable code
+PASS Parsing: <http://?> against <about:blank> 
+PASS Parsing: <http://#> against <about:blank> 
 PASS Parsing: <sc://ñ> against <about:blank> 
 PASS Parsing: <sc://ñ?x> against <about:blank> 
 PASS Parsing: <sc://ñ#x> against <about:blank> 

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


--- trunk/LayoutTests/imported/w3c/web-platform-tests/url/url-constructor-expected.txt	2017-02-16 23:09:42 UTC (rev 212469)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/url/url-constructor-expected.txt	2017-02-16 23:13:45 UTC (rev 212470)
@@ -402,12 +402,8 @@
 PASS Parsing: <file:?q=v> against <about:blank> 
 PASS Parsing: <file:#frag> against <about:blank> 
 PASS Parsing: <http://[1:0::]> against <http://example.net/> 
-FAIL Parsing: <http://?> against <about:blank> assert_throws: function "function () {
-          bURL(expected.input, expected.base)
-        }" did not throw
-FAIL Parsing: <http://#> against <about:blank> assert_throws: function "function () {
-          bURL(expected.input, expected.base)
-        }" did not throw
+PASS Parsing: <http://?> against <about:blank> 
+PASS Parsing: <http://#> against <about:blank> 
 PASS Parsing: <sc://ñ> against <about:blank> 
 PASS Parsing: <sc://ñ?x> against <about:blank> 
 PASS Parsing: <sc://ñ#x> against <about:blank> 

Modified: trunk/Source/WebCore/ChangeLog (212469 => 212470)


--- trunk/Source/WebCore/ChangeLog	2017-02-16 23:09:42 UTC (rev 212469)
+++ trunk/Source/WebCore/ChangeLog	2017-02-16 23:13:45 UTC (rev 212470)
@@ -1,3 +1,17 @@
+2017-02-16  Alex Christensen  <achristen...@webkit.org>
+
+        Special URLs without a host are invalid
+        https://bugs.webkit.org/show_bug.cgi?id=168461
+
+        Reviewed by Tim Horton.
+
+        http://? should be invalid.  This matches Chrome and the spec and the intent of my implementation
+        of URLParser which already fails with urls like http:// and this was just an oversight.
+        Covered by newly passing web platform tests.  Updated API tests.
+
+        * platform/URLParser.cpp:
+        (WebCore::URLParser::parse):
+
 2017-02-16  Zalan Bujtas  <za...@apple.com>
 
         Simple line layout: Add support for pagination.

Modified: trunk/Source/WebCore/platform/URLParser.cpp (212469 => 212470)


--- trunk/Source/WebCore/platform/URLParser.cpp	2017-02-16 23:09:42 UTC (rev 212469)
+++ trunk/Source/WebCore/platform/URLParser.cpp	2017-02-16 23:13:45 UTC (rev 212470)
@@ -1449,6 +1449,8 @@
                 if (isSlash || *c == '?' || *c == '#') {
                     auto iterator = CodePointIterator<CharacterType>(authorityOrHostBegin, c);
                     if (iterator.atEnd()) {
+                        if (m_urlIsSpecial)
+                            return failure();
                         m_url.m_userEnd = currentPosition(c);
                         m_url.m_passwordEnd = m_url.m_userEnd;
                         m_url.m_hostEnd = m_url.m_userEnd;

Modified: trunk/Tools/ChangeLog (212469 => 212470)


--- trunk/Tools/ChangeLog	2017-02-16 23:09:42 UTC (rev 212469)
+++ trunk/Tools/ChangeLog	2017-02-16 23:13:45 UTC (rev 212470)
@@ -1,3 +1,13 @@
+2017-02-16  Alex Christensen  <achristen...@webkit.org>
+
+        Special URLs without a host are invalid
+        https://bugs.webkit.org/show_bug.cgi?id=168461
+
+        Reviewed by Tim Horton.
+
+        * TestWebKitAPI/Tests/WebCore/URLParser.cpp:
+        (TestWebKitAPI::TEST_F):
+
 2017-02-10  Filip Pizlo  <fpi...@apple.com>
 
         The collector thread should only start when the mutator doesn't have heap access

Modified: trunk/Tools/TestWebKitAPI/Tests/WebCore/URLParser.cpp (212469 => 212470)


--- trunk/Tools/TestWebKitAPI/Tests/WebCore/URLParser.cpp	2017-02-16 23:09:42 UTC (rev 212469)
+++ trunk/Tools/TestWebKitAPI/Tests/WebCore/URLParser.cpp	2017-02-16 23:13:45 UTC (rev 212470)
@@ -919,11 +919,13 @@
         {"", "", "", "", 0, "", "", "", "http://:"},
         {"http", "", "", "", 0, "/", "", "", "http://:/"});
     checkURLDifferences("http:##foo",
-        {"http", "", "", "", 0, "", "", "#foo", "http://##foo"},
+        {"", "", "", "", 0, "", "", "", "http:##foo"},
         {"http", "", "", "", 0, "/", "", "#foo", "http:/##foo"});
     checkURLDifferences("http:??bar",
-        {"http", "", "", "", 0, "", "?bar", "", "http://??bar"},
+        {"", "", "", "", 0, "", "", "", "http:??bar"},
         {"http", "", "", "", 0, "/", "?bar", "", "http:/??bar"});
+    checkURL("asdf:##foo", {"asdf", "", "", "", 0, "", "", "#foo", "asdf:##foo"});
+    checkURL("asdf:??bar", {"asdf", "", "", "", 0, "", "?bar", "", "asdf:??bar"});
     checkRelativeURLDifferences("//C|/foo/bar", "file:///tmp/mock/path",
         {"file", "", "", "", 0, "/C:/foo/bar", "", "", "file:///C:/foo/bar"},
         {"", "", "", "", 0, "", "", "", "//C|/foo/bar"});
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to