Title: [267931] trunk
Revision
267931
Author
[email protected]
Date
2020-10-03 11:39:27 -0700 (Sat, 03 Oct 2020)

Log Message

"http:" should not be a valid URL
https://bugs.webkit.org/show_bug.cgi?id=217250

Reviewed by Brady Eidson.

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:

* workers/service/context/ServiceWorkerThreadProxy.cpp:
(WebCore::topOriginURL):
Fix strange code written in r226257 that relied on the ability to assemble URLs starting with the protocol only.

Source/WTF:

Same with https, ws, wss, and for some reason ftp.
This matches the URL specification and Chrome and Firefox.

* wtf/URLParser.cpp:
(WTF::URLParser::parse):

Tools:

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

LayoutTests:

* platform/mac-wk1/imported/w3c/web-platform-tests/url/failure-expected.txt: Removed.

Modified Paths

Removed Paths

  • trunk/LayoutTests/platform/mac-wk1/imported/w3c/web-platform-tests/url/

Diff

Modified: trunk/LayoutTests/ChangeLog (267930 => 267931)


--- trunk/LayoutTests/ChangeLog	2020-10-03 17:31:30 UTC (rev 267930)
+++ trunk/LayoutTests/ChangeLog	2020-10-03 18:39:27 UTC (rev 267931)
@@ -1,3 +1,12 @@
+2020-10-03  Alex Christensen  <[email protected]>
+
+        "http:" should not be a valid URL
+        https://bugs.webkit.org/show_bug.cgi?id=217250
+
+        Reviewed by Brady Eidson.
+
+        * platform/mac-wk1/imported/w3c/web-platform-tests/url/failure-expected.txt: Removed.
+
 2020-10-03  Myles C. Maxfield  <[email protected]>
 
         [GPU Process] Support drawing text in 2D canvas with font features

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


--- trunk/LayoutTests/fetch/fetch-url-serialization-expected.txt	2020-10-03 17:31:30 UTC (rev 267930)
+++ trunk/LayoutTests/fetch/fetch-url-serialization-expected.txt	2020-10-03 18:39:27 UTC (rev 267931)
@@ -326,6 +326,6 @@
 PASS Testing Request url '?a=b&c=d' with base 'http://example.org/foo/bar'
 PASS Testing Request url '??a=b&c=d' with base 'http://example.org/foo/bar'
 PASS Testing Request url 'http:' with base 'http://example.org/foo/bar'
-FAIL Testing Request url 'http:' with base 'https://example.org/foo/bar' assert_throws: function "function () {  new Request(url.input); }" did not throw
+PASS Testing Request url 'http:' with base 'https://example.org/foo/bar'
 PASS Testing Request url 'sc:' with base 'https://example.org/foo/bar'
 

Modified: trunk/LayoutTests/imported/w3c/ChangeLog (267930 => 267931)


--- trunk/LayoutTests/imported/w3c/ChangeLog	2020-10-03 17:31:30 UTC (rev 267930)
+++ trunk/LayoutTests/imported/w3c/ChangeLog	2020-10-03 18:39:27 UTC (rev 267931)
@@ -1,3 +1,14 @@
+2020-10-03  Alex Christensen  <[email protected]>
+
+        "http:" should not be a valid URL
+        https://bugs.webkit.org/show_bug.cgi?id=217250
+
+        Reviewed by Brady Eidson.
+
+        * 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:
+
 2020-10-02  Truitt Savell  <[email protected]>
 
         Unreviewed, reverting r267887.

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


--- trunk/LayoutTests/imported/w3c/web-platform-tests/url/a-element-expected.txt	2020-10-03 17:31:30 UTC (rev 267930)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/url/a-element-expected.txt	2020-10-03 18:39:27 UTC (rev 267931)
@@ -387,7 +387,7 @@
 PASS Parsing: <?a=b&c=d> against <http://example.org/foo/bar>
 PASS Parsing: <??a=b&c=d> against <http://example.org/foo/bar>
 PASS Parsing: <http:> against <http://example.org/foo/bar>
-FAIL Parsing: <http:> against <https://example.org/foo/bar> assert_unreached: Expected URL to fail parsing Reached unreachable code
+PASS Parsing: <http:> against <https://example.org/foo/bar>
 PASS Parsing: <sc:> against <https://example.org/foo/bar>
 PASS Parsing: <http://foo.bar/baz?qux#foobar> against <about:blank>
 PASS Parsing: <http://foo.bar/baz?qux#foo"bar> against <about:blank>

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


--- trunk/LayoutTests/imported/w3c/web-platform-tests/url/a-element-xhtml-expected.txt	2020-10-03 17:31:30 UTC (rev 267930)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/url/a-element-xhtml-expected.txt	2020-10-03 18:39:27 UTC (rev 267931)
@@ -387,7 +387,7 @@
 PASS Parsing: <?a=b&c=d> against <http://example.org/foo/bar>
 PASS Parsing: <??a=b&c=d> against <http://example.org/foo/bar>
 PASS Parsing: <http:> against <http://example.org/foo/bar>
-FAIL Parsing: <http:> against <https://example.org/foo/bar> assert_unreached: Expected URL to fail parsing Reached unreachable code
+PASS Parsing: <http:> against <https://example.org/foo/bar>
 PASS Parsing: <sc:> against <https://example.org/foo/bar>
 PASS Parsing: <http://foo.bar/baz?qux#foobar> against <about:blank>
 PASS Parsing: <http://foo.bar/baz?qux#foo"bar> against <about:blank>

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


--- trunk/LayoutTests/imported/w3c/web-platform-tests/url/url-constructor-expected.txt	2020-10-03 17:31:30 UTC (rev 267930)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/url/url-constructor-expected.txt	2020-10-03 18:39:27 UTC (rev 267931)
@@ -388,9 +388,7 @@
 PASS Parsing: <?a=b&c=d> against <http://example.org/foo/bar>
 PASS Parsing: <??a=b&c=d> against <http://example.org/foo/bar>
 PASS Parsing: <http:> against <http://example.org/foo/bar>
-FAIL Parsing: <http:> against <https://example.org/foo/bar> assert_throws_js: function "function () {
-          bURL(expected.input, expected.base)
-        }" did not throw
+PASS Parsing: <http:> against <https://example.org/foo/bar>
 PASS Parsing: <sc:> against <https://example.org/foo/bar>
 PASS Parsing: <http://foo.bar/baz?qux#foobar> against <about:blank>
 PASS Parsing: <http://foo.bar/baz?qux#foo"bar> against <about:blank>

Modified: trunk/Source/WTF/ChangeLog (267930 => 267931)


--- trunk/Source/WTF/ChangeLog	2020-10-03 17:31:30 UTC (rev 267930)
+++ trunk/Source/WTF/ChangeLog	2020-10-03 18:39:27 UTC (rev 267931)
@@ -1,3 +1,16 @@
+2020-10-03  Alex Christensen  <[email protected]>
+
+        "http:" should not be a valid URL
+        https://bugs.webkit.org/show_bug.cgi?id=217250
+
+        Reviewed by Brady Eidson.
+
+        Same with https, ws, wss, and for some reason ftp.
+        This matches the URL specification and Chrome and Firefox.
+
+        * wtf/URLParser.cpp:
+        (WTF::URLParser::parse):
+
 2020-10-03  Aditya Keerthi  <[email protected]>
 
         [macOS] Enable date, time, and datetime-local input types

Modified: trunk/Source/WTF/wtf/URLParser.cpp (267930 => 267931)


--- trunk/Source/WTF/wtf/URLParser.cpp	2020-10-03 17:31:30 UTC (rev 267930)
+++ trunk/Source/WTF/wtf/URLParser.cpp	2020-10-03 18:39:27 UTC (rev 267931)
@@ -1823,15 +1823,8 @@
         break;
     case State::SpecialAuthoritySlashes:
         LOG_FINAL_STATE("SpecialAuthoritySlashes");
-        m_url.m_userStart = currentPosition(c);
-        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_portLength = 0;
-        m_url.m_pathAfterLastSlash = m_url.m_userStart;
-        m_url.m_pathEnd = m_url.m_userStart;
-        m_url.m_queryEnd = m_url.m_userStart;
-        break;
+        failure();
+        return;
     case State::SpecialAuthorityIgnoreSlashes:
         LOG_FINAL_STATE("SpecialAuthorityIgnoreSlashes");
         failure();

Modified: trunk/Source/WebCore/ChangeLog (267930 => 267931)


--- trunk/Source/WebCore/ChangeLog	2020-10-03 17:31:30 UTC (rev 267930)
+++ trunk/Source/WebCore/ChangeLog	2020-10-03 18:39:27 UTC (rev 267931)
@@ -1,3 +1,14 @@
+2020-10-03  Alex Christensen  <[email protected]>
+
+        "http:" should not be a valid URL
+        https://bugs.webkit.org/show_bug.cgi?id=217250
+
+        Reviewed by Brady Eidson.
+
+        * workers/service/context/ServiceWorkerThreadProxy.cpp:
+        (WebCore::topOriginURL):
+        Fix strange code written in r226257 that relied on the ability to assemble URLs starting with the protocol only.
+
 2020-10-03  Myles C. Maxfield  <[email protected]>
 
         [GPU Process] Support drawing text in 2D canvas with font features

Modified: trunk/Source/WebCore/workers/service/context/ServiceWorkerThreadProxy.cpp (267930 => 267931)


--- trunk/Source/WebCore/workers/service/context/ServiceWorkerThreadProxy.cpp	2020-10-03 17:31:30 UTC (rev 267930)
+++ trunk/Source/WebCore/workers/service/context/ServiceWorkerThreadProxy.cpp	2020-10-03 18:39:27 UTC (rev 267931)
@@ -49,11 +49,7 @@
 
 static URL topOriginURL(const SecurityOrigin& origin)
 {
-    URL url;
-    url.setProtocol(origin.protocol());
-    url.setHost(origin.host());
-    url.setPort(origin.port());
-    return url;
+    return URL { URL { }, origin.toRawString() };
 }
 
 static inline UniqueRef<Page> createPageForServiceWorker(PageConfiguration&& configuration, const ServiceWorkerContextData& data, SecurityOrigin::StorageBlockingPolicy storageBlockingPolicy)

Modified: trunk/Tools/ChangeLog (267930 => 267931)


--- trunk/Tools/ChangeLog	2020-10-03 17:31:30 UTC (rev 267930)
+++ trunk/Tools/ChangeLog	2020-10-03 18:39:27 UTC (rev 267931)
@@ -1,3 +1,13 @@
+2020-10-03  Alex Christensen  <[email protected]>
+
+        "http:" should not be a valid URL
+        https://bugs.webkit.org/show_bug.cgi?id=217250
+
+        Reviewed by Brady Eidson.
+
+        * TestWebKitAPI/Tests/WTF/URLParser.cpp:
+        (TestWebKitAPI::TEST_F):
+
 2020-10-03  Aditya Keerthi  <[email protected]>
 
         [macOS] Enable date, time, and datetime-local input types

Modified: trunk/Tools/TestWebKitAPI/Tests/WTF/URLParser.cpp (267930 => 267931)


--- trunk/Tools/TestWebKitAPI/Tests/WTF/URLParser.cpp	2020-10-03 17:31:30 UTC (rev 267930)
+++ trunk/Tools/TestWebKitAPI/Tests/WTF/URLParser.cpp	2020-10-03 18:39:27 UTC (rev 267931)
@@ -753,9 +753,7 @@
     checkRelativeURLDifferences("http:/", "about:blank",
         {"", "", "", "", 0, "", "", "", "http:/"},
         {"http", "", "", "", 0, "/", "", "", "http:/"});
-    checkRelativeURLDifferences("http:", "about:blank",
-        {"http", "", "", "", 0, "", "", "", "http:"},
-        {"http", "", "", "", 0, "/", "", "", "http:/"});
+    checkRelativeURL("http:", "about:blank", {"", "", "", "", 0, "", "", "", "http:"});
     checkRelativeURLDifferences("http:/", "http://host",
         {"", "", "", "", 0, "", "", "", "http:/"},
         {"http", "", "", "", 0, "/", "", "", "http:/"});
@@ -762,9 +760,7 @@
     checkURLDifferences("http:/",
         {"", "", "", "", 0, "", "", "", "http:/"},
         {"http", "", "", "", 0, "/", "", "", "http:/"});
-    checkURLDifferences("http:",
-        {"http", "", "", "", 0, "", "", "", "http:"},
-        {"http", "", "", "", 0, "/", "", "", "http:/"});
+    checkURL("http:", {"", "", "", "", 0, "", "", "", "http:"});
     checkRelativeURLDifferences("http:/example.com/", "http://example.org/foo/bar",
         {"http", "", "", "example.org", 0, "/example.com/", "", "", "http://example.org/example.com/"},
         {"http", "", "", "example.com", 0, "/", "", "", "http://example.com/"});
@@ -1279,9 +1275,7 @@
     checkURL("notspecial:\t\t\n\t", {"notspecial", "", "", "", 0, "", "", "", "notspecial:"});
     checkURL("notspecial\t\t\n\t:\t\t\n\t/\t\t\n\t/\t\t\n\thost", {"notspecial", "", "", "host", 0, "", "", "", "notspecial://host"});
     checkRelativeURL("http:", "http://example.org/foo/bar?query#fragment", {"http", "", "", "example.org", 0, "/foo/bar", "query", "", "http://example.org/foo/bar?query"});
-    checkRelativeURLDifferences("ws:", "http://example.org/foo/bar",
-        {"ws", "", "", "", 0, "", "", "", "ws:"},
-        {"ws", "", "", "", 0, "s:", "", "", "ws:s:"});
+    checkRelativeURL("ws:", "http://example.org/foo/bar", {"", "", "", "", 0, "", "", "", "ws:"});
     checkRelativeURL("notspecial:", "http://example.org/foo/bar", {"notspecial", "", "", "", 0, "", "", "", "notspecial:"});
 
     const wchar_t surrogateBegin = 0xD800;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to