Bug 1719182 [wpt PR 29579] - Updated PR for URL empty query and fragment tests, a=testonly

Automatic update from web-platform-tests
Test URLs with empty query and fragment

Closes https://github.com/whatwg/url/issues/539.

Closes https://github.com/web-platform-tests/wpt/pull/25829 by superseding it.

Co-authored-by: Daijiro Wachi <daijiro.wachi@gmail.com>
--

wpt-commits: 6315c7757a6675f39262167c8196ce562f2a6778
wpt-pr: 29579
This commit is contained in:
Guy Bedford 2021-07-17 09:46:38 +00:00 коммит произвёл moz-wptsync-bot
Родитель 6c1db73005
Коммит 9ac644d7f7
5 изменённых файлов: 17 добавлений и 2 удалений

Просмотреть файл

@ -16,6 +16,8 @@ function runURLTests(urltests) {
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 = bURL(expected.input, expected.base)

Просмотреть файл

@ -16,6 +16,8 @@ function runURLTests(urltests) {
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 = bURL(expected.input, expected.base)

Просмотреть файл

@ -8016,5 +8016,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
}
]

Просмотреть файл

@ -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) {

Просмотреть файл

@ -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) {