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

Pier Angelo Vendrame (@pierov) git at gitlab.torproject.org
Wed Jul 31 13:20:52 UTC 2024



Pier Angelo Vendrame pushed to branch tor-browser-128.0esr-14.0-2 at The Tor Project / Applications / Tor Browser


Commits:
646ee32d by Henry Wilkes at 2024-07-31T14:16:49+01: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
=====================================
@@ -687,16 +687,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);
   }
 
@@ -904,6 +895,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/646ee32d1547c1cf6d18535a833968dc943bdf0d

-- 
View it on GitLab: https://gitlab.torproject.org/tpo/applications/tor-browser/-/commit/646ee32d1547c1cf6d18535a833968dc943bdf0d
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/20240731/1de1d9b3/attachment-0001.htm>


More information about the tor-commits mailing list