commit 6f0b6420c08fd4c35c7dc42a25421495523e9985
parent 49bd0e4c2ece121d164a9d53cbf9c8290488ba3e
Author: Maxx Crawford <mcrawford@mozilla.com>
Date: Wed, 10 Dec 2025 19:53:00 +0000
Bug 2005281 - Add train-hop shim for nsIAlertNotification on TimerFeed.sys.mjs r=home-newtab-reviewers,nbarrett
Differential Revision: https://phabricator.services.mozilla.com/D275830
Diffstat:
1 file changed, 29 insertions(+), 6 deletions(-)
diff --git a/browser/extensions/newtab/lib/Widgets/TimerFeed.sys.mjs b/browser/extensions/newtab/lib/Widgets/TimerFeed.sys.mjs
@@ -3,6 +3,12 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
const lazy = {};
+
+// eslint-disable-next-line mozilla/use-static-import
+const { AppConstants } = ChromeUtils.importESModule(
+ "resource://gre/modules/AppConstants.sys.mjs"
+);
+
ChromeUtils.defineESModuleGetters(lazy, {
PersistentCache: "resource://newtab/lib/PersistentCache.sys.mjs",
});
@@ -55,13 +61,30 @@ export class TimerFeed {
Ci.nsIAlertsService
);
- alertsService.showAlert(
- new AlertNotification({
- imageURL: "chrome://branding/content/icon64.png",
+ /**
+ * @backward-compat { version 147 }
+ * Remove`alertsService.showAlertNotification` call once Firefox 147
+ * makes it to the release channel.
+ */
+
+ if (Services.vc.compare(AppConstants.MOZ_APP_VERSION, "147.0a1") >= 0) {
+ alertsService.showAlert(
+ new AlertNotification({
+ imageURL: "chrome://branding/content/icon64.png",
+ title,
+ text: body,
+ })
+ );
+ } else {
+ alertsService.showAlertNotification(
+ "chrome://branding/content/icon64.png",
title,
- text: body,
- })
- );
+ body,
+ false,
+ "",
+ null
+ );
+ }
} catch (err) {
console.error("Failed to show system notification", err);
}