richard pushed to branch tor-browser-115.4.0esr-13.5-1 at The Tor Project / Applications / Tor Browser
Commits:
-
f68e26b8
by Henry Wilkes at 2023-11-13T16:23:07+00:00
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:
| ... | ... | @@ -453,6 +453,7 @@ let JSWINDOWACTORS = { |
| 453 | 453 | events: {
|
| 454 | 454 | DOMContentLoaded: {},
|
| 455 | 455 | SubmitSearchOnionize: { wantUntrusted: true },
|
| 456 | + YECHidden: { wantUntrusted: true },
|
|
| 456 | 457 | },
|
| 457 | 458 | },
|
| 458 | 459 |
| ... | ... | @@ -26,6 +26,11 @@ export class AboutTorChild extends JSWindowActorChild { |
| 26 | 26 | case "SubmitSearchOnionize":
|
| 27 | 27 | this.sendAsyncMessage("AboutTor:SetSearchOnionize", !!event.detail);
|
| 28 | 28 | break;
|
| 29 | + case "YECHidden":
|
|
| 30 | + // YEC 2023 banner was closed. Persist this for the rest of this
|
|
| 31 | + // session. See tor-browser#42188.
|
|
| 32 | + this.sendAsyncMessage("AboutTor:HideYEC");
|
|
| 33 | + break;
|
|
| 29 | 34 | }
|
| 30 | 35 | }
|
| 31 | 36 | } |
| ... | ... | @@ -7,6 +7,19 @@ ChromeUtils.defineESModuleGetters(lazy, { |
| 7 | 7 | TorConnect: "resource:///modules/TorConnect.sys.mjs",
|
| 8 | 8 | });
|
| 9 | 9 | |
| 10 | +/**
|
|
| 11 | + * Whether we should hide the Year end campaign (YEC) 2023 donation banner for
|
|
| 12 | + * new about:tor pages. Applied to all future about:tor pages within this
|
|
| 13 | + * session (i.e. new tabs, new windows, and after new identity).
|
|
| 14 | + *
|
|
| 15 | + * Will reset back to shown at the next full restart.
|
|
| 16 | + *
|
|
| 17 | + * See tor-browser#42188.
|
|
| 18 | + *
|
|
| 19 | + * @type {boolean}
|
|
| 20 | + */
|
|
| 21 | +let hideYEC = false;
|
|
| 22 | + |
|
| 10 | 23 | export class AboutTorParent extends JSWindowActorParent {
|
| 11 | 24 | receiveMessage(message) {
|
| 12 | 25 | const onionizePref = "torbrowser.homepage.search.onionize";
|
| ... | ... | @@ -22,10 +35,14 @@ export class AboutTorParent extends JSWindowActorParent { |
| 22 | 35 | Services.locale.appLocaleAsBCP47 === "ja-JP-macos"
|
| 23 | 36 | ? "ja"
|
| 24 | 37 | : Services.locale.appLocaleAsBCP47,
|
| 38 | + hideYEC,
|
|
| 25 | 39 | });
|
| 26 | 40 | case "AboutTor:SetSearchOnionize":
|
| 27 | 41 | Services.prefs.setBoolPref(onionizePref, message.data);
|
| 28 | 42 | break;
|
| 43 | + case "AboutTor:HideYEC":
|
|
| 44 | + hideYEC = true;
|
|
| 45 | + break;
|
|
| 29 | 46 | }
|
| 30 | 47 | return undefined;
|
| 31 | 48 | }
|
| ... | ... | @@ -200,6 +200,7 @@ const YecWidget = { |
| 200 | 200 | |
| 201 | 201 | this.isActive = now >= yecStart && now < yecEnd;
|
| 202 | 202 | document.getElementById("yec-2023-close").addEventListener("click", () => {
|
| 203 | + dispatchEvent(new CustomEvent("YECHidden", { bubbles: true }));
|
|
| 203 | 204 | this.isOpen = false;
|
| 204 | 205 | });
|
| 205 | 206 | |
| ... | ... | @@ -215,7 +216,7 @@ const YecWidget = { |
| 215 | 216 | |
| 216 | 217 | _isStable: false,
|
| 217 | 218 | _isActive: false,
|
| 218 | - _isOpen: true,
|
|
| 219 | + _isOpen: false,
|
|
| 219 | 220 | |
| 220 | 221 | /**
|
| 221 | 222 | * Whether this is a stable release.
|
| ... | ... | @@ -294,7 +295,8 @@ window.addEventListener("DOMContentLoaded", () => { |
| 294 | 295 | });
|
| 295 | 296 | |
| 296 | 297 | window.addEventListener("InitialData", event => {
|
| 297 | - const { appLocale, isStable } = event.detail;
|
|
| 298 | + const { appLocale, isStable, hideYEC } = event.detail;
|
|
| 298 | 299 | YecWidget.setDonateLocale(appLocale);
|
| 299 | 300 | YecWidget.isStable = isStable;
|
| 301 | + YecWidget.isOpen = !hideYEC;
|
|
| 300 | 302 | }); |