<script class="testbody" type="text/javascript"> "use strict";
/*
* We perform the following tests:
* 1. Request nocert.example.com which is a site without a certificate
* 2. Request a site with self-signed cert (self-signed.example.com)
* 3. Request a site with an untrusted cert (untrusted.example.com)
* 4. Request a site with an expired cert
* 5. Request a site with an untrusted and expired cert
* 6. Request a site with no subject alternative dns name matching
*
* Expected result: Https-first tries to upgrade each request. Receives for each one an SSL_ERROR_*
* and downgrades back to http.
*/
const badCertificates = ["nocert","self-signed", "untrusted","expired","untrusted-expired", "no-subject-alt-name"];
let currentTest = 0;
let testWin;
window.addEventListener("message", receiveMessage);
// Receive message and verify that it is from an http site.
// Verify that we got the correct message and an http scheme
async function receiveMessage(event) {
let data = event.data;
let currentBadCert = badCertificates[currentTest];
ok(data.result === "downgraded", "Downgraded request " + currentBadCert);
ok(data.scheme === "http:", "Received 'http' for " + currentBadCert);
testWin.close();
await SpecialPowers.removePermission( "https-only-load-insecure",
`http://${currentBadCert}.example.com`
);
if (++currentTest < badCertificates.length) {
startTest();
return;
}
window.removeEventListener("message", receiveMessage);
SimpleTest.finish();
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.