diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 17:32:43 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 17:32:43 +0000 |
commit | 6bf0a5cb5034a7e684dcc3500e841785237ce2dd (patch) | |
tree | a68f146d7fa01f0134297619fbe7e33db084e0aa /testing/web-platform/tests/url/url-origin.any.js | |
parent | Initial commit. (diff) | |
download | thunderbird-6bf0a5cb5034a7e684dcc3500e841785237ce2dd.tar.xz thunderbird-6bf0a5cb5034a7e684dcc3500e841785237ce2dd.zip |
Adding upstream version 1:115.7.0.upstream/1%115.7.0upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'testing/web-platform/tests/url/url-origin.any.js')
-rw-r--r-- | testing/web-platform/tests/url/url-origin.any.js | 16 |
1 files changed, 16 insertions, 0 deletions
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"}`); + } +} |