Pier Angelo Vendrame pushed to branch tor-browser-115.15.0esr-13.5-2 at The Tor Project / Applications / Tor Browser
Commits: 6935ca00 by Henry Wilkes at 2024-08-27T20:38:54+00:00 fixup! Bug 40597: Implement TorSettings module
Bug 42622: Send TorConnect "Error" signal before "StateChange".
- - - - -
1 changed file:
- toolkit/modules/TorConnect.sys.mjs
Changes:
===================================== toolkit/modules/TorConnect.sys.mjs ===================================== @@ -686,16 +686,7 @@ class ErrorState extends StateCallback { ErrorState.#hasEverHappened = true; }
- run(error) { - if (!(error instanceof TorConnectError)) { - error = new TorConnectError(TorConnectError.ExternalError, error); - } - TorConnect._errorCode = error.code; - TorConnect._errorDetails = error; - lazy.logger.error(`Entering error state (${error.code})`, error); - - Services.obs.notifyObservers(error, TorConnectTopics.Error); - + run(_error) { this.changeState(TorConnectState.Configuring); }
@@ -903,6 +894,23 @@ export const TorConnect = { // Set our new state first so that state transitions can themselves // trigger a state transition. this._stateHandler = this._makeState(newState); + + // Error signal needs to be sent out before we enter the Error state. + // Expected on android `onBootstrapError` to set lastKnownError. + // Expected in about:torconnect to set the error codes and internet status + // *before* the StateChange signal. + if (newState === TorConnectState.Error) { + let error = args[0]; + if (!(error instanceof TorConnectError)) { + error = new TorConnectError(TorConnectError.ExternalError, error); + } + TorConnect._errorCode = error.code; + TorConnect._errorDetails = error; + lazy.logger.error(`Entering error state (${error.code})`, error); + + Services.obs.notifyObservers(error, TorConnectTopics.Error); + } + Services.obs.notifyObservers( { state: newState }, TorConnectTopics.StateChange
View it on GitLab: https://gitlab.torproject.org/tpo/applications/tor-browser/-/commit/6935ca00...
tbb-commits@lists.torproject.org