[tor-commits] [tor-browser] 68/85: fixup! Bug 27476: Implement about:torconnect captive portal within Tor Browser
gitolite role
git at cupani.torproject.org
Fri Jun 10 17:01:59 UTC 2022
This is an automated email from the git hooks/post-receive script.
pierov pushed a commit to branch tor-browser-91.9.0esr-11.5-2
in repository tor-browser.
commit fbff9f39c5664de83eafde828505882a263d66a7
Author: Pier Angelo Vendrame <pierov at torproject.org>
AuthorDate: Fri May 13 12:43:15 2022 +0200
fixup! Bug 27476: Implement about:torconnect captive portal within Tor Browser
Fixes for bugs found in 91.9, to keep as a fixup also in 91.10.
Bug 40918: Hide breadcrumbs on the first bootstrap
Bug 40923: Redirect to location confirmation rather than location
detection failed when Moat reports a country code but the bootstrap
fails anyway.
---
browser/components/torconnect/TorConnectParent.jsm | 5 +++
.../torconnect/content/aboutTorConnect.js | 40 +++++++++++++++-------
2 files changed, 32 insertions(+), 13 deletions(-)
diff --git a/browser/components/torconnect/TorConnectParent.jsm b/browser/components/torconnect/TorConnectParent.jsm
index 3c2a56934c145..cf3c1233dd622 100644
--- a/browser/components/torconnect/TorConnectParent.jsm
+++ b/browser/components/torconnect/TorConnectParent.jsm
@@ -36,7 +36,9 @@ class TorConnectParent extends JSWindowActorParent {
BootstrapProgress: TorConnect.bootstrapProgress,
BootstrapStatus: TorConnect.bootstrapStatus,
InternetStatus: TorConnect.internetStatus,
+ DetectedLocation: TorConnect.detectedLocation,
ShowViewLog: TorConnect.logHasWarningOrError,
+ HasBootsrapEverFailed: TorConnect.hasBootstrapEverFailed,
QuickStartEnabled: TorSettings.quickstart.enabled,
UIState: TorConnect.uiState,
};
@@ -65,6 +67,8 @@ class TorConnectParent extends JSWindowActorParent {
self.state.ErrorMessage = null;
self.state.ErrorDetails = null;
}
+ self.state.HasBootsrapEverFailed =
+ TorConnect.hasBootstrapEverFailed;
break;
}
case TorConnectTopics.BootstrapProgress: {
@@ -81,6 +85,7 @@ class TorConnectParent extends JSWindowActorParent {
self.state.ErrorMessage = obj.message;
self.state.ErrorDetails = obj.details;
self.state.InternetStatus = TorConnect.internetStatus;
+ self.state.DetectedLocation = TorConnect.detectedLocation;
self.state.ShowViewLog = true;
break;
}
diff --git a/browser/components/torconnect/content/aboutTorConnect.js b/browser/components/torconnect/content/aboutTorConnect.js
index 8b5f7216e9ef8..6b33442c7d02b 100644
--- a/browser/components/torconnect/content/aboutTorConnect.js
+++ b/browser/components/torconnect/content/aboutTorConnect.js
@@ -403,12 +403,17 @@ class AboutTorConnect {
this.transitionUIState(UIStates.ConnectionAssist, state);
} else if (state.PreviousState === TorConnectState.AutoBootstrapping) {
if (this.uiState.bootstrapCause === UIStates.ConnectionAssist) {
- this.transitionUIState(
- this.getLocation() === "automatic"
- ? UIStates.CouldNotLocate
- : UIStates.LocationConfirm,
- state
- );
+ if (this.getLocation() === "automatic") {
+ this.uiState.allowAutomaticLocation = false;
+ if (!state.DetectedLocation) {
+ this.transitionUIState(UIStates.CouldNotLocate, state);
+ return;
+ }
+ // Change the location only here, to avoid overriding any user change/
+ // insisting with the detected location
+ this.setLocation(state.DetectedLocation);
+ }
+ this.transitionUIState(UIStates.LocationConfirm, state);
} else {
this.transitionUIState(UIStates.FinalError, state);
}
@@ -499,7 +504,11 @@ class AboutTorConnect {
this.setTitle(title, "");
this.showConfigureConnectionLink(description);
this.setProgress("", showProgressbar, state.BootstrapProgress);
- this.setBreadcrumbsStatus(...breadcrumbs);
+ if (state.HasBootsrapEverFailed) {
+ this.setBreadcrumbsStatus(...breadcrumbs);
+ } else {
+ this.hideBreadcrumbs();
+ }
this.hideButtons();
if (state.ShowViewLog) {
this.show(this.elements.viewLogContainer);
@@ -622,7 +631,7 @@ class AboutTorConnect {
RPMSendQuery("torconnect:get-country-codes").then(codes => {
if (codes && codes.length) {
this.populateFrequentLocations(codes);
- this.setLocationFromState();
+ this.setLocation();
}
});
let firstOpt = this.elements.locationDropdownSelect.options[0];
@@ -633,7 +642,7 @@ class AboutTorConnect {
firstOpt.value = "";
firstOpt.textContent = TorStrings.torConnect.selectCountryRegion;
}
- this.setLocationFromState();
+ this.setLocation();
this.validateLocation();
this.show(this.elements.locationDropdownLabel);
this.show(this.elements.locationDropdown);
@@ -650,8 +659,13 @@ class AboutTorConnect {
return this.elements.locationDropdownSelect.options[selectedIndex].value;
}
- setLocationFromState() {
- if (this.getLocation() === this.uiState.selectedLocation) {
+ setLocation(code) {
+ if (!code) {
+ code = this.uiState.selectedLocation;
+ } else {
+ this.uiState.selectedLocation = code;
+ }
+ if (this.getLocation() === code) {
return;
}
const options = this.elements.locationDropdownSelect.options;
@@ -659,7 +673,7 @@ class AboutTorConnect {
// the .value way to select (which would however require the label,
// rather than the code)...
for (let i = 0; i < options.length; i++) {
- if (options[i].value === this.uiState.selectedLocation) {
+ if (options[i].value === code) {
this.elements.locationDropdownSelect.selectedIndex = i;
break;
}
@@ -770,7 +784,7 @@ class AboutTorConnect {
RPMAddMessageListener("torconnect:user-action", ({ data }) => {
if (data.location) {
this.uiState.selectedLocation = data.location;
- this.setLocationFromState();
+ this.setLocation();
}
if (data.uiState !== undefined) {
this.transitionUIState(data.uiState, data.connState);
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the tor-commits
mailing list