From 0ebf5bdf043a27fd3dfb7f92e0cb63d88954c44d Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Fri, 19 Apr 2024 03:47:29 +0200 Subject: Adding upstream version 115.8.0esr. Signed-off-by: Daniel Baumann --- testing/web-platform/tests/url/url-origin.any.js | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 testing/web-platform/tests/url/url-origin.any.js (limited to 'testing/web-platform/tests/url/url-origin.any.js') diff --git a/testing/web-platform/tests/url/url-origin.any.js b/testing/web-platform/tests/url/url-origin.any.js new file mode 100644 index 0000000000..599984c6c1 --- /dev/null +++ b/testing/web-platform/tests/url/url-origin.any.js @@ -0,0 +1,16 @@ +promise_test(() => fetch("resources/urltestdata.json").then(res => res.json()).then(runURLTests), "Loading data…"); + +function runURLTests(urlTests) { + for (const expected of urlTests) { + // Skip comments and tests without "origin" expectation + if (typeof expected === "string" || !("origin" in expected)) + continue; + + const base = expected.base !== null ? expected.base : undefined; + + test(() => { + const url = new URL(expected.input, base); + assert_equals(url.origin, expected.origin, "origin"); + }, `Origin parsing: <${expected.input}> ${base ? "against <" + base + ">" : "without base"}`); + } +} -- cgit v1.2.3