1 /* -*- indent-tabs-mode: nil; js-indent-level: 2 -*-
2 * This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
7 * This task ought to have an ephemeral profile and should not apply updates.
8 * These settings are controlled externally, by
9 * `BackgroundTasks::IsUpdatingTaskName` and
10 * `BackgroundTasks::IsEphemeralProfileTaskName`.
13 import { AppConstants } from "resource://gre/modules/AppConstants.sys.mjs";
15 export async function runBackgroundTask() {
16 console.log("Running BackgroundTask_uninstall.");
18 if (AppConstants.platform === "win") {
20 removeNotifications();
25 console.log("Not a Windows install. Skipping notification removal.");
28 console.log("Cleaning up update files.");
30 await Cc["@mozilla.org/updates/update-manager;1"]
31 .getService(Ci.nsIUpdateManager)
32 .doUninstallCleanup();
38 function removeNotifications() {
39 console.log("Removing Windows toast notifications.");
41 if (!("nsIWindowsAlertsService" in Ci)) {
42 console.log("nsIWindowsAlertsService not present.");
48 alertsService = Cc["@mozilla.org/system-alerts-service;1"]
49 .getService(Ci.nsIAlertsService)
50 .QueryInterface(Ci.nsIWindowsAlertsService);
52 console.error("Error retrieving nsIWindowsAlertsService: " + e.message);
56 alertsService.removeAllNotificationsForInstall();
57 console.log("Finished removing Windows toast notifications.");