Commit 8f8c3495 authored by Pier Angelo Vendrame's avatar Pier Angelo Vendrame 🎃 Committed by morgan
Browse files

amend! TB 41435: Add a Tor Browser migration function

TB 41435: Add a Tor Browser migration function
parent fa075e61
Loading
Loading
Loading
Loading
Loading
+13 −2
Original line number Diff line number Diff line
@@ -1174,7 +1174,15 @@ export let ProfileDataUpgrader = {
    Services.prefs.setIntPref(MIGRATION_PREF, MIGRATION_VERSION);
  },

  async upgradeTB(isNewProfile) {
  /**
   * Run the profile data migration for Tor Browser if needed.
   *
   * @param {boolean} isNewProfile When true, just set the migration version
   * without actually changing anything.
   * @param {number} [currentVersion] The version to migrating from. To be used
   * only by tests.
   */
  async upgradeTB(isNewProfile, currentVersion) {
    // Version 1: Tor Browser 12.0. We use it to remove langpacks, after the
    //            migration to packaged locales.
    // Version 2: Tor Browser 13.0/13.0a1: tor-browser#41845. Also, removed some
@@ -1210,7 +1218,10 @@ export let ProfileDataUpgrader = {
      console.error("upgradeTB: isNewProfile is undefined.");
    }

    const currentVersion = Services.prefs.getIntPref(MIGRATION_PREF, 0);
    if (currentVersion === undefined) {
      currentVersion = Services.prefs.getIntPref(MIGRATION_PREF, 0);
    }

    const removeLangpacks = async () => {
      for (const addon of await AddonManager.getAddonsByTypes(["locale"])) {
        await addon.uninstall();