Skip to content
Snippets Groups Projects
Commit 47ac8526 authored by henry's avatar henry Committed by Richard Pospesel
Browse files

fixup! Bug 42072: 2023 year end campaign for about:tor.

Bug 42188: Make the YEC banner closed state persist for the current
session.
parent 2c6df91f
Branches
Tags tor-browser-115.5.0esr-13.0-1-build2
No related merge requests found
......@@ -453,6 +453,7 @@ let JSWINDOWACTORS = {
events: {
DOMContentLoaded: {},
SubmitSearchOnionize: { wantUntrusted: true },
YECHidden: { wantUntrusted: true },
},
},
......
......@@ -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;
}
}
}
......@@ -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;
}
......
......@@ -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;
});
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment