tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

BackgroundTask_install.sys.mjs (1011B)


      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/. */
      5 
      6 /**
      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`.
     11 */
     12 
     13 // This happens synchronously during installation. It shouldn't take that long
     14 // and if something goes wrong we really don't want to sit around waiting for
     15 // it.
     16 export const backgroundTaskTimeoutSec = 30;
     17 
     18 export async function runBackgroundTask() {
     19  console.log("Running BackgroundTask_install.");
     20 
     21  console.log("Cleaning up update files.");
     22  try {
     23    await Cc["@mozilla.org/updates/update-manager;1"]
     24      .getService(Ci.nsIUpdateManager)
     25      .doInstallCleanup();
     26  } catch (ex) {
     27    console.error(ex);
     28  }
     29 }