| ... | ... | @@ -687,16 +687,7 @@ class ErrorState extends StateCallback { | 
| 687 | 687 |      ErrorState.#hasEverHappened = true;
 | 
| 688 | 688 |    }
 | 
| 689 | 689 |  
 | 
| 690 |  | -  run(error) {
 | 
| 691 |  | -    if (!(error instanceof TorConnectError)) {
 | 
| 692 |  | -      error = new TorConnectError(TorConnectError.ExternalError, error);
 | 
| 693 |  | -    }
 | 
| 694 |  | -    TorConnect._errorCode = error.code;
 | 
| 695 |  | -    TorConnect._errorDetails = error;
 | 
| 696 |  | -    lazy.logger.error(`Entering error state (${error.code})`, error);
 | 
| 697 |  | -
 | 
| 698 |  | -    Services.obs.notifyObservers(error, TorConnectTopics.Error);
 | 
| 699 |  | -
 | 
|  | 690 | +  run(_error) {
 | 
| 700 | 691 |      this.changeState(TorConnectState.Configuring);
 | 
| 701 | 692 |    }
 | 
| 702 | 693 |  
 | 
| ... | ... | @@ -904,6 +895,23 @@ export const TorConnect = { | 
| 904 | 895 |      // Set our new state first so that state transitions can themselves
 | 
| 905 | 896 |      // trigger a state transition.
 | 
| 906 | 897 |      this._stateHandler = this._makeState(newState);
 | 
|  | 898 | +
 | 
|  | 899 | +    // Error signal needs to be sent out before we enter the Error state.
 | 
|  | 900 | +    // Expected on android `onBootstrapError` to set lastKnownError.
 | 
|  | 901 | +    // Expected in about:torconnect to set the error codes and internet status
 | 
|  | 902 | +    // *before* the StateChange signal.
 | 
|  | 903 | +    if (newState === TorConnectState.Error) {
 | 
|  | 904 | +      let error = args[0];
 | 
|  | 905 | +      if (!(error instanceof TorConnectError)) {
 | 
|  | 906 | +        error = new TorConnectError(TorConnectError.ExternalError, error);
 | 
|  | 907 | +      }
 | 
|  | 908 | +      TorConnect._errorCode = error.code;
 | 
|  | 909 | +      TorConnect._errorDetails = error;
 | 
|  | 910 | +      lazy.logger.error(`Entering error state (${error.code})`, error);
 | 
|  | 911 | +
 | 
|  | 912 | +      Services.obs.notifyObservers(error, TorConnectTopics.Error);
 | 
|  | 913 | +    }
 | 
|  | 914 | +
 | 
| 907 | 915 |      Services.obs.notifyObservers(
 | 
| 908 | 916 |        { state: newState },
 | 
| 909 | 917 |        TorConnectTopics.StateChange
 |