/* Any copyright is dedicated to the Public Domain. * http://creativecommons.org/publicdomain/zero/1.0/ */ /* This test checks pages of different URL variants (mostly differing in scheme) * and verifies that the shield is only shown when content blocking can deal * with the specific variant. */ ChromeUtils.defineESModuleGetters(this, { AppConstants: "resource://gre/modules/AppConstants.sys.mjs", }); const ICONS = { active: "chrome://browser/skin/trust-icon-active.svg", insecure: "chrome://browser/skin/trust-icon-insecure.svg", warning: "chrome://browser/skin/trust-icon-warning.svg", secure: "chrome://global/skin/icons/security.svg", secureCustomRoot: "chrome://global/skin/icons/security-custom-root.svg", broken: "chrome://global/skin/icons/security-broken.svg", failure: "chrome://global/skin/icons/info.svg", }; const TESTS = [ { url: "about:about", icon: ICONS.active, connectionIcon: ICONS.secure, descriptionSection: "trustpanel-header-enabled", }, { url: "https://example.com", icon: ICONS.active, // TODO(bug 2019135): this should be ICONS.secure (when TLS key logging is // not enabled) connectionIcon: ICONS.secureCustomRoot, descriptionSection: "trustpanel-header-enabled", }, { // eslint-disable-next-line sdl/no-insecure-url url: "http://example.com", icon: ICONS.insecure, connectionIcon: ICONS.broken, descriptionSection: "trustpanel-header-enabled-insecure", }, { url: "https://self-signed.example.com", icon: ICONS.insecure, connectionIcon: ICONS.broken, descriptionSection: "trustpanel-header-enabled-insecure", isErrorPage: true, }, { url: "about:neterror", icon: ICONS.warning, connectionIcon: ICONS.failure, descriptionSection: "trustpanel-header-enabled", }, ]; let fetchIconUrl = (doc, id) => { let icon = doc.defaultView.getComputedStyle( doc.getElementById(id) ).listStyleImage; return icon.match(/url\("([^"]+)"\)/)?.[1] ?? null; }; add_task(async function () { let extension = ExtensionTestUtils.loadExtension({ manifest: { web_accessible_resources: ["test_page.html"], }, files: { "test_page.html": `