Title: [262900] trunk
Revision
262900
Author
[email protected]
Date
2020-06-11 02:41:33 -0700 (Thu, 11 Jun 2020)

Log Message

Improve url-setters.html WPT test
https://bugs.webkit.org/show_bug.cgi?id=213046

Patch by Rob Buis <[email protected]> on 2020-06-11
Reviewed by Darin Adler.

LayoutTests/imported/w3c:

Update improved test expectation.

* web-platform-tests/url/url-setters-expected.txt:

Source/WebCore:

Improve url-setters.html WPT test by testing for failure that can occur
when setting host or hostname [1].

[1] https://url.spec.whatwg.org/#host-state

* html/URLDecomposition.cpp:
(WebCore::URLDecomposition::setHost):
(WebCore::URLDecomposition::setHostname):

Modified Paths

Diff

Modified: trunk/LayoutTests/imported/w3c/ChangeLog (262899 => 262900)


--- trunk/LayoutTests/imported/w3c/ChangeLog	2020-06-11 08:58:28 UTC (rev 262899)
+++ trunk/LayoutTests/imported/w3c/ChangeLog	2020-06-11 09:41:33 UTC (rev 262900)
@@ -1,3 +1,14 @@
+2020-06-11  Rob Buis  <[email protected]>
+
+        Improve url-setters.html WPT test
+        https://bugs.webkit.org/show_bug.cgi?id=213046
+
+        Reviewed by Darin Adler.
+
+        Update improved test expectation.
+
+        * web-platform-tests/url/url-setters-expected.txt:
+
 2020-06-10  Brent Fulgham  <[email protected]>
 
         Improve CSP compliance under PSON

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


--- trunk/LayoutTests/imported/w3c/web-platform-tests/url/url-setters-expected.txt	2020-06-11 08:58:28 UTC (rev 262899)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/url/url-setters-expected.txt	2020-06-11 09:41:33 UTC (rev 262900)
@@ -169,8 +169,8 @@
 PASS <a>: Setting <file://test/>.password = 'test' 
 PASS <area>: Setting <file://test/>.password = 'test' 
 PASS URL: Setting <sc://x/>.host = '\0' Non-special scheme 
-FAIL <a>: Setting <sc://x/>.host = '\0' Non-special scheme assert_equals: expected "sc://x/" but got "sc://\0/"
-FAIL <area>: Setting <sc://x/>.host = '\0' Non-special scheme assert_equals: expected "sc://x/" but got "sc://\0/"
+PASS <a>: Setting <sc://x/>.host = '\0' Non-special scheme 
+PASS <area>: Setting <sc://x/>.host = '\0' Non-special scheme 
 PASS URL: Setting <sc://x/>.host = '	' 
 PASS <a>: Setting <sc://x/>.host = '	' 
 PASS <area>: Setting <sc://x/>.host = '	' 
@@ -184,8 +184,8 @@
 PASS <a>: Setting <sc://x/>.host = '\r' 
 PASS <area>: Setting <sc://x/>.host = '\r' 
 PASS URL: Setting <sc://x/>.host = ' ' 
-FAIL <a>: Setting <sc://x/>.host = ' ' assert_equals: expected "sc://x/" but got "sc:// /"
-FAIL <area>: Setting <sc://x/>.host = ' ' assert_equals: expected "sc://x/" but got "sc:// /"
+PASS <a>: Setting <sc://x/>.host = ' ' 
+PASS <area>: Setting <sc://x/>.host = ' ' 
 FAIL URL: Setting <sc://x/>.host = '#' assert_equals: expected "sc:///" but got "sc://#/"
 FAIL <a>: Setting <sc://x/>.host = '#' assert_equals: expected "sc:///" but got "sc://#/"
 FAIL <area>: Setting <sc://x/>.host = '#' assert_equals: expected "sc:///" but got "sc://#/"
@@ -196,8 +196,8 @@
 FAIL <a>: Setting <sc://x/>.host = '?' assert_equals: expected "sc:///" but got "sc://?/"
 FAIL <area>: Setting <sc://x/>.host = '?' assert_equals: expected "sc:///" but got "sc://?/"
 PASS URL: Setting <sc://x/>.host = '@' 
-FAIL <a>: Setting <sc://x/>.host = '@' assert_equals: expected "sc://x/" but got "sc://@/"
-FAIL <area>: Setting <sc://x/>.host = '@' assert_equals: expected "sc://x/" but got "sc://@/"
+PASS <a>: Setting <sc://x/>.host = '@' 
+PASS <area>: Setting <sc://x/>.host = '@' 
 FAIL URL: Setting <sc://x/>.host = 'ß' assert_equals: expected "sc://%C3%9F/" but got "sc://xn--zca/"
 FAIL <a>: Setting <sc://x/>.host = 'ß' assert_equals: expected "sc://%C3%9F/" but got "sc://xn--zca/"
 FAIL <area>: Setting <sc://x/>.host = 'ß' assert_equals: expected "sc://%C3%9F/" but got "sc://xn--zca/"
@@ -232,8 +232,8 @@
 PASS <a>: Setting <http://example.net>.host = '0x7F000001:8080' IPv4 address syntax is normalized 
 PASS <area>: Setting <http://example.net>.host = '0x7F000001:8080' IPv4 address syntax is normalized 
 FAIL URL: Setting <http://example.net>.host = '[::0:01]:2' IPv6 address syntax is normalized assert_equals: expected "http://[::1]:2/" but got "http://example.net/"
-FAIL <a>: Setting <http://example.net>.host = '[::0:01]:2' IPv6 address syntax is normalized assert_equals: expected "http://[::1]:2/" but got "http://[:0/"
-FAIL <area>: Setting <http://example.net>.host = '[::0:01]:2' IPv6 address syntax is normalized assert_equals: expected "http://[::1]:2/" but got "http://[:0/"
+FAIL <a>: Setting <http://example.net>.host = '[::0:01]:2' IPv6 address syntax is normalized assert_equals: expected "http://[::1]:2/" but got "http://example.net/"
+FAIL <area>: Setting <http://example.net>.host = '[::0:01]:2' IPv6 address syntax is normalized assert_equals: expected "http://[::1]:2/" but got "http://example.net/"
 PASS URL: Setting <http://example.net>.host = 'example.com:80' Default port number is removed 
 PASS <a>: Setting <http://example.net>.host = 'example.com:80' Default port number is removed 
 PASS <area>: Setting <http://example.net>.host = 'example.com:80' Default port number is removed 
@@ -268,8 +268,8 @@
 PASS <a>: Setting <http://example.net/path>.host = 'example.com:8080\stuff' Stuff after a \ delimiter is ignored for special schemes 
 PASS <area>: Setting <http://example.net/path>.host = 'example.com:8080\stuff' Stuff after a \ delimiter is ignored for special schemes 
 PASS URL: Setting <view-source+http://example.net/path>.host = 'example.com\stuff' \ is not a delimiter for non-special schemes, but still forbidden in hosts 
-FAIL <a>: Setting <view-source+http://example.net/path>.host = 'example.com\stuff' \ is not a delimiter for non-special schemes, but still forbidden in hosts assert_equals: expected "view-source+http://example.net/path" but got "view-source+http://example.com\\stuff/path"
-FAIL <area>: Setting <view-source+http://example.net/path>.host = 'example.com\stuff' \ is not a delimiter for non-special schemes, but still forbidden in hosts assert_equals: expected "view-source+http://example.net/path" but got "view-source+http://example.com\\stuff/path"
+PASS <a>: Setting <view-source+http://example.net/path>.host = 'example.com\stuff' \ is not a delimiter for non-special schemes, but still forbidden in hosts 
+PASS <area>: Setting <view-source+http://example.net/path>.host = 'example.com\stuff' \ is not a delimiter for non-special schemes, but still forbidden in hosts 
 PASS URL: Setting <view-source+http://example.net/path>.host = 'example.com:8080stuff2' Anything other than ASCII digit stops the port parser in a setter but is not an error 
 PASS <a>: Setting <view-source+http://example.net/path>.host = 'example.com:8080stuff2' Anything other than ASCII digit stops the port parser in a setter but is not an error 
 PASS <area>: Setting <view-source+http://example.net/path>.host = 'example.com:8080stuff2' Anything other than ASCII digit stops the port parser in a setter but is not an error 
@@ -286,20 +286,20 @@
 PASS <a>: Setting <http://example.net/path>.host = 'example.com:65536' Port numbers are 16 bit integers, overflowing is an error. Hostname is still set, though. 
 PASS <area>: Setting <http://example.net/path>.host = 'example.com:65536' Port numbers are 16 bit integers, overflowing is an error. Hostname is still set, though. 
 PASS URL: Setting <http://example.net/>.host = '[google.com]' Broken IPv6 
-FAIL <a>: Setting <http://example.net/>.host = '[google.com]' Broken IPv6 assert_equals: expected "http://example.net/" but got "http://[google.com]/"
-FAIL <area>: Setting <http://example.net/>.host = '[google.com]' Broken IPv6 assert_equals: expected "http://example.net/" but got "http://[google.com]/"
+PASS <a>: Setting <http://example.net/>.host = '[google.com]' Broken IPv6 
+PASS <area>: Setting <http://example.net/>.host = '[google.com]' Broken IPv6 
 PASS URL: Setting <http://example.net/>.host = '[::1.2.3.4x]' 
-FAIL <a>: Setting <http://example.net/>.host = '[::1.2.3.4x]' assert_equals: expected "http://example.net/" but got "http://[:0/"
-FAIL <area>: Setting <http://example.net/>.host = '[::1.2.3.4x]' assert_equals: expected "http://example.net/" but got "http://[:0/"
+PASS <a>: Setting <http://example.net/>.host = '[::1.2.3.4x]' 
+PASS <area>: Setting <http://example.net/>.host = '[::1.2.3.4x]' 
 PASS URL: Setting <http://example.net/>.host = '[::1.2.3.]' 
-FAIL <a>: Setting <http://example.net/>.host = '[::1.2.3.]' assert_equals: expected "http://example.net/" but got "http://[:0/"
-FAIL <area>: Setting <http://example.net/>.host = '[::1.2.3.]' assert_equals: expected "http://example.net/" but got "http://[:0/"
+PASS <a>: Setting <http://example.net/>.host = '[::1.2.3.]' 
+PASS <area>: Setting <http://example.net/>.host = '[::1.2.3.]' 
 PASS URL: Setting <http://example.net/>.host = '[::1.2.]' 
-FAIL <a>: Setting <http://example.net/>.host = '[::1.2.]' assert_equals: expected "http://example.net/" but got "http://[:0/"
-FAIL <area>: Setting <http://example.net/>.host = '[::1.2.]' assert_equals: expected "http://example.net/" but got "http://[:0/"
+PASS <a>: Setting <http://example.net/>.host = '[::1.2.]' 
+PASS <area>: Setting <http://example.net/>.host = '[::1.2.]' 
 PASS URL: Setting <http://example.net/>.host = '[::1.]' 
-FAIL <a>: Setting <http://example.net/>.host = '[::1.]' assert_equals: expected "http://example.net/" but got "http://[:0/"
-FAIL <area>: Setting <http://example.net/>.host = '[::1.]' assert_equals: expected "http://example.net/" but got "http://[:0/"
+PASS <a>: Setting <http://example.net/>.host = '[::1.]' 
+PASS <area>: Setting <http://example.net/>.host = '[::1.]' 
 FAIL URL: Setting <file://y/>.host = 'x:123' assert_equals: expected "file://y/" but got "file://x:123/"
 FAIL <a>: Setting <file://y/>.host = 'x:123' assert_equals: expected "file://y/" but got "file://x:123/"
 FAIL <area>: Setting <file://y/>.host = 'x:123' assert_equals: expected "file://y/" but got "file://x:123/"
@@ -316,8 +316,8 @@
 PASS <a>: Setting <sc://test:12/>.host = '' 
 PASS <area>: Setting <sc://test:12/>.host = '' 
 PASS URL: Setting <sc://x/>.hostname = '\0' Non-special scheme 
-FAIL <a>: Setting <sc://x/>.hostname = '\0' Non-special scheme assert_equals: expected "sc://x/" but got "sc://\0/"
-FAIL <area>: Setting <sc://x/>.hostname = '\0' Non-special scheme assert_equals: expected "sc://x/" but got "sc://\0/"
+PASS <a>: Setting <sc://x/>.hostname = '\0' Non-special scheme 
+PASS <area>: Setting <sc://x/>.hostname = '\0' Non-special scheme 
 PASS URL: Setting <sc://x/>.hostname = '	' 
 PASS <a>: Setting <sc://x/>.hostname = '	' 
 PASS <area>: Setting <sc://x/>.hostname = '	' 
@@ -331,8 +331,8 @@
 PASS <a>: Setting <sc://x/>.hostname = '\r' 
 PASS <area>: Setting <sc://x/>.hostname = '\r' 
 PASS URL: Setting <sc://x/>.hostname = ' ' 
-FAIL <a>: Setting <sc://x/>.hostname = ' ' assert_equals: expected "sc://x/" but got "sc:// /"
-FAIL <area>: Setting <sc://x/>.hostname = ' ' assert_equals: expected "sc://x/" but got "sc:// /"
+PASS <a>: Setting <sc://x/>.hostname = ' ' 
+PASS <area>: Setting <sc://x/>.hostname = ' ' 
 FAIL URL: Setting <sc://x/>.hostname = '#' assert_equals: expected "sc:///" but got "sc://#/"
 FAIL <a>: Setting <sc://x/>.hostname = '#' assert_equals: expected "sc:///" but got "sc://#/"
 FAIL <area>: Setting <sc://x/>.hostname = '#' assert_equals: expected "sc:///" but got "sc://#/"
@@ -343,8 +343,8 @@
 FAIL <a>: Setting <sc://x/>.hostname = '?' assert_equals: expected "sc:///" but got "sc://?/"
 FAIL <area>: Setting <sc://x/>.hostname = '?' assert_equals: expected "sc:///" but got "sc://?/"
 PASS URL: Setting <sc://x/>.hostname = '@' 
-FAIL <a>: Setting <sc://x/>.hostname = '@' assert_equals: expected "sc://x/" but got "sc://@/"
-FAIL <area>: Setting <sc://x/>.hostname = '@' assert_equals: expected "sc://x/" but got "sc://@/"
+PASS <a>: Setting <sc://x/>.hostname = '@' 
+PASS <area>: Setting <sc://x/>.hostname = '@' 
 PASS URL: Setting <mailto:[email protected]>.hostname = 'example.com' Cannot-be-a-base means no host 
 PASS <a>: Setting <mailto:[email protected]>.hostname = 'example.com' Cannot-be-a-base means no host 
 PASS <area>: Setting <mailto:[email protected]>.hostname = 'example.com' Cannot-be-a-base means no host 
@@ -388,11 +388,11 @@
 FAIL <a>: Setting <http://example.net/path>.hostname = 'example.com\stuff' Stuff after a \ delimiter is ignored for special schemes assert_equals: expected "http://example.com/path" but got "http://example.com/stuff/path"
 FAIL <area>: Setting <http://example.net/path>.hostname = 'example.com\stuff' Stuff after a \ delimiter is ignored for special schemes assert_equals: expected "http://example.com/path" but got "http://example.com/stuff/path"
 PASS URL: Setting <view-source+http://example.net/path>.hostname = 'example.com\stuff' \ is not a delimiter for non-special schemes, but still forbidden in hosts 
-FAIL <a>: Setting <view-source+http://example.net/path>.hostname = 'example.com\stuff' \ is not a delimiter for non-special schemes, but still forbidden in hosts assert_equals: expected "view-source+http://example.net/path" but got "view-source+http://example.com\\stuff/path"
-FAIL <area>: Setting <view-source+http://example.net/path>.hostname = 'example.com\stuff' \ is not a delimiter for non-special schemes, but still forbidden in hosts assert_equals: expected "view-source+http://example.net/path" but got "view-source+http://example.com\\stuff/path"
+PASS <a>: Setting <view-source+http://example.net/path>.hostname = 'example.com\stuff' \ is not a delimiter for non-special schemes, but still forbidden in hosts 
+PASS <area>: Setting <view-source+http://example.net/path>.hostname = 'example.com\stuff' \ is not a delimiter for non-special schemes, but still forbidden in hosts 
 PASS URL: Setting <http://example.net/>.hostname = '[google.com]' Broken IPv6 
-FAIL <a>: Setting <http://example.net/>.hostname = '[google.com]' Broken IPv6 assert_equals: expected "http://example.net/" but got "http://[google.com]/"
-FAIL <area>: Setting <http://example.net/>.hostname = '[google.com]' Broken IPv6 assert_equals: expected "http://example.net/" but got "http://[google.com]/"
+PASS <a>: Setting <http://example.net/>.hostname = '[google.com]' Broken IPv6 
+PASS <area>: Setting <http://example.net/>.hostname = '[google.com]' Broken IPv6 
 PASS URL: Setting <http://example.net/>.hostname = '[::1.2.3.4x]' 
 PASS <a>: Setting <http://example.net/>.hostname = '[::1.2.3.4x]' 
 PASS <area>: Setting <http://example.net/>.hostname = '[::1.2.3.4x]' 

Modified: trunk/Source/WebCore/ChangeLog (262899 => 262900)


--- trunk/Source/WebCore/ChangeLog	2020-06-11 08:58:28 UTC (rev 262899)
+++ trunk/Source/WebCore/ChangeLog	2020-06-11 09:41:33 UTC (rev 262900)
@@ -1,3 +1,19 @@
+2020-06-11  Rob Buis  <[email protected]>
+
+        Improve url-setters.html WPT test
+        https://bugs.webkit.org/show_bug.cgi?id=213046
+
+        Reviewed by Darin Adler.
+
+        Improve url-setters.html WPT test by testing for failure that can occur
+        when setting host or hostname [1].
+
+        [1] https://url.spec.whatwg.org/#host-state
+
+        * html/URLDecomposition.cpp:
+        (WebCore::URLDecomposition::setHost):
+        (WebCore::URLDecomposition::setHostname):
+
 2020-06-11  ChangSeok Oh  <[email protected]>
 
         [GTK] Implement button-press-event, button-release-event, and absolute-axis-event of GAMEPAD API.

Modified: trunk/Source/WebCore/html/URLDecomposition.cpp (262899 => 262900)


--- trunk/Source/WebCore/html/URLDecomposition.cpp	2020-06-11 08:58:28 UTC (rev 262899)
+++ trunk/Source/WebCore/html/URLDecomposition.cpp	2020-06-11 09:41:33 UTC (rev 262900)
@@ -124,7 +124,8 @@
                 fullURL.setHostAndPort(value.substring(0, separator + 1 + portLength));
         }
     }
-    setFullURL(fullURL);
+    if (fullURL.isValid())
+        setFullURL(fullURL);
 }
 
 String URLDecomposition::hostname() const
@@ -152,7 +153,8 @@
     if (fullURL.cannotBeABaseURL() || !fullURL.canSetHostOrPort())
         return;
     fullURL.setHost(host);
-    setFullURL(fullURL);
+    if (fullURL.isValid())
+        setFullURL(fullURL);
 }
 
 String URLDecomposition::port() const
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to