This is an automated email from the git hooks/post-receive script.
pierov pushed a change to branch tor-browser-91.11.0esr-12.0-1 in repository tor-browser.
from 4ff5808811ac9 fixup! Bug 31286: Implementation of bridge, proxy, and firewall settings in about:preferences#connection new 16a1af2604d74 fixup! Bug 31286: Implementation of bridge, proxy, and firewall settings in about:preferences#connection new 55991a59b5c28 fixup! Bug 31286: Implementation of bridge, proxy, and firewall settings in about:preferences#connection new a1c57b4b4a76d fixup! Bug 31286: Implementation of bridge, proxy, and firewall settings in about:preferences#connection new ef0f0ae9f0e56 fixup! Bug 31286: Implementation of bridge, proxy, and firewall settings in about:preferences#connection
The 4 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: .../torpreferences/content/builtinBridgeDialog.jsm | 17 ++----- .../torpreferences/content/connectionPane.js | 57 ++++++++++++---------- .../torpreferences/content/provideBridgeDialog.jsm | 15 ++---- .../torpreferences/content/requestBridgeDialog.jsm | 13 ++--- 4 files changed, 44 insertions(+), 58 deletions(-)
This is an automated email from the git hooks/post-receive script.
pierov pushed a commit to branch tor-browser-91.11.0esr-12.0-1 in repository tor-browser.
commit 16a1af2604d74bff271237f3d224701cc79040b7 Author: WofWca wofwca@protonmail.com AuthorDate: Thu Jul 21 11:59:14 2022 +0300
fixup! Bug 31286: Implementation of bridge, proxy, and firewall settings in about:preferences#connection
refactor: replace some `let` with `const` --- .../torpreferences/content/connectionPane.js | 38 ++++++++++++---------- 1 file changed, 21 insertions(+), 17 deletions(-)
diff --git a/browser/components/torpreferences/content/connectionPane.js b/browser/components/torpreferences/content/connectionPane.js index e3125c850708e..f523642cd3532 100644 --- a/browser/components/torpreferences/content/connectionPane.js +++ b/browser/components/torpreferences/content/connectionPane.js @@ -154,7 +154,7 @@ const gConnectionPane = (function() { }, }; /* selectors */
- let retval = { + const retval = { // cached frequently accessed DOM elements _enableQuickstartCheckbox: null,
@@ -166,7 +166,7 @@ const gConnectionPane = (function() {
// disables the provided list of elements _setElementsDisabled(elements, disabled) { - for (let currentElement of elements) { + for (const currentElement of elements) { currentElement.disabled = disabled; } }, @@ -182,7 +182,7 @@ const gConnectionPane = (function() { .querySelector(selectors.category.title) .setAttribute("value", TorStrings.settings.categoryTitle);
- let prefpane = document.getElementById("mainPrefPane"); + const prefpane = document.getElementById("mainPrefPane");
// 'Connect to Tor' Message Bar
@@ -235,7 +235,7 @@ const gConnectionPane = (function() { prefpane.querySelector(selectors.torPreferences.description).textContent = TorStrings.settings.torPreferencesDescription; { - let learnMore = prefpane.querySelector( + const learnMore = prefpane.querySelector( selectors.torPreferences.learnMore ); learnMore.setAttribute("value", TorStrings.settings.learnMore); @@ -329,7 +329,7 @@ const gConnectionPane = (function() { prefpane.querySelector(selectors.bridges.description).textContent = TorStrings.settings.bridgesDescription; { - let learnMore = prefpane.querySelector(selectors.bridges.learnMore); + const learnMore = prefpane.querySelector(selectors.bridges.learnMore); learnMore.setAttribute("value", TorStrings.settings.learnMore); learnMore.setAttribute("href", TorStrings.settings.learnMoreBridgesURL); if (TorStrings.settings.learnMoreBridgesURL.startsWith("about:")) { @@ -654,7 +654,7 @@ const gConnectionPane = (function() { this._populateBridgeCards = () => { const collapseThreshold = 4;
- let newStrings = new Set(TorSettings.bridges.bridge_strings); + const newStrings = new Set(TorSettings.bridges.bridge_strings); const numBridges = newStrings.size; if (!newStrings.size) { bridgeHeader.setAttribute("hidden", "true"); @@ -833,7 +833,9 @@ const gConnectionPane = (function() { .querySelector(selectors.bridges.addBuiltinLabel) .setAttribute("value", TorStrings.settings.bridgeSelectBrowserBuiltin); { - let button = prefpane.querySelector(selectors.bridges.addBuiltinButton); + const button = prefpane.querySelector( + selectors.bridges.addBuiltinButton + ); button.setAttribute("label", TorStrings.settings.bridgeSelectBuiltin); button.addEventListener("command", e => { this.onAddBuiltinBridge(); @@ -843,7 +845,7 @@ const gConnectionPane = (function() { .querySelector(selectors.bridges.requestLabel) .setAttribute("value", TorStrings.settings.bridgeRequestFromTorProject); { - let button = prefpane.querySelector(selectors.bridges.requestButton); + const button = prefpane.querySelector(selectors.bridges.requestButton); button.setAttribute("label", TorStrings.settings.bridgeRequest); button.addEventListener("command", e => { this.onRequestBridge(); @@ -898,7 +900,9 @@ const gConnectionPane = (function() { prefpane.querySelector(selectors.advanced.label).textContent = TorStrings.settings.advancedLabel; { - let settingsButton = prefpane.querySelector(selectors.advanced.button); + const settingsButton = prefpane.querySelector( + selectors.advanced.button + ); settingsButton.setAttribute( "label", TorStrings.settings.advancedButton @@ -912,7 +916,7 @@ const gConnectionPane = (function() { prefpane .querySelector(selectors.advanced.torLogsLabel) .setAttribute("value", TorStrings.settings.showTorDaemonLogs); - let torLogsButton = prefpane.querySelector( + const torLogsButton = prefpane.querySelector( selectors.advanced.torLogsButton ); torLogsButton.setAttribute("label", TorStrings.settings.showLogs); @@ -964,7 +968,7 @@ const gConnectionPane = (function() { switch (topic) { // triggered when a TorSettings param has changed case TorSettingsTopics.SettingChanged: { - let obj = subject?.wrappedJSObject; + const obj = subject?.wrappedJSObject; switch (data) { case TorSettingsData.QuickStartEnabled: { this._enableQuickstartCheckbox.checked = obj.value; @@ -1014,7 +1018,7 @@ const gConnectionPane = (function() { },
onCopyBridgeAddress(addressElem) { - let clipboard = Cc["@mozilla.org/widget/clipboardhelper;1"].getService( + const clipboard = Cc["@mozilla.org/widget/clipboardhelper;1"].getService( Ci.nsIClipboardHelper ); clipboard.copyString(addressElem.value); @@ -1052,10 +1056,10 @@ const gConnectionPane = (function() {
// called when the request bridge button is activated onRequestBridge() { - let requestBridgeDialog = new RequestBridgeDialog(); + const requestBridgeDialog = new RequestBridgeDialog(); requestBridgeDialog.openDialog(gSubDialog, aBridges => { if (aBridges.length) { - let bridgeStrings = aBridges.join("\n"); + const bridgeStrings = aBridges.join("\n"); TorSettings.bridges.enabled = true; TorSettings.bridges.source = TorBridgeSource.BridgeDB; TorSettings.bridges.bridge_strings = bridgeStrings; @@ -1070,7 +1074,7 @@ const gConnectionPane = (function() { },
onAddBridgeManually() { - let provideBridgeDialog = new ProvideBridgeDialog(); + const provideBridgeDialog = new ProvideBridgeDialog(); provideBridgeDialog.openDialog(gSubDialog, aBridgeString => { if (aBridgeString.length) { TorSettings.bridges.enabled = true; @@ -1088,12 +1092,12 @@ const gConnectionPane = (function() { },
onAdvancedSettings() { - let connectionSettingsDialog = new ConnectionSettingsDialog(); + const connectionSettingsDialog = new ConnectionSettingsDialog(); connectionSettingsDialog.openDialog(gSubDialog); },
onViewTorLogs() { - let torLogDialog = new TorLogDialog(); + const torLogDialog = new TorLogDialog(); torLogDialog.openDialog(gSubDialog); }, };
This is an automated email from the git hooks/post-receive script.
pierov pushed a commit to branch tor-browser-91.11.0esr-12.0-1 in repository tor-browser.
commit 55991a59b5c287e1f6dec7c09ce105c40869aa6b Author: WofWca wofwca@protonmail.com AuthorDate: Wed Jul 20 14:54:27 2022 +0300
fixup! Bug 31286: Implementation of bridge, proxy, and firewall settings in about:preferences#connection
fix: `about:preferences#connection`: only change settings if dialog is closed with "accept" button Fixes https://gitlab.torproject.org/tpo/applications/tor-browser/-/issues/41063 --- .../torpreferences/content/builtinBridgeDialog.jsm | 17 +++++------------ .../components/torpreferences/content/connectionPane.js | 12 ++++++------ .../torpreferences/content/provideBridgeDialog.jsm | 15 +++++---------- .../torpreferences/content/requestBridgeDialog.jsm | 13 +++++-------- 4 files changed, 21 insertions(+), 36 deletions(-)
diff --git a/browser/components/torpreferences/content/builtinBridgeDialog.jsm b/browser/components/torpreferences/content/builtinBridgeDialog.jsm index 5b5e1560cd466..35ff6410768a9 100644 --- a/browser/components/torpreferences/content/builtinBridgeDialog.jsm +++ b/browser/components/torpreferences/content/builtinBridgeDialog.jsm @@ -11,9 +11,9 @@ const { } = ChromeUtils.import("resource:///modules/TorSettings.jsm");
class BuiltinBridgeDialog { - constructor() { + constructor(onSubmit) { + this.onSubmit = onSubmit; this._dialog = null; - this._bridgeType = ""; }
static get selectors() { @@ -77,14 +77,12 @@ class BuiltinBridgeDialog { ) { radioGroup.selectedItem = types[TorSettings.bridges.builtin_type]?.elemRadio; - this._bridgeType = TorSettings.bridges.builtin_type; } else { radioGroup.selectedItem = null; - this._bridgeType = ""; }
this._dialog.addEventListener("dialogaccept", e => { - this._bridgeType = radioGroup.value; + this.onSubmit(radioGroup.value); }); this._dialog.addEventListener("dialoghelp", e => { window.top.openTrustedLinkIn( @@ -105,15 +103,10 @@ class BuiltinBridgeDialog { }, 0); }
- openDialog(gSubDialog, aCloseCallback) { + openDialog(gSubDialog) { gSubDialog.open( "chrome://browser/content/torpreferences/builtinBridgeDialog.xhtml", - { - features: "resizable=yes", - closingCallback: () => { - aCloseCallback(this._bridgeType); - }, - }, + { features: "resizable=yes" }, this ); } diff --git a/browser/components/torpreferences/content/connectionPane.js b/browser/components/torpreferences/content/connectionPane.js index f523642cd3532..eadd4e6037f4d 100644 --- a/browser/components/torpreferences/content/connectionPane.js +++ b/browser/components/torpreferences/content/connectionPane.js @@ -1037,8 +1037,7 @@ const gConnectionPane = (function() { },
onAddBuiltinBridge() { - const builtinBridgeDialog = new BuiltinBridgeDialog(); - builtinBridgeDialog.openDialog(gSubDialog, aBridgeType => { + const builtinBridgeDialog = new BuiltinBridgeDialog(aBridgeType => { if (!aBridgeType) { TorSettings.bridges.enabled = false; TorSettings.bridges.builtin_type = ""; @@ -1052,12 +1051,12 @@ const gConnectionPane = (function() { this._populateBridgeCards(); }); }); + builtinBridgeDialog.openDialog(gSubDialog); },
// called when the request bridge button is activated onRequestBridge() { - const requestBridgeDialog = new RequestBridgeDialog(); - requestBridgeDialog.openDialog(gSubDialog, aBridges => { + const requestBridgeDialog = new RequestBridgeDialog(aBridges => { if (aBridges.length) { const bridgeStrings = aBridges.join("\n"); TorSettings.bridges.enabled = true; @@ -1071,11 +1070,11 @@ const gConnectionPane = (function() { TorSettings.bridges.enabled = false; } }); + requestBridgeDialog.openDialog(gSubDialog); },
onAddBridgeManually() { - const provideBridgeDialog = new ProvideBridgeDialog(); - provideBridgeDialog.openDialog(gSubDialog, aBridgeString => { + const provideBridgeDialog = new ProvideBridgeDialog(aBridgeString => { if (aBridgeString.length) { TorSettings.bridges.enabled = true; TorSettings.bridges.source = TorBridgeSource.UserProvided; @@ -1089,6 +1088,7 @@ const gConnectionPane = (function() { TorSettings.bridges.source = TorBridgeSource.Invalid; } }); + provideBridgeDialog.openDialog(gSubDialog); },
onAdvancedSettings() { diff --git a/browser/components/torpreferences/content/provideBridgeDialog.jsm b/browser/components/torpreferences/content/provideBridgeDialog.jsm index bc6a841138fb6..33ee8e023bfda 100644 --- a/browser/components/torpreferences/content/provideBridgeDialog.jsm +++ b/browser/components/torpreferences/content/provideBridgeDialog.jsm @@ -9,10 +9,10 @@ const { TorSettings, TorBridgeSource } = ChromeUtils.import( );
class ProvideBridgeDialog { - constructor() { + constructor(onSubmit) { + this.onSubmit = onSubmit; this._dialog = null; this._textarea = null; - this._bridgeString = ""; }
static get selectors() { @@ -40,7 +40,7 @@ class ProvideBridgeDialog { }
this._dialog.addEventListener("dialogaccept", e => { - this._bridgeString = this._textarea.value; + this.onSubmit(this._textarea.value); }); this._dialog.addEventListener("dialoghelp", e => { window.top.openTrustedLinkIn( @@ -57,15 +57,10 @@ class ProvideBridgeDialog { }, 0); }
- openDialog(gSubDialog, aCloseCallback) { + openDialog(gSubDialog) { gSubDialog.open( "chrome://browser/content/torpreferences/provideBridgeDialog.xhtml", - { - features: "resizable=yes", - closingCallback: () => { - aCloseCallback(this._bridgeString); - }, - }, + { features: "resizable=yes" }, this ); } diff --git a/browser/components/torpreferences/content/requestBridgeDialog.jsm b/browser/components/torpreferences/content/requestBridgeDialog.jsm index 9b8cd6db0a9b9..feabb931008f3 100644 --- a/browser/components/torpreferences/content/requestBridgeDialog.jsm +++ b/browser/components/torpreferences/content/requestBridgeDialog.jsm @@ -6,7 +6,8 @@ const { BridgeDB } = ChromeUtils.import("resource:///modules/BridgeDB.jsm"); const { TorStrings } = ChromeUtils.import("resource:///modules/TorStrings.jsm");
class RequestBridgeDialog { - constructor() { + constructor(onSubmit) { + this.onSubmit = onSubmit; this._dialog = null; this._submitButton = null; this._dialogHeader = null; @@ -15,7 +16,6 @@ class RequestBridgeDialog { this._captchaRefreshButton = null; this._incorrectCaptchaHbox = null; this._incorrectCaptchaLabel = null; - this._bridges = []; }
static get selectors() { @@ -53,7 +53,7 @@ class RequestBridgeDialog { if (uri) { this._setcaptchaImage(uri); } else if (bridges) { - this._bridges = bridges; + this.onSubmit(bridges); this._submitButton.disabled = false; this._dialog.cancelDialog(); } @@ -163,20 +163,18 @@ class RequestBridgeDialog { BridgeDB.submitCaptchaGuess(captchaText) .then(aBridges => { if (aBridges) { - this._bridges = aBridges; + this.onSubmit(aBridges); this._submitButton.disabled = false; // This was successful, but use cancelDialog() to close, since // we intercept the `dialogaccept` event. this._dialog.cancelDialog(); } else { - this._bridges = []; this._setUIDisabled(false); this._incorrectCaptchaHbox.style.visibility = "visible"; } }) .catch(aError => { // TODO: handle other errors properly here when we do the bridge settings re-design - this._bridges = []; this._setUIDisabled(false); this._incorrectCaptchaHbox.style.visibility = "visible"; console.log(aError); @@ -195,14 +193,13 @@ class RequestBridgeDialog { }); }
- openDialog(gSubDialog, aCloseCallback) { + openDialog(gSubDialog) { gSubDialog.open( "chrome://browser/content/torpreferences/requestBridgeDialog.xhtml", { features: "resizable=yes", closingCallback: () => { this.close(); - aCloseCallback(this._bridges); }, }, this
This is an automated email from the git hooks/post-receive script.
pierov pushed a commit to branch tor-browser-91.11.0esr-12.0-1 in repository tor-browser.
commit a1c57b4b4a76dc347c491f351e365634d5277023 Author: WofWca wofwca@protonmail.com AuthorDate: Thu Jul 21 12:12:33 2022 +0300
fixup! Bug 31286: Implementation of bridge, proxy, and firewall settings in about:preferences#connection
refactor: request brdiges: don't update bridges if they were already obtained in another tab --- browser/components/torpreferences/content/requestBridgeDialog.jsm | 2 -- 1 file changed, 2 deletions(-)
diff --git a/browser/components/torpreferences/content/requestBridgeDialog.jsm b/browser/components/torpreferences/content/requestBridgeDialog.jsm index feabb931008f3..eff4c2c083ef2 100644 --- a/browser/components/torpreferences/content/requestBridgeDialog.jsm +++ b/browser/components/torpreferences/content/requestBridgeDialog.jsm @@ -53,8 +53,6 @@ class RequestBridgeDialog { if (uri) { this._setcaptchaImage(uri); } else if (bridges) { - this.onSubmit(bridges); - this._submitButton.disabled = false; this._dialog.cancelDialog(); } });
This is an automated email from the git hooks/post-receive script.
pierov pushed a commit to branch tor-browser-91.11.0esr-12.0-1 in repository tor-browser.
commit ef0f0ae9f0e567c4ad18a6a594a7e510fb5b20b3 Author: WofWca wofwca@protonmail.com AuthorDate: Tue Jul 26 13:26:00 2022 +0300
fixup! Bug 31286: Implementation of bridge, proxy, and firewall settings in about:preferences#connection
improvement: adjust bridge settings change logic
Now that we don't call these callbacks unless "accept" was pressed, the logic can be adjusted accordingly
Co-authored-by: Pier Angelo Vendrame pierov@torproject.org --- browser/components/torpreferences/content/connectionPane.js | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-)
diff --git a/browser/components/torpreferences/content/connectionPane.js b/browser/components/torpreferences/content/connectionPane.js index eadd4e6037f4d..dd15bca7bf13c 100644 --- a/browser/components/torpreferences/content/connectionPane.js +++ b/browser/components/torpreferences/content/connectionPane.js @@ -1066,8 +1066,6 @@ const gConnectionPane = (function() { TorSettings.applySettings().then(result => { this._populateBridgeCards(); }); - } else { - TorSettings.bridges.enabled = false; } }); requestBridgeDialog.openDialog(gSubDialog); @@ -1079,14 +1077,15 @@ const gConnectionPane = (function() { TorSettings.bridges.enabled = true; TorSettings.bridges.source = TorBridgeSource.UserProvided; TorSettings.bridges.bridge_strings = aBridgeString; - TorSettings.saveToPrefs(); - TorSettings.applySettings().then(result => { - this._populateBridgeCards(); - }); } else { TorSettings.bridges.enabled = false; TorSettings.bridges.source = TorBridgeSource.Invalid; + TorSettings.bridges.bridge_strings = ""; } + TorSettings.saveToPrefs(); + TorSettings.applySettings().then(result => { + this._populateBridgeCards(); + }); }); provideBridgeDialog.openDialog(gSubDialog); },
tor-commits@lists.torproject.org