1
0
Fork 0
firefox/dom/security/test/https-only/file_insecure_reload.sjs
Daniel Baumann 5e9a113729
Adding upstream version 140.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
2025-06-25 09:37:52 +02:00

27 lines
798 B
JavaScript

// https://bugzilla.mozilla.org/show_bug.cgi?id=1702001
// An onload postmessage to window opener
const ON_LOAD = `
<html>
<body>
send onload message...
<script type="application/javascript">
window.opener.postMessage({result: 'you entered the http page', historyLength: history.length}, '*');
</script>
</body>
</html>`;
// When an https request is sent, cause a timeout so that the https-only error
// page is displayed.
function handleRequest(request, response) {
response.setHeader("Cache-Control", "no-cache", false);
if (request.scheme === "https") {
// Simulating a timeout by processing the https request
// async and *never* return anything!
response.processAsync();
return;
}
if (request.scheme === "http") {
response.write(ON_LOAD);
}
}