This is an automated email from the git hooks/post-receive script.
richard pushed a change to branch tor-browser-91.9.0esr-11.5-1 in repository tor-browser.
from 39e8bb27af332 Bug 21952: Implement Onion-Location new 24149aac9f045 fixup! fixup! Add TorStrings module for localization new d14fb6c9346d1 fixup! squash! Bug 27476: Implement about:torconnect captive portal within Tor Browser new 93f776a110482 fixup! squash! Bug 27476: Implement about:torconnect captive portal within Tor Browser new 6cd20ba7ae5bc fixup! squash! Bug 27476: Implement about:torconnect captive portal within Tor Browser new 84e48eb00923a fixup! squash! Bug 27476: Implement about:torconnect captive portal within Tor Browser new 190a4168bcbc7 fixup! squash! Bug 27476: Implement about:torconnect captive portal within Tor Browser new c61bd180a8ade fixup! squash! Bug 27476: Implement about:torconnect captive portal within Tor Browser new efd187eb3da2a fixup! squash! Bug 27476: Implement about:torconnect captive portal within Tor Browser new 2ecfedf37a30f fixup! squash! Bug 27476: Implement about:torconnect captive portal within Tor Browser new ba925df5d1f2e fixup! squash! Bug 27476: Implement about:torconnect captive portal within Tor Browser new b59c7d7f2d00d fixup! squash! Bug 31286: Implementation of bridge, proxy, and firewall settings in about:preferences#connection new fa3f15cf50d13 fixup! squash! Bug 27476: Implement about:torconnect captive portal within Tor Browser new 93ef67dd2bec5 fixup! fixup! Bug 40597: Implement TorSettings module new 4a98eaf61f717 fixup! fixup! Bug 40597: Implement TorSettings module new ccd86dbf59ee1 fixup! fixup! Bug 40597: Implement TorSettings module new ef9c0a301b640 fixup! squash! Bug 27476: Implement about:torconnect captive portal within Tor Browser new 251c38c5c362a fixup! squash! Bug 27476: Implement about:torconnect captive portal within Tor Browser new 958d5920c36b0 fixup! fixup! Bug 40597: Implement TorSettings module new e6082a8a67ec7 fixup! squash! Bug 31286: Implementation of bridge, proxy, and firewall settings in about:preferences#connection new 23c8b99580272 fixup! fixup! Bug 40597: Implement TorSettings module new 6a61028e16fc0 fixup! squash! Bug 27476: Implement about:torconnect captive portal within Tor Browser new a417e67ee8f2a fixup! squash! Bug 31286: Implementation of bridge, proxy, and firewall settings in about:preferences#connection new bc8da424873fe fixup! squash! Bug 31286: Implementation of bridge, proxy, and firewall settings in about:preferences#connection new ac854d83775dd fixup! squash! Bug 31286: Implementation of bridge, proxy, and firewall settings in about:preferences#connection new 84b491c6fe7d7 fixup! squash! Bug 31286: Implementation of bridge, proxy, and firewall settings in about:preferences#connection new c110b565f3f3d fixup! squash! Bug 31286: Implementation of bridge, proxy, and firewall settings in about:preferences#connection new 907f3ed2bddd0 fixup! fixup! Bug 40597: Implement TorSettings module new ee7544dcb1c43 fixup! fixup! Bug 40597: Implement TorSettings module new 19cb248d6d79a fixup! squash! Bug 27476: Implement about:torconnect captive portal within Tor Browser new 7ffad04403bb9 fixup! squash! Bug 27476: Implement about:torconnect captive portal within Tor Browser new 823ffd4470964 fixup! fixup! squash! Bug 27476: Implement about:torconnect captive portal within Tor Browser new c6c168edef9ed fixup! Bug 31286: Implementation of bridge, proxy, and firewall settings in about:preferences#connection new dce69bdadefe0 fixup! Bug 31286: Implementation of bridge, proxy, and firewall settings in about:preferences#connection
The 33 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "add" were already present in the repository and have only been added to this reference.
Summary of changes: browser/components/torconnect/TorConnectParent.jsm | 53 +- .../torconnect/content/aboutTorConnect.css | 178 ++++-- .../torconnect/content/aboutTorConnect.js | 675 +++++++++++++-------- .../torconnect/content/aboutTorConnect.xhtml | 24 +- browser/components/torconnect/content/globe.svg | 4 - browser/components/torconnect/jar.mn | 1 - .../torpreferences/content/connectionPane.js | 402 ++++-------- .../torpreferences/content/connectionPane.xhtml | 17 + .../torpreferences/content/torPreferences.css | 130 +++- browser/modules/Moat.jsm | 37 +- browser/modules/TorConnect.jsm | 210 +++++-- browser/modules/TorStrings.jsm | 57 +- toolkit/modules/RemotePageAccessManager.jsm | 7 +- 13 files changed, 1093 insertions(+), 702 deletions(-) delete mode 100644 browser/components/torconnect/content/globe.svg
This is an automated email from the git hooks/post-receive script.
richard pushed a commit to branch tor-browser-91.9.0esr-11.5-1 in repository tor-browser.
commit 24149aac9f0459f20ff8ea9241370a922b4e3fda Author: Pier Angelo Vendrame pierov@torproject.org AuthorDate: Thu Apr 7 15:44:16 2022 +0200
fixup! fixup! Add TorStrings module for localization --- browser/modules/TorStrings.jsm | 56 +++++++++++++++++++++++++++++------------- 1 file changed, 39 insertions(+), 17 deletions(-)
diff --git a/browser/modules/TorStrings.jsm b/browser/modules/TorStrings.jsm index eb1e7808b4b90..028d4e27fe709 100644 --- a/browser/modules/TorStrings.jsm +++ b/browser/modules/TorStrings.jsm @@ -282,6 +282,8 @@ var TorStrings = { ), bridgeLocation: getString("torPreferences.bridgeLocation", "Your location"), bridgeLocationAutomatic: getString("torPreferences.bridgeLocationAutomatic", "Automatic"), + bridgeLocationFrequent: getString("torPreferences.bridgeLocationFrequent", "Frequently selected locations"), + bridgeLocationOther: getString("torPreferences.bridgeLocationOther", "Other locations"), bridgeChooseForMe: getString("torPreferences.bridgeChooseForMe", "Choose a Bridge For Me\u2026"), bridgeCurrent: getString("torPreferences.bridgeBadgeCurrent", "Your Current Bridges"), bridgeId: getString("torPreferences.bridgeId", "#1 bridge: #2"), @@ -293,8 +295,8 @@ var TorStrings = { ), bridgeCopy: getString("torPreferences.bridgeCopy", "Copy Bridge Address"), copied: getString("torPreferences.copied", "Copied!"), - bridgeShowAll: getString("torPreferences.bridgeShowAll", "Show all bridges"), - bridgeRemoveAll: getString("torPreferences.bridgeRemoveAll", "Remove all bridges"), + bridgeShowAll: getString("torPreferences.bridgeShowAll", "Show All Bridges"), + bridgeRemoveAll: getString("torPreferences.bridgeRemoveAll", "Remove All Bridges"), bridgeAdd: getString("torPreferences.bridgeAdd", "Add a New Bridge"), bridgeSelectBrowserBuiltin: getString( "torPreferences.bridgeSelectBrowserBuiltin", @@ -332,6 +334,10 @@ var TorStrings = { "View the Tor logs" ), showLogs: getString("torPreferences.viewLogs", "View Logs\u2026"), + // Remove all bridges dialog + removeBridgesQuestion: getString("torPreferences.removeBridgesQuestion", "Remove all the bridges?"), + removeBridgesWarning: getString("torPreferences.removeBridgesWarning", "This action cannot be undone."), + cancel: getString("torPreferences.cancel", "Cancel"), // Scan bridge QR dialog scanQrTitle: getString("torPreferences.scanQrTitle", "Scan the QR code"), // Builtin bridges dialog @@ -500,6 +506,13 @@ var TorStrings = { "Connecting…" ),
+ tryingAgain: getStringNet("torConnect.tryingAgain", "Trying again…"), + + noInternet: getStringNet( + "torConnect.noInternet", + "Tor Browser couldn’t reach the Internet" + ), + torBootstrapFailed: getStringLauncher( "tor_bootstrap_failed", "Tor failed to establish a Tor network connection." @@ -526,20 +539,10 @@ var TorStrings = { ),
tryingBridgeAgain: getStringNet( - "torConnect.tryingBridge", + "torConnect.tryingBridgeAgain", "Trying one more time…" ),
- addLocation: getStringNet( - "torConnect.addLocation", - "Add your location settings" - ), - - addLocationDescription: getStringNet( - "torConnect.addLocationDescription", - "Tor Browser needs to know your location in order to choose the right bridge for you. If you’d rather not share your location, #1 manually instead." - ), - errorLocation: getStringNet( "torConnect.errorLocation", "Tor Browser couldn’t locate you" @@ -547,7 +550,17 @@ var TorStrings = {
errorLocationDescription: getStringNet( "torConnect.errorLocationDescription", - "Tor Browser still couldn’t connect to Tor. Please check your location settings are correct and try again." + "Tor Browser needs to know your location in order to choose the right bridge for you. If you’d rather not share your location, #1 manually instead." + ), + + isLocationCorrect: getStringNet( + "torConnect.isLocationCorrect", + "Are these location settings correct?" + ), + + isLocationCorrectDescription: getStringNet( + "torConnect.isLocationCorrectDescription", + "Tor Browser still couldn’t connect to Tor. Please check your location settings are correct and try again, or #1 instead." ),
finalError: getStringNet( @@ -604,8 +617,7 @@ var TorStrings = { "Connected" ),
- tryAgain: getStringNet("torConnect.tryAgain", "Try connecting again"), - offline: getStringNet("torConnect.offline", "Offline"), + tryAgain: getStringNet("torConnect.tryAgain", "Try Again"),
// tor connect strings for message box in about:preferences#connection connectMessage: getStringNet("torConnect.connectMessage", "Changes to Tor Settings will not take effect until you connect"), @@ -615,12 +627,22 @@ var TorStrings = {
tryBridge: getStringNet("torConnect.tryBridge", "Try a Bridge"),
+ automatic: getStringNet("torConnect.automatic", "Automatic"), selectCountryRegion: getStringNet( "torConnect.selectCountryRegion", - "Select Country or Region", + "Select Country or Region" + ), + frequentLocations: getStringNet( + "torConnect.frequentLocations", + "Frequently selected locations" + ), + otherLocations: getStringNet( + "torConnect.otherLocations", + "Other locations" ),
// TorConnect.jsm error messages + offline: getStringNet("torConnect.offline", "Internet not reachable"), autoBootstrappingFailed: getStringNet( "torConnect.autoBootstrappingFailed", "Automatic configuration failed"
This is an automated email from the git hooks/post-receive script.
richard pushed a commit to branch tor-browser-91.9.0esr-11.5-1 in repository tor-browser.
commit d14fb6c9346d1927fa09d7acc0cbda9b4a37ad6c Author: Pier Angelo Vendrame pierov@torproject.org AuthorDate: Thu Apr 7 12:23:55 2022 +0200
fixup! squash! Bug 27476: Implement about:torconnect captive portal within Tor Browser
Bug 40871: increased the width of #connectPageContainer --- browser/components/torconnect/content/aboutTorConnect.css | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/browser/components/torconnect/content/aboutTorConnect.css b/browser/components/torconnect/content/aboutTorConnect.css index 0a3dc9fbd75fd..ba554729e3872 100644 --- a/browser/components/torconnect/content/aboutTorConnect.css +++ b/browser/components/torconnect/content/aboutTorConnect.css @@ -196,7 +196,8 @@ input[type="checkbox"]:not(:disabled):active:checked {
#connectPageContainer { margin-top: 10vh; - width: 50%; + width: 100%; + max-width: 45em; }
#quickstartCheckbox, #quickstartCheckboxLabel {
This is an automated email from the git hooks/post-receive script.
richard pushed a commit to branch tor-browser-91.9.0esr-11.5-1 in repository tor-browser.
commit 93f776a11048205ac3e1b70e25f767831b18a089 Author: Pier Angelo Vendrame pierov@torproject.org AuthorDate: Thu Apr 7 12:28:43 2022 +0200
fixup! squash! Bug 27476: Implement about:torconnect captive portal within Tor Browser
Bug 40872: switched blue-60 to --in-content-accent-color-active in breadcrumbs items. --- browser/components/torconnect/content/aboutTorConnect.css | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/browser/components/torconnect/content/aboutTorConnect.css b/browser/components/torconnect/content/aboutTorConnect.css index ba554729e3872..6322497b09521 100644 --- a/browser/components/torconnect/content/aboutTorConnect.css +++ b/browser/components/torconnect/content/aboutTorConnect.css @@ -46,7 +46,7 @@ }
.breadcrumb-item:hover { - color: var(--blue-60); + color: var(--in-content-accent-color-active); }
.breadcrumb-separator { @@ -70,7 +70,7 @@ }
#breadcrumbs .active { - color: var(--blue-60); + color: var(--in-content-accent-color-active); }
#breadcrumbs .disabled, #breadcrumbs .disabled:hover {
This is an automated email from the git hooks/post-receive script.
richard pushed a commit to branch tor-browser-91.9.0esr-11.5-1 in repository tor-browser.
commit 6cd20ba7ae5bc205df9001bcb89c97469bb49bdf Author: Pier Angelo Vendrame pierov@torproject.org AuthorDate: Thu Apr 7 12:50:29 2022 +0200
fixup! squash! Bug 27476: Implement about:torconnect captive portal within Tor Browser
Bug 40873: reduced width of location dropdown to ~240px --- browser/components/torconnect/content/aboutTorConnect.css | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-)
diff --git a/browser/components/torconnect/content/aboutTorConnect.css b/browser/components/torconnect/content/aboutTorConnect.css index 6322497b09521..999fc319377a0 100644 --- a/browser/components/torconnect/content/aboutTorConnect.css +++ b/browser/components/torconnect/content/aboutTorConnect.css @@ -125,7 +125,7 @@ div#locationDropdownLabel { margin-inline: 4px; }
-/* these two follow similar css in error-pages.css for buttons */ +/* this follows similar css in error-pages.css for buttons */ @media only screen and (min-width: 480px) { form#locationDropdown { margin-inline: 4px; @@ -136,14 +136,13 @@ div#locationDropdownLabel { }
@media only screen and (max-width: 480px) { - form#locationDropdown, - div#locationDropdownLabel { - margin: 0.66em 0 0; + #tryAgainButton { + margin-top: 4px; } +}
- form#locationDropdown { - width: 100%; - } +form#locationDropdown { + width: 240px; }
form#locationDropdown select {
This is an automated email from the git hooks/post-receive script.
richard pushed a commit to branch tor-browser-91.9.0esr-11.5-1 in repository tor-browser.
commit 84e48eb00923a7f555fda35abc7269c39b92abdc Author: Pier Angelo Vendrame pierov@torproject.org AuthorDate: Thu Apr 7 14:47:11 2022 +0200
fixup! squash! Bug 27476: Implement about:torconnect captive portal within Tor Browser
Bug 40874: relabeled "Connect" to "Try Again" when torconnect hits an error --- browser/components/torconnect/content/aboutTorConnect.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/browser/components/torconnect/content/aboutTorConnect.js b/browser/components/torconnect/content/aboutTorConnect.js index 8710eef95a49e..2ef0b8597948f 100644 --- a/browser/components/torconnect/content/aboutTorConnect.js +++ b/browser/components/torconnect/content/aboutTorConnect.js @@ -380,11 +380,11 @@ class AboutTorConnect { this.show(this.elements.quickstartContainer); this.show(this.elements.configureButton); this.show(this.elements.connectButton, true); + this.elements.connectButton.textContent = + TorStrings.torConnect.torConnectButton; if (state.StateChanged) { this.elements.connectButton.focus(); } - this.elements.connectButton.textContent = - TorStrings.torConnect.torConnectButton; } }
@@ -483,6 +483,7 @@ class AboutTorConnect { this.hideButtons(); this.show(this.elements.configureButton); this.show(this.elements.connectButton); + this.elements.connectButton.textContent = TorStrings.torConnect.tryAgain; this.show(this.elements.tryBridgeButton, true); }
This is an automated email from the git hooks/post-receive script.
richard pushed a commit to branch tor-browser-91.9.0esr-11.5-1 in repository tor-browser.
commit 190a4168bcbc732150a4f89dcefdf1ba061fbbd9 Author: Pier Angelo Vendrame pierov@torproject.org AuthorDate: Thu Apr 7 14:53:43 2022 +0200
fixup! squash! Bug 27476: Implement about:torconnect captive portal within Tor Browser
Bug 40875: removed "Connect" option from final error --- browser/components/torconnect/content/aboutTorConnect.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/browser/components/torconnect/content/aboutTorConnect.js b/browser/components/torconnect/content/aboutTorConnect.js index 2ef0b8597948f..3945da741f9ea 100644 --- a/browser/components/torconnect/content/aboutTorConnect.js +++ b/browser/components/torconnect/content/aboutTorConnect.js @@ -546,8 +546,7 @@ class AboutTorConnect { this.setProgress(state ? state.ErrorDetails : "", false); this.hideButtons(); this.show(this.elements.restartButton); - this.show(this.elements.configureButton); - this.show(this.elements.connectButton, true); + this.show(this.elements.configureButton, true); }
initElements(direction) {
This is an automated email from the git hooks/post-receive script.
richard pushed a commit to branch tor-browser-91.9.0esr-11.5-1 in repository tor-browser.
commit c61bd180a8ade14fd4f0136e732179a9326b9ef9 Author: Pier Angelo Vendrame pierov@torproject.org AuthorDate: Thu Apr 7 15:22:38 2022 +0200
fixup! squash! Bug 27476: Implement about:torconnect captive portal within Tor Browser
Bug 40876: add optgroups to country selector --- .../torconnect/content/aboutTorConnect.js | 30 +++++++++------------- 1 file changed, 12 insertions(+), 18 deletions(-)
diff --git a/browser/components/torconnect/content/aboutTorConnect.js b/browser/components/torconnect/content/aboutTorConnect.js index 3945da741f9ea..3d66913ab1c97 100644 --- a/browser/components/torconnect/content/aboutTorConnect.js +++ b/browser/components/torconnect/content/aboutTorConnect.js @@ -187,7 +187,6 @@ class AboutTorConnect { locationNodes.sort((left, right) => left.textContent.localeCompare(right.textContent) ); - this.elements.locationDropdownSelect.append( selectCountryRegion, ...locationNodes @@ -204,14 +203,13 @@ class AboutTorConnect { for (const code of specialLocations) { const option = document.createElement("option"); option.value = code; - + option.className = "frequent-location"; // codes (partially) come from rdsys service, so make sure we have a // string defined for it let name = this.locations[code]; if (!name) { name = code; } - option.textContent = name; locationNodes.push(option); } @@ -220,28 +218,24 @@ class AboutTorConnect { left.textContent.localeCompare(right.textContent) );
- const disabledDividerNode = document.createElement("option"); - disabledDividerNode.setAttribute("disabled", true); - disabledDividerNode.className = "divider"; + const specialGroup = document.createElement("optgroup"); + specialGroup.setAttribute("label", TorStrings.torConnect.frequentLocations); + specialGroup.className = "frequent-location"; + const locationGroup = document.createElement("optgroup"); + locationGroup.setAttribute("label", TorStrings.torConnect.otherLocations); + locationGroup.className = "frequent-location"; + // options[0] is "Select Country or Region" this.elements.locationDropdownSelect.options[0].after( + specialGroup, ...locationNodes, - disabledDividerNode + locationGroup ); }
removeSpecialLocations() { const select = this.elements.locationDropdownSelect; - if (select.querySelector(".divider") === null) { - return; - } - - while (select.options.length > 1) { - // Skip the "select country/region" option - const opt = select.options[1]; - opt.remove(); - if (opt.className === "divider") { - break; - } + for (const option of select.querySelectorAll(".frequent-location")) { + option.remove(); } }
This is an automated email from the git hooks/post-receive script.
richard pushed a commit to branch tor-browser-91.9.0esr-11.5-1 in repository tor-browser.
commit efd187eb3da2aaa10bad2cd705c906e9106b22fb Author: Pier Angelo Vendrame pierov@torproject.org AuthorDate: Thu Apr 7 15:31:36 2022 +0200
fixup! squash! Bug 27476: Implement about:torconnect captive portal within Tor Browser
Bug 40877: hide #viewLinkContainer rather than its child element --- .../components/torconnect/content/aboutTorConnect.js | 17 ++++++++++------- .../components/torconnect/content/aboutTorConnect.xhtml | 2 +- 2 files changed, 11 insertions(+), 8 deletions(-)
diff --git a/browser/components/torconnect/content/aboutTorConnect.js b/browser/components/torconnect/content/aboutTorConnect.js index 3d66913ab1c97..efea3c237470e 100644 --- a/browser/components/torconnect/content/aboutTorConnect.js +++ b/browser/components/torconnect/content/aboutTorConnect.js @@ -41,6 +41,7 @@ class AboutTorConnect { }, }, viewLog: { + container: "#viewLogContainer", link: "span#viewLogLink", }, quickstart: { @@ -92,6 +93,7 @@ class AboutTorConnect { tryBridgeLabel: document.querySelector( this.selectors.breadcrumbs.tryBridge.label ), + viewLogContainer: document.querySelector(this.selectors.viewLog.container), viewLogLink: document.querySelector(this.selectors.viewLog.link), quickstartContainer: document.querySelector( this.selectors.quickstart.container @@ -331,7 +333,7 @@ class AboutTorConnect { showProgressbar ); this.hide(this.elements.quickstartContainer); - this.hide(this.elements.viewLogLink); + this.hide(this.elements.viewLogContainer); this.hideButtons(); }
@@ -340,7 +342,7 @@ class AboutTorConnect { const showProgressbar = false;
this.hide(this.elements.quickstartContainer); - this.hide(this.elements.viewLogLink); + this.hide(this.elements.viewLogContainer); this.hideButtons();
if (hasError) { @@ -402,9 +404,9 @@ class AboutTorConnect { BreadcrumbStatus.Active ); if (state.ShowViewLog) { - this.show(this.elements.viewLogLink); + this.show(this.elements.viewLogContainer); } else { - this.hide(this.elements.viewLogLink); + this.hide(this.elements.viewLogContainer); } this.hideButtons(); this.show(this.elements.cancelButton, true); @@ -421,9 +423,9 @@ class AboutTorConnect { this.setProgress("", showProgressbar, state.BootstrapProgress); this.hideBreadcrumbs(); if (state.ShowViewLog) { - this.show(this.elements.viewLogLink); + this.show(this.elements.viewLogContainer); } else { - this.hide(this.elements.viewLogLink); + this.hide(this.elements.viewLogContainer); } this.hideButtons(); this.show(this.elements.cancelButton, true); @@ -439,7 +441,7 @@ class AboutTorConnect { this.setLongText(""); this.setProgress(state.ErrorDetails, showProgressbar); this.hideButtons(); - this.show(this.elements.viewLogLink); + this.show(this.elements.viewLogContainer); }
update_Bootstrapped(state) { @@ -563,6 +565,7 @@ class AboutTorConnect { this.elements.tryBridgeLabel.textContent = TorStrings.torConnect.breadcrumbTryBridge;
+ this.hide(this.elements.viewLogContainer); this.elements.viewLogLink.textContent = TorStrings.torConnect.viewLog; this.elements.viewLogLink.addEventListener("click", event => { RPMSendAsyncMessage("torconnect:view-tor-logs"); diff --git a/browser/components/torconnect/content/aboutTorConnect.xhtml b/browser/components/torconnect/content/aboutTorConnect.xhtml index a98af43e2d53f..0591ed03a540c 100644 --- a/browser/components/torconnect/content/aboutTorConnect.xhtml +++ b/browser/components/torconnect/content/aboutTorConnect.xhtml @@ -37,7 +37,7 @@ </div>
<div id="viewLogContainer"> - <span id="viewLogLink" hidden="true"></span> + <span id="viewLogLink"></span> </div>
<div id="quickstartContainer">
This is an automated email from the git hooks/post-receive script.
richard pushed a commit to branch tor-browser-91.9.0esr-11.5-1 in repository tor-browser.
commit 2ecfedf37a30f398d19981634ac2d1df96837911 Author: Pier Angelo Vendrame pierov@torproject.org AuthorDate: Thu Apr 7 15:43:28 2022 +0200
fixup! squash! Bug 27476: Implement about:torconnect captive portal within Tor Browser
Bug 40878: updated the reds we use in dark mode --- browser/components/torconnect/content/aboutTorConnect.css | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/browser/components/torconnect/content/aboutTorConnect.css b/browser/components/torconnect/content/aboutTorConnect.css index 999fc319377a0..d9ed605402f26 100644 --- a/browser/components/torconnect/content/aboutTorConnect.css +++ b/browser/components/torconnect/content/aboutTorConnect.css @@ -79,7 +79,15 @@ }
#breadcrumbs .error { - color: var(--red-60); + color: var(--in-content-danger-button-background); +} + +#breadcrumbs .error:hover { + color: var(--in-content-danger-button-background-hover); +} + +#breadcrumbs .error:active { + color: var(--in-content-danger-button-background-active); }
#connection-assist {
This is an automated email from the git hooks/post-receive script.
richard pushed a commit to branch tor-browser-91.9.0esr-11.5-1 in repository tor-browser.
commit ba925df5d1f2e63d83f34d08d9e2aa21dd2c7ffe Author: Pier Angelo Vendrame pierov@torproject.org AuthorDate: Fri Apr 8 10:36:51 2022 +0200
fixup! squash! Bug 27476: Implement about:torconnect captive portal within Tor Browser
Bug 40881: animated torconnect's progress bar --- .../torconnect/content/aboutTorConnect.css | 31 ++++++++++++++++++++-- 1 file changed, 29 insertions(+), 2 deletions(-)
diff --git a/browser/components/torconnect/content/aboutTorConnect.css b/browser/components/torconnect/content/aboutTorConnect.css index d9ed605402f26..f2d8089a96326 100644 --- a/browser/components/torconnect/content/aboutTorConnect.css +++ b/browser/components/torconnect/content/aboutTorConnect.css @@ -189,6 +189,17 @@ input[type="checkbox"]:not(:disabled):active:checked { background-color: var(--purple-80)!important; }
+:root { + --progressbar-shadow-start: rgba(255, 255, 255, 0.85); +} + +@media (prefers-color-scheme: dark) +{ + :root { + --progressbar-shadow-start: rgba(28, 27, 34, 0.85); + } +} + #progressBackground { position:fixed; padding:0; @@ -196,9 +207,25 @@ input[type="checkbox"]:not(:disabled):active:checked { top:0; left:0; width: 0%; - height: 7px; - background-image: linear-gradient(90deg, rgb(20, 218, 221) 0%, rgb(128, 109, 236) 100%); + height: 40px; + background-image: + linear-gradient(transparent 17.5%, var(--progressbar-shadow-start) 17.5%, var(--in-content-page-background) 100%), + linear-gradient(90deg, #FC00FF 0%, #00DBDE 50%, #FC00FF 100%); + background-size: 100%, 200%; border-radius: 0; + animation: progressAnimation 5s ease infinite; +} + +@keyframes progressAnimation { + 0% { + background-position: 200%; + } + 50% { + background-position: 100%; + } + 100% { + background-position: 0%; + } }
#connectPageContainer {
This is an automated email from the git hooks/post-receive script.
richard pushed a commit to branch tor-browser-91.9.0esr-11.5-1 in repository tor-browser.
commit b59c7d7f2d00df4363f0c4f49e354bbe2bfbc4ff Author: Pier Angelo Vendrame pierov@torproject.org AuthorDate: Fri Apr 8 11:20:37 2022 +0200
fixup! squash! Bug 31286: Implementation of bridge, proxy, and firewall settings in about:preferences#connection
Bug 40876: add all countries to about:preferences#connection --- .../torpreferences/content/connectionPane.js | 64 +++++++++++++--------- .../torpreferences/content/torPreferences.css | 5 ++ 2 files changed, 43 insertions(+), 26 deletions(-)
diff --git a/browser/components/torpreferences/content/connectionPane.js b/browser/components/torpreferences/content/connectionPane.js index 309d6498a0c80..1562e9c780747 100644 --- a/browser/components/torpreferences/content/connectionPane.js +++ b/browser/components/torpreferences/content/connectionPane.js @@ -346,36 +346,48 @@ const gConnectionPane = (function() { TorConnect.beginAutoBootstrap(location.value); }); this._populateLocations = () => { - let value = location.value; + const currentValue = location.value; locationEntries.textContent = ""; - - { + const createItem = (value, label, disabled) => { const item = document.createXULElement("menuitem"); - item.setAttribute("value", ""); - item.setAttribute( - "label", - TorStrings.settings.bridgeLocationAutomatic - ); - locationEntries.appendChild(item); - } - - const codes = TorConnect.countryCodes; - const items = codes.map(code => { - const item = document.createXULElement("menuitem"); - item.setAttribute("value", code); - item.setAttribute( - "label", - TorConnect.countryNames[code] - ? TorConnect.countryNames[code] - : code - ); + item.setAttribute("value", value); + item.setAttribute("label", label); + if (disabled) { + item.setAttribute("disabled", "true"); + } return item; - }); - items.sort((left, right) => - left.textContent.localeCompare(right.textContent) + }; + const addLocations = codes => { + const items = []; + for (const code of codes) { + items.push( + createItem( + code, + TorConnect.countryNames[code] + ? TorConnect.countryNames[code] + : code + ) + ); + } + items.sort((left, right) => + left.label.localeCompare(right.label) + ); + locationEntries.append(...items); + }; + locationEntries.append( + createItem("", TorStrings.settings.bridgeLocationAutomatic) ); - locationEntries.append(...items); - location.value = value; + if (TorConnect.countryCodes.length) { + locationEntries.append( + createItem("", TorStrings.settings.bridgeLocationFrequent, true) + ); + addLocations(TorConnect.countryCodes); + locationEntries.append( + createItem("", TorStrings.settings.bridgeLocationOther, true) + ); + } + addLocations(Object.keys(TorConnect.countryNames)); + location.value = currentValue; }; this._showAutoconfiguration = () => { if ( diff --git a/browser/components/torpreferences/content/torPreferences.css b/browser/components/torpreferences/content/torPreferences.css index 31b6e29d679f3..535baefbcbabb 100644 --- a/browser/components/torpreferences/content/torPreferences.css +++ b/browser/components/torpreferences/content/torPreferences.css @@ -176,6 +176,11 @@ html:dir(rtl) input[type="checkbox"].toggle-button::before { width: 280px; }
+#torPreferences-bridges-location menuitem[disabled="true"] { + color: var(--in-content-button-text-color, inherit); + font-weight: 700; +} + /* Bridge cards */ :root { --bridgeCard-animation-time: 0.25s;
This is an automated email from the git hooks/post-receive script.
richard pushed a commit to branch tor-browser-91.9.0esr-11.5-1 in repository tor-browser.
commit fa3f15cf50d13c7ae72caee416b71c8058ffa3eb Author: Pier Angelo Vendrame pierov@torproject.org AuthorDate: Fri Apr 8 15:23:55 2022 +0200
fixup! squash! Bug 27476: Implement about:torconnect captive portal within Tor Browser
Bug 40882: fixed a typo that prevented reload on about:torconnect from working --- browser/components/torconnect/TorConnectParent.jsm | 17 +++++++++++------ .../components/torconnect/content/aboutTorConnect.js | 4 ++-- 2 files changed, 13 insertions(+), 8 deletions(-)
diff --git a/browser/components/torconnect/TorConnectParent.jsm b/browser/components/torconnect/TorConnectParent.jsm index dd3d1b2410f95..479446898e115 100644 --- a/browser/components/torconnect/TorConnectParent.jsm +++ b/browser/components/torconnect/TorConnectParent.jsm @@ -4,9 +4,12 @@ var EXPORTED_SYMBOLS = ["TorConnectParent"];
const { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm"); const { TorStrings } = ChromeUtils.import("resource:///modules/TorStrings.jsm"); -const { TorConnect, TorConnectTopics, TorConnectState, TorCensorshipLevel } = ChromeUtils.import( - "resource:///modules/TorConnect.jsm" -); +const { + TorConnect, + TorConnectTopics, + TorConnectState, + TorCensorshipLevel, +} = ChromeUtils.import("resource:///modules/TorConnect.jsm"); const { TorSettings, TorSettingsTopics, TorSettingsData } = ChromeUtils.import( "resource:///modules/TorSettings.jsm" ); @@ -24,7 +27,7 @@ class TorConnectParent extends JSWindowActorParent {
this.state = { State: TorConnect.state, - DetectedCensorshiplevel: TorConnect.detectedCensorshiplevel, + DetectedCensorshipLevel: TorConnect.detectedCensorshipLevel, StateChanged: false, ErrorMessage: TorConnect.errorMessage, ErrorDetails: TorConnect.errorDetails, @@ -73,10 +76,12 @@ class TorConnectParent extends JSWindowActorParent { case TorConnectTopics.BootstrapError: { self.state.ErrorMessage = obj.message; self.state.ErrorDetails = obj.details; - self.state.DetectedCensorshiplevel = obj.censorshipLevel; + self.state.DetectedCensorshipLevel = obj.censorshipLevel;
// With severe censorshp, we offer user list of countries to try - if (self.state.DetectedCensorshiplevel == TorCensorshipLevel.Severe) { + if ( + self.state.DetectedCensorshipLevel == TorCensorshipLevel.Severe + ) { self.state.CountryCodes = TorConnect.countryCodes; }
diff --git a/browser/components/torconnect/content/aboutTorConnect.js b/browser/components/torconnect/content/aboutTorConnect.js index efea3c237470e..eb691444e4d26 100644 --- a/browser/components/torconnect/content/aboutTorConnect.js +++ b/browser/components/torconnect/content/aboutTorConnect.js @@ -346,7 +346,7 @@ class AboutTorConnect { this.hideButtons();
if (hasError) { - switch (state.DetectedCensorshiplevel) { + switch (state.DetectedCensorshipLevel) { case TorCensorshipLevel.None: // we shouldn't be able to get here break; @@ -387,7 +387,7 @@ class AboutTorConnect { update_AutoBootstrapping(state) { const showProgressbar = true;
- if (state.DetectedCensorshiplevel >= TorCensorshipLevel.Severe) { + if (state.DetectedCensorshipLevel >= TorCensorshipLevel.Severe) { this.setTitle(TorStrings.torConnect.tryingBridgeAgain, ""); } else { this.setTitle(TorStrings.torConnect.tryingBridge, "");
This is an automated email from the git hooks/post-receive script.
richard pushed a commit to branch tor-browser-91.9.0esr-11.5-1 in repository tor-browser.
commit 93ef67dd2bec5a97c48a0e4bc5810a1d0735a738 Author: Pier Angelo Vendrame pierov@torproject.org AuthorDate: Fri Apr 8 15:24:50 2022 +0200
fixup! fixup! Bug 40597: Implement TorSettings module
Bug 40882: fixed a typo that prevented reload on about:torconnect from working --- browser/modules/TorConnect.jsm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/browser/modules/TorConnect.jsm b/browser/modules/TorConnect.jsm index 13c1f54d2ee97..5a7172c51244f 100644 --- a/browser/modules/TorConnect.jsm +++ b/browser/modules/TorConnect.jsm @@ -231,7 +231,7 @@ const TorConnect = (() => { _state: TorConnectState.Initial, _bootstrapProgress: 0, _bootstrapStatus: null, - _detectedCensorshiplevel: TorCensorshipLevel.None, + _detectedCensorshipLevel: TorCensorshipLevel.None, // list of country codes Moat has settings for _countryCodes: [], _countryNames: Object.freeze((() => {
This is an automated email from the git hooks/post-receive script.
richard pushed a commit to branch tor-browser-91.9.0esr-11.5-1 in repository tor-browser.
commit 4a98eaf61f7173d39d32d215912ce078ee9cbb5a Author: Pier Angelo Vendrame pierov@torproject.org AuthorDate: Fri Apr 8 17:54:03 2022 +0200
fixup! fixup! Bug 40597: Implement TorSettings module
Improved the Internet status test. Probably it always failed when offline, because getting responseStatus would throw an exception. Also, it returns the server's date when successful. --- browser/modules/Moat.jsm | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-)
diff --git a/browser/modules/Moat.jsm b/browser/modules/Moat.jsm index 2995a9148f0a3..bdcf6cb631561 100644 --- a/browser/modules/Moat.jsm +++ b/browser/modules/Moat.jsm @@ -393,7 +393,7 @@ class InternetTestResponseListener { }
// callers wait on this for final response - status() { + get status() { return this._promise; }
@@ -406,8 +406,18 @@ class InternetTestResponseListener { statuses = { components: status, successful: Components.isSuccessCode(status), - http: request.responseStatus, }; + try { + if (statuses.successful) { + statuses.http = request.responseStatus; + statuses.date = request.getResponseHeader("Date"); + } + } catch (err) { + console.warn( + "Successful request, but could not get the HTTP status or date", + err + ); + } } catch (err) { this._reject(err); } @@ -549,7 +559,7 @@ class MoatRPC {
const listener = new InternetTestResponseListener(); await ch.asyncOpen(listener, ch); - return listener.status(); + return listener.status; }
//
This is an automated email from the git hooks/post-receive script.
richard pushed a commit to branch tor-browser-91.9.0esr-11.5-1 in repository tor-browser.
commit ccd86dbf59ee124ee72f743d6da2731742e4681c Author: Pier Angelo Vendrame pierov@torproject.org AuthorDate: Mon Apr 11 12:52:05 2022 +0200
fixup! fixup! Bug 40597: Implement TorSettings module
The Internet status is now checked as a part of the manual/quick bootstrap state. If the bootstrap fails *and* Moat cannot be reached, the type of error that is transitioned to has the offline message. --- browser/modules/TorConnect.jsm | 140 ++++++++++++++++++++++++++++++++++++++++- 1 file changed, 137 insertions(+), 3 deletions(-)
diff --git a/browser/modules/TorConnect.jsm b/browser/modules/TorConnect.jsm index 5a7172c51244f..a9d4c01086dc9 100644 --- a/browser/modules/TorConnect.jsm +++ b/browser/modules/TorConnect.jsm @@ -1,12 +1,12 @@ "use strict";
-var EXPORTED_SYMBOLS = ["TorConnect", "TorConnectTopics", "TorConnectState", "TorCensorshipLevel"]; +var EXPORTED_SYMBOLS = ["InternetStatus", "TorConnect", "TorConnectTopics", "TorConnectState", "TorCensorshipLevel"];
const { Services } = ChromeUtils.import( "resource://gre/modules/Services.jsm" );
-const { setTimeout } = ChromeUtils.import( +const { setTimeout, clearTimeout } = ChromeUtils.import( "resource://gre/modules/Timer.jsm" );
@@ -225,6 +225,94 @@ const debug_sleep = async (ms) => { }); }
+const InternetStatus = Object.freeze({ + Unknown: -1, + Offline: 0, + Online: 1, +}); + +class InternetTest { + static get TIMEOUT() { + return 30000; + } + + constructor() { + this._status = InternetStatus.Unknown; + this._error = null; + this._pending = false; + this._timeout = setTimeout(() => { + this._timeout = null; + this.test(); + }, InternetTest.TIMEOUT + this.timeoutRand()); + this.onResult = (online, date) => {} + this.onError = (err) => {}; + } + + test() { + if (this._pending) { + return; + } + this.cancel(); + this._pending = true; + + this._testAsync() + .then((status) => { + this._pending = false; + this._status = status.successful ? InternetStatus.Online : InternetStatus.Offline; + this.onResult(this.status, status.date); + }) + .catch(error => { + this._error = error; + this._pending = false; + this.onError(error); + }); + } + + cancel() { + if (this._timeout !== null) { + clearTimeout(this._timeout); + this._timeout = null; + } + } + + async _testAsync() { + // Callbacks for the Internet test are desirable, because we will be + // waiting both for the bootstrap, and for the Internet test. + // However, managing Moat with async/await is much easier as it avoids a + // callback hell, and it makes extra esplicit that we are uniniting it. + const mrpc = new MoatRPC(); + let status = null; + let error = null; + try { + await mrpc.init(); + status = await mrpc.testInternetConnection(); + } catch (err) { + console.error("Error while checking the Internet connection", err); + error = err; + } finally { + mrpc.uninit(); + } + if (error !== null) { + throw error; + } + return status; + } + + get status() { + return this._status; + } + + get error() { + return this._error; + } + + // We randomize the Internet test timeout to make fingerprinting it harder, at least a little bit... + timeoutRand() { + const window = 5000; + return window * (Math.random() * 2 - 1); + } +} + const TorConnect = (() => { let retval = {
@@ -232,6 +320,7 @@ const TorConnect = (() => { _bootstrapProgress: 0, _bootstrapStatus: null, _detectedCensorshipLevel: TorCensorshipLevel.None, + _internetStatus: InternetStatus.Unknown, // list of country codes Moat has settings for _countryCodes: [], _countryNames: Object.freeze((() => { @@ -311,9 +400,36 @@ const TorConnect = (() => { }
const tbr = new TorBootstrapRequest(); + const internetTest = new InternetTest(); + + let bootstrapError = ""; + let bootstrapErrorDetails = ""; + const maybeTransitionToError = () => { + console.log("TorConnect: maybe transition!", internetTest.status, internetTest.error, bootstrapError); + if (internetTest.status === InternetStatus.Unknown && internetTest.error === null) { + // We have been called by a failed bootstrap, but the internet test has not run yet - force + // it to run immediately! + internetTest.test(); + // Return from this call, because the Internet test's callback will call us again + return; + } + // Do not transition to the offline error until we are sure that also the bootstrap failed, in + // case Moat is down but the bootstrap can proceed anyway. + if (bootstrapError === "") { + return; + } + if (internetTest.status === InternetStatus.Offline) { + TorConnect._changeState(TorConnectState.Error, TorStrings.torConnect.offline, "", true); + } else { + // Give priority to the bootstrap error, in case the Internet test fails + TorConnect._changeState(TorConnectState.Error, bootstrapError, bootstrapErrorDetails, true); + } + } + this.on_transition = async (nextState) => { if (nextState === TorConnectState.Configuring) { // stop bootstrap process if user cancelled + internetTest.cancel(); await tbr.cancel(); } resolve(); @@ -323,12 +439,26 @@ const TorConnect = (() => { TorConnect._updateBootstrapStatus(progress, status); }; tbr.onbootstrapcomplete = () => { + internetTest.cancel(); TorConnect._changeState(TorConnectState.Bootstrapped); }; tbr.onbootstraperror = (message, details) => { - TorConnect._changeState(TorConnectState.Error, message, details, true); + // We have to wait for the Internet test to finish before sending the bootstrap error + bootstrapError = message; + bootstrapErrorDetails = details; + maybeTransitionToError(); };
+ internetTest.onResult = (status, date) => { + // TODO: Use the date to save the clock skew? + console.log("TorConnect: Internet test", status, date); + TorConnect._internetStatus = status; + maybeTransitionToError(); + }; + internetTest.onError = () => { + maybeTransitionToError(); + } + tbr.bootstrap(); }); })], @@ -619,6 +749,10 @@ const TorConnect = (() => { return this._detectedCensorshipLevel; },
+ get internetStatus() { + return this._internetStatus; + }, + get errorMessage() { return this._errorMessage; },
This is an automated email from the git hooks/post-receive script.
richard pushed a commit to branch tor-browser-91.9.0esr-11.5-1 in repository tor-browser.
commit ef9c0a301b640370f857681ac9c116e94b65b114 Author: Pier Angelo Vendrame pierov@torproject.org AuthorDate: Mon Apr 11 16:12:49 2022 +0200
fixup! squash! Bug 27476: Implement about:torconnect captive portal within Tor Browser
Bug 40891: started working on the You Are Offline panel (WIP). --- browser/components/torconnect/TorConnectParent.jsm | 12 ++-- .../torconnect/content/aboutTorConnect.css | 14 ++-- .../torconnect/content/aboutTorConnect.js | 76 +++++++++++++++------- .../torconnect/content/aboutTorConnect.xhtml | 4 +- 4 files changed, 73 insertions(+), 33 deletions(-)
diff --git a/browser/components/torconnect/TorConnectParent.jsm b/browser/components/torconnect/TorConnectParent.jsm index 479446898e115..f39b31a974a95 100644 --- a/browser/components/torconnect/TorConnectParent.jsm +++ b/browser/components/torconnect/TorConnectParent.jsm @@ -5,6 +5,7 @@ var EXPORTED_SYMBOLS = ["TorConnectParent"]; const { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm"); const { TorStrings } = ChromeUtils.import("resource:///modules/TorStrings.jsm"); const { + InternetStatus, TorConnect, TorConnectTopics, TorConnectState, @@ -27,12 +28,13 @@ class TorConnectParent extends JSWindowActorParent {
this.state = { State: TorConnect.state, - DetectedCensorshipLevel: TorConnect.detectedCensorshipLevel, StateChanged: false, ErrorMessage: TorConnect.errorMessage, ErrorDetails: TorConnect.errorDetails, BootstrapProgress: TorConnect.bootstrapProgress, BootstrapStatus: TorConnect.bootstrapStatus, + DetectedCensorshipLevel: TorConnect.detectedCensorshipLevel, + InternetStatus: TorConnect.internetStatus, ShowViewLog: TorConnect.logHasWarningOrError, QuickStartEnabled: TorSettings.quickstart.enabled, CountryCodes: TorConnect.countryCodes, @@ -77,6 +79,7 @@ class TorConnectParent extends JSWindowActorParent { self.state.ErrorMessage = obj.message; self.state.ErrorDetails = obj.details; self.state.DetectedCensorshipLevel = obj.censorshipLevel; + self.state.InternetStatus = TorConnect.internetStatus;
// With severe censorshp, we offer user list of countries to try if ( @@ -142,9 +145,6 @@ class TorConnectParent extends JSWindowActorParent { case "torconnect:open-tor-preferences": TorConnect.openTorPreferences(); break; - case "torconnect:view-tor-logs": - TorConnect.viewTorLogs(); - break; case "torconnect:cancel-bootstrap": TorConnect.cancelBootstrap(); break; @@ -154,6 +154,9 @@ class TorConnectParent extends JSWindowActorParent { case "torconnect:begin-autobootstrap": TorConnect.beginAutoBootstrap(message.data); break; + case "torconnect:view-tor-logs": + TorConnect.viewTorLogs(); + break; case "torconnect:restart": Services.startup.quit( Ci.nsIAppStartup.eRestart | Ci.nsIAppStartup.eAttemptQuit @@ -169,6 +172,7 @@ class TorConnectParent extends JSWindowActorParent { TorStrings, TorConnectState, TorCensorshipLevel, + InternetStatus, Direction: Services.locale.isAppLocaleRTL ? "rtl" : "ltr", State: this.state, CountryNames: TorConnect.countryNames, diff --git a/browser/components/torconnect/content/aboutTorConnect.css b/browser/components/torconnect/content/aboutTorConnect.css index f2d8089a96326..926ff4927505a 100644 --- a/browser/components/torconnect/content/aboutTorConnect.css +++ b/browser/components/torconnect/content/aboutTorConnect.css @@ -69,27 +69,31 @@ margin-top: -1px; }
-#breadcrumbs .active { +.breadcrumb-item.active { color: var(--in-content-accent-color-active); }
-#breadcrumbs .disabled, #breadcrumbs .disabled:hover { +.breadcrumb-item.disabled, .breadcrumb-item.disabled:hover { color: var(--green-90-a40); cursor: default; }
-#breadcrumbs .error { +.breadcrumb-item.error { color: var(--in-content-danger-button-background); }
-#breadcrumbs .error:hover { +.breadcrumb-item.error:hover { color: var(--in-content-danger-button-background-hover); }
-#breadcrumbs .error:active { +.breadcrumb-item.error:active { color: var(--in-content-danger-button-background-active); }
+.breadcrumb-item.hidden, .breadcrumb-separator.hidden { + display: none; +} + #connection-assist { margin-left: 0; } diff --git a/browser/components/torconnect/content/aboutTorConnect.js b/browser/components/torconnect/content/aboutTorConnect.js index eb691444e4d26..30dfbd978315f 100644 --- a/browser/components/torconnect/content/aboutTorConnect.js +++ b/browser/components/torconnect/content/aboutTorConnect.js @@ -6,12 +6,14 @@ let TorStrings = {}; let TorConnectState = {}; let TorCensorshipLevel = {}; +let InternetStatus = {};
const BreadcrumbStatus = Object.freeze({ - Disabled: -1, - Default: 0, - Active: 1, - Error: 2, + Hidden: "hidden", + Disabled: "disabled", + Default: "default", + Active: "active", + Error: "error", });
class AboutTorConnect { @@ -32,10 +34,12 @@ class AboutTorConnect { label: "#connection-assist .breadcrumb-label", }, locationSettings: { + separator: "#location-settings-separator", link: "#location-settings", label: "#location-settings .breadcrumb-label", }, tryBridge: { + separator: "#try-bridge-separator", link: "#try-bridge", label: "#try-bridge .breadcrumb-label", }, @@ -81,12 +85,18 @@ class AboutTorConnect { connectionAssistLabel: document.querySelector( this.selectors.breadcrumbs.connectionAssist.label ), + locationSettingsSeparator: document.querySelector( + this.selectors.breadcrumbs.locationSettings.separator + ), locationSettingsLink: document.querySelector( this.selectors.breadcrumbs.locationSettings.link ), locationSettingsLabel: document.querySelector( this.selectors.breadcrumbs.locationSettings.label ), + tryBridgeSeparator: document.querySelector( + this.selectors.breadcrumbs.tryBridge.separator + ), tryBridgeLink: document.querySelector( this.selectors.breadcrumbs.tryBridge.link ), @@ -284,26 +294,28 @@ class AboutTorConnect {
setBreadcrumbsStatus(connectionAssist, locationSettings, tryBridge) { this.elements.breadcrumbContainer.classList.remove("hidden"); - let elems = [ - [this.elements.connectionAssistLink, connectionAssist], - [this.elements.locationSettingsLink, locationSettings], - [this.elements.tryBridgeLink, tryBridge], + const elems = [ + [this.elements.connectionAssistLink, connectionAssist, null], + [ + this.elements.locationSettingsLink, + locationSettings, + this.elements.locationSettingsSeparator, + ], + [ + this.elements.tryBridgeLink, + tryBridge, + this.elements.tryBridgeSeparator, + ], ]; - elems.forEach(([elem, status]) => { - elem.classList.remove("disabled"); - elem.classList.remove("active"); - elem.classList.remove("error"); - switch (status) { - case BreadcrumbStatus.Disabled: - elem.classList.add("disabled"); - break; - case BreadcrumbStatus.Active: - elem.classList.add("active"); - break; - case BreadcrumbStatus.Error: - elem.classList.add("error"); - break; + elems.forEach(([elem, status, separator]) => { + elem.classList.remove(BreadcrumbStatus.Hidden); + elem.classList.remove(BreadcrumbStatus.Disabled); + elem.classList.remove(BreadcrumbStatus.Active); + elem.classList.remove(BreadcrumbStatus.Error); + if (status !== "") { + elem.classList.add(status); } + separator?.classList.toggle("hidden", status === BreadcrumbStatus.Hidden); }); }
@@ -346,6 +358,10 @@ class AboutTorConnect { this.hideButtons();
if (hasError) { + if (state.InternetStatus === InternetStatus.Offline) { + this.showOffline(state.ErrorMessage); + return; + } switch (state.DetectedCensorshipLevel) { case TorCensorshipLevel.None: // we shouldn't be able to get here @@ -463,6 +479,21 @@ class AboutTorConnect { // it isn't in use (eg using tor-launcher or system tor) }
+ showOffline(error) { + this.setTitle(TorStrings.torConnect.noInternet, "error"); + this.setLongText("Some long text from 🍩️"); + this.setProgress(error, false); + this.setBreadcrumbsStatus( + BreadcrumbStatus.Default, + BreadcrumbStatus.Active, + BreadcrumbStatus.Hidden + ); + this.hideButtons(); + this.show(this.elements.configureButton); + this.show(this.elements.connectButton, true); + this.elements.connectButton.textContent = TorStrings.torConnect.tryAgain; + } + showConnectionAssistant(error) { const hasError = !!error; this.setTitle( @@ -662,6 +693,7 @@ class AboutTorConnect { TorStrings = Object.freeze(args.TorStrings); TorConnectState = Object.freeze(args.TorConnectState); TorCensorshipLevel = Object.freeze(args.TorCensorshipLevel); + InternetStatus = Object.freeze(args.InternetStatus); this.locations = args.CountryNames;
this.initElements(args.Direction); diff --git a/browser/components/torconnect/content/aboutTorConnect.xhtml b/browser/components/torconnect/content/aboutTorConnect.xhtml index 0591ed03a540c..4bb5b31949a67 100644 --- a/browser/components/torconnect/content/aboutTorConnect.xhtml +++ b/browser/components/torconnect/content/aboutTorConnect.xhtml @@ -14,12 +14,12 @@ <span id="connection-assist-icon" class="breadcrumb-icon" /> <span class="breadcrumb-label"/> </span> - <span class="breadcrumb-separator breadcrumb-icon" /> + <span id="location-settings-separator" class="breadcrumb-separator breadcrumb-icon" /> <span id="location-settings" class="breadcrumb-item"> <span id="location-settings-icon" class="breadcrumb-icon" /> <span class="breadcrumb-label"/> </span> - <span class="breadcrumb-separator breadcrumb-icon" /> + <span id="try-bridge-separator" class="breadcrumb-separator breadcrumb-icon" /> <span id="try-bridge" class="breadcrumb-item"> <span id="try-bridge-icon" class="breadcrumb-icon" /> <span class="breadcrumb-label"/>
This is an automated email from the git hooks/post-receive script.
richard pushed a commit to branch tor-browser-91.9.0esr-11.5-1 in repository tor-browser.
commit 251c38c5c362aaf7d2bd55ea5ab515dca9d9fcd4 Author: Pier Angelo Vendrame pierov@torproject.org AuthorDate: Wed Apr 13 09:05:37 2022 +0200
fixup! squash! Bug 27476: Implement about:torconnect captive portal within Tor Browser
Reworked the about:torconnect page to have its own state machine, that is slightly different from the TorConnect's one.
Also includes: Bug 40889: applied visual tweaks to breadcrumb styling Bug 40892: hghlighted the UI elements in error red instead of the breadcrumb --- browser/components/torconnect/TorConnectParent.jsm | 13 - .../torconnect/content/aboutTorConnect.css | 79 ++-- .../torconnect/content/aboutTorConnect.js | 479 +++++++++++---------- .../torconnect/content/aboutTorConnect.xhtml | 15 +- browser/components/torconnect/content/globe.svg | 4 - browser/components/torconnect/jar.mn | 1 - 6 files changed, 302 insertions(+), 289 deletions(-)
diff --git a/browser/components/torconnect/TorConnectParent.jsm b/browser/components/torconnect/TorConnectParent.jsm index f39b31a974a95..528f48392880b 100644 --- a/browser/components/torconnect/TorConnectParent.jsm +++ b/browser/components/torconnect/TorConnectParent.jsm @@ -9,7 +9,6 @@ const { TorConnect, TorConnectTopics, TorConnectState, - TorCensorshipLevel, } = ChromeUtils.import("resource:///modules/TorConnect.jsm"); const { TorSettings, TorSettingsTopics, TorSettingsData } = ChromeUtils.import( "resource:///modules/TorSettings.jsm" @@ -33,11 +32,9 @@ class TorConnectParent extends JSWindowActorParent { ErrorDetails: TorConnect.errorDetails, BootstrapProgress: TorConnect.bootstrapProgress, BootstrapStatus: TorConnect.bootstrapStatus, - DetectedCensorshipLevel: TorConnect.detectedCensorshipLevel, InternetStatus: TorConnect.internetStatus, ShowViewLog: TorConnect.logHasWarningOrError, QuickStartEnabled: TorSettings.quickstart.enabled, - CountryCodes: TorConnect.countryCodes, };
// JSWindowActiveParent derived objects cannot observe directly, so create a member @@ -78,16 +75,7 @@ class TorConnectParent extends JSWindowActorParent { case TorConnectTopics.BootstrapError: { self.state.ErrorMessage = obj.message; self.state.ErrorDetails = obj.details; - self.state.DetectedCensorshipLevel = obj.censorshipLevel; self.state.InternetStatus = TorConnect.internetStatus; - - // With severe censorshp, we offer user list of countries to try - if ( - self.state.DetectedCensorshipLevel == TorCensorshipLevel.Severe - ) { - self.state.CountryCodes = TorConnect.countryCodes; - } - self.state.ShowViewLog = true; break; } @@ -171,7 +159,6 @@ class TorConnectParent extends JSWindowActorParent { return { TorStrings, TorConnectState, - TorCensorshipLevel, InternetStatus, Direction: Services.locale.isAppLocaleRTL ? "rtl" : "ltr", State: this.state, diff --git a/browser/components/torconnect/content/aboutTorConnect.css b/browser/components/torconnect/content/aboutTorConnect.css index 926ff4927505a..7f7d75010e82e 100644 --- a/browser/components/torconnect/content/aboutTorConnect.css +++ b/browser/components/torconnect/content/aboutTorConnect.css @@ -10,22 +10,9 @@ --onion-radius: 75px; }
-/* override firefox's default blue focus coloring */ -:focus { - outline: none!important; - box-shadow: 0 0 0 3px var(--purple-30) !important; - border: 1px var(--purple-80) solid !important; -} - -@media (prefers-color-scheme: dark) -{ - :focus { - box-shadow: 0 0 0 3px var(--purple-50)!important; - } -} - #breadcrumbs { display: flex; + align-items: center; margin: 0 0 24px 0; color: var(--grey-40); } @@ -38,15 +25,24 @@ display: flex; margin: 0; margin-inline-start: 20px; + padding: 8px; }
.breadcrumb-item { + align-items: center; cursor: pointer; color: var(--in-content-text-color); + border-radius: 4px; }
.breadcrumb-item:hover { + color: var(--in-content-accent-color); + background-color: var(--grey-20); +} + +.breadcrumb-item:active { color: var(--in-content-accent-color-active); + background-color: var(--grey-30); }
.breadcrumb-separator { @@ -60,24 +56,26 @@
.breadcrumb-icon { display: inline list-item; + height: 16px; list-style-position: inside; fill: currentColor; -moz-context-properties: fill; }
-.breadcrumb-label { - margin-top: -1px; -} - .breadcrumb-item.active { - color: var(--in-content-accent-color-active); + color: var(--in-content-accent-color); }
-.breadcrumb-item.disabled, .breadcrumb-item.disabled:hover { - color: var(--green-90-a40); +.breadcrumb-item.disabled, .breadcrumb-item.disabled:hover, .breadcrumb-item.disabled:active { + color: var(--in-content-text-color); + opacity: 0.4; cursor: default; }
+.breadcrumb-item.disabled:hover, .breadcrumb-item.disabled:active { + background-color: var(--grey-20); +} + .breadcrumb-item.error { color: var(--in-content-danger-button-background); } @@ -94,8 +92,12 @@ display: none; }
-#connection-assist { - margin-left: 0; +#connect-to-tor { + margin-inline-start: 0; +} + +#connect-to-tor-icon { + list-style-image: url("chrome://browser/content/torconnect/onion.svg"); }
#connection-assist-icon { @@ -114,29 +116,24 @@ list-style-image: url("chrome://browser/content/torconnect/bridge.svg"); }
-button.primary { - background-color: var(--purple-60)!important; - color: white!important; - fill: white!important; -} - -button.primary:hover { - background-color: var(--purple-70)!important; - color: white!important; - fill: white!important; -} - -button.primary:active { - background-color: var(--purple-80)!important; - color: white!important; - fill: white!important; +button { + --in-content-primary-button-background: var(--purple-60); + --in-content-primary-button-background-hover: var(--purple-70); + --in-content-primary-button-background-active: var(--purple-80); + --in-content-focus-outline-color: var(--purple-60); + --in-content-primary-button-text-color: white; + fill: white; }
-div#locationDropdownLabel { +#locationDropdownLabel { margin-block: auto; margin-inline: 4px; }
+#locationDropdownLabel.error { + color: var(--in-content-danger-button-background) +} + /* this follows similar css in error-pages.css for buttons */ @media only screen and (min-width: 480px) { form#locationDropdown { @@ -277,7 +274,7 @@ body { fill: var(--onion-color); }
-.title.error { +.title.assit { background-image: url("chrome://browser/content/torconnect/connection-failure.svg"); }
diff --git a/browser/components/torconnect/content/aboutTorConnect.js b/browser/components/torconnect/content/aboutTorConnect.js index 30dfbd978315f..e525949c40d88 100644 --- a/browser/components/torconnect/content/aboutTorConnect.js +++ b/browser/components/torconnect/content/aboutTorConnect.js @@ -5,7 +5,6 @@ // populated in AboutTorConnect.init() let TorStrings = {}; let TorConnectState = {}; -let TorCensorshipLevel = {}; let InternetStatus = {};
const BreadcrumbStatus = Object.freeze({ @@ -29,15 +28,15 @@ class AboutTorConnect { }, breadcrumbs: { container: "#breadcrumbs", + connectToTor: { + link: "#connect-to-tor", + label: "#connect-to-tor .breadcrumb-label", + }, connectionAssist: { + separator: "#connection-assist-separator", link: "#connection-assist", label: "#connection-assist .breadcrumb-label", }, - locationSettings: { - separator: "#location-settings-separator", - link: "#location-settings", - label: "#location-settings .breadcrumb-label", - }, tryBridge: { separator: "#try-bridge-separator", link: "#try-bridge", @@ -59,10 +58,9 @@ class AboutTorConnect { cancel: "button#cancelButton", connect: "button#connectButton", tryBridge: "button#tryBridgeButton", - locationDropdownLabel: "div#locationDropdownLabel", + locationDropdownLabel: "#locationDropdownLabel", locationDropdown: "form#locationDropdown", locationDropdownSelect: "form#locationDropdown select", - tryAgain: "button#tryAgainButton", }, });
@@ -79,21 +77,21 @@ class AboutTorConnect { breadcrumbContainer: document.querySelector( this.selectors.breadcrumbs.container ), + connectToTorLink: document.querySelector( + this.selectors.breadcrumbs.connectToTor.link + ), + connectToTorLabel: document.querySelector( + this.selectors.breadcrumbs.connectToTor.label + ), + connectionAssistSeparator: document.querySelector( + this.selectors.breadcrumbs.connectionAssist.separator + ), connectionAssistLink: document.querySelector( this.selectors.breadcrumbs.connectionAssist.link ), connectionAssistLabel: document.querySelector( this.selectors.breadcrumbs.connectionAssist.label ), - locationSettingsSeparator: document.querySelector( - this.selectors.breadcrumbs.locationSettings.separator - ), - locationSettingsLink: document.querySelector( - this.selectors.breadcrumbs.locationSettings.link - ), - locationSettingsLabel: document.querySelector( - this.selectors.breadcrumbs.locationSettings.label - ), tryBridgeSeparator: document.querySelector( this.selectors.breadcrumbs.tryBridge.separator ), @@ -116,7 +114,6 @@ class AboutTorConnect { configureButton: document.querySelector(this.selectors.buttons.configure), cancelButton: document.querySelector(this.selectors.buttons.cancel), connectButton: document.querySelector(this.selectors.buttons.connect), - tryBridgeButton: document.querySelector(this.selectors.buttons.tryBridge), locationDropdownLabel: document.querySelector( this.selectors.buttons.locationDropdownLabel ), @@ -126,13 +123,21 @@ class AboutTorConnect { locationDropdownSelect: document.querySelector( this.selectors.buttons.locationDropdownSelect ), - tryAgainButton: document.querySelector(this.selectors.buttons.tryAgain), + tryBridgeButton: document.querySelector(this.selectors.buttons.tryBridge), });
// a redirect url can be passed as a query parameter for the page to // forward us to once bootstrap completes (otherwise the window will just close) redirect = null;
+ showNext = state => {}; + + allowAutomaticLocation = true; + + bootstrappingTitle = ""; + bootstrappingDescription = ""; + bootstrappingBreadcrumb = -1; + locations = {};
beginBootstrap() { @@ -147,6 +152,9 @@ class AboutTorConnect { this.hide(this.elements.tryBridgeButton); this.show(this.elements.cancelButton); this.elements.cancelButton.focus(); + if (countryCode === "automatic") { + countryCode = ""; + } RPMSendAsyncMessage("torconnect:begin-autobootstrap", countryCode); }
@@ -159,11 +167,7 @@ class AboutTorConnect { */
show(element, primary) { - if (primary) { - element.classList.add("primary"); - } else { - element.classList.remove("primary"); - } + element.classList.toggle("primary", primary !== undefined && primary); element.removeAttribute("hidden"); }
@@ -176,10 +180,9 @@ class AboutTorConnect { this.hide(this.elements.configureButton); this.hide(this.elements.cancelButton); this.hide(this.elements.connectButton); - this.hide(this.elements.tryBridgeButton); this.hide(this.elements.locationDropdownLabel); this.hide(this.elements.locationDropdown); - this.hide(this.elements.tryAgainButton); + this.hide(this.elements.tryBridgeButton); }
populateLocations() { @@ -205,14 +208,14 @@ class AboutTorConnect { ); }
- populateSpecialLocations(specialLocations) { - this.removeSpecialLocations(); - if (!specialLocations || !specialLocations.length) { + populateFrequentLocations(locations) { + this.removeFrequentLocations(); + if (!locations || !locations.length) { return; }
const locationNodes = []; - for (const code of specialLocations) { + for (const code of locations) { const option = document.createElement("option"); option.value = code; option.className = "frequent-location"; @@ -230,21 +233,24 @@ class AboutTorConnect { left.textContent.localeCompare(right.textContent) );
- const specialGroup = document.createElement("optgroup"); - specialGroup.setAttribute("label", TorStrings.torConnect.frequentLocations); - specialGroup.className = "frequent-location"; + const frequentGroup = document.createElement("optgroup"); + frequentGroup.setAttribute( + "label", + TorStrings.torConnect.frequentLocations + ); + frequentGroup.className = "frequent-location"; const locationGroup = document.createElement("optgroup"); locationGroup.setAttribute("label", TorStrings.torConnect.otherLocations); locationGroup.className = "frequent-location"; - // options[0] is "Select Country or Region" + // options[0] is either "Select Country or Region" or "Automatic" this.elements.locationDropdownSelect.options[0].after( - specialGroup, + frequentGroup, ...locationNodes, locationGroup ); }
- removeSpecialLocations() { + removeFrequentLocations() { const select = this.elements.locationDropdownSelect; for (const option of select.querySelectorAll(".frequent-location")) { option.remove(); @@ -257,20 +263,15 @@ class AboutTorConnect { selectedIndex ]; if (!selectedOption.value) { - this.elements.tryAgainButton.setAttribute("disabled", "disabled"); + this.elements.tryBridgeButton.setAttribute("disabled", "disabled"); } else { - this.elements.tryAgainButton.removeAttribute("disabled"); + this.elements.tryBridgeButton.removeAttribute("disabled"); } }
setTitle(title, className) { this.elements.titleText.textContent = title; - if (className !== "error") { - this.elements.title.classList.remove("error"); - } - if (className !== "location") { - this.elements.title.classList.remove("location"); - } + this.elements.title.className = "title"; if (className) { this.elements.title.classList.add(className); } @@ -292,14 +293,14 @@ class AboutTorConnect { } }
- setBreadcrumbsStatus(connectionAssist, locationSettings, tryBridge) { + setBreadcrumbsStatus(connectToTor, connectionAssist, tryBridge) { this.elements.breadcrumbContainer.classList.remove("hidden"); const elems = [ - [this.elements.connectionAssistLink, connectionAssist, null], + [this.elements.connectToTorLink, connectToTor, null], [ - this.elements.locationSettingsLink, - locationSettings, - this.elements.locationSettingsSeparator, + this.elements.connectionAssistLink, + connectionAssist, + this.elements.connectionAssistSeparator, ], [ this.elements.tryBridgeLink, @@ -336,118 +337,29 @@ class AboutTorConnect { /* Per-state updates */
update_Initial(state) { - const hasError = false; - const showProgressbar = false; - - this.setTitle(TorStrings.torConnect.torConnect, hasError ? "error" : ""); - this.setProgress( - TorStrings.settings.torPreferencesDescription, - showProgressbar - ); - this.hide(this.elements.quickstartContainer); - this.hide(this.elements.viewLogContainer); - this.hideButtons(); + this.showConnectToTor(state, false); }
update_Configuring(state) { - const hasError = state.ErrorMessage != null; - const showProgressbar = false; - this.hide(this.elements.quickstartContainer); this.hide(this.elements.viewLogContainer); this.hideButtons();
- if (hasError) { - if (state.InternetStatus === InternetStatus.Offline) { - this.showOffline(state.ErrorMessage); - return; - } - switch (state.DetectedCensorshipLevel) { - case TorCensorshipLevel.None: - // we shouldn't be able to get here - break; - case TorCensorshipLevel.Moderate: - // bootstrap failed once, offer auto bootstrap - this.showConnectionAssistant(state.ErrorDetails); - if (state.StateChanged) { - this.elements.tryBridgeButton.focus(); - } - break; - case TorCensorshipLevel.Severe: - // autobootstrap failed, verify correct location - this.showLocationSettings(state.CountryCodes, state.ErrorMessage); - if (state.StateChanged) { - this.elements.tryAgainButton.focus(); - } - break; - case TorCensorshipLevel.Extreme: - // finally offer to restart tor-browser or go to configure options - this.showFinalError(state); - break; - } + if (state.ErrorMessage === null) { + this.showConnectToTor(state, false); + } else if (state.InternetStatus === InternetStatus.Offline) { + this.showOffline(state.ErrorMessage); } else { - this.setTitle(TorStrings.torConnect.torConnect, ""); - this.setLongText(TorStrings.settings.torPreferencesDescription); - this.setProgress("", showProgressbar); - this.show(this.elements.quickstartContainer); - this.show(this.elements.configureButton); - this.show(this.elements.connectButton, true); - this.elements.connectButton.textContent = - TorStrings.torConnect.torConnectButton; - if (state.StateChanged) { - this.elements.connectButton.focus(); - } + this.showNext(state); } }
update_AutoBootstrapping(state) { - const showProgressbar = true; - - if (state.DetectedCensorshipLevel >= TorCensorshipLevel.Severe) { - this.setTitle(TorStrings.torConnect.tryingBridgeAgain, ""); - } else { - this.setTitle(TorStrings.torConnect.tryingBridge, ""); - } - this.showConfigureConnectionLink(TorStrings.torConnect.assistDescription); - this.setProgress( - state.BootstrapStatus, - showProgressbar, - state.BootstrapProgress - ); - this.setBreadcrumbsStatus( - BreadcrumbStatus.Disabled, - BreadcrumbStatus.Disabled, - BreadcrumbStatus.Active - ); - if (state.ShowViewLog) { - this.show(this.elements.viewLogContainer); - } else { - this.hide(this.elements.viewLogContainer); - } - this.hideButtons(); - this.show(this.elements.cancelButton, true); - if (state.StateChanged) { - this.elements.cancelButton.focus(); - } + this.showBootstrapping(state); }
update_Bootstrapping(state) { - const showProgressbar = true; - - this.setTitle(TorStrings.torConnect.torConnecting, ""); - this.setLongText(TorStrings.settings.torPreferencesDescription); - this.setProgress("", showProgressbar, state.BootstrapProgress); - this.hideBreadcrumbs(); - if (state.ShowViewLog) { - this.show(this.elements.viewLogContainer); - } else { - this.hide(this.elements.viewLogContainer); - } - this.hideButtons(); - this.show(this.elements.cancelButton, true); - if (state.StateChanged) { - this.elements.cancelButton.focus(); - } + this.showBootstrapping(state); }
update_Error(state) { @@ -479,6 +391,63 @@ class AboutTorConnect { // it isn't in use (eg using tor-launcher or system tor) }
+ showConnectToTor(state, tryAgain) { + this.setTitle(TorStrings.torConnect.torConnect, ""); + this.setLongText(TorStrings.settings.torPreferencesDescription); + this.setProgress("", false); + this.hideButtons(); + this.show(this.elements.quickstartContainer); + this.show(this.elements.configureButton); + this.show(this.elements.connectButton, true); + if (state?.StateChanged) { + this.elements.connectButton.focus(); + } + if (tryAgain) { + this.setBreadcrumbsStatus( + BreadcrumbStatus.Active, + BreadcrumbStatus.Default, + BreadcrumbStatus.Disabled + ); + this.elements.connectButton.textContent = TorStrings.torConnect.tryAgain; + } + this.bootstrappingDescription = + TorStrings.settings.torPreferencesDescription; + this.showNext = fromState => { + this.showConnectionAssistant(fromState.ErrorDetails); + if (fromState.StateChanged) { + this.elements.tryBridgeButton.focus(); + } + }; + } + + showBootstrapping(state) { + const showProgressbar = true; + this.setTitle(this.bootstrappingTitle, ""); + this.showConfigureConnectionLink(this.bootstrappingDescription); + this.setProgress("", showProgressbar, state.BootstrapProgress); + if (this.bootstrappingBreadcrumb < 0) { + this.hideBreadcrumbs(); + } else { + const breadcrumbs = [ + BreadcrumbStatus.Disabled, + BreadcrumbStatus.Disabled, + BreadcrumbStatus.Disabled, + ]; + breadcrumbs[this.bootstrappingBreadcrumb] = BreadcrumbStatus.Active; + this.setBreadcrumbsStatus(...breadcrumbs); + } + if (state.ShowViewLog) { + this.show(this.elements.viewLogContainer); + } else { + this.hide(this.elements.viewLogContainer); + } + this.hideButtons(); + this.show(this.elements.cancelButton, true); + if (state.StateChanged) { + this.elements.cancelButton.focus(); + } + } + showOffline(error) { this.setTitle(TorStrings.torConnect.noInternet, "error"); this.setLongText("Some long text from 🍩️"); @@ -494,24 +463,89 @@ class AboutTorConnect { this.elements.connectButton.textContent = TorStrings.torConnect.tryAgain; }
- showConnectionAssistant(error) { - const hasError = !!error; - this.setTitle( - TorStrings.torConnect.couldNotConnect, - hasError ? "error" : "" - ); + showConnectionAssistant(errorMessage) { + this.setTitle(TorStrings.torConnect.couldNotConnect, "assit"); this.showConfigureConnectionLink(TorStrings.torConnect.assistDescription); - this.setProgress(error, false); + this.setProgress(errorMessage, false); this.setBreadcrumbsStatus( + BreadcrumbStatus.Default, BreadcrumbStatus.Active, + BreadcrumbStatus.Disabled + ); + this.showLocationForm(false, TorStrings.torConnect.tryBridge); + this.bootstrappingBreadcrumb = 2; + this.bootstrappingTitle = TorStrings.torConnect.tryingBridge; + this.bootstrappingDescription = TorStrings.torConnect.assistDescription; + this.showNext = state => { + if (this.getLocation() === "automatic") { + this.showCannotLocate(state.ErrorMessage); + } else { + this.showLocationConfirmation(state.ErrorMessage); + } + if (state.StateChanged) { + this.elements.tryBridgeButton.focus(); + } + }; + } + + showCannotLocate(errorMessage) { + this.allowAutomaticLocation = false; + this.setTitle(TorStrings.torConnect.errorLocation, "location"); + this.showConfigureConnectionLink( + TorStrings.torConnect.errorLocationDescription + ); + this.setProgress(errorMessage, false); + this.setBreadcrumbsStatus( BreadcrumbStatus.Default, + BreadcrumbStatus.Active, BreadcrumbStatus.Disabled ); + this.showLocationForm(true, TorStrings.torConnect.tryBridge); + this.bootstrappingBreadcrumb = 2; + this.bootstrappingTitle = TorStrings.torConnect.tryingBridgeAgain; + this.bootstrappingDescription = + TorStrings.torConnect.errorLocationDescription; + this.showNext = state => { + this.showFinalError(state); + }; + } + + showLocationConfirmation(errorMessage) { + this.setTitle(TorStrings.torConnect.isLocationCorrect, "location"); + this.showConfigureConnectionLink( + TorStrings.torConnect.isLocationCorrectDescription + ); + this.setProgress(errorMessage, false); + this.setBreadcrumbsStatus( + BreadcrumbStatus.Default, + BreadcrumbStatus.Default, + BreadcrumbStatus.Active + ); + this.showLocationForm(true, TorStrings.torConnect.tryAgain); + this.bootstrappingBreadcrumb = 2; + this.bootstrappingTitle = TorStrings.torConnect.tryingBridgeAgain; + this.bootstrappingDescription = + TorStrings.torConnect.isLocationCorrectDescription; + this.showNext = state => { + this.showFinalError(state); + }; + } + + showFinalError(state) { + this.setTitle(TorStrings.torConnect.finalError, "error"); + this.setLongText(TorStrings.torConnect.finalErrorDescription); + this.setProgress(state ? state.ErrorDetails : "", false); + this.setBreadcrumbsStatus( + BreadcrumbStatus.Default, + BreadcrumbStatus.Default, + BreadcrumbStatus.Active + ); this.hideButtons(); - this.show(this.elements.configureButton); - this.show(this.elements.connectButton); - this.elements.connectButton.textContent = TorStrings.torConnect.tryAgain; - this.show(this.elements.tryBridgeButton, true); + this.show(this.elements.restartButton); + this.show(this.elements.configureButton, true); + this.showNext = fromState => { + this.showFinalError(fromState); + }; }
showConfigureConnectionLink(text) { @@ -523,76 +557,77 @@ class AboutTorConnect { e.preventDefault(); RPMSendAsyncMessage("torconnect:open-tor-preferences"); }); - this.setLongText(pieces[0], link, pieces[1]); - } - - showLocationSettings(locations, error) { - const hasError = !!error; - if (hasError) { - this.setTitle(TorStrings.torConnect.errorLocation, "location"); - this.setLongText(TorStrings.torConnect.errorLocationDescription); - this.setBreadcrumbsStatus( - BreadcrumbStatus.Disabled, - BreadcrumbStatus.Error, - BreadcrumbStatus.Disabled - ); - this.elements.tryAgainButton.textContent = TorStrings.torConnect.tryAgain; + if (pieces.length > 1) { + const first = pieces.shift(); + this.setLongText(first, link, ...pieces); } else { - this.setTitle(TorStrings.torConnect.addLocation, "location"); - this.showConfigureConnectionLink( - TorStrings.torConnect.addLocationDescription - ); - this.setBreadcrumbsStatus( - BreadcrumbStatus.Default, - BreadcrumbStatus.Active, - BreadcrumbStatus.Disabled - ); - this.elements.tryAgainButton.textContent = - TorStrings.torConnect.tryBridge; + this.setLongText(text); } - this.setProgress(error, false); + } + + showLocationForm(isError, buttonLabel) { this.hideButtons(); - if (!locations || !locations.length) { - RPMSendQuery("torconnect:get-country-codes").then(codes => { - if (codes && codes.length) { - this.populateSpecialLocations(codes); - } - }); + RPMSendQuery("torconnect:get-country-codes").then(codes => { + if (codes && codes.length) { + this.populateFrequentLocations(codes); + } + }); + let firstOpt = this.elements.locationDropdownSelect.options[0]; + if (this.allowAutomaticLocation) { + firstOpt.value = "automatic"; + firstOpt.textContent = TorStrings.torConnect.automatic; } else { - this.populateSpecialLocations(locations); + firstOpt.value = ""; + firstOpt.textContent = TorStrings.torConnect.selectCountryRegion; } this.validateLocation(); this.show(this.elements.locationDropdownLabel); this.show(this.elements.locationDropdown); - this.show(this.elements.tryAgainButton, true); + this.elements.locationDropdownLabel.classList.toggle("error", isError); + this.show(this.elements.tryBridgeButton, true); + this.elements.tryBridgeButton.classList.toggle("danger-button", isError); + if (buttonLabel !== undefined) { + this.elements.tryBridgeButton.textContent = buttonLabel; + } }
- showFinalError(state) { - this.setTitle(TorStrings.torConnect.finalError, "error"); - this.setLongText(TorStrings.torConnect.finalErrorDescription); - this.setProgress(state ? state.ErrorDetails : "", false); - this.hideButtons(); - this.show(this.elements.restartButton); - this.show(this.elements.configureButton, true); + getLocation() { + const selectedIndex = this.elements.locationDropdownSelect.selectedIndex; + return this.elements.locationDropdownSelect.options[selectedIndex].value; }
initElements(direction) { document.documentElement.setAttribute("dir", direction);
+ this.bootstrappingTitle = TorStrings.torConnect.torConnecting; + + this.elements.connectToTorLink.addEventListener("click", event => { + if ( + this.elements.connectToTorLink.classList.contains( + BreadcrumbStatus.Active + ) + ) { + return; + } + this.showConnectToTor(null, true); + }); + this.elements.connectToTorLabel.textContent = + TorStrings.torConnect.torConnect; this.elements.connectionAssistLink.addEventListener("click", event => { - if (!this.elements.connectionAssistLink.classList.contains("disabled")) { - this.showConnectionAssistant(); + if ( + this.elements.connectionAssistLink.classList.contains( + BreadcrumbStatus.Active + ) || + this.elements.connectionAssistLink.classList.contains( + BreadcrumbStatus.Disabled + ) + ) { + return; } + this.showConnectionAssistant(); }); this.elements.connectionAssistLabel.textContent = TorStrings.torConnect.breadcrumbAssist; - this.elements.locationSettingsLink.addEventListener("click", event => { - if (!this.elements.connectionAssistLink.classList.contains("disabled")) { - this.showLocationSettings(); - } - }); - this.elements.locationSettingsLabel.textContent = - TorStrings.torConnect.breadcrumbLocation; this.elements.tryBridgeLabel.textContent = TorStrings.torConnect.breadcrumbTryBridge;
@@ -629,6 +664,13 @@ class AboutTorConnect { this.elements.connectButton.textContent = TorStrings.torConnect.torConnectButton; this.elements.connectButton.addEventListener("click", () => { + if ( + this.elements.connectButton.textContent === + TorStrings.torConnect.tryAgain + ) { + this.bootstrappingBreadcrumb = 0; + this.bootstrappingTitle = TorStrings.torConnect.tryingAgain; + } this.beginBootstrap(); });
@@ -637,23 +679,17 @@ class AboutTorConnect { this.validateLocation(); });
- this.elements.tryBridgeButton.textContent = TorStrings.torConnect.tryBridge; - this.elements.tryBridgeButton.addEventListener("click", () => { - this.beginAutoBootstrap(); - }); - this.elements.locationDropdownLabel.textContent = TorStrings.torConnect.yourLocation;
- this.elements.tryAgainButton.textContent = TorStrings.torConnect.tryAgain; - this.elements.tryAgainButton.setAttribute("disabled", "disabled"); - this.elements.tryAgainButton.addEventListener("click", () => { - let selectedIndex = this.elements.locationDropdownSelect.selectedIndex; - let selectedOption = this.elements.locationDropdownSelect.options[ - selectedIndex - ]; - - this.beginAutoBootstrap(selectedOption.value); + this.elements.tryBridgeButton.textContent = TorStrings.torConnect.tryBridge; + this.elements.tryBridgeButton.addEventListener("click", () => { + const value = this.getLocation(); + if (value === "automatic") { + this.beginAutoBootstrap(); + } else { + this.beginAutoBootstrap(value); + } }); }
@@ -692,7 +728,6 @@ class AboutTorConnect { // various constants TorStrings = Object.freeze(args.TorStrings); TorConnectState = Object.freeze(args.TorConnectState); - TorCensorshipLevel = Object.freeze(args.TorCensorshipLevel); InternetStatus = Object.freeze(args.InternetStatus); this.locations = args.CountryNames;
diff --git a/browser/components/torconnect/content/aboutTorConnect.xhtml b/browser/components/torconnect/content/aboutTorConnect.xhtml index 4bb5b31949a67..674029fdeda34 100644 --- a/browser/components/torconnect/content/aboutTorConnect.xhtml +++ b/browser/components/torconnect/content/aboutTorConnect.xhtml @@ -10,13 +10,13 @@ <div id="progressBackground"></div> <div id="connectPageContainer" class="container"> <div id="breadcrumbs" class="hidden"> - <span id="connection-assist" class="breadcrumb-item"> - <span id="connection-assist-icon" class="breadcrumb-icon" /> + <span id="connect-to-tor" class="breadcrumb-item"> + <span id="connect-to-tor-icon" class="breadcrumb-icon" /> <span class="breadcrumb-label"/> </span> - <span id="location-settings-separator" class="breadcrumb-separator breadcrumb-icon" /> - <span id="location-settings" class="breadcrumb-item"> - <span id="location-settings-icon" class="breadcrumb-icon" /> + <span id="connection-assist-separator" class="breadcrumb-separator breadcrumb-icon" /> + <span id="connection-assist" class="breadcrumb-item"> + <span id="connection-assist-icon" class="breadcrumb-icon" /> <span class="breadcrumb-label"/> </span> <span id="try-bridge-separator" class="breadcrumb-separator breadcrumb-icon" /> @@ -50,13 +50,12 @@ <button id="configureButton" hidden="true"></button> <button id="cancelButton" hidden="true"></button> <button id="connectButton" class="primary" hidden="true"></button> - <button id="tryBridgeButton" class="primary" hidden="true"></button> - <div id="locationDropdownLabel"/> + <label id="locationDropdownLabel" for="countries"/> <form id="locationDropdown" hidden="true"> <select id="countries"> </select> </form> - <button id="tryAgainButton" class="primary" hidden="true"></button> + <button id="tryBridgeButton" class="primary" hidden="true"></button> </div> </div> </div> diff --git a/browser/components/torconnect/content/globe.svg b/browser/components/torconnect/content/globe.svg deleted file mode 100644 index f4d1f19b43ce8..0000000000000 --- a/browser/components/torconnect/content/globe.svg +++ /dev/null @@ -1,4 +0,0 @@ -<?xml version="1.0" encoding="UTF-8" standalone="no"?> -<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg"> - <path d="M8 0.5C6.01088 0.5 4.10322 1.29018 2.6967 2.6967C1.29018 4.10322 0.5 6.01088 0.5 8C0.5 9.98912 1.29018 11.8968 2.6967 13.3033C4.10322 14.7098 6.01088 15.5 8 15.5C9.98912 15.5 11.8968 14.7098 13.3033 13.3033C14.7098 11.8968 15.5 9.98912 15.5 8C15.5 6.01088 14.7098 4.10322 13.3033 2.6967C11.8968 1.29018 9.98912 0.5 8 0.5ZM10.447 2.25C11.4738 2.69088 12.3637 3.39877 13.0242 4.30006C13.6848 5.20135 14.0918 6.26313 14.203 7.375H11.974C11.8509 5.51288 11.1778 3.72922 10.04 2.25H10 [...] -</svg> diff --git a/browser/components/torconnect/jar.mn b/browser/components/torconnect/jar.mn index 8ca0b0651523e..043bd1435cda5 100644 --- a/browser/components/torconnect/jar.mn +++ b/browser/components/torconnect/jar.mn @@ -5,7 +5,6 @@ browser.jar: content/browser/torconnect/aboutTorConnect.js (content/aboutTorConnect.js) content/browser/torconnect/arrow-right.svg (content/arrow-right.svg) content/browser/torconnect/bridge.svg (content/bridge.svg) - content/browser/torconnect/globe.svg (content/globe.svg) content/browser/torconnect/connection-failure.svg (content/connection-failure.svg) content/browser/torconnect/connection-location.svg (content/connection-location.svg) content/browser/torconnect/onion.svg (content/onion.svg)
This is an automated email from the git hooks/post-receive script.
richard pushed a commit to branch tor-browser-91.9.0esr-11.5-1 in repository tor-browser.
commit 958d5920c36b07b5db2e7e1a2b871848f2a72bc6 Author: Pier Angelo Vendrame pierov@torproject.org AuthorDate: Wed Apr 13 09:07:24 2022 +0200
fixup! fixup! Bug 40597: Implement TorSettings module
Removed the "detected censorship level", as the UI now manages states on its own. --- browser/modules/TorConnect.jsm | 40 ++++++++++------------------------------ 1 file changed, 10 insertions(+), 30 deletions(-)
diff --git a/browser/modules/TorConnect.jsm b/browser/modules/TorConnect.jsm index a9d4c01086dc9..4e7d99ac93c80 100644 --- a/browser/modules/TorConnect.jsm +++ b/browser/modules/TorConnect.jsm @@ -1,6 +1,6 @@ "use strict";
-var EXPORTED_SYMBOLS = ["InternetStatus", "TorConnect", "TorConnectTopics", "TorConnectState", "TorCensorshipLevel"]; +var EXPORTED_SYMBOLS = ["InternetStatus", "TorConnect", "TorConnectTopics", "TorConnectState"];
const { Services } = ChromeUtils.import( "resource://gre/modules/Services.jsm" @@ -61,17 +61,6 @@ const TorConnectState = Object.freeze({ Disabled: "Disabled", });
-const TorCensorshipLevel = Object.freeze({ - /* No censorship detected */ - None: 0, - /* Moderate censorship detected, autobootstrap may evade it */ - Moderate: 1, - /* Severe censorship detected, but connection may still succeed */ - Severe: 2, - /* Extreme censorship detected, connection will always end in an error */ - Extreme: 3, -}); - /* TorConnect State Transitions
@@ -319,7 +308,6 @@ const TorConnect = (() => { _state: TorConnectState.Initial, _bootstrapProgress: 0, _bootstrapStatus: null, - _detectedCensorshipLevel: TorCensorshipLevel.None, _internetStatus: InternetStatus.Unknown, // list of country codes Moat has settings for _countryCodes: [], @@ -335,6 +323,7 @@ const TorConnect = (() => { _errorMessage: null, _errorDetails: null, _logHasWarningOrError: false, + _hasBootstrapEverFailed: false, _transitionPromise: null,
/* These functions represent ongoing work associated with one of our states @@ -383,17 +372,13 @@ const TorConnect = (() => { [TorConnectState.Bootstrapping, new StateCallback(TorConnectState.Bootstrapping, async function() { // wait until bootstrap completes or we get an error await new Promise(async (resolve, reject) => { - - // we reset the bootstrap failure count so users can manually try settings without the - // censorship circumvention state machine getting in the way - TorConnect._detectedCensorshipLevel = TorCensorshipLevel.None; - // debug hook to simulate censorship preventing bootstrapping if (Services.prefs.getIntPref(TorConnectPrefs.censorship_level, 0) > 0) { this.on_transition = (nextState) => { resolve(); }; await debug_sleep(1500); + TorConnect._hasBootstrapEverFailed = true; TorConnect._changeState(TorConnectState.Error, "Bootstrap failed (for debugging purposes)", "Error: Censorship simulation", true); TorProtocolService._torBootstrapDebugSetError(); return; @@ -405,7 +390,6 @@ const TorConnect = (() => { let bootstrapError = ""; let bootstrapErrorDetails = ""; const maybeTransitionToError = () => { - console.log("TorConnect: maybe transition!", internetTest.status, internetTest.error, bootstrapError); if (internetTest.status === InternetStatus.Unknown && internetTest.error === null) { // We have been called by a failed bootstrap, but the internet test has not run yet - force // it to run immediately! @@ -422,6 +406,7 @@ const TorConnect = (() => { TorConnect._changeState(TorConnectState.Error, TorStrings.torConnect.offline, "", true); } else { // Give priority to the bootstrap error, in case the Internet test fails + TorConnect._hasBootstrapEverFailed = true; TorConnect._changeState(TorConnectState.Error, bootstrapError, bootstrapErrorDetails, true); } } @@ -451,7 +436,6 @@ const TorConnect = (() => {
internetTest.onResult = (status, date) => { // TODO: Use the date to save the clock skew? - console.log("TorConnect: Internet test", status, date); TorConnect._internetStatus = status; maybeTransitionToError(); }; @@ -479,7 +463,7 @@ const TorConnect = (() => { // always fail even after manually selecting location specific settings if (censorshipLevel == 3) { await debug_sleep(2500); - TorConnect._changeState(TorConnectState.Error, "Error: Extreme Censorship simulation", "", true); + TorConnect._changeState(TorConnectState.Error, "Error: censorship simulation", "", true); return; // only fail after auto selecting, manually selecting succeeds } else if (censorshipLevel == 2 && !countryCode) { @@ -607,11 +591,7 @@ const TorConnect = (() => { TorConnect._errorMessage = errorMessage; TorConnect._errorDetails = errorDetails;
- if (bootstrappingFailure && TorConnect._detectedCensorshipLevel < TorCensorshipLevel.Extreme) { - TorConnect._detectedCensorshipLevel += 1; - } - - Services.obs.notifyObservers({message: errorMessage, details: errorDetails, censorshipLevel: TorConnect.detectedCensorshipLevel}, TorConnectTopics.BootstrapError); + Services.obs.notifyObservers({message: errorMessage, details: errorDetails}, TorConnectTopics.BootstrapError);
TorConnect._changeState(TorConnectState.Configuring); }); @@ -745,10 +725,6 @@ const TorConnect = (() => { return this._bootstrapStatus; },
- get detectedCensorshipLevel() { - return this._detectedCensorshipLevel; - }, - get internetStatus() { return this._internetStatus; }, @@ -765,6 +741,10 @@ const TorConnect = (() => { return this._logHasWarningOrError; },
+ get hasBootstrapEverFailed() { + return this._hasBootstrapEverFailed; + }, + get countryCodes() { return this._countryCodes; },
This is an automated email from the git hooks/post-receive script.
richard pushed a commit to branch tor-browser-91.9.0esr-11.5-1 in repository tor-browser.
commit e6082a8a67ec709ce3d945ca002366957b7665b6 Author: Pier Angelo Vendrame pierov@torproject.org AuthorDate: Wed Apr 13 09:46:56 2022 +0200
fixup! squash! Bug 31286: Implementation of bridge, proxy, and firewall settings in about:preferences#connection
Use the new property hasBootstrapEverFailed to detect when to show the potentially blocked status for Tor. --- browser/components/torpreferences/content/connectionPane.js | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/browser/components/torpreferences/content/connectionPane.js b/browser/components/torpreferences/content/connectionPane.js index 1562e9c780747..2f2cf2df270ca 100644 --- a/browser/components/torpreferences/content/connectionPane.js +++ b/browser/components/torpreferences/content/connectionPane.js @@ -280,9 +280,7 @@ const gConnectionPane = (function() { if (TorConnect.state === TorConnectState.Bootstrapped) { torIcon.className = "connected"; torStatus.textContent = TorStrings.settings.statusTorConnected; - } else if ( - TorConnect.detectedCensorshipLevel > TorCensorshipLevel.None - ) { + } else if (TorConnect.hasBootstrapEverFailed) { torIcon.className = "blocked"; torStatus.textContent = TorStrings.settings.statusTorBlocked; } else {
This is an automated email from the git hooks/post-receive script.
richard pushed a commit to branch tor-browser-91.9.0esr-11.5-1 in repository tor-browser.
commit 23c8b99580272f4e855a68287810ffa97aa76ccc Author: Pier Angelo Vendrame pierov@torproject.org AuthorDate: Wed Apr 13 20:52:13 2022 +0200
fixup! fixup! Bug 40597: Implement TorSettings module
Added a helper on TorConnect to make about:torconnect UI state persistent. --- browser/modules/TorConnect.jsm | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-)
diff --git a/browser/modules/TorConnect.jsm b/browser/modules/TorConnect.jsm index 4e7d99ac93c80..6b501209d844e 100644 --- a/browser/modules/TorConnect.jsm +++ b/browser/modules/TorConnect.jsm @@ -326,6 +326,10 @@ const TorConnect = (() => { _hasBootstrapEverFailed: false, _transitionPromise: null,
+ // This is used as a helper to make the state of about:torconnect persistent + // during a session, but TorConnect does not use this data at all. + _uiState: {}, + /* These functions represent ongoing work associated with one of our states Some of these functions are mostly empty, apart from defining an on_transition function used to resolve their Promise */ @@ -729,6 +733,14 @@ const TorConnect = (() => { return this._internetStatus; },
+ get countryCodes() { + return this._countryCodes; + }, + + get countryNames() { + return this._countryNames; + }, + get errorMessage() { return this._errorMessage; }, @@ -745,12 +757,11 @@ const TorConnect = (() => { return this._hasBootstrapEverFailed; },
- get countryCodes() { - return this._countryCodes; + get uiState() { + return this._uiState; }, - - get countryNames() { - return this._countryNames; + set uiState(newState) { + this._uiState = newState; },
/*
This is an automated email from the git hooks/post-receive script.
richard pushed a commit to branch tor-browser-91.9.0esr-11.5-1 in repository tor-browser.
commit 6a61028e16fc04260551649360ae878549f0b733 Author: Pier Angelo Vendrame pierov@torproject.org AuthorDate: Thu Apr 14 11:55:13 2022 +0200
fixup! squash! Bug 27476: Implement about:torconnect captive portal within Tor Browser
Reworked how the UI states are managed and shown. Also, the UI state is saved to TorConnect, so that reloading the page or opening it in another tab/window shows the same state. Syncrhonize the breadcrumb and location changes. --- browser/components/torconnect/TorConnectParent.jsm | 25 ++ .../torconnect/content/aboutTorConnect.css | 2 +- .../torconnect/content/aboutTorConnect.js | 309 +++++++++++++-------- toolkit/modules/RemotePageAccessManager.jsm | 7 +- 4 files changed, 229 insertions(+), 114 deletions(-)
diff --git a/browser/components/torconnect/TorConnectParent.jsm b/browser/components/torconnect/TorConnectParent.jsm index 528f48392880b..95eb9c975c7d5 100644 --- a/browser/components/torconnect/TorConnectParent.jsm +++ b/browser/components/torconnect/TorConnectParent.jsm @@ -14,6 +14,8 @@ const { TorSettings, TorSettingsTopics, TorSettingsData } = ChromeUtils.import( "resource:///modules/TorSettings.jsm" );
+const BroadcastTopic = "about-torconnect:broadcast"; + /* This object is basically a marshalling interface between the TorConnect module and a particular about:torconnect page @@ -28,6 +30,7 @@ class TorConnectParent extends JSWindowActorParent { this.state = { State: TorConnect.state, StateChanged: false, + PreviousState: TorConnectState.Initial, ErrorMessage: TorConnect.errorMessage, ErrorDetails: TorConnect.errorDetails, BootstrapProgress: TorConnect.bootstrapProgress, @@ -35,6 +38,7 @@ class TorConnectParent extends JSWindowActorParent { InternetStatus: TorConnect.internetStatus, ShowViewLog: TorConnect.logHasWarningOrError, QuickStartEnabled: TorSettings.quickstart.enabled, + UIState: TorConnect.uiState, };
// JSWindowActiveParent derived objects cannot observe directly, so create a member @@ -52,6 +56,7 @@ class TorConnectParent extends JSWindowActorParent { self.state.StateChanged = false; switch (aTopic) { case TorConnectTopics.StateChange: { + self.state.PreviousState = self.state.State; self.state.State = obj.state; self.state.StateChanged = true;
@@ -110,6 +115,17 @@ class TorConnectParent extends JSWindowActorParent { this.torConnectObserver, TorSettingsTopics.SettingChanged ); + + this.userActionObserver = { + observe(aSubject, aTopic, aData) { + let obj = aSubject?.wrappedJSObject; + if (obj) { + obj.connState = self.state; + self.sendAsyncMessage("torconnect:user-action", obj); + } + }, + }; + Services.obs.addObserver(this.userActionObserver, BroadcastTopic); }
willDestroy() { @@ -122,6 +138,7 @@ class TorConnectParent extends JSWindowActorParent { this.torConnectObserver, TorSettingsTopics.SettingChanged ); + Services.obs.addObserver(this.userActionObserver, BroadcastTopic); }
async receiveMessage(message) { @@ -150,12 +167,20 @@ class TorConnectParent extends JSWindowActorParent { Ci.nsIAppStartup.eRestart | Ci.nsIAppStartup.eAttemptQuit ); break; + case "torconnect:set-ui-state": + TorConnect.uiState = message.data; + this.state.UIState = TorConnect.uiState; + break; + case "torconnect:broadcast-user-action": + Services.obs.notifyObservers(message.data, BroadcastTopic); + break; case "torconnect:get-init-args": // called on AboutTorConnect.init(), pass down all state data it needs to init
// pretend this is a state transition on init // so we always get fresh UI this.state.StateChanged = true; + this.state.UIState = TorConnect.uiState; return { TorStrings, TorConnectState, diff --git a/browser/components/torconnect/content/aboutTorConnect.css b/browser/components/torconnect/content/aboutTorConnect.css index 7f7d75010e82e..41cfe2bb80c70 100644 --- a/browser/components/torconnect/content/aboutTorConnect.css +++ b/browser/components/torconnect/content/aboutTorConnect.css @@ -274,7 +274,7 @@ body { fill: var(--onion-color); }
-.title.assit { +.title.offline, .title.assit, .title.final { background-image: url("chrome://browser/content/torconnect/connection-failure.svg"); }
diff --git a/browser/components/torconnect/content/aboutTorConnect.js b/browser/components/torconnect/content/aboutTorConnect.js index e525949c40d88..506b125e8b98f 100644 --- a/browser/components/torconnect/content/aboutTorConnect.js +++ b/browser/components/torconnect/content/aboutTorConnect.js @@ -7,6 +7,15 @@ let TorStrings = {}; let TorConnectState = {}; let InternetStatus = {};
+const UIStates = Object.freeze({ + ConnectToTor: "ConnectToTor", + Offline: "Offline", + ConnectionAssist: "ConnectionAssist", + CouldNotLocate: "CouldNotLocate", + LocationConfirm: "LocationConfirm", + FinalError: "FinalError", +}); + const BreadcrumbStatus = Object.freeze({ Hidden: "hidden", Disabled: "disabled", @@ -130,28 +139,34 @@ class AboutTorConnect { // forward us to once bootstrap completes (otherwise the window will just close) redirect = null;
- showNext = state => {}; - - allowAutomaticLocation = true; - - bootstrappingTitle = ""; - bootstrappingDescription = ""; - bootstrappingBreadcrumb = -1; + uiState = { + currentState: UIStates.ConnectToTor, + connectIsTryAgain: false, + allowAutomaticLocation: true, + selectedLocation: "automatic", + bootstrapCause: UIStates.ConnectToTor, + };
locations = {};
+ constructor() { + this.uiStates = Object.freeze( + Object.fromEntries([ + [UIStates.ConnectToTor, this.showConnectToTor.bind(this)], + [UIStates.Offline, this.showOffline.bind(this)], + [UIStates.ConnectionAssist, this.showConnectionAssistant.bind(this)], + [UIStates.CouldNotLocate, this.showCouldNotLocate.bind(this)], + [UIStates.LocationConfirm, this.showLocationConfirmation.bind(this)], + [UIStates.FinalError, this.showFinalError.bind(this)], + ]) + ); + } + beginBootstrap() { - this.hide(this.elements.connectButton); - this.hide(this.elements.quickstartContainer); - this.show(this.elements.cancelButton); - this.elements.cancelButton.focus(); RPMSendAsyncMessage("torconnect:begin-bootstrap"); }
beginAutoBootstrap(countryCode) { - this.hide(this.elements.tryBridgeButton); - this.show(this.elements.cancelButton); - this.elements.cancelButton.focus(); if (countryCode === "automatic") { countryCode = ""; } @@ -162,6 +177,18 @@ class AboutTorConnect { RPMSendAsyncMessage("torconnect:cancel-bootstrap"); }
+ transitionUIState(nextState, connState) { + if (nextState !== this.uiState.currentState) { + this.uiState.currentState = nextState; + this.saveUIState(); + } + this.uiStates[nextState](connState); + } + + saveUIState() { + RPMSendAsyncMessage("torconnect:set-ui-state", this.uiState); + } + /* Element helper methods */ @@ -176,6 +203,7 @@ class AboutTorConnect { }
hideButtons() { + this.hide(this.elements.quickstartContainer); this.hide(this.elements.restartButton); this.hide(this.elements.configureButton); this.hide(this.elements.cancelButton); @@ -337,20 +365,17 @@ class AboutTorConnect { /* Per-state updates */
update_Initial(state) { - this.showConnectToTor(state, false); + this.showConnectToTor(state); }
update_Configuring(state) { - this.hide(this.elements.quickstartContainer); - this.hide(this.elements.viewLogContainer); - this.hideButtons(); - - if (state.ErrorMessage === null) { - this.showConnectToTor(state, false); - } else if (state.InternetStatus === InternetStatus.Offline) { - this.showOffline(state.ErrorMessage); - } else { - this.showNext(state); + if ( + state.StateChanged && + (state.PreviousState === TorConnectState.Bootstrapping || + state.PreviousState === TorConnectState.AutoBootstrapping) + ) { + // The bootstrap has been cancelled + this.transitionUIState(this.uiState.bootstrapCause, state); } }
@@ -363,13 +388,36 @@ class AboutTorConnect { }
update_Error(state) { - const showProgressbar = false; - - this.setTitle(state.ErrorMessage, "error"); - this.setLongText(""); - this.setProgress(state.ErrorDetails, showProgressbar); - this.hideButtons(); - this.show(this.elements.viewLogContainer); + if (!this.uiState.connectIsTryAgain) { + // TorConnect.hasBootstrapEverFailed remains false in case of Internet + // offline + this.uiState.connectIsTryAgain = true; + this.saveUIState(); + } + if (!state.StateChanged) { + return; + } + if (state.InternetStatus === InternetStatus.Offline) { + this.transitionUIState(UIStates.Offline, state); + } else if (state.PreviousState === TorConnectState.Bootstrapping) { + 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 + ); + } else { + this.transitionUIState(UIStates.FinalError, state); + } + } else { + console.error( + "We received an error starting from an unexpected state", + state + ); + } }
update_Bootstrapped(state) { @@ -391,10 +439,11 @@ class AboutTorConnect { // it isn't in use (eg using tor-launcher or system tor) }
- showConnectToTor(state, tryAgain) { + showConnectToTor(state) { this.setTitle(TorStrings.torConnect.torConnect, ""); this.setLongText(TorStrings.settings.torPreferencesDescription); this.setProgress("", false); + this.hide(this.elements.viewLogContainer); this.hideButtons(); this.show(this.elements.quickstartContainer); this.show(this.elements.configureButton); @@ -402,7 +451,7 @@ class AboutTorConnect { if (state?.StateChanged) { this.elements.connectButton.focus(); } - if (tryAgain) { + if (this.uiState.connectIsTryAgain) { this.setBreadcrumbsStatus( BreadcrumbStatus.Active, BreadcrumbStatus.Default, @@ -410,38 +459,53 @@ class AboutTorConnect { ); this.elements.connectButton.textContent = TorStrings.torConnect.tryAgain; } - this.bootstrappingDescription = - TorStrings.settings.torPreferencesDescription; - this.showNext = fromState => { - this.showConnectionAssistant(fromState.ErrorDetails); - if (fromState.StateChanged) { - this.elements.tryBridgeButton.focus(); - } - }; + this.uiState.bootstrapCause = UIStates.ConnectToTor; + this.saveUIState(); }
showBootstrapping(state) { const showProgressbar = true; - this.setTitle(this.bootstrappingTitle, ""); - this.showConfigureConnectionLink(this.bootstrappingDescription); - this.setProgress("", showProgressbar, state.BootstrapProgress); - if (this.bootstrappingBreadcrumb < 0) { - this.hideBreadcrumbs(); - } else { - const breadcrumbs = [ - BreadcrumbStatus.Disabled, - BreadcrumbStatus.Disabled, - BreadcrumbStatus.Disabled, - ]; - breadcrumbs[this.bootstrappingBreadcrumb] = BreadcrumbStatus.Active; - this.setBreadcrumbsStatus(...breadcrumbs); + let title = ""; + let description = ""; + const breadcrumbs = [ + BreadcrumbStatus.Disabled, + BreadcrumbStatus.Disabled, + BreadcrumbStatus.Disabled, + ]; + switch (this.uiState.bootstrapCause) { + case UIStates.ConnectToTor: + breadcrumbs[0] = BreadcrumbStatus.Active; + title = this.uiState.connectIsTryAgain + ? TorStrings.torConnect.tryAgain + : TorStrings.torConnect.torConnecting; + description = TorStrings.settings.torPreferencesDescription; + break; + case UIStates.ConnectionAssist: + breadcrumbs[2] = BreadcrumbStatus.Active; + title = TorStrings.torConnect.tryingBridge; + description = TorStrings.torConnect.assistDescription; + break; + case UIStates.CouldNotLocate: + breadcrumbs[2] = BreadcrumbStatus.Active; + title = TorStrings.torConnect.tryingBridgeAgain; + description = TorStrings.torConnect.errorLocationDescription; + break; + case UIStates.LocationConfirm: + breadcrumbs[2] = BreadcrumbStatus.Active; + title = TorStrings.torConnect.tryingBridgeAgain; + description = TorStrings.torConnect.isLocationCorrectDescription; + break; } + this.setTitle(title, ""); + this.showConfigureConnectionLink(description); + this.setProgress("", showProgressbar, state.BootstrapProgress); + this.setBreadcrumbsStatus(...breadcrumbs); + this.hideButtons(); if (state.ShowViewLog) { this.show(this.elements.viewLogContainer); } else { this.hide(this.elements.viewLogContainer); } - this.hideButtons(); this.show(this.elements.cancelButton, true); if (state.StateChanged) { this.elements.cancelButton.focus(); @@ -449,7 +513,7 @@ class AboutTorConnect { }
showOffline(error) { - this.setTitle(TorStrings.torConnect.noInternet, "error"); + this.setTitle(TorStrings.torConnect.noInternet, "offline"); this.setLongText("Some long text from 🍩️"); this.setProgress(error, false); this.setBreadcrumbsStatus( @@ -457,82 +521,73 @@ class AboutTorConnect { BreadcrumbStatus.Active, BreadcrumbStatus.Hidden ); + this.show(this.elements.viewLogContainer); this.hideButtons(); this.show(this.elements.configureButton); this.show(this.elements.connectButton, true); this.elements.connectButton.textContent = TorStrings.torConnect.tryAgain; }
- showConnectionAssistant(errorMessage) { + showConnectionAssistant(state) { this.setTitle(TorStrings.torConnect.couldNotConnect, "assit"); this.showConfigureConnectionLink(TorStrings.torConnect.assistDescription); - this.setProgress(errorMessage, false); + this.setProgress(state?.ErrorDetails, false); this.setBreadcrumbsStatus( BreadcrumbStatus.Default, BreadcrumbStatus.Active, BreadcrumbStatus.Disabled ); this.showLocationForm(false, TorStrings.torConnect.tryBridge); - this.bootstrappingBreadcrumb = 2; - this.bootstrappingTitle = TorStrings.torConnect.tryingBridge; - this.bootstrappingDescription = TorStrings.torConnect.assistDescription; - this.showNext = state => { - if (this.getLocation() === "automatic") { - this.showCannotLocate(state.ErrorMessage); - } else { - this.showLocationConfirmation(state.ErrorMessage); - } - if (state.StateChanged) { - this.elements.tryBridgeButton.focus(); - } - }; + if (state?.StateChanged) { + this.elements.tryBridgeButton.focus(); + } + this.uiState.bootstrapCause = UIStates.ConnectionAssist; + this.saveUIState(); }
- showCannotLocate(errorMessage) { - this.allowAutomaticLocation = false; + showCouldNotLocate(state) { + this.uiState.allowAutomaticLocation = false; this.setTitle(TorStrings.torConnect.errorLocation, "location"); this.showConfigureConnectionLink( TorStrings.torConnect.errorLocationDescription ); - this.setProgress(errorMessage, false); + this.setProgress(state.ErrorMessage, false); this.setBreadcrumbsStatus( BreadcrumbStatus.Default, BreadcrumbStatus.Active, BreadcrumbStatus.Disabled ); + this.show(this.elements.viewLogContainer); this.showLocationForm(true, TorStrings.torConnect.tryBridge); - this.bootstrappingBreadcrumb = 2; - this.bootstrappingTitle = TorStrings.torConnect.tryingBridgeAgain; - this.bootstrappingDescription = - TorStrings.torConnect.errorLocationDescription; - this.showNext = state => { - this.showFinalError(state); - }; + if (state.StateChanged) { + this.elements.tryBridgeButton.focus(); + } + this.uiState.bootstrapCause = UIStates.CouldNotLocate; + this.saveUIState(); }
- showLocationConfirmation(errorMessage) { + showLocationConfirmation(state) { this.setTitle(TorStrings.torConnect.isLocationCorrect, "location"); this.showConfigureConnectionLink( TorStrings.torConnect.isLocationCorrectDescription ); - this.setProgress(errorMessage, false); + this.setProgress(state.ErrorMessage, false); this.setBreadcrumbsStatus( BreadcrumbStatus.Default, BreadcrumbStatus.Default, BreadcrumbStatus.Active ); + this.show(this.elements.viewLogContainer); this.showLocationForm(true, TorStrings.torConnect.tryAgain); - this.bootstrappingBreadcrumb = 2; - this.bootstrappingTitle = TorStrings.torConnect.tryingBridgeAgain; - this.bootstrappingDescription = - TorStrings.torConnect.isLocationCorrectDescription; - this.showNext = state => { - this.showFinalError(state); - }; + if (state.StateChanged) { + this.elements.tryBridgeButton.focus(); + } + this.uiState.bootstrapCause = UIStates.LocationConfirm; + this.saveUIState(); }
showFinalError(state) { - this.setTitle(TorStrings.torConnect.finalError, "error"); + this.setTitle(TorStrings.torConnect.finalError, "final"); this.setLongText(TorStrings.torConnect.finalErrorDescription); this.setProgress(state ? state.ErrorDetails : "", false); this.setBreadcrumbsStatus( @@ -543,9 +598,6 @@ class AboutTorConnect { this.hideButtons(); this.show(this.elements.restartButton); this.show(this.elements.configureButton, true); - this.showNext = fromState => { - this.showFinalError(fromState); - }; }
showConfigureConnectionLink(text) { @@ -570,16 +622,18 @@ class AboutTorConnect { RPMSendQuery("torconnect:get-country-codes").then(codes => { if (codes && codes.length) { this.populateFrequentLocations(codes); + this.setLocationFromState(); } }); let firstOpt = this.elements.locationDropdownSelect.options[0]; - if (this.allowAutomaticLocation) { + if (this.uiState.allowAutomaticLocation) { firstOpt.value = "automatic"; firstOpt.textContent = TorStrings.torConnect.automatic; } else { firstOpt.value = ""; firstOpt.textContent = TorStrings.torConnect.selectCountryRegion; } + this.setLocationFromState(); this.validateLocation(); this.show(this.elements.locationDropdownLabel); this.show(this.elements.locationDropdown); @@ -596,20 +650,34 @@ class AboutTorConnect { return this.elements.locationDropdownSelect.options[selectedIndex].value; }
+ setLocationFromState() { + if (this.getLocation() === this.uiState.selectedLocation) { + return; + } + const options = this.elements.locationDropdownSelect.options; + // We need to do this way, because we have repeated values that break + // 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) { + this.elements.locationDropdownSelect.selectedIndex = i; + break; + } + } + this.validateLocation(); + } + initElements(direction) { document.documentElement.setAttribute("dir", direction);
- this.bootstrappingTitle = TorStrings.torConnect.torConnecting; - this.elements.connectToTorLink.addEventListener("click", event => { - if ( - this.elements.connectToTorLink.classList.contains( - BreadcrumbStatus.Active - ) - ) { + if (this.uiState.currentState === UIStates.ConnectToTor) { return; } - this.showConnectToTor(null, true); + this.transitionUIState(UIStates.ConnectToTor, null); + RPMSendAsyncMessage("torconnect:broadcast-user-action", { + uiState: UIStates.ConnectToTor, + }); }); this.elements.connectToTorLabel.textContent = TorStrings.torConnect.torConnect; @@ -624,7 +692,10 @@ class AboutTorConnect { ) { return; } - this.showConnectionAssistant(); + this.transitionUIState(UIStates.ConnectionAssist, null); + RPMSendAsyncMessage("torconnect:broadcast-user-action", { + uiState: UIStates.ConnectionAssist, + }); }); this.elements.connectionAssistLabel.textContent = TorStrings.torConnect.breadcrumbAssist; @@ -664,19 +735,17 @@ class AboutTorConnect { this.elements.connectButton.textContent = TorStrings.torConnect.torConnectButton; this.elements.connectButton.addEventListener("click", () => { - if ( - this.elements.connectButton.textContent === - TorStrings.torConnect.tryAgain - ) { - this.bootstrappingBreadcrumb = 0; - this.bootstrappingTitle = TorStrings.torConnect.tryingAgain; - } this.beginBootstrap(); });
this.populateLocations(); this.elements.locationDropdownSelect.addEventListener("change", () => { + this.uiState.selectedLocation = this.getLocation(); + this.saveUIState(); this.validateLocation(); + RPMSendAsyncMessage("torconnect:broadcast-user-action", { + location: this.uiState.selectedLocation, + }); });
this.elements.locationDropdownLabel.textContent = @@ -698,6 +767,15 @@ class AboutTorConnect { RPMAddMessageListener("torconnect:state-change", ({ data }) => { this.updateUI(data); }); + RPMAddMessageListener("torconnect:user-action", ({ data }) => { + if (data.location) { + this.uiState.selectedLocation = data.location; + this.setLocationFromState(); + } + if (data.uiState !== undefined) { + this.transitionUIState(data.uiState, data.connState); + } + }); }
initKeyboardShortcuts() { @@ -735,6 +813,13 @@ class AboutTorConnect { this.initObservers(); this.initKeyboardShortcuts();
+ if (Object.keys(args.State.UIState).length) { + this.uiState = args.State.UIState; + } else { + args.State.UIState = this.uiState; + this.saveUIState(); + } + this.uiStates[this.uiState.currentState](args.State); // populate UI based on current state this.updateUI(args.State); } diff --git a/toolkit/modules/RemotePageAccessManager.jsm b/toolkit/modules/RemotePageAccessManager.jsm index 5ddf546ce12de..c195ab688b236 100644 --- a/toolkit/modules/RemotePageAccessManager.jsm +++ b/toolkit/modules/RemotePageAccessManager.jsm @@ -220,7 +220,10 @@ let RemotePageAccessManager = { RPMSendQuery: ["FetchUpdateData"], }, "about:torconnect": { - RPMAddMessageListener: ["torconnect:state-change"], + RPMAddMessageListener: [ + "torconnect:state-change", + "torconnect:user-action", + ], RPMSendAsyncMessage: [ "torconnect:open-tor-preferences", "torconnect:begin-bootstrap", @@ -229,6 +232,8 @@ let RemotePageAccessManager = { "torconnect:set-quickstart", "torconnect:view-tor-logs", "torconnect:restart", + "torconnect:set-ui-state", + "torconnect:broadcast-user-action", ], RPMSendQuery: [ "torconnect:get-init-args",
This is an automated email from the git hooks/post-receive script.
richard pushed a commit to branch tor-browser-91.9.0esr-11.5-1 in repository tor-browser.
commit a417e67ee8f2a2aede55dcaf99a466a8caf2ca44 Author: Pier Angelo Vendrame pierov@torproject.org AuthorDate: Thu Apr 14 12:14:12 2022 +0200
fixup! squash! Bug 31286: Implementation of bridge, proxy, and firewall settings in about:preferences#connection
Bug 40893: use a lighter background for bridge-moji Bug 40894: switch the bridge line text to lighter colors --- browser/components/torpreferences/content/torPreferences.css | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/browser/components/torpreferences/content/torPreferences.css b/browser/components/torpreferences/content/torPreferences.css index 535baefbcbabb..0c74b00907631 100644 --- a/browser/components/torpreferences/content/torPreferences.css +++ b/browser/components/torpreferences/content/torPreferences.css @@ -233,7 +233,7 @@ html:dir(rtl) input[type="checkbox"].toggle-button::before { padding: 4px; font-size: 20px; border-radius: 4px; - background: var(--in-content-button-background-hover); + background: var(--in-content-box-background-odd); }
.torPreferences-bridgeCard-headingAddr { @@ -242,8 +242,9 @@ html:dir(rtl) input[type="checkbox"].toggle-button::before { width: 20px; flex: 1; margin: 0 8px; - white-space: nowrap; overflow: hidden; + color: var(--in-content-deemphasized-text); + white-space: nowrap; text-overflow: ellipsis; }
@@ -380,8 +381,9 @@ html:dir(rtl) input[type="checkbox"].toggle-button::before { margin: 8px 0; }
-.torPreferences-bridgeCard-addr { +input.torPreferences-bridgeCard-addr { width: 100%; + color: var(--in-content-deemphasized-text); }
.torPreferences-bridgeCard-leranMoreBox {
This is an automated email from the git hooks/post-receive script.
richard pushed a commit to branch tor-browser-91.9.0esr-11.5-1 in repository tor-browser.
commit bc8da424873fe0045fc2598cfe8e1a77b1e2d932 Author: Pier Angelo Vendrame pierov@torproject.org AuthorDate: Thu Apr 14 14:09:55 2022 +0200
fixup! squash! Bug 31286: Implementation of bridge, proxy, and firewall settings in about:preferences#connection
Bug 40895: expand bridge automatically if connected (or it is the only one) --- .../torpreferences/content/connectionPane.js | 11 +++++++--- .../torpreferences/content/torPreferences.css | 24 ++++++++++++++++++---- 2 files changed, 28 insertions(+), 7 deletions(-)
diff --git a/browser/components/torpreferences/content/connectionPane.js b/browser/components/torpreferences/content/connectionPane.js index 2f2cf2df270ca..552ddb85e8a83 100644 --- a/browser/components/torpreferences/content/connectionPane.js +++ b/browser/components/torpreferences/content/connectionPane.js @@ -367,9 +367,7 @@ const gConnectionPane = (function() { ) ); } - items.sort((left, right) => - left.label.localeCompare(right.label) - ); + items.sort((left, right) => left.label.localeCompare(right.label)); locationEntries.append(...items); }; locationEntries.append( @@ -449,6 +447,12 @@ const gConnectionPane = (function() { card.removeAttribute("id"); const grid = card.querySelector(selectors.bridges.cardQrGrid); card.addEventListener("click", e => { + if ( + card.classList.contains("currently-connected") || + bridgeCards.classList.contains("single-card") + ) { + return; + } let target = e.target; let apply = true; while (target !== null && target !== card && apply) { @@ -627,6 +631,7 @@ const gConnectionPane = (function() { bridgeCards.removeAttribute("hidden"); bridgeSwitch.checked = TorSettings.bridges.enabled; bridgeCards.classList.toggle("disabled", !TorSettings.bridges.enabled); + bridgeCards.classList.toggle("single-card", numBridges === 1);
let shownCards = 0; const toShow = this._currentBridgesExpanded diff --git a/browser/components/torpreferences/content/torPreferences.css b/browser/components/torpreferences/content/torPreferences.css index 0c74b00907631..02ad792e83161 100644 --- a/browser/components/torpreferences/content/torPreferences.css +++ b/browser/components/torpreferences/content/torPreferences.css @@ -205,9 +205,12 @@ html:dir(rtl) input[type="checkbox"].toggle-button::before { /* define border-radius here because of the transition */ border-radius: 4px; transition: margin var(--bridgeCard-animation-time), box-shadow 150ms; + cursor: pointer; }
-.torPreferences-bridgeCard.expanded { +.torPreferences-bridgeCard.expanded, +.torPreferences-bridgeCard.currently-connected, +.single-card .torPreferences-bridgeCard { margin: 12px 0; background: var(--in-content-box-background); box-shadow: var(--card-shadow); @@ -216,7 +219,11 @@ html:dir(rtl) input[type="checkbox"].toggle-button::before { .torPreferences-bridgeCard:hover { background: var(--in-content-box-background); box-shadow: var(--card-shadow-hover); - cursor: pointer; +} + +.single-card .torPreferences-bridgeCard, +.torPreferences-bridgeCard.currently-connected { + cursor: default; }
.torPreferences-bridgeCard-heading { @@ -248,7 +255,9 @@ html:dir(rtl) input[type="checkbox"].toggle-button::before { text-overflow: ellipsis; }
-.expanded .torPreferences-bridgeCard-headingAddr { +.expanded .torPreferences-bridgeCard-headingAddr, +.currently-connected .torPreferences-bridgeCard-headingAddr, +.single-card .torPreferences-bridgeCard-headingAddr { display: none; }
@@ -360,10 +369,17 @@ html:dir(rtl) input[type="checkbox"].toggle-button::before { visibility: hidden; }
-.expanded .torPreferences-bridgeCard-grid { +.expanded .torPreferences-bridgeCard-grid, +.currently-connected .torPreferences-bridgeCard-grid, +.single-card .torPreferences-bridgeCard-grid { visibility: visible; }
+.currently-connected .torPreferences-bridgeCard-grid, +.single-card .torPreferences-bridgeCard-grid { + height: auto; +} + .torPreferences-bridgeCard-grid.to-animate { transition: height var(--bridgeCard-animation-time) ease-out, visibility var(--bridgeCard-animation-time); overflow: hidden;
This is an automated email from the git hooks/post-receive script.
richard pushed a commit to branch tor-browser-91.9.0esr-11.5-1 in repository tor-browser.
commit ac854d83775dd48be36fa74c49c4283dcdc4c0bf Author: Pier Angelo Vendrame pierov@torproject.org AuthorDate: Thu Apr 14 17:12:40 2022 +0200
fixup! squash! Bug 31286: Implementation of bridge, proxy, and firewall settings in about:preferences#connection
Bug 40883: ask for confirmation before removing all bridges --- .../torpreferences/content/connectionPane.js | 43 +++++++++- .../torpreferences/content/connectionPane.xhtml | 14 ++++ .../torpreferences/content/torPreferences.css | 91 ++++++++++++++++++++++ 3 files changed, 146 insertions(+), 2 deletions(-)
diff --git a/browser/components/torpreferences/content/connectionPane.js b/browser/components/torpreferences/content/connectionPane.js index 552ddb85e8a83..727ac98d17606 100644 --- a/browser/components/torpreferences/content/connectionPane.js +++ b/browser/components/torpreferences/content/connectionPane.js @@ -135,6 +135,13 @@ const gConnectionPane = (function() { requestButton: "#torPreferences-addBridge-buttonRequestBridge", enterLabel: "#torPreferences-addBridge-labelEnterBridge", enterButton: "#torPreferences-addBridge-buttonEnterBridge", + removeOverlay: "#bridge-remove-overlay", + removeModal: "#bridge-remove-modal", + removeDismiss: "#bridge-remove-dismiss", + removeQuestion: "#bridge-remove-question", + removeWarning: "#bridge-remove-warning", + removeConfirm: "#bridge-remove-confirm", + removeCancel: "#bridge-remove-cancel", }, advanced: { header: "h1#torPreferences-advanced-header", @@ -612,7 +619,7 @@ const gConnectionPane = (function() { const removeAll = prefpane.querySelector(selectors.bridges.removeAll); removeAll.setAttribute("label", TorStrings.settings.bridgeRemoveAll); removeAll.addEventListener("command", () => { - this.onRemoveAllBridges(); + this._confirmBridgeRemoval(); }); this._populateBridgeCards = async () => { const collapseThreshold = 4; @@ -802,7 +809,37 @@ const gConnectionPane = (function() { }); }
- Services.obs.addObserver(this, TorConnectTopics.StateChange); + { + const overlay = prefpane.querySelector(selectors.bridges.removeOverlay); + this._confirmBridgeRemoval = () => { + overlay.classList.remove("hidden"); + }; + const closeDialog = () => { + overlay.classList.add("hidden"); + }; + overlay.addEventListener("click", closeDialog); + const modal = prefpane.querySelector(selectors.bridges.removeModal); + modal.addEventListener("click", e => { + e.stopPropagation(); + }); + const dismiss = prefpane.querySelector(selectors.bridges.removeDismiss); + dismiss.addEventListener("click", closeDialog); + const question = prefpane.querySelector( + selectors.bridges.removeQuestion + ); + question.textContent = TorStrings.settings.removeBridgesQuestion; + const warning = prefpane.querySelector(selectors.bridges.removeWarning); + warning.textContent = TorStrings.settings.removeBridgesWarning; + const confirm = prefpane.querySelector(selectors.bridges.removeConfirm); + confirm.setAttribute("label", TorStrings.settings.remove); + confirm.addEventListener("command", () => { + this.onRemoveAllBridges(); + closeDialog(); + }); + const cancel = prefpane.querySelector(selectors.bridges.removeCancel); + cancel.setAttribute("label", TorStrings.settings.cancel); + cancel.addEventListener("command", closeDialog); + }
// Advanced setup prefpane.querySelector(selectors.advanced.header).innerText = @@ -831,6 +868,8 @@ const gConnectionPane = (function() { torLogsButton.addEventListener("command", () => { this.onViewTorLogs(); }); + + Services.obs.addObserver(this, TorConnectTopics.StateChange); },
init() { diff --git a/browser/components/torpreferences/content/connectionPane.xhtml b/browser/components/torpreferences/content/connectionPane.xhtml index 67f98685d8038..049cf77aa05dc 100644 --- a/browser/components/torpreferences/content/connectionPane.xhtml +++ b/browser/components/torpreferences/content/connectionPane.xhtml @@ -174,4 +174,18 @@ </hbox> </box> </groupbox> + +<html:div id="bridge-remove-overlay" class="hidden"> + <html:div id="bridge-remove-modal"> + <html:img id="bridge-remove-dismiss" src="chrome://global/skin/icons/close.svg"/> + <html:div id="bridge-remove-icon"/> + <html:p id="bridge-remove-question"/> + <html:p id="bridge-remove-warning"/> + <html:div id="bridge-remove-buttonbar"> + <button id="bridge-remove-cancel"/> + <button id="bridge-remove-confirm"/> + </html:div> + </html:div> +</html:div> + </html:template> diff --git a/browser/components/torpreferences/content/torPreferences.css b/browser/components/torpreferences/content/torPreferences.css index 02ad792e83161..a081a193d0d1f 100644 --- a/browser/components/torpreferences/content/torPreferences.css +++ b/browser/components/torpreferences/content/torPreferences.css @@ -562,3 +562,94 @@ textarea#torPreferences-torDialog-textarea { /* 10 lines */ min-height: 20em; } + +/* Bridge remove overlay */ +#bridge-remove-overlay { + position: fixed; + display: flex; + align-items: center; + justify-content: center; + top: 0; + inset: 0; + width: 100%; + height: 100%; + z-index: 1; + background-color: rgba(0, 0, 0, 0.5); +} + +#bridge-remove-overlay.hidden { + display: none; +} + +#bridge-remove-modal { + position: relative; + min-width: 250px; + max-width: 500px; + min-height: 200px; + z-index: 2; + text-align: center; + background: var(--in-content-page-background); + box-shadow: var(--shadow-30); +} + +#bridge-remove-dismiss { + position: absolute; + top: 16px; + inset-inline-end: 16px; + width: 16px; + height: 16px; + fill: currentColor; + -moz-context-properties: fill; +} + +#bridge-remove-dismiss:hover { + background-color: var(--in-content-button-background-hover); + color: var(--in-content-button-text-color-hover); + border: 1px solid var(--in-content-button-border-color-hover); + border-radius: 4px; +} + +#bridge-remove-dismiss:hover:active { + background-color: var(--in-content-button-background-active); +} + +#bridge-remove-icon { + width: 40px; + height: 40px; + background-image: url("chrome://global/skin/icons/warning.svg"); + background-size: 40px; + margin: 16px auto; + fill: currentColor; + -moz-context-properties: fill; +} + +#bridge-remove-question { + font-size: 150%; +} + +#bridge-remove-warning { + color: var(--in-content-deemphasized-text); +} + +#bridge-remove-buttonbar { + padding: 16px 32px; +} + +#bridge-remove-buttonbar button { + min-width: 140px; +} + +#bridge-remove-confirm { + background: var(--in-content-danger-button-background); + color: var(--in-content-primary-button-text-color); +} + +#bridge-remove-confirm:hover { + background: var(--in-content-danger-button-background-hover); + color: var(--in-content-primary-button-text-color-hover); + border-color: var(--in-content-primary-button-border-hover); +} + +#bridge-remove-confirm:hover:active { + background: var(--in-content-danger-button-background-active); +}
This is an automated email from the git hooks/post-receive script.
richard pushed a commit to branch tor-browser-91.9.0esr-11.5-1 in repository tor-browser.
commit 84b491c6fe7d781f5dba7748a71750d5842f1945 Author: Pier Angelo Vendrame pierov@torproject.org AuthorDate: Thu Apr 14 17:18:32 2022 +0200
fixup! squash! Bug 31286: Implementation of bridge, proxy, and firewall settings in about:preferences#connection
Bug 40897: limit the extent of the "Show All Bridges" fade --- browser/components/torpreferences/content/torPreferences.css | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/browser/components/torpreferences/content/torPreferences.css b/browser/components/torpreferences/content/torPreferences.css index a081a193d0d1f..2ab29bcd60faa 100644 --- a/browser/components/torpreferences/content/torPreferences.css +++ b/browser/components/torpreferences/content/torPreferences.css @@ -193,7 +193,7 @@ html:dir(rtl) input[type="checkbox"].toggle-button::before { }
#torPreferences-currentBridges-cards.list-collapsed { - mask-image: linear-gradient(rgb(0, 0, 0), rgba(0, 0, 0, 0.1)); + mask-image: linear-gradient(rgb(0, 0, 0) 0% 75%, rgba(0, 0, 0, 0.1)); }
#torPreferences-currentBridges-cards.disabled {
This is an automated email from the git hooks/post-receive script.
richard pushed a commit to branch tor-browser-91.9.0esr-11.5-1 in repository tor-browser.
commit c110b565f3f3dc100271788f10c04d39083f7c19 Author: Pier Angelo Vendrame pierov@torproject.org AuthorDate: Thu Apr 14 17:39:59 2022 +0200
fixup! squash! Bug 31286: Implementation of bridge, proxy, and firewall settings in about:preferences#connection
Forget the built-in bridge type, when the user is using built-in bridges and clicks on remove all bridges, otherwise at next Tor Browser restart the built-in bridges come back (but only disabled). --- browser/components/torpreferences/content/connectionPane.js | 3 +++ 1 file changed, 3 insertions(+)
diff --git a/browser/components/torpreferences/content/connectionPane.js b/browser/components/torpreferences/content/connectionPane.js index 727ac98d17606..2d3bb8bdfb601 100644 --- a/browser/components/torpreferences/content/connectionPane.js +++ b/browser/components/torpreferences/content/connectionPane.js @@ -969,6 +969,9 @@ const gConnectionPane = (function() { onRemoveAllBridges() { TorSettings.bridges.enabled = false; TorSettings.bridges.bridge_strings = ""; + if (TorSettings.bridges.source == TorBridgeSource.BuiltIn) { + TorSettings.bridges.builtin_type = ""; + } TorSettings.saveToPrefs(); TorSettings.applySettings().then(result => { this._populateBridgeCards();
This is an automated email from the git hooks/post-receive script.
richard pushed a commit to branch tor-browser-91.9.0esr-11.5-1 in repository tor-browser.
commit 907f3ed2bddd0e7bb6648f667df0178adfe6443c Author: Pier Angelo Vendrame pierov@torproject.org AuthorDate: Thu Apr 14 18:49:50 2022 +0200
fixup! fixup! Bug 40597: Implement TorSettings module
Try to use the fallback settings if getting localized settings fails. --- browser/modules/Moat.jsm | 21 +++++++++++++++++++++ browser/modules/TorConnect.jsm | 24 ++++++++++++++++++------ 2 files changed, 39 insertions(+), 6 deletions(-)
diff --git a/browser/modules/Moat.jsm b/browser/modules/Moat.jsm index bdcf6cb631561..35931172f3ee4 100644 --- a/browser/modules/Moat.jsm +++ b/browser/modules/Moat.jsm @@ -787,4 +787,25 @@ class MoatRPC {
return map; } + + // Request a copy of the defaul/fallback bridge settings, takes the following parameters: + // - transports: optional, an array of transports available to the client; if empty (or not + // given) returns settings using all working transports known to the server + // + // returns an array of settings objects in roughly the same format as the _settings + // object on the TorSettings module + async circumvention_defaults(transports) { + const args = { + transports: transports ? transports : [], + }; + const response = await this._makeRequest("circumvention/defaults", args); + if ("errors" in response) { + const code = response.errors[0].code; + const detail = response.errors[0].detail; + throw new Error(`MoatRPC: ${detail} (${code})`); + } else if ("settings" in response) { + return this._fixupSettingsList(response.settings); + } + return []; + } } diff --git a/browser/modules/TorConnect.jsm b/browser/modules/TorConnect.jsm index 6b501209d844e..59d59b70eaad8 100644 --- a/browser/modules/TorConnect.jsm +++ b/browser/modules/TorConnect.jsm @@ -496,12 +496,24 @@ const TorConnect = (() => {
if (this.transitioning) return;
- if (this.settings === null) { - // unable to determine country - throw_error(TorStrings.torConnect.autoBootstrappingFailed, TorStrings.torConnect.cannotDetermineCountry); - } else if (this.settings.length === 0) { - // no settings available for country - throw_error(TorStrings.torConnect.autoBootstrappingFailed, TorStrings.torConnect.noSettingsForCountry); + const noCountry = this.settings !== null; + const noLocalizedSettings = this.settings && this.settings.length === 0; + if (noCountry || noLocalizedSettings) { + try { + this.settings = await this.mrpc.circumvention_defaults([...TorBuiltinBridgeTypes, "vanilla"]); + } catch (err) { + console.error("We could not get localized settings, but defaults settings failed as well", err); + } + } + if (this.settings === null || this.settings.length === 0) { + // The fallback has failed as well, so throw the original error + if (noCountry) { + // unable to determine country + throw_error(TorStrings.torConnect.autoBootstrappingFailed, TorStrings.torConnect.cannotDetermineCountry); + } else { + // no settings available for country + throw_error(TorStrings.torConnect.autoBootstrappingFailed, TorStrings.torConnect.noSettingsForCountry); + } }
// apply each of our settings and try to bootstrap with each
This is an automated email from the git hooks/post-receive script.
richard pushed a commit to branch tor-browser-91.9.0esr-11.5-1 in repository tor-browser.
commit ee7544dcb1c4318d39efdbffc5e0ce7a757e8548 Author: Pier Angelo Vendrame pierov@torproject.org AuthorDate: Tue Apr 26 12:08:27 2022 +0200
fixup! fixup! Bug 40597: Implement TorSettings module
Changed the timeoutRand function, and fixed a typo. --- browser/modules/TorConnect.jsm | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-)
diff --git a/browser/modules/TorConnect.jsm b/browser/modules/TorConnect.jsm index 59d59b70eaad8..711134326a14d 100644 --- a/browser/modules/TorConnect.jsm +++ b/browser/modules/TorConnect.jsm @@ -221,10 +221,6 @@ const InternetStatus = Object.freeze({ });
class InternetTest { - static get TIMEOUT() { - return 30000; - } - constructor() { this._status = InternetStatus.Unknown; this._error = null; @@ -232,7 +228,7 @@ class InternetTest { this._timeout = setTimeout(() => { this._timeout = null; this.test(); - }, InternetTest.TIMEOUT + this.timeoutRand()); + }, this.timeoutRand()); this.onResult = (online, date) => {} this.onError = (err) => {}; } @@ -268,7 +264,7 @@ class InternetTest { // Callbacks for the Internet test are desirable, because we will be // waiting both for the bootstrap, and for the Internet test. // However, managing Moat with async/await is much easier as it avoids a - // callback hell, and it makes extra esplicit that we are uniniting it. + // callback hell, and it makes extra explicit that we are uniniting it. const mrpc = new MoatRPC(); let status = null; let error = null; @@ -297,8 +293,9 @@ class InternetTest {
// We randomize the Internet test timeout to make fingerprinting it harder, at least a little bit... timeoutRand() { - const window = 5000; - return window * (Math.random() * 2 - 1); + const offset = 30000; + const randRange = 5000; + return offset + randRange * (Math.random() * 2 - 1); } }
This is an automated email from the git hooks/post-receive script.
richard pushed a commit to branch tor-browser-91.9.0esr-11.5-1 in repository tor-browser.
commit 19cb248d6d79a971a58cfe044138a2545f197b45 Author: Pier Angelo Vendrame pierov@torproject.org AuthorDate: Tue Apr 26 12:09:48 2022 +0200
fixup! squash! Bug 27476: Implement about:torconnect captive portal within Tor Browser
Fixed the problems with checkbox and select :focus, and fixed a few problems with the dark mode. --- .../torconnect/content/aboutTorConnect.css | 29 +++++++++++++++------- 1 file changed, 20 insertions(+), 9 deletions(-)
diff --git a/browser/components/torconnect/content/aboutTorConnect.css b/browser/components/torconnect/content/aboutTorConnect.css index 41cfe2bb80c70..a8cc2676428af 100644 --- a/browser/components/torconnect/content/aboutTorConnect.css +++ b/browser/components/torconnect/content/aboutTorConnect.css @@ -10,6 +10,19 @@ --onion-radius: 75px; }
+input[type="checkbox"]:focus, select:focus { + outline: none!important; + box-shadow: 0 0 0 3px var(--purple-30) !important; + border: 1px var(--purple-80) solid !important; +} + +@media (-moz-toolbar-prefers-color-scheme: dark) +{ + input[type="checkbox"]:focus, select:focus { + box-shadow: 0 0 0 3px var(--purple-50)!important; + } +} + #breadcrumbs { display: flex; align-items: center; @@ -37,12 +50,12 @@
.breadcrumb-item:hover { color: var(--in-content-accent-color); - background-color: var(--grey-20); + background-color: var(--in-content-button-background-hover); }
.breadcrumb-item:active { color: var(--in-content-accent-color-active); - background-color: var(--grey-30); + background-color: var(--in-content-button-background-active); }
.breadcrumb-separator { @@ -72,10 +85,6 @@ cursor: default; }
-.breadcrumb-item.disabled:hover, .breadcrumb-item.disabled:active { - background-color: var(--grey-20); -} - .breadcrumb-item.error { color: var(--in-content-danger-button-background); } @@ -117,11 +126,14 @@ }
button { + --purple-button-text-color: rgb(251,251,254); + --in-content-primary-button-text-color: var(--purple-button-text-color); --in-content-primary-button-background: var(--purple-60); + --in-content-primary-button-text-color-hover: var(--purple-button-text-color); --in-content-primary-button-background-hover: var(--purple-70); + --in-content-primary-button-text-color-active: var(--purple-button-text-color); --in-content-primary-button-background-active: var(--purple-80); --in-content-focus-outline-color: var(--purple-60); - --in-content-primary-button-text-color: white; fill: white; }
@@ -194,8 +206,7 @@ input[type="checkbox"]:not(:disabled):active:checked { --progressbar-shadow-start: rgba(255, 255, 255, 0.85); }
-@media (prefers-color-scheme: dark) -{ +@media (-moz-toolbar-prefers-color-scheme: dark) { :root { --progressbar-shadow-start: rgba(28, 27, 34, 0.85); }
This is an automated email from the git hooks/post-receive script.
richard pushed a commit to branch tor-browser-91.9.0esr-11.5-1 in repository tor-browser.
commit 7ffad04403bb9150698bde633ef06ce6c2145763 Author: Pier Angelo Vendrame pierov@torproject.org AuthorDate: Tue Apr 26 12:56:55 2022 +0200
fixup! squash! Bug 27476: Implement about:torconnect captive portal within Tor Browser
Improved the progressbar style --- .../torconnect/content/aboutTorConnect.css | 59 +++++++++++++++++----- .../torconnect/content/aboutTorConnect.js | 2 +- .../torconnect/content/aboutTorConnect.xhtml | 5 +- 3 files changed, 50 insertions(+), 16 deletions(-)
diff --git a/browser/components/torconnect/content/aboutTorConnect.css b/browser/components/torconnect/content/aboutTorConnect.css index a8cc2676428af..664a0f534835b 100644 --- a/browser/components/torconnect/content/aboutTorConnect.css +++ b/browser/components/torconnect/content/aboutTorConnect.css @@ -203,31 +203,62 @@ input[type="checkbox"]:not(:disabled):active:checked { }
:root { - --progressbar-shadow-start: rgba(255, 255, 255, 0.85); + --progressbar-shadow-start: rgba(255, 255, 255, 0.7); + --progressbar-gradient: linear-gradient(90deg, #FC00FF 0%, #00DBDE 50%, #FC00FF 100%); }
@media (-moz-toolbar-prefers-color-scheme: dark) { :root { - --progressbar-shadow-start: rgba(28, 27, 34, 0.85); + --progressbar-shadow-start: rgba(28, 27, 34, 0.7); } }
-#progressBackground { - position:fixed; - padding:0; - margin:0; - top:0; - left:0; +#progressBar { + position: fixed; + top: 0; + inset-inline-start: 0; width: 0%; - height: 40px; - background-image: - linear-gradient(transparent 17.5%, var(--progressbar-shadow-start) 17.5%, var(--in-content-page-background) 100%), - linear-gradient(90deg, #FC00FF 0%, #00DBDE 50%, #FC00FF 100%); - background-size: 100%, 200%; - border-radius: 0; + padding: 0; + margin: 0; animation: progressAnimation 5s ease infinite; }
+#progressBackground { + height: 66px; + margin-top: -26px; + background-image: + linear-gradient(var(--progressbar-shadow-start), var(--in-content-page-background) 100%), + var(--progressbar-gradient); + background-position: inherit; + filter: blur(5px); + border-end-end-radius: 33px; +} + +#progressSolid { + position: absolute; + top: 0; + width: 100%; + height: 7px; + background-image: var(--progressbar-gradient); + background-position: inherit; +} + +#progressBackground, #progressSolid { + background-size: 200% 100%; +} + +@keyframes progressAnimation { + 0% { + background-position: 200%; + } + 50% { + background-position: 100%; + } + 100% { + background-position: 0%; + } +} + @keyframes progressAnimation { 0% { background-position: 200%; diff --git a/browser/components/torconnect/content/aboutTorConnect.js b/browser/components/torconnect/content/aboutTorConnect.js index 506b125e8b98f..162133ee5f12f 100644 --- a/browser/components/torconnect/content/aboutTorConnect.js +++ b/browser/components/torconnect/content/aboutTorConnect.js @@ -33,7 +33,7 @@ class AboutTorConnect { }, progress: { description: "p#connectShortDescText", - meter: "div#progressBackground", + meter: "div#progressBar", }, breadcrumbs: { container: "#breadcrumbs", diff --git a/browser/components/torconnect/content/aboutTorConnect.xhtml b/browser/components/torconnect/content/aboutTorConnect.xhtml index 674029fdeda34..77d2e68895708 100644 --- a/browser/components/torconnect/content/aboutTorConnect.xhtml +++ b/browser/components/torconnect/content/aboutTorConnect.xhtml @@ -7,7 +7,10 @@ <link rel="stylesheet" href="chrome://browser/content/torconnect/aboutTorConnect.css" type="text/css" media="all" /> </head> <body> - <div id="progressBackground"></div> + <div id="progressBar"> + <div id="progressBackground" /> + <div id="progressSolid" /> + </div> <div id="connectPageContainer" class="container"> <div id="breadcrumbs" class="hidden"> <span id="connect-to-tor" class="breadcrumb-item">
This is an automated email from the git hooks/post-receive script.
richard pushed a commit to branch tor-browser-91.9.0esr-11.5-1 in repository tor-browser.
commit 823ffd447096493b73595bbe36e8dcdb6828165a Author: Richard Pospesel richard@torproject.org AuthorDate: Tue May 3 19:18:10 2022 +0000
fixup! fixup! squash! Bug 27476: Implement about:torconnect captive portal within Tor Browser --- browser/components/torconnect/TorConnectParent.jsm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/browser/components/torconnect/TorConnectParent.jsm b/browser/components/torconnect/TorConnectParent.jsm index 95eb9c975c7d5..3c2a56934c145 100644 --- a/browser/components/torconnect/TorConnectParent.jsm +++ b/browser/components/torconnect/TorConnectParent.jsm @@ -138,7 +138,7 @@ class TorConnectParent extends JSWindowActorParent { this.torConnectObserver, TorSettingsTopics.SettingChanged ); - Services.obs.addObserver(this.userActionObserver, BroadcastTopic); + Services.obs.removeObserver(this.userActionObserver, BroadcastTopic); }
async receiveMessage(message) {
This is an automated email from the git hooks/post-receive script.
richard pushed a commit to branch tor-browser-91.9.0esr-11.5-1 in repository tor-browser.
commit c6c168edef9ed7ff0c6b792dc127c4085a7993ae Author: Richard Pospesel richard@torproject.org AuthorDate: Tue May 3 21:15:46 2022 +0000
fixup! Bug 31286: Implementation of bridge, proxy, and firewall settings in about:preferences#connection
Bug 40896: [Connection Settings] Update strings for current bridges --- browser/components/torpreferences/content/connectionPane.js | 4 ++++ browser/components/torpreferences/content/connectionPane.xhtml | 3 +++ browser/modules/TorStrings.jsm | 1 + 3 files changed, 8 insertions(+)
diff --git a/browser/components/torpreferences/content/connectionPane.js b/browser/components/torpreferences/content/connectionPane.js index 2d3bb8bdfb601..dfb8b00d81384 100644 --- a/browser/components/torpreferences/content/connectionPane.js +++ b/browser/components/torpreferences/content/connectionPane.js @@ -110,6 +110,7 @@ const gConnectionPane = (function() { chooseForMe: "#torPreferences-bridges-buttonChooseBridgeForMe", currentHeader: "#torPreferences-currentBridges-header", currentHeaderText: "#torPreferences-currentBridges-headerText", + currentDescriptionText: "#torPreferences-currentBridges-description", switch: "#torPreferences-currentBridges-switch", cards: "#torPreferences-currentBridges-cards", cardTemplate: "#torPreferences-bridgeCard-template", @@ -428,6 +429,9 @@ const gConnectionPane = (function() { this._populateBridgeCards(); }); }); + prefpane.querySelector( + selectors.bridges.currentDescriptionText + ).textContent = TorStrings.settings.bridgeCurrentDescription; const bridgeTemplate = prefpane.querySelector( selectors.bridges.cardTemplate ); diff --git a/browser/components/torpreferences/content/connectionPane.xhtml b/browser/components/torpreferences/content/connectionPane.xhtml index 049cf77aa05dc..39a9c184502f0 100644 --- a/browser/components/torpreferences/content/connectionPane.xhtml +++ b/browser/components/torpreferences/content/connectionPane.xhtml @@ -93,6 +93,9 @@ <html:span id="torPreferences-currentBridges-headerText"/> <html:input type="checkbox" id="torPreferences-currentBridges-switch" class="toggle-button"/> </html:h2> + <description flex="1"> + <html:span id="torPreferences-currentBridges-description"/> + </description> <menupopup id="torPreferences-bridgeCard-menu"/> <vbox id="torPreferences-bridgeCard-template" class="torPreferences-bridgeCard"> <hbox class="torPreferences-bridgeCard-heading"> diff --git a/browser/modules/TorStrings.jsm b/browser/modules/TorStrings.jsm index 028d4e27fe709..7a21981184b8e 100644 --- a/browser/modules/TorStrings.jsm +++ b/browser/modules/TorStrings.jsm @@ -286,6 +286,7 @@ var TorStrings = { bridgeLocationOther: getString("torPreferences.bridgeLocationOther", "Other locations"), bridgeChooseForMe: getString("torPreferences.bridgeChooseForMe", "Choose a Bridge For Me\u2026"), bridgeCurrent: getString("torPreferences.bridgeBadgeCurrent", "Your Current Bridges"), + bridgeCurrentDescription: getString("torPreferences.bridgeBadgeCurrentDescription", "You can keep one or more bridges saved, and Tor will choose which one to use when you connect. Tor will automatically switch to use another bridge when needed."), bridgeId: getString("torPreferences.bridgeId", "#1 bridge: #2"), remove: getString("torPreferences.remove", "Remove"), bridgeDisableBuiltIn: getString("torPreferences.bridgeDisableBuiltIn", "Disable built-in bridges"),
This is an automated email from the git hooks/post-receive script.
richard pushed a commit to branch tor-browser-91.9.0esr-11.5-1 in repository tor-browser.
commit dce69bdadefe0db9c3ac680df788e3ea95b8258b Author: Richard Pospesel richard@torproject.org AuthorDate: Tue May 3 22:24:19 2022 +0000
fixup! Bug 31286: Implementation of bridge, proxy, and firewall settings in about:preferences#connection
CreaBug 40860: te shortlist of unicode emoji for bridge-moji feature --- .../torpreferences/content/connectionPane.js | 279 ++------------------- 1 file changed, 20 insertions(+), 259 deletions(-)
diff --git a/browser/components/torpreferences/content/connectionPane.js b/browser/components/torpreferences/content/connectionPane.js index dfb8b00d81384..46fbbfecf832f 100644 --- a/browser/components/torpreferences/content/connectionPane.js +++ b/browser/components/torpreferences/content/connectionPane.js @@ -1079,272 +1079,33 @@ function makeBridgeId(bridgeString) { // JS uses UTF-16. While most of these emojis are surrogate pairs, a few // ones fit one UTF-16 character. So we could not use neither indices, // nor substr, nor some function to split the string. - const emojis = [ - "😄️", - "😒️", - "😉", - "😭️", - "😂️", - "😎️", - "🤩️", - "😘", - "😜️", - "😏️", - "😷", - "🤢", - "🤕", - "🤧", - "🥵", - "🥶", - "🥴", - "😵️", - "🤮️", - "🤑", - "🤔", - "🫢", - "🤐", - "😮💨", - "😐", - "🤤", - "😴", - "🤯", - "🤠", - "🥳", - "🥸", - "🤓", - "🧐", - "😨", - "😳", - "🥺", - "🤬", - "😈", - "👿", - "💀", - "💩", - "🤡", - "👺", - "👻", - "👽", - "🦴", - "🤖", - "😸", - "🙈", - "🙉", - "🙊", - "💋", - "💖", - "💯", - "💢", - "💧", - "💨", - "💭", - "💤", - "👋", - "👌", - "✌", - "👍", - "👎", - "🤛", - "🙌", - "💪", - "🙏", - "✍", - "🧠", - "👀", - "👂", - "👅", - "🦷", - "🐾", - "🐶", - "🦊", - "🦝", - "🐈", - "🦁", - "🐯", - "🐴", - "🦄", - "🦓", - "🐮", - "🐷", - "🐑", - "🐪", - "🐘", - "🐭", - "🐰", - "🦔", - "🦇", - "🐻", - "🐨", - "🐼", - "🐔", - "🦨", - "🦘", - "🐦", - "🐧", - "🦩", - "🦉", - "🦜", - "🪶", - "🐸", - "🐊", - "🐢", - "🦎", - "🐍", - "🦖", - "🦀", - "🐬", - "🐙", - "🐌", - "🐝", - "🐞", - "🌸", - "🌲", - "🌵", - "🍀", - "🍁", - "🍇", - "🍉", - "🍊", - "🍋", - "🍌", - "🍍", - "🍎", - "🥥", - "🍐", - "🍒", - "🍓", - "🫐", - "🥝", - "🥔", - "🥕", - "🧅", - "🌰", - "🍄", - "🍞", - "🥞", - "🧀", - "🍖", - "🍔", - "🍟", - "🍕", - "🥚", - "🍿", - "🧂", - "🍙", - "🍦", - "🍩", - "🍪", - "🎂", - "🍬", - "🍭", - "🥛", - "☕", - "🫖", - "🍾", - "🍷", - "🍹", - "🍺", - "🍴", - "🥄", - "🫙", - "🧭", - "🌋", - "🪵", - "🏡", - "🏢", - "🏰", - "⛲", - "⛺", - "🎡", - "🚂", - "🚘", - "🚜", - "🚲", - "🚔", - "🚨", - "⛽", - "🚥", - "🚧", - "⚓", - "⛵", - "🛟", - "🪂", - "🚀", - "⌛", - "⏰", - "🌂", - "🌞", - "🌙", - "🌟", - "⛅", - "⚡", - "🔥", - "🌊", - "🎃", - "🎈", - "🎉", - "✨", - "🎀", - "🎁", - "🏆", - "🏅", - "🔮", - "🪄", - "🎾", - "🎳", - "🎲", - "🎭", - "🎨", - "🧵", - "🎩", - "📢", - "🔔", - "🎵", - "🎤", - "🎧", - "🎷", - "🎸", - "🥁", - "🔋", - "🔌", - "💻", - "💾", - "💿", - "🎬", - "📺", - "📷", - "🎮", - "🧩", - "🔍", - "💡", - "📖", - "💰", - "💼", - "📈", - "📌", - "📎", - "🔒", - "🔑", - "🔧", - "🪛", - "🔩", - "🧲", - "🔬", - "🔭", - "📡", - "🚪", - "🪑", - "⛔", - "🚩", +const emojis = [ + "👽","🤖","🧚","🧜","🏄","🐵","🦍","🐶","🐺","🦊","🐈","🦁","🐯","🐴","🦄","🦓", + "🦌","🐮","🐷","🐗","🐑","🦙","🦒","🐘","🐭","🐹","🐇","🐿","🦔","🐨","🐼","🦥", + "🦨","🦘","🐓","🐥","🐦","🐧","🕊","🦆","🦢","🦉","🦤","🦩","🦚","🦜","🐊","🐢", + "🦎","🐍","🐉","🦕","🦖","🐋","🐬","🐟","🐠","🐡","🦈","🐙","🐚","🐌","🦋","🐛", + "🐝","🐞","💐","🌸","🌹","🌺","🌻","🌼","🌷","🌱","🌲","🌳","🌴","🌵","🌿","🍁", + "🍇","🍉","🍊","🍋","🍌","🍍","🥭","🍏","🍐","🍑","🍒","🍓","🥝","🍅","🥥","🥑", + "🍆","🥕","🌽","🌶","🥬","🥦","🧅","🍄","🥜","🥐","🥖","🥨","🥞","🧇","🍔","🍕", + "🌭","🌮","🌯","🥚","🍿","🍙","🥟","🦀","🦞","🦑","🍦","🍩","🧁","🍬","🍭","🧃", + "🧉","🧭","⛰","🌋","🏝","🏡","⛲","⛺","🎠","🎡","💈","🚂","🚃","🚌","🚗","🚚", + "🚜","🛵","🛺","🚲","🛴","🛹","⚓️","⛵","🛶","🚤","🚢","✈️","🪂","🚁","🚠","🛰", + "🚀","🛸","⏳","🌙","🌡","☀️","🪐","⭐","☁️","🌧","🌩","🌀","🌈","☂️","❄️","☄️", + "🔥","💧","🌊","🎃","✨","🎈","🎉","🎊","🎏","🎟","🏆","⚽","🏀","🏈","🎾","🥏", + "🏓","⛸","🪀","🪁","🎱","🔮","🪄","🕹","🎲","🧩","🧸","🎨","🧵","🧶","🕶","🧦", + "🎒","👟","👠","👑","🎓","🧢","💍","💎","📢","🎵","🎙","🎤","🎧","📻","🎷","🪗", + "🎸","🎺","🎻","🪕","🥁","☎️","💿","🎥","🎬","📺","📷","🔍","💡","🔦","📖","📚", + "🏷","✏️","🖌","🖍","📎","📌","🔑","🪃","🏹","⚙️","🧲","🧪","🧬","🔭","📡","🗿", ];
+ // FNV-1a implementation that is compatible with other languages const prime = 0x01000193; const offset = 0x811c9dc5; let hash = offset; const encoder = new TextEncoder(); - for (const charCode of encoder.encode(bridgeString)) { - hash = Math.imul(hash ^ charCode, prime); + for (const byte of encoder.encode(bridgeString)) { + hash = Math.imul(hash ^ byte, prime); }
const hashBytes = [
tor-commits@lists.torproject.org