diff --git a/testing/web-platform/tests/url/resources/a-element-origin.js b/testing/web-platform/tests/url/resources/a-element-origin.js index 3b8cb1cbbe7c7..cb7d4a895c40c 100644 --- a/testing/web-platform/tests/url/resources/a-element-origin.js +++ b/testing/web-platform/tests/url/resources/a-element-origin.js @@ -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) diff --git a/testing/web-platform/tests/url/resources/a-element.js b/testing/web-platform/tests/url/resources/a-element.js index f64531bc8bd52..553855a870c55 100644 --- a/testing/web-platform/tests/url/resources/a-element.js +++ b/testing/web-platform/tests/url/resources/a-element.js @@ -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) diff --git a/testing/web-platform/tests/url/resources/urltestdata.json b/testing/web-platform/tests/url/resources/urltestdata.json index a56b30caf98cb..e346f87c3db44 100644 --- a/testing/web-platform/tests/url/resources/urltestdata.json +++ b/testing/web-platform/tests/url/resources/urltestdata.json @@ -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 } ] diff --git a/testing/web-platform/tests/url/url-constructor.any.js b/testing/web-platform/tests/url/url-constructor.any.js index 3f4af56d2a965..dfa98092fa647 100644 --- a/testing/web-platform/tests/url/url-constructor.any.js +++ b/testing/web-platform/tests/url/url-constructor.any.js @@ -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) { diff --git a/testing/web-platform/tests/url/url-origin.any.js b/testing/web-platform/tests/url/url-origin.any.js index d9ef64c73b8bc..9c1f97ed2e594 100644 --- a/testing/web-platform/tests/url/url-origin.any.js +++ b/testing/web-platform/tests/url/url-origin.any.js @@ -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) {