Diff
Modified: trunk/LayoutTests/imported/w3c/ChangeLog (279894 => 279895)
--- trunk/LayoutTests/imported/w3c/ChangeLog 2021-07-13 22:40:14 UTC (rev 279894)
+++ trunk/LayoutTests/imported/w3c/ChangeLog 2021-07-13 22:54:29 UTC (rev 279895)
@@ -1,3 +1,27 @@
+2021-07-13 Alex Christensen <[email protected]>
+
+ Update and fix URL WPT tests
+ https://bugs.webkit.org/show_bug.cgi?id=227820
+
+ Reviewed by Chris Dumez.
+
+ * web-platform-tests/url/failure-expected.txt:
+ * web-platform-tests/url/resources/a-element-origin.js:
+ (runURLTests):
+ * web-platform-tests/url/resources/a-element.js:
+ (runURLTests):
+ * web-platform-tests/url/resources/setters_tests.json:
+ * web-platform-tests/url/resources/urltestdata.json:
+ * web-platform-tests/url/url-constructor.any-expected.txt:
+ * web-platform-tests/url/url-constructor.any.js:
+ (bURL):
+ * web-platform-tests/url/url-constructor.any.worker-expected.txt:
+ * web-platform-tests/url/url-origin.any.js:
+ (bURL):
+ * web-platform-tests/url/url-setters-a-area.window-expected.txt:
+ * web-platform-tests/url/url-setters.any-expected.txt:
+ * web-platform-tests/url/url-setters.any.worker-expected.txt:
+
2021-07-13 Chris Dumez <[email protected]>
Resync webmessaging WPT tests from upstream
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/url/failure-expected.txt (279894 => 279895)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/url/failure-expected.txt 2021-07-13 22:40:14 UTC (rev 279894)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/url/failure-expected.txt 2021-07-13 22:54:29 UTC (rev 279895)
@@ -1,7 +1,3 @@
-Blocked access to external URL http://./Y:
-CONSOLE MESSAGE: Beacon API cannot load http://./Y: due to access control checks.
-Blocked access to external URL http://./y:
-CONSOLE MESSAGE: Beacon API cannot load http://./y: due to access control checks.
PASS Loading data…
PASS URL's constructor's base argument: file://example:1/ should throw
@@ -74,16 +70,8 @@
PASS URL's href: http::@/www.example.com should throw
PASS URL's constructor's base argument: http:@:www.example.com should throw
PASS URL's href: http:@:www.example.com should throw
-FAIL XHR: http:@:www.example.com should throw assert_throws_dom: function "() => client.open("GET", test.input)" did not throw
-FAIL sendBeacon(): http:@:www.example.com should throw assert_throws_js: function "() => self.navigator.sendBeacon(test.input)" did not throw
-FAIL Location's href: http:@:www.example.com should throw assert_throws_js: function "() => self[0].location = test.input" did not throw
-FAIL window.open(): http:@:www.example.com should throw assert_throws_dom: function "() => self.open(test.input).close()" did not throw
PASS URL's constructor's base argument: http:/@:www.example.com should throw
PASS URL's href: http:/@:www.example.com should throw
-FAIL XHR: http:/@:www.example.com should throw assert_throws_dom: function "() => client.open("GET", test.input)" did not throw
-FAIL sendBeacon(): http:/@:www.example.com should throw assert_throws_js: function "() => self.navigator.sendBeacon(test.input)" did not throw
-FAIL Location's href: http:/@:www.example.com should throw assert_throws_js: function "() => self[0].location = test.input" did not throw
-FAIL window.open(): http:/@:www.example.com should throw assert_throws_dom: function "() => self.open(test.input).close()" did not throw
PASS URL's constructor's base argument: http://@:www.example.com should throw
PASS URL's href: http://@:www.example.com should throw
PASS XHR: http://@:www.example.com should throw
@@ -404,16 +392,8 @@
PASS window.open(): asdf://%43|/ should throw
PASS URL's constructor's base argument: \\\.\Y: should throw
PASS URL's href: \\\.\Y: should throw
-FAIL XHR: \\\.\Y: should throw assert_throws_dom: function "() => client.open("GET", test.input)" did not throw
-FAIL sendBeacon(): \\\.\Y: should throw assert_throws_js: function "() => self.navigator.sendBeacon(test.input)" did not throw
-FAIL Location's href: \\\.\Y: should throw assert_throws_js: function "() => self[0].location = test.input" did not throw
-FAIL window.open(): \\\.\Y: should throw assert_throws_dom: function "() => self.open(test.input).close()" did not throw
PASS URL's constructor's base argument: \\\.\y: should throw
PASS URL's href: \\\.\y: should throw
-FAIL XHR: \\\.\y: should throw assert_throws_dom: function "() => client.open("GET", test.input)" did not throw
-FAIL sendBeacon(): \\\.\y: should throw assert_throws_js: function "() => self.navigator.sendBeacon(test.input)" did not throw
-FAIL Location's href: \\\.\y: should throw assert_throws_js: function "() => self[0].location = test.input" did not throw
-FAIL window.open(): \\\.\y: should throw assert_throws_dom: function "() => self.open(test.input).close()" did not throw
PASS URL's constructor's base argument: https://[0::0::0] should throw
PASS URL's href: https://[0::0::0] should throw
PASS XHR: https://[0::0::0] should throw
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/url/resources/a-element-origin.js (279894 => 279895)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/url/resources/a-element-origin.js 2021-07-13 22:40:14 UTC (rev 279894)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/url/resources/a-element-origin.js 2021-07-13 22:54:29 UTC (rev 279895)
@@ -16,6 +16,8 @@
for(var i = 0, l = urltests.length; i < l; i++) {
var expected = urltests[i]
if (typeof expected === "string" || !("origin" in expected)) continue
+ // skip without base because you cannot unset the baseURL of a document
+ if (expected.base === null) continue;
test(function() {
var url = "" expected.base)
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/url/resources/a-element.js (279894 => 279895)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/url/resources/a-element.js 2021-07-13 22:40:14 UTC (rev 279894)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/url/resources/a-element.js 2021-07-13 22:54:29 UTC (rev 279895)
@@ -16,6 +16,8 @@
for(var i = 0, l = urltests.length; i < l; i++) {
var expected = urltests[i]
if (typeof expected === "string") continue // skip comments
+ // skip without base because you cannot unset the baseURL of a document
+ if (expected.base === null) continue;
test(function() {
var url = "" expected.base)
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/url/resources/setters_tests.json (279894 => 279895)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/url/resources/setters_tests.json 2021-07-13 22:40:14 UTC (rev 279894)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/url/resources/setters_tests.json 2021-07-13 22:54:29 UTC (rev 279895)
@@ -1612,6 +1612,51 @@
}
},
{
+ "comment": "Special URLs cannot have their paths erased",
+ "href": "file:///some/path",
+ "new_value": "",
+ "expected": {
+ "href": "file:///",
+ "pathname": "/"
+ }
+ },
+ {
+ "comment": "Non-special URLs can have their paths erased",
+ "href": "foo://somehost/some/path",
+ "new_value": "",
+ "expected": {
+ "href": "foo://somehost",
+ "pathname": ""
+ }
+ },
+ {
+ "comment": "Non-special URLs with an empty host can have their paths erased",
+ "href": "foo:///some/path",
+ "new_value": "",
+ "expected": {
+ "href": "foo://",
+ "pathname": ""
+ }
+ },
+ {
+ "comment": "Path-only URLs cannot have their paths erased",
+ "href": "foo:/some/path",
+ "new_value": "",
+ "expected": {
+ "href": "foo:/",
+ "pathname": "/"
+ }
+ },
+ {
+ "comment": "Path-only URLs always have an initial slash",
+ "href": "foo:/some/path",
+ "new_value": "test",
+ "expected": {
+ "href": "foo:/test",
+ "pathname": "/test"
+ }
+ },
+ {
"href": "unix:/run/foo.socket?timeout=10",
"new_value": "/var/log/../run/bar.socket",
"expected": {
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/url/resources/urltestdata.json (279894 => 279895)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/url/resources/urltestdata.json 2021-07-13 22:40:14 UTC (rev 279894)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/url/resources/urltestdata.json 2021-07-13 22:54:29 UTC (rev 279895)
@@ -3303,12 +3303,14 @@
{
"input": "http:@:www.example.com",
"base": "about:blank",
- "failure": true
+ "failure": true,
+ "inputCanBeRelative": true
},
{
"input": "http:/@:www.example.com",
"base": "about:blank",
- "failure": true
+ "failure": true,
+ "inputCanBeRelative": true
},
{
"input": "http://@:www.example.com",
@@ -6373,7 +6375,8 @@
{
"input": "\\\\\\.\\Y:",
"base": "about:blank",
- "failure": true
+ "failure": true,
+ "inputCanBeRelative": true
},
"# file: drive letter cases from https://crbug.com/1078698 but lowercased",
{
@@ -6435,7 +6438,8 @@
{
"input": "\\\\\\.\\y:",
"base": "about:blank",
- "failure": true
+ "failure": true,
+ "inputCanBeRelative": true
},
"# Additional file URL tests for (https://github.com/whatwg/url/issues/405)",
{
@@ -8016,5 +8020,16 @@
"protocol": "abc:",
"search": "",
"username": ""
+ },
+ "Empty query and fragment with blank should throw an error",
+ {
+ "input": "#",
+ "base": null,
+ "failure": true
+ },
+ {
+ "input": "?",
+ "base": null,
+ "failure": true
}
]
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/url/url-constructor.any-expected.txt (279894 => 279895)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/url/url-constructor.any-expected.txt 2021-07-13 22:40:14 UTC (rev 279894)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/url/url-constructor.any-expected.txt 2021-07-13 22:54:29 UTC (rev 279895)
@@ -643,4 +643,6 @@
PASS Parsing: <abc:rootless> against <abc:/path>
PASS Parsing: <abc:rootless> against <abc:path>
PASS Parsing: <abc:/rooted> against <abc://host/path>
+PASS Parsing: <#> against <null>
+PASS Parsing: <?> against <null>
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/url/url-constructor.any.js (279894 => 279895)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/url/url-constructor.any.js 2021-07-13 22:40:14 UTC (rev 279894)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/url/url-constructor.any.js 2021-07-13 22:54:29 UTC (rev 279895)
@@ -1,7 +1,7 @@
// META: timeout=long
function bURL(url, base) {
- return new URL(url, base || "about:blank")
+ return base ? new URL(url, base) : new URL(url)
}
function runURLTests(urltests) {
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/url/url-constructor.any.worker-expected.txt (279894 => 279895)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/url/url-constructor.any.worker-expected.txt 2021-07-13 22:40:14 UTC (rev 279894)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/url/url-constructor.any.worker-expected.txt 2021-07-13 22:54:29 UTC (rev 279895)
@@ -643,4 +643,6 @@
PASS Parsing: <abc:rootless> against <abc:/path>
PASS Parsing: <abc:rootless> against <abc:path>
PASS Parsing: <abc:/rooted> against <abc://host/path>
+PASS Parsing: <#> against <null>
+PASS Parsing: <?> against <null>
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/url/url-origin.any.js (279894 => 279895)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/url/url-origin.any.js 2021-07-13 22:40:14 UTC (rev 279894)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/url/url-origin.any.js 2021-07-13 22:54:29 UTC (rev 279895)
@@ -1,7 +1,7 @@
promise_test(() => fetch("resources/urltestdata.json").then(res => res.json()).then(runURLTests), "Loading data…");
function bURL(url, base) {
- return new URL(url, base || "about:blank")
+ return base ? new URL(url, base) : new URL(url)
}
function runURLTests(urltests) {
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/url/url-setters-a-area.window-expected.txt (279894 => 279895)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/url/url-setters-a-area.window-expected.txt 2021-07-13 22:40:14 UTC (rev 279894)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/url/url-setters-a-area.window-expected.txt 2021-07-13 22:54:29 UTC (rev 279895)
@@ -340,6 +340,16 @@
PASS <area>: Setting <_javascript_://x/>.port = '12'
PASS <a>: Setting <mailto:[email protected]>.pathname = '/foo' Cannot-be-a-base don’t have a path
PASS <area>: Setting <mailto:[email protected]>.pathname = '/foo' Cannot-be-a-base don’t have a path
+PASS <a>: Setting <file:///some/path>.pathname = '' Special URLs cannot have their paths erased
+PASS <area>: Setting <file:///some/path>.pathname = '' Special URLs cannot have their paths erased
+PASS <a>: Setting <foo://somehost/some/path>.pathname = '' Non-special URLs can have their paths erased
+PASS <area>: Setting <foo://somehost/some/path>.pathname = '' Non-special URLs can have their paths erased
+PASS <a>: Setting <foo:///some/path>.pathname = '' Non-special URLs with an empty host can have their paths erased
+PASS <area>: Setting <foo:///some/path>.pathname = '' Non-special URLs with an empty host can have their paths erased
+PASS <a>: Setting <foo:/some/path>.pathname = '' Path-only URLs cannot have their paths erased
+PASS <area>: Setting <foo:/some/path>.pathname = '' Path-only URLs cannot have their paths erased
+PASS <a>: Setting <foo:/some/path>.pathname = 'test' Path-only URLs always have an initial slash
+PASS <area>: Setting <foo:/some/path>.pathname = 'test' Path-only URLs always have an initial slash
PASS <a>: Setting <unix:/run/foo.socket?timeout=10>.pathname = '/var/log/../run/bar.socket'
PASS <area>: Setting <unix:/run/foo.socket?timeout=10>.pathname = '/var/log/../run/bar.socket'
PASS <a>: Setting <https://example.net#nav>.pathname = 'home'
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/url/url-setters.any-expected.txt (279894 => 279895)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/url/url-setters.any-expected.txt 2021-07-13 22:40:14 UTC (rev 279894)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/url/url-setters.any-expected.txt 2021-07-13 22:54:29 UTC (rev 279895)
@@ -170,6 +170,11 @@
PASS URL: Setting <sc://x/>.port = '12'
PASS URL: Setting <_javascript_://x/>.port = '12'
PASS URL: Setting <mailto:[email protected]>.pathname = '/foo' Cannot-be-a-base don’t have a path
+PASS URL: Setting <file:///some/path>.pathname = '' Special URLs cannot have their paths erased
+PASS URL: Setting <foo://somehost/some/path>.pathname = '' Non-special URLs can have their paths erased
+PASS URL: Setting <foo:///some/path>.pathname = '' Non-special URLs with an empty host can have their paths erased
+PASS URL: Setting <foo:/some/path>.pathname = '' Path-only URLs cannot have their paths erased
+PASS URL: Setting <foo:/some/path>.pathname = 'test' Path-only URLs always have an initial slash
PASS URL: Setting <unix:/run/foo.socket?timeout=10>.pathname = '/var/log/../run/bar.socket'
PASS URL: Setting <https://example.net#nav>.pathname = 'home'
PASS URL: Setting <https://example.net#nav>.pathname = '../home'
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/url/url-setters.any.worker-expected.txt (279894 => 279895)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/url/url-setters.any.worker-expected.txt 2021-07-13 22:40:14 UTC (rev 279894)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/url/url-setters.any.worker-expected.txt 2021-07-13 22:54:29 UTC (rev 279895)
@@ -170,6 +170,11 @@
PASS URL: Setting <sc://x/>.port = '12'
PASS URL: Setting <_javascript_://x/>.port = '12'
PASS URL: Setting <mailto:[email protected]>.pathname = '/foo' Cannot-be-a-base don’t have a path
+PASS URL: Setting <file:///some/path>.pathname = '' Special URLs cannot have their paths erased
+PASS URL: Setting <foo://somehost/some/path>.pathname = '' Non-special URLs can have their paths erased
+PASS URL: Setting <foo:///some/path>.pathname = '' Non-special URLs with an empty host can have their paths erased
+PASS URL: Setting <foo:/some/path>.pathname = '' Path-only URLs cannot have their paths erased
+PASS URL: Setting <foo:/some/path>.pathname = 'test' Path-only URLs always have an initial slash
PASS URL: Setting <unix:/run/foo.socket?timeout=10>.pathname = '/var/log/../run/bar.socket'
PASS URL: Setting <https://example.net#nav>.pathname = 'home'
PASS URL: Setting <https://example.net#nav>.pathname = '../home'
Modified: trunk/Source/WTF/ChangeLog (279894 => 279895)
--- trunk/Source/WTF/ChangeLog 2021-07-13 22:40:14 UTC (rev 279894)
+++ trunk/Source/WTF/ChangeLog 2021-07-13 22:54:29 UTC (rev 279895)
@@ -1,3 +1,15 @@
+2021-07-13 Alex Christensen <[email protected]>
+
+ Update and fix URL WPT tests
+ https://bugs.webkit.org/show_bug.cgi?id=227820
+
+ Reviewed by Chris Dumez.
+
+ There was an edge case where if we set a path to an empty string, it would add a slash. No more.
+
+ * wtf/URL.cpp:
+ (WTF::URL::setPath):
+
2021-07-13 Michael Catanzaro <[email protected]>
Remove USE_64KB_PAGE_BLOCK
Modified: trunk/Source/WTF/wtf/URL.cpp (279894 => 279895)
--- trunk/Source/WTF/wtf/URL.cpp 2021-07-13 22:40:14 UTC (rev 279894)
+++ trunk/Source/WTF/wtf/URL.cpp 2021-07-13 22:54:29 UTC (rev 279895)
@@ -682,7 +682,7 @@
parse(makeString(
StringView(m_string).left(pathStart()),
- path.startsWith('/') || (path.startsWith('\\') && (hasSpecialScheme() || protocolIs("file"))) ? "" : "/",
+ path.startsWith('/') || (path.startsWith('\\') && (hasSpecialScheme() || protocolIs("file"))) || (!hasSpecialScheme() && path.isEmpty() && m_schemeEnd + 1 < pathStart()) ? "" : "/",
!hasSpecialScheme() && host().isEmpty() && path.startsWith("//") && path.length() > 2 ? "/." : "",
escapePathWithoutCopying(path),
StringView(m_string).substring(m_pathEnd)