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