[tor-commits] [Git][tpo/applications/tor-browser][tor-browser-115.15.0esr-13.5-2] fixup! Bug 40597: Implement TorSettings module

Pier Angelo Vendrame (@pierov) git at gitlab.torproject.org
Wed Aug 28 06:45:31 UTC 2024



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/6935ca008ef96a5c040296a08d5d590fae2d1e25

-- 
View it on GitLab: https://gitlab.torproject.org/tpo/applications/tor-browser/-/commit/6935ca008ef96a5c040296a08d5d590fae2d1e25
You're receiving this email because of your account on gitlab.torproject.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.torproject.org/pipermail/tor-commits/attachments/20240828/43648108/attachment-0001.htm>


More information about the tor-commits mailing list