tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

commit f00627afacaa2a0488a832d8d1d2662914a95dee
parent 85b7cd6498e356042098cb9eb6eda713789d4232
Author: Rebecca King <rking@mozilla.com>
Date:   Thu, 13 Nov 2025 20:23:00 +0000

Bug 1997327 - Update ipprotection-message-bar to be able to handle info messages - r=ip-protection-reviewers,fluent-reviewers,bolsson,kpatenio

Differential Revision: https://phabricator.services.mozilla.com/D270735

Diffstat:
Mbrowser/components/ipprotection/content/ipprotection-content.mjs | 12+++++++++---
Mbrowser/components/ipprotection/content/ipprotection-message-bar.mjs | 10++++++++++
Mbrowser/locales-preview/ipProtection.ftl | 3+++
3 files changed, 22 insertions(+), 3 deletions(-)

diff --git a/browser/components/ipprotection/content/ipprotection-content.mjs b/browser/components/ipprotection/content/ipprotection-content.mjs @@ -192,11 +192,12 @@ export default class IPProtectionContentElement extends MozLitElement { } messageBarTemplate() { - // Fallback to a generic error + // TODO: Set messageId based on state in Bug 1997328 return html` <ipprotection-message-bar class="vpn-top-content" - type=${ERRORS.GENERIC} + type=${this.#hasErrors ? ERRORS.GENERIC : "info"} + messageId="ipprotection-message-continuous-onboarding-1" ></ipprotection-message-bar> `; } @@ -264,11 +265,16 @@ export default class IPProtectionContentElement extends MozLitElement { } render() { - if (this.#hasErrors && !this._messageDismissed) { + // TODO: Set showContinuousOnboarding based on state Bug 1997328 + if ( + (this.#hasErrors || this.showContinuousOnboarding) && + !this._messageDismissed + ) { this._showMessageBar = true; } const messageBar = this._showMessageBar ? this.messageBarTemplate() : null; + //TODO: Check state to determine what position to add the message bar Bug 1997328 const content = html`${messageBar}${this.mainContentTemplate()}`; // TODO: Conditionally render post-upgrade subview within #ipprotection-content-wrapper - Bug 1973813 diff --git a/browser/components/ipprotection/content/ipprotection-message-bar.mjs b/browser/components/ipprotection/content/ipprotection-message-bar.mjs @@ -14,6 +14,8 @@ import "chrome://global/content/elements/moz-message-bar.mjs"; export default class IPProtectionMessageBarElement extends MozLitElement { #MESSAGE_TYPE_MAP = new Map([ ["generic-error", () => this.genericErrorTemplate()], + + ["info", () => this.infoMessageTemplate()], ]); DISMISS_EVENT = "ipprotection-message-bar:user-dismissed"; @@ -23,6 +25,7 @@ export default class IPProtectionMessageBarElement extends MozLitElement { static properties = { type: { type: String }, + messageId: { type: String }, }; constructor() { @@ -58,6 +61,13 @@ export default class IPProtectionMessageBarElement extends MozLitElement { `; } + infoMessageTemplate() { + return html` + <moz-message-bar type="info" data-l10n-id=${this.messageId} dismissable> + </moz-message-bar> + `; + } + firstUpdated() { this.mozMessageBarEl.addEventListener( "message-bar:user-dismissed", diff --git a/browser/locales-preview/ipProtection.ftl b/browser/locales-preview/ipProtection.ftl @@ -74,6 +74,9 @@ ipprotection-message-generic-error = .heading = Couldn’t connect to VPN .message = Try again in a few minutes. +ipprotection-message-continuous-onboarding-1 = + .message = Turn on VPN to hide your location and add extra encryption to your browsing. + ## IP Protection Settings ip-protection-description =