Source code

Revision control

Copy as Markdown

Other Tools

Test Info: Warnings

/* Any copyright is dedicated to the Public Domain.
// The test loads a web page with mixed active and display content
// on it while the "block mixed content" settings are _off_.
// It then checks that the loading mixed content warning messages
// are logged to the console and have the correct "Learn More"
// url appended to them.
// Bug 875456 - Log mixed content messages from the Mixed Content
// Blocker to the Security Pane in the Web Console
"use strict";
const TEST_URI =
"test/browser/test-mixedcontent-securityerrors.html";
const LEARN_MORE_URI =
"Mixed_content" +
DOCS_GA_PARAMS;
add_task(async function () {
await Promise.all([
pushPref("security.mixed_content.block_active_content", false),
pushPref("security.mixed_content.block_display_content", false),
pushPref("security.mixed_content.upgrade_display_content", false),
]);
const hud = await openNewTabAndConsole(TEST_URI);
const activeContentText =
"Loading mixed (insecure) active content " +
"\u201chttp://example.com/\u201d on a secure page";
const displayContentText =
"Loading mixed (insecure) display content " +
const waitUntilWarningMessage = text =>
waitFor(() => findWarningMessage(hud, text), undefined, 100);
const onMixedActiveContent = waitUntilWarningMessage(activeContentText);
const onMixedDisplayContent = waitUntilWarningMessage(displayContentText);
await onMixedDisplayContent;
ok(true, "Mixed display content warning message is visible");
const mixedActiveContentMessage = await onMixedActiveContent;
ok(true, "Mixed active content warning message is visible");
const checkLink = ({ link, where, expectedLink, expectedTab }) => {
is(link, expectedLink, `Clicking the provided link opens ${link}`);
is(where, expectedTab, `Clicking the provided link opens in expected tab`);
};
info("Clicking on the Learn More link");
const learnMoreLink =
mixedActiveContentMessage.querySelector(".learn-more-link");
const linkSimulation = await simulateLinkClick(learnMoreLink);
checkLink({
...linkSimulation,
expectedLink: LEARN_MORE_URI,
expectedTab: "tab",
});
});