Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Tor Browser
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Container registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
The Tor Project
Applications
Tor Browser
Commits
e6a6de19
Verified
Commit
e6a6de19
authored
Jan 9, 2024
by
Pier Angelo Vendrame
Browse files
Options
Downloads
Patches
Plain Diff
fixup! Bug 40597: Implement TorSettings module
Bug 42359: Handle firewall and proxy in setSettings.
parent
b0076a91
Branches
Branches containing commit
Tags
Tags containing commit
1 merge request
!889
Bug 42366: Tor Browser 115.7.0esr alpha rebase
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
toolkit/modules/TorSettings.sys.mjs
+60
-28
60 additions, 28 deletions
toolkit/modules/TorSettings.sys.mjs
with
60 additions
and
28 deletions
toolkit/modules/TorSettings.sys.mjs
+
60
−
28
View file @
e6a6de19
...
...
@@ -301,8 +301,12 @@ class TorSettingsImpl {
return
this
.
#parsePort
(
val
,
false
)
??
0
;
},
},
username
:
{},
password
:
{},
username
:
{
transform
:
val
=>
val
??
""
,
},
password
:
{
transform
:
val
=>
val
??
""
,
},
uri
:
{
getter
:
()
=>
{
const
{
type
,
address
,
port
,
username
,
password
}
=
this
.
proxy
;
...
...
@@ -910,7 +914,11 @@ class TorSettingsImpl {
}
/**
* Set all of our settings at once from a settings object.
* Set blocks of settings at once from an object.
*
* It is possible to set all settings, or only some sections (e.g., only
* bridges), but if a key is present, its settings must make sense (e.g., if
* bridges are enabled, a valid source must be provided).
*
* @param {object} settings The settings object to set
*/
...
...
@@ -924,8 +932,15 @@ class TorSettingsImpl {
// Hold off on lots of notifications until all settings are changed.
this
.
freezeNotifications
();
try
{
if
(
"
bridges
"
in
settings
)
{
this
.
bridges
.
enabled
=
!!
settings
.
bridges
.
enabled
;
// Currently, disabling bridges in the UI does not remove the lines,
// because we call only the `enabled` setter.
// So, if the bridge source is undefined but bridges are disabled,
// do not force Invalid. Instead, keep the current source.
if
(
this
.
bridges
.
enabled
||
settings
.
bridges
.
source
!==
undefined
)
{
this
.
bridges
.
source
=
settings
.
bridges
.
source
;
}
switch
(
settings
.
bridges
.
source
)
{
case
TorBridgeSource
.
BridgeDB
:
case
TorBridgeSource
.
UserProvided
:
...
...
@@ -951,8 +966,25 @@ class TorSettingsImpl {
}
break
;
}
}
if
(
"
proxy
"
in
settings
)
{
this
.
proxy
.
enabled
=
!!
settings
.
proxy
.
enabled
;
if
(
this
.
proxy
.
enabled
)
{
this
.
proxy
.
type
=
settings
.
proxy
.
type
;
this
.
proxy
.
address
=
settings
.
proxy
.
address
;
this
.
proxy
.
port
=
settings
.
proxy
.
port
;
this
.
proxy
.
username
=
settings
.
proxy
.
username
;
this
.
proxy
.
password
=
settings
.
proxy
.
password
;
}
}
// TODO: proxy and firewall
if
(
"
firewall
"
in
settings
)
{
this
.
firewall
.
enabled
=
!!
settings
.
firewall
.
enabled
;
if
(
this
.
firewall
.
enabled
)
{
this
.
firewall
.
allowed_ports
=
settings
.
firewall
.
allowed_ports
;
}
}
}
catch
(
ex
)
{
// Restore the old settings without any new notifications generated from
// the above code.
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
sign in
to comment