From 26a029d407be480d791972afb5975cf62c9360a6 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Fri, 19 Apr 2024 02:47:55 +0200 Subject: Adding upstream version 124.0.1. Signed-off-by: Daniel Baumann --- ...webconsole_allow_mixedcontent_securityerrors.js | 64 ++++++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100644 devtools/client/webconsole/test/browser/browser_webconsole_allow_mixedcontent_securityerrors.js (limited to 'devtools/client/webconsole/test/browser/browser_webconsole_allow_mixedcontent_securityerrors.js') diff --git a/devtools/client/webconsole/test/browser/browser_webconsole_allow_mixedcontent_securityerrors.js b/devtools/client/webconsole/test/browser/browser_webconsole_allow_mixedcontent_securityerrors.js new file mode 100644 index 0000000000..fa907a6748 --- /dev/null +++ b/devtools/client/webconsole/test/browser/browser_webconsole_allow_mixedcontent_securityerrors.js @@ -0,0 +1,64 @@ +/* Any copyright is dedicated to the Public Domain. + * http://creativecommons.org/publicdomain/zero/1.0/ */ + +// 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 = + "https://example.com/browser/devtools/client/webconsole/" + + "test/browser/test-mixedcontent-securityerrors.html"; +const LEARN_MORE_URI = + "https://developer.mozilla.org/docs/Web/Security/" + + "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 " + + "\u201chttp://example.com/tests/image/test/mochitest/blue.png\u201d on a secure page"; + + 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", + }); +}); -- cgit v1.2.3