diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 01:47:29 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 01:47:29 +0000 |
commit | 0ebf5bdf043a27fd3dfb7f92e0cb63d88954c44d (patch) | |
tree | a31f07c9bcca9d56ce61e9a1ffd30ef350d513aa /dom/security/test/https-first/test_data_uri.html | |
parent | Initial commit. (diff) | |
download | firefox-esr-0ebf5bdf043a27fd3dfb7f92e0cb63d88954c44d.tar.xz firefox-esr-0ebf5bdf043a27fd3dfb7f92e0cb63d88954c44d.zip |
Adding upstream version 115.8.0esr.upstream/115.8.0esr
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'dom/security/test/https-first/test_data_uri.html')
-rw-r--r-- | dom/security/test/https-first/test_data_uri.html | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/dom/security/test/https-first/test_data_uri.html b/dom/security/test/https-first/test_data_uri.html new file mode 100644 index 0000000000..b9891260db --- /dev/null +++ b/dom/security/test/https-first/test_data_uri.html @@ -0,0 +1,51 @@ +<!DOCTYPE HTML> +<html> +<head> + <meta charset="utf-8"> + <title>Bug 1709069: Test that Data URI which makes a top-level request gets updated in https-first</title> + <script src="/tests/SimpleTest/SimpleTest.js"></script> + <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" /> +</head> +<body> +<iframe style="width:100%;" id="testframe"></iframe> +<script class="testbody" type="text/javascript"> + +SimpleTest.waitForExplicitFinish(); +window.addEventListener("message", receiveMessage); + +// HTML site which makes a top-level http request +const HTML = ` +<html> +<body> + DATA HTML +<script> + window.open("http://example.com/tests/dom/security/test/https-first/file_data_uri.html"); +<\/script> +<\/body> +<\/html> +`; + +const DATA_HTML = "data:text/html, " + HTML; + +// Verify that data uri top-level request got upgraded to https and +// the reached location is correct +async function receiveMessage(event){ + let data = event.data; + is(data.location, "https://example.com/tests/dom/security/test/https-first/file_data_uri.html", + "Reached the correct location"); + window.removeEventListener("message", receiveMessage); + SimpleTest.finish(); +} + +function test_toplevel_https() { + document.getElementById("testframe").src = DATA_HTML; +} + +SpecialPowers.pushPrefEnv({ set: [ + ["dom.security.https_first", true], + ]}, test_toplevel_https); + + +</script> +</body> +</html> |