Source code

Revision control

Copy as Markdown

Other Tools

Test Info:

<title> Bug 1706126: Test https-first, downgrade first request and then upgrade redirection to subdomain</title>
<script src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
<script class="testbody" type="text/javascript">
"use strict";
* Description of the test:
* First we request which HTTPS-First upgrades to
* The request doesn't receive an answer (timeout), so we send a background
* request.
* The background request receives an answer. So the request gets downgraded
* to by the exempt flag.
* The request gets redirected to At that stage
* HTTPS-First should clear the exempt flag and upgrade the redirection to
let testWin;
window.addEventListener("message", receiveMessage);
// Receive message and verify that it is from an https site.
async function receiveMessage(event) {
let data =;
ok(data.result === "upgraded", "Redirected successful to 'https' for subdomain ");
is(data.scheme,"https:", "scheme is 'https' for subdomain");
window.removeEventListener("message", receiveMessage);
async function runTest() {
testWin =, "_blank");
SpecialPowers.pushPrefEnv({ set: [
["", true]
]}, runTest);