henry pushed to branch tor-browser-128.8.0esr-14.5-1 at The Tor Project / 
Applications / Tor Browser


Commits:
4aeac6bb by Henry Wilkes at 2025-03-20T18:17:26+00:00
fixup! TB 40597: Implement TorSettings module

TB 43488: Skip straight to "FinalError" if we do not get an expected
TorConnectError.

- - - - -


1 changed file:

- toolkit/modules/TorConnect.sys.mjs


Changes:

=====================================
toolkit/modules/TorConnect.sys.mjs
=====================================
@@ -1441,28 +1441,45 @@ export const TorConnect = {
 
       this._signalError(error);
 
+      let errorStage = TorConnectStage.FinalError;
+
       switch (beginStage) {
         case TorConnectStage.Start:
         case TorConnectStage.Offline:
-          this._setStage(TorConnectStage.ChooseRegion);
-          return;
+          if (
+            error instanceof TorConnectError &&
+            error.code === TorConnectError.BootstrapError
+          ) {
+            errorStage = TorConnectStage.ChooseRegion;
+          }
+          // Else, some other unexpected error type. Skip straight to the
+          // "FinalError". See tor-browser#43488.
+          break;
         case TorConnectStage.ChooseRegion:
-          if (regionCode === "automatic") {
+          // TODO: Handle a Moat error of the type
+          // DomainFrontRequestNetworkError to show a different stage. See
+          // tor-browser#43569.
+          if (
+            regionCode === "automatic" &&
+            error instanceof TorConnectError &&
+            (error.code === TorConnectError.AllSettingsFailed ||
+              error.code === TorConnectError.CannotDetermineCountry ||
+              error.code === TorConnectError.NoSettingsForCountry)
+          ) {
             // The automatic region failed.
-            if (bootstrapAttempt.detectedRegion) {
-              this._setStage(TorConnectStage.ConfirmRegion);
-            } else {
-              this._setStage(TorConnectStage.RegionNotFound);
-            }
-            return;
+            errorStage = bootstrapAttempt.detectedRegion
+              ? TorConnectStage.ConfirmRegion
+              : TorConnectStage.RegionNotFound;
           }
           // Else, not automatic. Go straight to the final error since the user
           // is unlikely to succeed re-selecting the same region and it would 
be
           // unexpected for the user to select a different region.
           // See tor-browser#42550.
+          // Else, some other error type. Skip straight to the "FinalError". 
See
+          // tor-browser#43488.
           break;
       }
-      this._setStage(TorConnectStage.FinalError);
+      this._setStage(errorStage);
       return;
     }
 



View it on GitLab: 
https://gitlab.torproject.org/tpo/applications/tor-browser/-/commit/4aeac6bb44edd2bea8ef4b7bb40afcd6c03a15a2

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


_______________________________________________
tbb-commits mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to