[tbb-commits] [Git][tpo/applications/tor-browser][tor-browser-115.5.0esr-13.5-1] fixup! Bug 40597: Implement TorSettings module
richard (@richard)
git at gitlab.torproject.org
Thu Nov 30 12:14:55 UTC 2023
richard pushed to branch tor-browser-115.5.0esr-13.5-1 at The Tor Project / Applications / Tor Browser
Commits:
27e45bc9 by Pier Angelo Vendrame at 2023-11-30T12:14:32+00:00
fixup! Bug 40597: Implement TorSettings module
Bug 40856: Add defaults to preference getters
During testing sometimes we might delete some preferences related to
TorSettings. Since this module did not have defaults to handle these
cases, sometimes we risked of ending in broken situations.
- - - - -
1 changed file:
- toolkit/modules/TorSettings.sys.mjs
Changes:
=====================================
toolkit/modules/TorSettings.sys.mjs
=====================================
@@ -327,11 +327,13 @@ export const TorSettings = (() => {
/* Quickstart */
settings.quickstart.enabled = Services.prefs.getBoolPref(
- TorSettingsPrefs.quickstart.enabled
+ TorSettingsPrefs.quickstart.enabled,
+ false
);
/* Bridges */
settings.bridges.enabled = Services.prefs.getBoolPref(
- TorSettingsPrefs.bridges.enabled
+ TorSettingsPrefs.bridges.enabled,
+ false
);
settings.bridges.source = Services.prefs.getIntPref(
TorSettingsPrefs.bridges.source,
@@ -339,13 +341,17 @@ export const TorSettings = (() => {
);
if (settings.bridges.source == TorBridgeSource.BuiltIn) {
const builtinType = Services.prefs.getStringPref(
- TorSettingsPrefs.bridges.builtin_type
+ TorSettingsPrefs.bridges.builtin_type,
+ ""
);
settings.bridges.builtin_type = builtinType;
settings.bridges.bridge_strings = getBuiltinBridgeStrings(builtinType);
if (!settings.bridges.bridge_strings.length) {
// in this case the user is using a builtin bridge that is no longer supported,
// reset to settings to default values
+ console.warn(
+ `[TorSettings] Cannot find any bridge line for the configured bridge type ${builtinType}`
+ );
settings.bridges.source = TorBridgeSource.Invalid;
settings.bridges.builtin_type = null;
}
@@ -363,23 +369,29 @@ export const TorSettings = (() => {
}
/* Proxy */
settings.proxy.enabled = Services.prefs.getBoolPref(
- TorSettingsPrefs.proxy.enabled
+ TorSettingsPrefs.proxy.enabled,
+ false
);
if (settings.proxy.enabled) {
settings.proxy.type = Services.prefs.getIntPref(
- TorSettingsPrefs.proxy.type
+ TorSettingsPrefs.proxy.type,
+ TorProxyType.Invalid
);
settings.proxy.address = Services.prefs.getStringPref(
- TorSettingsPrefs.proxy.address
+ TorSettingsPrefs.proxy.address,
+ ""
);
settings.proxy.port = Services.prefs.getIntPref(
- TorSettingsPrefs.proxy.port
+ TorSettingsPrefs.proxy.port,
+ 0
);
settings.proxy.username = Services.prefs.getStringPref(
- TorSettingsPrefs.proxy.username
+ TorSettingsPrefs.proxy.username,
+ ""
);
settings.proxy.password = Services.prefs.getStringPref(
- TorSettingsPrefs.proxy.password
+ TorSettingsPrefs.proxy.password,
+ ""
);
} else {
settings.proxy.type = TorProxyType.Invalid;
@@ -391,11 +403,13 @@ export const TorSettings = (() => {
/* Firewall */
settings.firewall.enabled = Services.prefs.getBoolPref(
- TorSettingsPrefs.firewall.enabled
+ TorSettingsPrefs.firewall.enabled,
+ false
);
if (settings.firewall.enabled) {
const portList = Services.prefs.getStringPref(
- TorSettingsPrefs.firewall.allowed_ports
+ TorSettingsPrefs.firewall.allowed_ports,
+ ""
);
settings.firewall.allowed_ports = parsePortList(portList);
} else {
View it on GitLab: https://gitlab.torproject.org/tpo/applications/tor-browser/-/commit/27e45bc9f53c2f5426196a9085a71fc584fd7180
--
View it on GitLab: https://gitlab.torproject.org/tpo/applications/tor-browser/-/commit/27e45bc9f53c2f5426196a9085a71fc584fd7180
You're receiving this email because of your account on gitlab.torproject.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.torproject.org/pipermail/tbb-commits/attachments/20231130/3ab7358a/attachment-0001.htm>
More information about the tbb-commits
mailing list