Source code
Revision control
Copy as Markdown
Other Tools
Test Info:
"use strict";
const testPath = getRootDirectory(gTestPath).replace(
);
let remainingMessages = 2;
const kTestURI =
testPath + "file_mixed_content_auto_upgrade_display_console.html";
add_task(async function () {
// A longer timeout is necessary for this test than the plain mochitests
// due to opening a new tab with the web console.
requestLongerTimeout(4);
// Enable HTTPS-Only Mode and register console-listener
await SpecialPowers.pushPrefEnv({
set: [
["security.mixed_content.upgrade_display_content", true],
["security.mixed_content.upgrade_display_content.image", true],
],
});
Services.console.registerListener(on_auto_upgrade_message);
BrowserTestUtils.startLoadingURIString(gBrowser.selectedBrowser, kTestURI);
await BrowserTestUtils.waitForCondition(() => remainingMessages == 0);
Services.console.unregisterListener(on_auto_upgrade_message);
});
function on_auto_upgrade_message(msgObj) {
const message = msgObj.message;
// The console message is:
// "Mixed Content: Upgrading insecure display request
if (!message.includes("Mixed Content:")) {
return;
}
ok(
message.includes("Upgrading insecure display request"),
"msg includes info"
);
ok(
message.includes("file_mixed_content_auto_upgrade_display_console.jpg") ||
message.includes(
"file_mixed_content_auto_upgrade_display_console_favicon.jpg"
),
"msg includes file"
);
remainingMessages--;
}