commit 974d7ee3f051ed5125f7845b0c9483376df9ed57
parent 1d41dfae06684b0cfaffd0bd77ce492b5c0cfb0f
Author: Dale Harvey <dale@arandomurl.com>
Date: Tue, 21 Oct 2025 13:51:02 +0000
Bug 1979713 - Show Not Secure label in unified trust urlbar icon. r=fluent-reviewers,desktop-theme-reviewers,urlbar-reviewers,bolsson,dao
Differential Revision: https://phabricator.services.mozilla.com/D268047
Diffstat:
5 files changed, 41 insertions(+), 3 deletions(-)
diff --git a/browser/base/content/navigator-toolbox.inc.xhtml b/browser/base/content/navigator-toolbox.inc.xhtml
@@ -223,6 +223,7 @@
</box>
<box id="trust-icon-container" align="center" role="button" data-l10n-id="urlbar-identity-button">
<image id="trust-icon"/>
+ <label id="trust-label" crop="center" flex="1" data-l10n-id="urlbar-trust-icon-notsecure-label" />
</box>
<!-- Use onclick instead of normal popup= syntax since the popup
code fires onmousedown, and hence eats our favicon drag events. -->
diff --git a/browser/components/urlbar/tests/browser/browser.toml b/browser/components/urlbar/tests/browser/browser.toml
@@ -712,6 +712,7 @@ https_first_disabled = true
["browser_top_sites_switchtab.js"]
["browser_trust_panel.js"]
+https_first_disabled = true
["browser_trust_panel_pages.js"]
diff --git a/browser/components/urlbar/tests/browser/browser_trust_panel.js b/browser/components/urlbar/tests/browser/browser_trust_panel.js
@@ -23,9 +23,13 @@ add_setup(async function setup() {
["browser.urlbar.trustPanel.featureGate", true],
],
});
+ registerCleanupFunction(async () => {
+ await PlacesUtils.history.clear();
+ });
});
let urlbarBtn = win => win.document.getElementById("trust-icon");
+let urlbarLabel = win => win.document.getElementById("trust-label");
let urlbarIcon = win =>
gBrowser.ownerGlobal
.getComputedStyle(urlbarBtn(win))
@@ -55,6 +59,10 @@ add_task(async function basic_test() {
await BrowserTestUtils.waitForCondition(() => urlbarIcon(window) != "none");
Assert.equal(urlbarIcon(window), ETP_ACTIVE_ICON, "Showing trusted icon");
+ Assert.ok(
+ !BrowserTestUtils.isVisible(urlbarLabel(window)),
+ "Not showing Not Secure label"
+ );
await toggleETP(tab);
Assert.equal(
@@ -67,5 +75,22 @@ add_task(async function basic_test() {
Assert.equal(urlbarIcon(window), ETP_ACTIVE_ICON, "Showing trusted icon");
await BrowserTestUtils.removeTab(tab);
- await PlacesUtils.history.clear();
+});
+
+add_task(async function test_notsecure_label() {
+ const tab = await BrowserTestUtils.openNewForegroundTab({
+ gBrowser,
+ // eslint-disable-next-line @microsoft/sdl/no-insecure-url
+ opening: "http://example.com",
+ waitForLoad: true,
+ });
+
+ await BrowserTestUtils.waitForCondition(() => urlbarIcon(window) != "none");
+
+ Assert.ok(
+ BrowserTestUtils.isVisible(urlbarLabel(window)),
+ "Showing Not Secure label"
+ );
+
+ await BrowserTestUtils.removeTab(tab);
});
diff --git a/browser/locales/en-US/browser/browser.ftl b/browser/locales/en-US/browser/browser.ftl
@@ -1337,7 +1337,12 @@ onboarding-aw-finish-setup-button =
onboarding-checklist-button-label = Finish setup
-## The urlbar trust panel
+## The urlbar trust icon & panel
+
+# LOCALIZATION NOTE (trustpanel-urlbar-notsecure-label):
+# Keep this string as short as possible, this is displayed in the URL bar
+# use a synonym for "safe" or "private" if "secure" is too long.
+urlbar-trust-icon-notsecure-label = Not Secure
trustpanel-etp-label-enabled = Enhanced Tracking Protection is on
trustpanel-etp-label-disabled = Enhanced Tracking Protection is off
diff --git a/browser/themes/shared/identity-block/identity-block.css b/browser/themes/shared/identity-block/identity-block.css
@@ -307,8 +307,10 @@
list-style-image: url(chrome://browser/skin/trust-icon-active.svg);
- &.insecure {
+ &:where(.insecure) {
list-style-image: url(chrome://browser/skin/trust-icon-insecure.svg);
+ background-color: var(--urlbar-box-bgcolor);
+ color: var(--urlbar-box-text-color);
}
&.inactive {
@@ -327,4 +329,8 @@
display: flex;
}
}
+
+ #trust-icon-container:not(.insecure) > #trust-label {
+ display: none;
+ }
}