[tbb-commits] [Git][tpo/applications/tor-browser][tor-browser-115.4.0esr-13.5-1] fixup! Bug 42072: 2023 year end campaign for about:tor.

richard (@richard) git at gitlab.torproject.org
Mon Nov 13 16:24:49 UTC 2023



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
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/f68e26b8f94542799f41017083b3eafb149b2103

-- 
View it on GitLab: https://gitlab.torproject.org/tpo/applications/tor-browser/-/commit/f68e26b8f94542799f41017083b3eafb149b2103
You're receiving this email because of your account on gitlab.torproject.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.torproject.org/pipermail/tbb-commits/attachments/20231113/1bde15cf/attachment-0001.htm>


More information about the tbb-commits mailing list