Verified Commit 6b032630 authored by Pier Angelo Vendrame's avatar Pier Angelo Vendrame 🎃
Browse files

fixup! Bug 40597: Implement TorSettings module

Bug 41801: Fix handleProcessReady in TorSettings.init
parent bb307a09
Loading
Loading
Loading
Loading
+10 −10
Original line number Diff line number Diff line
@@ -299,7 +299,7 @@ const TorSettings = (() => {
        Services.obs.addObserver(this, TorTopics.ProcessIsReady);

        if (TorMonitorService.isRunning) {
          handleProcessReady();
          this.handleProcessReady();
        }
      }
    },
@@ -308,22 +308,22 @@ const TorSettings = (() => {
    async observe(subject, topic, data) {
      console.log(`TorSettings: Observed ${topic}`);

      // once the tor daemon is ready, we need to apply our settings
      const handleProcessReady = async () => {
        // push down settings to tor
        await this.applySettings();
        console.log("TorSettings: Ready");
        Services.obs.notifyObservers(null, TorSettingsTopics.Ready);
      };

      switch (topic) {
        case TorTopics.ProcessIsReady:
          Services.obs.removeObserver(this, TorTopics.ProcessIsReady);
          await handleProcessReady();
          await this.handleProcessReady();
          break;
      }
    },

    // once the tor daemon is ready, we need to apply our settings
    async handleProcessReady() {
      // push down settings to tor
      await this.applySettings();
      console.log("TorSettings: Ready");
      Services.obs.notifyObservers(null, TorSettingsTopics.Ready);
    },

    // load our settings from prefs
    loadFromPrefs() {
      console.log("TorSettings: loadFromPrefs()");