Pier Angelo Vendrame pushed to branch tor-browser-115.5.0esr-13.5-1 at The Tor Project / Applications / Tor Browser
Commits: 75ee8a08 by Pier Angelo Vendrame at 2023-11-28T17:06:52+01:00 fixup! Bug 31286: Implementation of bridge, proxy, and firewall settings in about:preferences#connection
Bug 42299: Unbreak about:preferences#connection when invalid bridge lines are supplied
We switched to a shared bridge line parser. It might throw if an invalid bridge line is passed, but we do not handle the exception in connectionPane.js. As a result, the page breaks.
As a workaround, we can simply ignore the errors, but a better solution would warn the user about that. A bridge card rework is expected to happen in the 13.5 cycle, so I think we can defer a proper fix to that moment. (This should also be the UX of 11.5, 12.0 and 12.5).
- - - - -
1 changed file:
- browser/components/torpreferences/content/connectionPane.js
Changes:
===================================== browser/components/torpreferences/content/connectionPane.js ===================================== @@ -398,7 +398,7 @@ const gConnectionPane = (function () { bridgeSwitch.addEventListener("toggle", () => { TorSettings.bridges.enabled = bridgeSwitch.pressed; TorSettings.saveToPrefs(); - TorSettings.applySettings().then(result => { + TorSettings.applySettings().finally(() => { this._populateBridgeCards(); }); }); @@ -486,7 +486,12 @@ const gConnectionPane = (function () { }); const idString = TorStrings.settings.bridgeId; const id = card.querySelector(selectors.bridges.cardId); - const details = TorParsers.parseBridgeLine(bridgeString); + let details; + try { + details = TorParsers.parseBridgeLine(bridgeString); + } catch (e) { + console.error(`Detected invalid bridge line: ${bridgeString}`, e); + } if (details && details.id !== undefined) { card.setAttribute("data-bridge-id", details.id); } @@ -529,7 +534,7 @@ const gConnectionPane = (function () { bridgeSwitch.pressed && !!strings.length; TorSettings.bridges.bridge_strings = strings.join("\n"); TorSettings.saveToPrefs(); - TorSettings.applySettings().then(result => { + TorSettings.applySettings().finally(() => { this._populateBridgeCards(); }); }); @@ -1021,7 +1026,7 @@ const gConnectionPane = (function () { TorSettings.bridges.builtin_type = ""; } TorSettings.saveToPrefs(); - TorSettings.applySettings().then(result => { + TorSettings.applySettings().finally(() => { this._populateBridgeCards(); }); }, @@ -1036,8 +1041,12 @@ const gConnectionPane = (function () { async saveBridgeSettings(connect) { TorSettings.saveToPrefs(); // FIXME: This can throw if the user adds a bridge manually with invalid - // content. Should be addressed by tor-browser#40552. - await TorSettings.applySettings(); + // content. Should be addressed by tor-browser#41913. + try { + await TorSettings.applySettings(); + } catch (e) { + console.error("Applying settings failed", e); + }
this._populateBridgeCards();
View it on GitLab: https://gitlab.torproject.org/tpo/applications/tor-browser/-/commit/75ee8a08...
tbb-commits@lists.torproject.org