diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 19:33:14 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 19:33:14 +0000 |
commit | 36d22d82aa202bb199967e9512281e9a53db42c9 (patch) | |
tree | 105e8c98ddea1c1e4784a60a5a6410fa416be2de /devtools/client/webconsole/test/browser/browser_webconsole_allow_mixedcontent_securityerrors.js | |
parent | Initial commit. (diff) | |
download | firefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.tar.xz firefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.zip |
Adding upstream version 115.7.0esr.upstream/115.7.0esrupstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'devtools/client/webconsole/test/browser/browser_webconsole_allow_mixedcontent_securityerrors.js')
-rw-r--r-- | devtools/client/webconsole/test/browser/browser_webconsole_allow_mixedcontent_securityerrors.js | 64 |
1 files changed, 64 insertions, 0 deletions
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", + }); +}); |