Title: [268853] trunk
Revision
268853
Author
[email protected]
Date
2020-10-21 22:24:47 -0700 (Wed, 21 Oct 2020)

Log Message

Update and pass new URL web platform tests
https://bugs.webkit.org/show_bug.cgi?id=218056

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/resources/setters_tests.json:
* web-platform-tests/url/resources/urltestdata.json:
* web-platform-tests/url/url-constructor-expected.txt:
* web-platform-tests/url/url-searchparams.any.js:
* web-platform-tests/url/url-setters-expected.txt:

Source/WebCore:

Don't add an extra forward slash at the beginning when setting the path of a file URL
that starts with a backslash, which we turn into a forward slash when parsing file URL paths.
This conveniently involves removing duplicate code.

This matches the behavior of Chrome and the URL spec.
Covered by newly passing web platform tests.

* html/URLDecomposition.cpp:
(WebCore::URLDecomposition::setPathname):

Source/WTF:

* wtf/URL.cpp:
(WTF::URL::setPath):

Modified Paths

Diff

Modified: trunk/LayoutTests/imported/w3c/ChangeLog (268852 => 268853)


--- trunk/LayoutTests/imported/w3c/ChangeLog	2020-10-22 04:50:33 UTC (rev 268852)
+++ trunk/LayoutTests/imported/w3c/ChangeLog	2020-10-22 05:24:47 UTC (rev 268853)
@@ -1,5 +1,20 @@
 2020-10-21  Alex Christensen  <[email protected]>
 
+        Update and pass new URL web platform tests
+        https://bugs.webkit.org/show_bug.cgi?id=218056
+
+        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/resources/setters_tests.json:
+        * web-platform-tests/url/resources/urltestdata.json:
+        * web-platform-tests/url/url-constructor-expected.txt:
+        * web-platform-tests/url/url-searchparams.any.js:
+        * web-platform-tests/url/url-setters-expected.txt:
+
+2020-10-21  Alex Christensen  <[email protected]>
+
         Implement ISO-2022-JP encoder step 3
         https://bugs.webkit.org/show_bug.cgi?id=218046
 

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


--- trunk/LayoutTests/imported/w3c/web-platform-tests/url/a-element-expected.txt	2020-10-22 04:50:33 UTC (rev 268852)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/url/a-element-expected.txt	2020-10-22 05:24:47 UTC (rev 268853)
@@ -488,6 +488,8 @@
 PASS Parsing: <///one/two> against <file:///>
 PASS Parsing: <////one/two> against <file:///>
 PASS Parsing: <file:///.//> against <file:////>
+PASS Parsing: <file:.//p> against <about:blank>
+PASS Parsing: <file:/.//p> against <about:blank>
 PASS Parsing: <http://[1:0::]> against <http://example.net/>
 PASS Parsing: <http://[0:1:2:3:4:5:6:7:8]> against <http://example.net/>
 PASS Parsing: <https://[0::0::0]> against <about:blank>

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


--- trunk/LayoutTests/imported/w3c/web-platform-tests/url/a-element-xhtml-expected.txt	2020-10-22 04:50:33 UTC (rev 268852)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/url/a-element-xhtml-expected.txt	2020-10-22 05:24:47 UTC (rev 268853)
@@ -488,6 +488,8 @@
 PASS Parsing: <///one/two> against <file:///>
 PASS Parsing: <////one/two> against <file:///>
 PASS Parsing: <file:///.//> against <file:////>
+PASS Parsing: <file:.//p> against <about:blank>
+PASS Parsing: <file:/.//p> against <about:blank>
 PASS Parsing: <http://[1:0::]> against <http://example.net/>
 PASS Parsing: <http://[0:1:2:3:4:5:6:7:8]> against <http://example.net/>
 PASS Parsing: <https://[0::0::0]> against <about:blank>

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/url/resources/setters_tests.json (268852 => 268853)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/url/resources/setters_tests.json	2020-10-22 04:50:33 UTC (rev 268852)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/url/resources/setters_tests.json	2020-10-22 05:24:47 UTC (rev 268853)
@@ -1672,8 +1672,8 @@
             "href": "file://monkey/",
             "new_value": "\\\\",
             "expected": {
-                "href": "file://monkey/",
-                "pathname": "/"
+                "href": "file://monkey//",
+                "pathname": "//"
             }
         },
         {
@@ -1681,8 +1681,8 @@
             "href": "file:///unicorn",
             "new_value": "//\\/",
             "expected": {
-                "href": "file:///",
-                "pathname": "/"
+                "href": "file://////",
+                "pathname": "////"
             }
         },
         {
@@ -1690,8 +1690,8 @@
             "href": "file:///unicorn",
             "new_value": "//monkey/..//",
             "expected": {
-                "href": "file:///",
-                "pathname": "/"
+                "href": "file://///",
+                "pathname": "///"
             }
         },
         {
@@ -1947,4 +1947,4 @@
             }
         }
     ]
-}
\ No newline at end of file
+}

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/url/resources/urltestdata.json (268852 => 268853)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/url/resources/urltestdata.json	2020-10-22 04:50:33 UTC (rev 268852)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/url/resources/urltestdata.json	2020-10-22 05:24:47 UTC (rev 268853)
@@ -6091,7 +6091,7 @@
     "base": "about:blank",
     "failure": true
   },
-  "# Additional file URL tetsts for (https://github.com/whatwg/url/issues/405)",
+  "# Additional file URL tests for (https://github.com/whatwg/url/issues/405)",
   {
     "input": "file://localhost//a//../..//foo",
     "base": "about:blank",
@@ -6218,6 +6218,35 @@
     "search": "",
     "hash": ""
   },
+  "File URL tests for https://github.com/whatwg/url/issues/549",
+  {
+    "input": "file:.//p",
+    "base": "about:blank",
+    "href": "file:////p",
+    "protocol": "file:",
+    "username": "",
+    "password": "",
+    "host": "",
+    "hostname": "",
+    "port": "",
+    "pathname": "//p",
+    "search": "",
+    "hash": ""
+  },
+  {
+    "input": "file:/.//p",
+    "base": "about:blank",
+    "href": "file:////p",
+    "protocol": "file:",
+    "username": "",
+    "password": "",
+    "host": "",
+    "hostname": "",
+    "port": "",
+    "pathname": "//p",
+    "search": "",
+    "hash": ""
+  },
   "# IPv6 tests",
   {
     "input": "http://[1:0::]",

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


--- trunk/LayoutTests/imported/w3c/web-platform-tests/url/url-constructor-expected.txt	2020-10-22 04:50:33 UTC (rev 268852)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/url/url-constructor-expected.txt	2020-10-22 05:24:47 UTC (rev 268853)
@@ -487,6 +487,8 @@
 PASS Parsing: <///one/two> against <file:///>
 PASS Parsing: <////one/two> against <file:///>
 PASS Parsing: <file:///.//> against <file:////>
+PASS Parsing: <file:.//p> against <about:blank>
+PASS Parsing: <file:/.//p> against <about:blank>
 PASS Parsing: <http://[1:0::]> against <http://example.net/>
 PASS Parsing: <http://[0:1:2:3:4:5:6:7:8]> against <http://example.net/>
 PASS Parsing: <https://[0::0::0]> against <about:blank>

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/url/url-searchparams.any.js (268852 => 268853)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/url/url-searchparams.any.js	2020-10-22 04:50:33 UTC (rev 268852)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/url/url-searchparams.any.js	2020-10-22 05:24:47 UTC (rev 268853)
@@ -7,7 +7,7 @@
     var url = ""
     assert_true("searchParams" in url)
     var searchParams = url.searchParams
-    assert_true(url.searchParams === searchParams, 'Object identity should hold.')
+    assert_equals(url.searchParams, searchParams, 'Object identity should hold.')
   }, 'URL.searchParams getter')
 
   test(function() {

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/url/url-setters-expected.txt (268852 => 268853)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/url/url-setters-expected.txt	2020-10-22 04:50:33 UTC (rev 268852)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/url/url-setters-expected.txt	2020-10-22 05:24:47 UTC (rev 268853)
@@ -507,9 +507,9 @@
 PASS URL: Setting <https://example.net#nav>.pathname = '../home'
 PASS <a>: Setting <https://example.net#nav>.pathname = '../home'
 PASS <area>: Setting <https://example.net#nav>.pathname = '../home'
-FAIL URL: Setting <http://example.net/home?lang=fr#nav>.pathname = '\a\%2E\b\%2e.\c' \ is a segment delimiter for 'special' URLs assert_equals: expected "http://example.net/a/c?lang=fr#nav" but got "http://example.net//a/c?lang=fr#nav"
-FAIL <a>: Setting <http://example.net/home?lang=fr#nav>.pathname = '\a\%2E\b\%2e.\c' \ is a segment delimiter for 'special' URLs assert_equals: expected "http://example.net/a/c?lang=fr#nav" but got "http://example.net//a/c?lang=fr#nav"
-FAIL <area>: Setting <http://example.net/home?lang=fr#nav>.pathname = '\a\%2E\b\%2e.\c' \ is a segment delimiter for 'special' URLs assert_equals: expected "http://example.net/a/c?lang=fr#nav" but got "http://example.net//a/c?lang=fr#nav"
+PASS URL: Setting <http://example.net/home?lang=fr#nav>.pathname = '\a\%2E\b\%2e.\c' \ is a segment delimiter for 'special' URLs
+PASS <a>: Setting <http://example.net/home?lang=fr#nav>.pathname = '\a\%2E\b\%2e.\c' \ is a segment delimiter for 'special' URLs
+PASS <area>: Setting <http://example.net/home?lang=fr#nav>.pathname = '\a\%2E\b\%2e.\c' \ is a segment delimiter for 'special' URLs
 PASS URL: Setting <view-source+http://example.net/home?lang=fr#nav>.pathname = '\a\%2E\b\%2e.\c' \ is *not* a segment delimiter for non-'special' URLs
 PASS <a>: Setting <view-source+http://example.net/home?lang=fr#nav>.pathname = '\a\%2E\b\%2e.\c' \ is *not* a segment delimiter for non-'special' URLs
 PASS <area>: Setting <view-source+http://example.net/home?lang=fr#nav>.pathname = '\a\%2E\b\%2e.\c' \ is *not* a segment delimiter for non-'special' URLs
@@ -534,15 +534,15 @@
 PASS URL: Setting <sc://example.net>.pathname = '#' # needs to be encoded, non-special scheme
 PASS <a>: Setting <sc://example.net>.pathname = '#' # needs to be encoded, non-special scheme
 PASS <area>: Setting <sc://example.net>.pathname = '#' # needs to be encoded, non-special scheme
-FAIL URL: Setting <file://monkey/>.pathname = '\\' File URLs and (back)slashes assert_equals: expected "file://monkey/" but got "file://monkey///"
-FAIL <a>: Setting <file://monkey/>.pathname = '\\' File URLs and (back)slashes assert_equals: expected "file://monkey/" but got "file://monkey///"
-FAIL <area>: Setting <file://monkey/>.pathname = '\\' File URLs and (back)slashes assert_equals: expected "file://monkey/" but got "file://monkey///"
-FAIL URL: Setting <file:///unicorn>.pathname = '//\/' File URLs and (back)slashes assert_equals: expected "file:///" but got "file://////"
-FAIL <a>: Setting <file:///unicorn>.pathname = '//\/' File URLs and (back)slashes assert_equals: expected "file:///" but got "file://////"
-FAIL <area>: Setting <file:///unicorn>.pathname = '//\/' File URLs and (back)slashes assert_equals: expected "file:///" but got "file://////"
-FAIL URL: Setting <file:///unicorn>.pathname = '//monkey/..//' File URLs and (back)slashes assert_equals: expected "file:///" but got "file://///"
-FAIL <a>: Setting <file:///unicorn>.pathname = '//monkey/..//' File URLs and (back)slashes assert_equals: expected "file:///" but got "file://///"
-FAIL <area>: Setting <file:///unicorn>.pathname = '//monkey/..//' File URLs and (back)slashes assert_equals: expected "file:///" but got "file://///"
+PASS URL: Setting <file://monkey/>.pathname = '\\' File URLs and (back)slashes
+PASS <a>: Setting <file://monkey/>.pathname = '\\' File URLs and (back)slashes
+PASS <area>: Setting <file://monkey/>.pathname = '\\' File URLs and (back)slashes
+PASS URL: Setting <file:///unicorn>.pathname = '//\/' File URLs and (back)slashes
+PASS <a>: Setting <file:///unicorn>.pathname = '//\/' File URLs and (back)slashes
+PASS <area>: Setting <file:///unicorn>.pathname = '//\/' File URLs and (back)slashes
+PASS URL: Setting <file:///unicorn>.pathname = '//monkey/..//' File URLs and (back)slashes
+PASS <a>: Setting <file:///unicorn>.pathname = '//monkey/..//' File URLs and (back)slashes
+PASS <area>: Setting <file:///unicorn>.pathname = '//monkey/..//' File URLs and (back)slashes
 PASS URL: Setting <non-spec:/>.pathname = '/.//p' Serialize /. in path
 PASS <a>: Setting <non-spec:/>.pathname = '/.//p' Serialize /. in path
 PASS <area>: Setting <non-spec:/>.pathname = '/.//p' Serialize /. in path

Modified: trunk/Source/WTF/ChangeLog (268852 => 268853)


--- trunk/Source/WTF/ChangeLog	2020-10-22 04:50:33 UTC (rev 268852)
+++ trunk/Source/WTF/ChangeLog	2020-10-22 05:24:47 UTC (rev 268853)
@@ -1,3 +1,13 @@
+2020-10-21  Alex Christensen  <[email protected]>
+
+        Update and pass new URL web platform tests
+        https://bugs.webkit.org/show_bug.cgi?id=218056
+
+        Reviewed by Tim Horton.
+
+        * wtf/URL.cpp:
+        (WTF::URL::setPath):
+
 2020-10-20  Sihui Liu  <[email protected]>
 
         Add stubs for SpeechRecognition

Modified: trunk/Source/WTF/wtf/URL.cpp (268852 => 268853)


--- trunk/Source/WTF/wtf/URL.cpp	2020-10-22 04:50:33 UTC (rev 268852)
+++ trunk/Source/WTF/wtf/URL.cpp	2020-10-22 05:24:47 UTC (rev 268853)
@@ -677,7 +677,7 @@
 
     parse(makeString(
         StringView(m_string).left(pathStart()),
-        path.startsWith('/') || (hasSpecialScheme() && path.startsWith('\\')) ? "" : "/",
+        path.startsWith('/') || (path.startsWith('\\') && (hasSpecialScheme() || protocolIs("file"))) ? "" : "/",
         escapePathWithoutCopying(path),
         StringView(m_string).substring(m_pathEnd)
     ));

Modified: trunk/Source/WebCore/ChangeLog (268852 => 268853)


--- trunk/Source/WebCore/ChangeLog	2020-10-22 04:50:33 UTC (rev 268852)
+++ trunk/Source/WebCore/ChangeLog	2020-10-22 05:24:47 UTC (rev 268853)
@@ -1,5 +1,22 @@
 2020-10-21  Alex Christensen  <[email protected]>
 
+        Update and pass new URL web platform tests
+        https://bugs.webkit.org/show_bug.cgi?id=218056
+
+        Reviewed by Tim Horton.
+
+        Don't add an extra forward slash at the beginning when setting the path of a file URL
+        that starts with a backslash, which we turn into a forward slash when parsing file URL paths.
+        This conveniently involves removing duplicate code.
+
+        This matches the behavior of Chrome and the URL spec.
+        Covered by newly passing web platform tests.
+
+        * html/URLDecomposition.cpp:
+        (WebCore::URLDecomposition::setPathname):
+
+2020-10-21  Alex Christensen  <[email protected]>
+
         Replace O(n^2) algorithm from r268709 with O(n) algorithm
         https://bugs.webkit.org/show_bug.cgi?id=218062
 

Modified: trunk/Source/WebCore/html/URLDecomposition.cpp (268852 => 268853)


--- trunk/Source/WebCore/html/URLDecomposition.cpp	2020-10-22 04:50:33 UTC (rev 268852)
+++ trunk/Source/WebCore/html/URLDecomposition.cpp	2020-10-22 05:24:47 UTC (rev 268853)
@@ -202,10 +202,7 @@
     auto fullURL = this->fullURL();
     if (fullURL.cannotBeABaseURL() || !fullURL.canSetPathname())
         return;
-    if (value.startsWith('/'))
-        fullURL.setPath(value);
-    else
-        fullURL.setPath(makeString('/', value));
+    fullURL.setPath(value);
     setFullURL(fullURL);
 }
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to