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

Commits:

1 changed file:

Changes:

  • toolkit/modules/TorConnect.sys.mjs
    ... ... @@ -1441,28 +1441,45 @@ export const TorConnect = {
    1441 1441
     
    
    1442 1442
           this._signalError(error);
    
    1443 1443
     
    
    1444
    +      let errorStage = TorConnectStage.FinalError;
    
    1445
    +
    
    1444 1446
           switch (beginStage) {
    
    1445 1447
             case TorConnectStage.Start:
    
    1446 1448
             case TorConnectStage.Offline:
    
    1447
    -          this._setStage(TorConnectStage.ChooseRegion);
    
    1448
    -          return;
    
    1449
    +          if (
    
    1450
    +            error instanceof TorConnectError &&
    
    1451
    +            error.code === TorConnectError.BootstrapError
    
    1452
    +          ) {
    
    1453
    +            errorStage = TorConnectStage.ChooseRegion;
    
    1454
    +          }
    
    1455
    +          // Else, some other unexpected error type. Skip straight to the
    
    1456
    +          // "FinalError". See tor-browser#43488.
    
    1457
    +          break;
    
    1449 1458
             case TorConnectStage.ChooseRegion:
    
    1450
    -          if (regionCode === "automatic") {
    
    1459
    +          // TODO: Handle a Moat error of the type
    
    1460
    +          // DomainFrontRequestNetworkError to show a different stage. See
    
    1461
    +          // tor-browser#43569.
    
    1462
    +          if (
    
    1463
    +            regionCode === "automatic" &&
    
    1464
    +            error instanceof TorConnectError &&
    
    1465
    +            (error.code === TorConnectError.AllSettingsFailed ||
    
    1466
    +              error.code === TorConnectError.CannotDetermineCountry ||
    
    1467
    +              error.code === TorConnectError.NoSettingsForCountry)
    
    1468
    +          ) {
    
    1451 1469
                 // The automatic region failed.
    
    1452
    -            if (bootstrapAttempt.detectedRegion) {
    
    1453
    -              this._setStage(TorConnectStage.ConfirmRegion);
    
    1454
    -            } else {
    
    1455
    -              this._setStage(TorConnectStage.RegionNotFound);
    
    1456
    -            }
    
    1457
    -            return;
    
    1470
    +            errorStage = bootstrapAttempt.detectedRegion
    
    1471
    +              ? TorConnectStage.ConfirmRegion
    
    1472
    +              : TorConnectStage.RegionNotFound;
    
    1458 1473
               }
    
    1459 1474
               // Else, not automatic. Go straight to the final error since the user
    
    1460 1475
               // is unlikely to succeed re-selecting the same region and it would be
    
    1461 1476
               // unexpected for the user to select a different region.
    
    1462 1477
               // See tor-browser#42550.
    
    1478
    +          // Else, some other error type. Skip straight to the "FinalError". See
    
    1479
    +          // tor-browser#43488.
    
    1463 1480
               break;
    
    1464 1481
           }
    
    1465
    -      this._setStage(TorConnectStage.FinalError);
    
    1482
    +      this._setStage(errorStage);
    
    1466 1483
           return;
    
    1467 1484
         }
    
    1468 1485