Skip to content
Snippets Groups Projects
Verified Commit 75ee8a08 authored by Pier Angelo Vendrame's avatar Pier Angelo Vendrame :jack_o_lantern:
Browse files

fixup! Bug 31286: Implementation of bridge, proxy, and firewall settings in...

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).
parent 918f4d09
No related branches found
No related tags found
1 merge request!855Bug 42299: Unbreak about:preferences#connection when invalid bridge lines are supplied
......@@ -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();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment