Commit fe45b5e3 authored by henry's avatar henry Committed by clairehurst
Browse files

fixup! TB 40597: Implement TorSettings module

TB 43571: Allow android to enter ProviderStopped.
parent 14f24ee0
Loading
Loading
Loading
Loading
+6 −20
Original line number Diff line number Diff line
@@ -1109,13 +1109,10 @@ export const TorConnect = {
      throw new Error(`Trying to set the stage to ${name} during a bootstrap`);
    }
    if (!this._providerRunning && name !== TorConnectStage.ProviderStopped) {
      if (!lazy.TorLauncherUtil.isAndroid) {
        // TODO: Remove Android exception.
      throw new Error(
        `Trying to set the stage to ${name} when provider is not running`
      );
    }
    }

    lazy.logger.info(`Entering stage ${name}`);
    this._stageName = name;
@@ -1596,14 +1593,9 @@ export const TorConnect = {
      return;
    }
    if (!this._providerRunning && stage !== TorConnectStage.ProviderStopped) {
      if (!lazy.TorLauncherUtil.isAndroid) {
        // TODO: Remove Android exception.
        lazy.logger.warn(
          `Cannot move to ${stage} when provider is not running`
        );
      lazy.logger.warn(`Cannot move to ${stage} when provider is not running`);
      return;
    }
    }
    if (this._stageName === TorConnectStage.Loading) {
      if (stage === TorConnectStage.ProviderStopped) {
        lazy.logger.info("Skipping straight from Loading to ProviderStopped");
@@ -1709,15 +1701,9 @@ export const TorConnect = {
        // But other methods should take into account that _providerRunning is now
        // `false` to early return and guarantee that we enter this
        // ProviderStopped stage.
        if (lazy.TorLauncherUtil.isAndroid) {
          // TODO: Remove this Android path when android supports the
          // `ProviderStopped` stage.
          this._makeStageRequest(TorConnectStage.Start, true);
        } else {
        this._makeStageRequest(TorConnectStage.ProviderStopped, true);
      }
    }
    }

    const providerStatus = this._providerStatus();
    lazy.logger.debug("New provider status", providerStatus);