Verified Commit 64c5d915 authored by ma1's avatar ma1
Browse files

fixup! Bug 40926: Implemented the New Identity feature

Bug 41833: Reload extensions on new identity
parent b3b01c00
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -144,6 +144,7 @@ XPCOMUtils.defineLazyGetter(this, "NewIdentityButton", () => {
      this.clearStorage();
      this.clearPreferencesAndPermissions();
      await this.clearData();
      await this.reloadAddons();
      this.clearConnections();
      this.clearPrivateSession();
    }
@@ -414,6 +415,15 @@ XPCOMUtils.defineLazyGetter(this, "NewIdentityButton", () => {
      Services.obs.notifyObservers(null, "last-pb-context-exited");
    }

    async reloadAddons() {
      logger.info("Reloading add-ons to clear their temporary state.");
      // Reload all active extensions except search engines, which would throw.
      const addons = (
        await AddonManager.getAddonsByTypes(["extension"])
      ).filter(a => a.isActive && !a.id.endsWith("@search.mozilla.org"));
      await Promise.all(addons.map(a => a.reload()));
    }

    // Broadcast as a hook to clear other data

    broadcast() {