diff options
Diffstat (limited to 'test/wpt/tests/fetch/api/response/multi-globals')
4 files changed, 48 insertions, 0 deletions
diff --git a/test/wpt/tests/fetch/api/response/multi-globals/current/current.html b/test/wpt/tests/fetch/api/response/multi-globals/current/current.html new file mode 100644 index 0000000..9bb6e0b --- /dev/null +++ b/test/wpt/tests/fetch/api/response/multi-globals/current/current.html @@ -0,0 +1,3 @@ +<!DOCTYPE html> +<title>Current page used as a test helper</title> +<base href="success/"> diff --git a/test/wpt/tests/fetch/api/response/multi-globals/incumbent/incumbent.html b/test/wpt/tests/fetch/api/response/multi-globals/incumbent/incumbent.html new file mode 100644 index 0000000..f63372e --- /dev/null +++ b/test/wpt/tests/fetch/api/response/multi-globals/incumbent/incumbent.html @@ -0,0 +1,16 @@ +<!DOCTYPE html> +<title>Incumbent page used as a test helper</title> + +<iframe src="../current/current.html" id="c"></iframe> +<iframe src="../relevant/relevant.html" id="r"></iframe> + +<script> +'use strict'; + +window.createRedirectResponse = (...args) => { + const current = document.querySelector('#c').contentWindow; + const relevant = document.querySelector('#r').contentWindow; + return current.Response.redirect.call(relevant.Response, ...args); +}; + +</script> diff --git a/test/wpt/tests/fetch/api/response/multi-globals/relevant/relevant.html b/test/wpt/tests/fetch/api/response/multi-globals/relevant/relevant.html new file mode 100644 index 0000000..44f42ed --- /dev/null +++ b/test/wpt/tests/fetch/api/response/multi-globals/relevant/relevant.html @@ -0,0 +1,2 @@ +<!DOCTYPE html> +<title>Relevant page used as a test helper</title> diff --git a/test/wpt/tests/fetch/api/response/multi-globals/url-parsing.html b/test/wpt/tests/fetch/api/response/multi-globals/url-parsing.html new file mode 100644 index 0000000..5f2f42a --- /dev/null +++ b/test/wpt/tests/fetch/api/response/multi-globals/url-parsing.html @@ -0,0 +1,27 @@ +<!DOCTYPE html> +<title>Response.redirect URL parsing, with multiple globals in play</title> +<link rel="help" href="https://fetch.spec.whatwg.org/#dom-response-redirect"> +<link rel="author" title="Domenic Denicola" href="mailto:d@domenic.me"> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> + +<!-- This is the entry global --> + +<iframe src="incumbent/incumbent.html"></iframe> + +<script> +'use strict'; + +const loadPromise = new Promise(resolve => { + window.addEventListener("load", () => resolve()); +}); + +promise_test(() => { + return loadPromise.then(() => { + const res = document.querySelector('iframe').contentWindow.createRedirectResponse("url"); + + assert_equals(res.headers.get("Location"), new URL("current/success/url", location.href).href); + }); +}, "should parse the redirect Location URL relative to the current settings object"); + +</script> |