richard pushed to branch tor-browser-115.5.0esr-13.0-1 at The Tor Project / Applications / Tor Browser
Commits: 47ac8526 by Henry Wilkes at 2023-11-16T18:26:37+00:00 fixup! Bug 42072: 2023 year end campaign for about:tor.
Bug 42188: Make the YEC banner closed state persist for the current session.
- - - - -
4 changed files:
- browser/components/BrowserGlue.sys.mjs - browser/components/abouttor/AboutTorChild.sys.mjs - browser/components/abouttor/AboutTorParent.sys.mjs - browser/components/abouttor/content/aboutTor.js
Changes:
===================================== browser/components/BrowserGlue.sys.mjs ===================================== @@ -453,6 +453,7 @@ let JSWINDOWACTORS = { events: { DOMContentLoaded: {}, SubmitSearchOnionize: { wantUntrusted: true }, + YECHidden: { wantUntrusted: true }, }, },
===================================== browser/components/abouttor/AboutTorChild.sys.mjs ===================================== @@ -26,6 +26,11 @@ export class AboutTorChild extends JSWindowActorChild { case "SubmitSearchOnionize": this.sendAsyncMessage("AboutTor:SetSearchOnionize", !!event.detail); break; + case "YECHidden": + // YEC 2023 banner was closed. Persist this for the rest of this + // session. See tor-browser#42188. + this.sendAsyncMessage("AboutTor:HideYEC"); + break; } } }
===================================== browser/components/abouttor/AboutTorParent.sys.mjs ===================================== @@ -7,6 +7,19 @@ ChromeUtils.defineESModuleGetters(lazy, { TorConnect: "resource:///modules/TorConnect.sys.mjs", });
+/** + * Whether we should hide the Year end campaign (YEC) 2023 donation banner for + * new about:tor pages. Applied to all future about:tor pages within this + * session (i.e. new tabs, new windows, and after new identity). + * + * Will reset back to shown at the next full restart. + * + * See tor-browser#42188. + * + * @type {boolean} + */ +let hideYEC = false; + export class AboutTorParent extends JSWindowActorParent { receiveMessage(message) { const onionizePref = "torbrowser.homepage.search.onionize"; @@ -22,10 +35,14 @@ export class AboutTorParent extends JSWindowActorParent { Services.locale.appLocaleAsBCP47 === "ja-JP-macos" ? "ja" : Services.locale.appLocaleAsBCP47, + hideYEC, }); case "AboutTor:SetSearchOnionize": Services.prefs.setBoolPref(onionizePref, message.data); break; + case "AboutTor:HideYEC": + hideYEC = true; + break; } return undefined; }
===================================== browser/components/abouttor/content/aboutTor.js ===================================== @@ -200,6 +200,7 @@ const YecWidget = {
this.isActive = now >= yecStart && now < yecEnd; document.getElementById("yec-2023-close").addEventListener("click", () => { + dispatchEvent(new CustomEvent("YECHidden", { bubbles: true })); this.isOpen = false; });
@@ -215,7 +216,7 @@ const YecWidget = {
_isStable: false, _isActive: false, - _isOpen: true, + _isOpen: false,
/** * Whether this is a stable release. @@ -294,7 +295,8 @@ window.addEventListener("DOMContentLoaded", () => { });
window.addEventListener("InitialData", event => { - const { appLocale, isStable } = event.detail; + const { appLocale, isStable, hideYEC } = event.detail; YecWidget.setDonateLocale(appLocale); YecWidget.isStable = isStable; + YecWidget.isOpen = !hideYEC; });
View it on GitLab: https://gitlab.torproject.org/tpo/applications/tor-browser/-/commit/47ac8526...