tor-browser

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

commit fda063630b13dfe14a41394a2eee3c22d66bfde8
parent 927a12194df537f5443674e1c3fee8ff6809ff21
Author: Serban Stanca <sstanca@mozilla.com>
Date:   Wed, 12 Nov 2025 19:04:43 +0200

Revert "Bug 1997328 - Update ipprotection-content element to show onboarding messages based on state - r=ip-protection-reviewers,fluent-reviewers,bolsson,kpatenio" for causing mochitests failures in browser_IPProtectionService.js.

This reverts commit dce7e1b78eb5c206240f063576c867ba1fd7147b.

This reverts commit a63b4b06c538bbae7727feeb290ce87e1e52fdd4.

Diffstat:
Mbrowser/components/ipprotection/IPProtectionPanel.sys.mjs | 3---
Mbrowser/components/ipprotection/content/ipprotection-content.mjs | 37++++---------------------------------
Mbrowser/components/ipprotection/content/ipprotection-message-bar.mjs | 47++++++-----------------------------------------
Mbrowser/locales-preview/ipProtection.ftl | 4----
4 files changed, 10 insertions(+), 81 deletions(-)

diff --git a/browser/components/ipprotection/IPProtectionPanel.sys.mjs b/browser/components/ipprotection/IPProtectionPanel.sys.mjs @@ -78,8 +78,6 @@ export class IPProtectionPanel { * True if we're running the Alpha variant, else false. * @property {boolean} hasUpgraded * True if a Mozilla VPN subscription is linked to the user's Mozilla account. - * @property {string} onboardingMessage - * Continuous onboarding message to display in-panel, empty string if none applicable */ /** @@ -125,7 +123,6 @@ export class IPProtectionPanel { error: "", isAlpha: lazy.IPPEnrollAndEntitleManager.isAlpha, hasUpgraded: lazy.IPPEnrollAndEntitleManager.hasUpgraded, - onboardingMessage: "", }; if (window) { diff --git a/browser/components/ipprotection/content/ipprotection-content.mjs b/browser/components/ipprotection/content/ipprotection-content.mjs @@ -206,36 +206,11 @@ export default class IPProtectionContentElement extends MozLitElement { } messageBarTemplate() { - let messageId; - let messageLink; - let messageLinkl10nId; - // If there are errors, the error message should take precedence - if (this.#hasErrors) { - messageId = "ipprotection-message-generic-error"; - } else if (this.state.onboardingMessage) { - messageId = this.state.onboardingMessage; - - switch (this.state.onboardingMessage) { - case "ipprotection-message-continuous-onboarding-intro": - break; - case "ipprotection-message-continuous-onboarding-autostart": - messageLink = "about:settings#privacy"; - messageLinkl10nId = "setting-link"; - break; - case "ipprotection-message-continuous-onboarding-site-settings": - messageLink = "about:settings#privacy"; - messageLinkl10nId = "setting-link"; - break; - } - } - + // Fallback to a generic error return html` <ipprotection-message-bar class="vpn-top-content" - type=${this.#hasErrors ? ERRORS.GENERIC : "info"} - .messageId=${ifDefined(messageId)} - .messageLink=${ifDefined(messageLink)} - .messageLinkl10nId=${ifDefined(messageLinkl10nId)} + type=${ERRORS.GENERIC} ></ipprotection-message-bar> `; } @@ -347,16 +322,12 @@ export default class IPProtectionContentElement extends MozLitElement { } render() { - if ( - (this.#hasErrors || this.state.onboardingMessage) && - !this._messageDismissed - ) { + if (this.#hasErrors && !this._messageDismissed) { this._showMessageBar = true; } const messageBar = this._showMessageBar ? this.messageBarTemplate() : null; - - let content = html`${messageBar}${this.mainContentTemplate()}`; + const content = html`${messageBar}${this.mainContentTemplate()}`; // TODO: Conditionally render post-upgrade subview within #ipprotection-content-wrapper - Bug 1973813 return html` diff --git a/browser/components/ipprotection/content/ipprotection-message-bar.mjs b/browser/components/ipprotection/content/ipprotection-message-bar.mjs @@ -3,24 +3,17 @@ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ import { MozLitElement } from "chrome://global/content/lit-utils.mjs"; -import { html, ifDefined } from "chrome://global/content/vendor/lit.all.mjs"; +import { html } from "chrome://global/content/vendor/lit.all.mjs"; // eslint-disable-next-line import/no-unassigned-import import "chrome://global/content/elements/moz-message-bar.mjs"; -const lazy = {}; - -ChromeUtils.defineESModuleGetters(lazy, { - URILoadingHelper: "resource:///modules/URILoadingHelper.sys.mjs", -}); - /** * A custom element that handles the message bar for IP Protection. */ 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"; @@ -30,16 +23,12 @@ export default class IPProtectionMessageBarElement extends MozLitElement { static properties = { type: { type: String }, - messageId: { type: String }, - messageLink: { type: String }, - messageLinkl10nId: { type: String }, }; constructor() { super(); this.handleDismiss = this.handleDismiss.bind(this); - this.handleClickSetingsLink = this.handleClickSettingsLink.bind(this); } connectedCallback() { @@ -60,24 +49,11 @@ export default class IPProtectionMessageBarElement extends MozLitElement { genericErrorTemplate() { return html` - <moz-message-bar type="error" data-l10n-id=${this.messageId} dismissable> - </moz-message-bar> - `; - } - - infoMessageTemplate() { - return html` - <moz-message-bar type="info" dismissable> - <span - slot="message" - data-l10n-id=${this.messageId} - @click=${this.handleClickSettingsLink} - > - <a - data-l10n-name=${ifDefined(this.messageLinkl10nId)} - href=${ifDefined(this.messageLink)} - ></a> - </span> + <moz-message-bar + type="error" + data-l10n-id="ipprotection-message-generic-error" + dismissable + > </moz-message-bar> `; } @@ -92,17 +68,6 @@ export default class IPProtectionMessageBarElement extends MozLitElement { ); } - handleClickSettingsLink(event) { - if (event.target.hasAttribute("href")) { - event.preventDefault(); - lazy.URILoadingHelper.openTrustedLinkIn(window, this.messageLink, "tab"); - - this.dispatchEvent( - new CustomEvent("IPProtection:Close", { bubbles: true, composed: true }) - ); - } - } - render() { let messageBarTemplate = this.#MESSAGE_TYPE_MAP.get(this.type)(); diff --git a/browser/locales-preview/ipProtection.ftl b/browser/locales-preview/ipProtection.ftl @@ -74,10 +74,6 @@ ipprotection-message-generic-error = .heading = Couldn’t connect to VPN .message = Try again in a few minutes. -ipprotection-message-continuous-onboarding-intro = Turn on VPN to hide your location and add extra encryption to your browsing. -ipprotection-message-continuous-onboarding-autostart = <a data-l10n-name="setting-link">Set VPN to turn on</a> every time you open { -brand-short-name } for an extra layer of protection. -ipprotection-message-continuous-onboarding-site-settings = { -brand-short-name } will remember which websites you’ve set to use VPN. Update these in <a data-l10n-name="setting-link">settings</a> anytime. - ## IP Protection Settings ip-protection-description =