Skip to content

Commit

Permalink
Bug 1719182 [wpt PR 29579] - Updated PR for URL empty query and fragm…
Browse files Browse the repository at this point in the history
…ent tests, a=testonly

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

Closes whatwg/url#539.

Closes web-platform-tests/wpt#25829 by superseding it.

Co-authored-by: Daijiro Wachi <[email protected]>
--

wpt-commits: 6315c7757a6675f39262167c8196ce562f2a6778
wpt-pr: 29579
  • Loading branch information
guybedford authored and moz-wptsync-bot committed Jul 17, 2021
1 parent dead703 commit 5724e00
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 2 deletions.
2 changes: 2 additions & 0 deletions testing/web-platform/tests/url/resources/a-element-origin.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 2 additions & 0 deletions testing/web-platform/tests/url/resources/a-element.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
11 changes: 11 additions & 0 deletions testing/web-platform/tests/url/resources/urltestdata.json
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
]
2 changes: 1 addition & 1 deletion testing/web-platform/tests/url/url-constructor.any.js
Original file line number Diff line number Diff line change
@@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion testing/web-platform/tests/url/url-origin.any.js
Original file line number Diff line number Diff line change
@@ -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) {
Expand Down

0 comments on commit 5724e00

Please sign in to comment.