tor-commits
Threads by month
- ----- 2025 -----
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
April 2024
- 1 participants
- 152 discussions

[Git][tpo/applications/mullvad-browser][mullvad-browser-115.9.0esr-13.5-1] fixup! Adding issue and merge request templates
by richard (@richard) 10 Apr '24
by richard (@richard) 10 Apr '24
10 Apr '24
richard pushed to branch mullvad-browser-115.9.0esr-13.5-1 at The Tor Project / Applications / Mullvad Browser
Commits:
0cc8a01a by Richard Pospesel at 2024-04-10T18:09:38+00:00
fixup! Adding issue and merge request templates
add an issue template to guide emergency bug fixes
- - - - -
1 changed file:
- + .gitlab/issue_templates/Emergency Security Issue.md
Changes:
=====================================
.gitlab/issue_templates/Emergency Security Issue.md
=====================================
@@ -0,0 +1,90 @@
+**NOTE** This is an issue template to standardise our process for responding to and fixing critical security and privacy vulnerabilities, exploits, etc.
+
+## Information
+
+### Related Issue
+- tor-browser#AAAAA
+- mullvad-browser#BBBBB
+- tor-browser-build#CCCCC
+
+#### Affected Platforms
+
+- [ ] Android
+- [ ] Desktop
+ - [ ] Windows
+ - [ ] macOS
+ - [ ] Linux
+
+### Type of Issue: What are we dealing with?
+
+- [ ] Security (sandbox escape, remote code execution, etc)
+- [ ] Proxy Bypass (traffic contents becoming MITM'able)
+- [ ] De-Anonymization (otherwise identifying which website a user is visiting)
+- [ ] Cross-Site Linkability (correlating sessions across circuits and websites)
+- [ ] Disk Leak (persisting session information to disk)
+- [ ] Other (please explain)
+
+### Involvement: Who needs to be consulted and or involved to fix this?
+
+- [ ] Applications Developers
+ - [ ] **boklm** : build, packaging, signing, release
+ - [ ] **clairehurst** : Android, macOS
+ - [ ] **dan** : Android, macOS
+ - [ ] **henry** : accessibility, frontend, localisation
+ - [ ] **ma1** : firefox internals
+ - [ ] **pierov** : updater, fonts, localisation, general
+ - [ ] **richard** : signing, release
+ - [ ] **thorin** : fingerprinting
+- [ ] Other Engineering Teams
+ - [ ] Networking (**ahf**, **dgoulet**)
+ - [ ] Anti-Censorship (**meskio**, **cohosh**)
+ - [ ] UX (**donuts**)
+ - [ ] TPA (**anarcat**, **lavamind**)
+- [ ] External Tor Partners
+ - [ ] Mozilla
+ - [ ] Mullvad
+ - [ ] Brave
+ - [ ] Guardian Project (Orbot, Onion Browser)
+ - [ ] Tails
+ - [ ] Other (please list)
+
+### Urgency: When do we need to act?
+
+- [ ] **ASAP** :rotating_light: Emergency release :rotating_light:
+- [ ] Next scheduled stable
+- [ ] Next scheduled alpha, then backport to stable
+- [ ] Next major release
+- [ ] Other (please explain)
+
+#### Justification
+
+<!-- Provide some paragraph here justifying the logic behind our estimated urgency -->
+
+### Side-Effects: Who will be affected by a fix for this?
+Sometimes fixes have side-effects: users lose their data, roadmaps need to be adjusted, services have to be upgraded, etc. Please enumerate the known downstream consequences a fix to this issue will likely incur.
+- [ ] End-Users (please list)
+- [ ] Internal Partners (please list)
+- [ ] External Partners (please list)
+
+## Todo:
+
+### Communications
+
+- [ ] Start an initial email thread with the following people:
+ - [ ] **bella**
+ - [ ] Relevant Applications Developers
+ - [ ] **(Optional)** **micah**
+ - if there are considerations or asks outside the Applications Team
+ - [ ] **(Optional)** Other Team Leads
+ - if there are considerations or asks outside the Applications Team
+ - [ ] **(Optional)** **gazebook**
+ - if there are consequences to the organisation or partners beyond a browser update, then a communication plan may be needed
+
+/cc @bella
+/cc @ma1
+/cc @micah
+/cc @richard
+
+/confidential
+
+Godspeed! :pray:
View it on GitLab: https://gitlab.torproject.org/tpo/applications/mullvad-browser/-/commit/0cc…
--
View it on GitLab: https://gitlab.torproject.org/tpo/applications/mullvad-browser/-/commit/0cc…
You're receiving this email because of your account on gitlab.torproject.org.
1
0

[Git][tpo/applications/tor-browser-build][main] Bug 41124: Fix copying .DS_Store in gatekeeper-bundling.sh
by boklm (@boklm) 10 Apr '24
by boklm (@boklm) 10 Apr '24
10 Apr '24
boklm pushed to branch main at The Tor Project / Applications / tor-browser-build
Commits:
263c4936 by Nicolas Vigier at 2024-04-10T19:29:10+02:00
Bug 41124: Fix copying .DS_Store in gatekeeper-bundling.sh
Fixing some issue introduced in 4e2b66e977873c46b3678c93ae9173f53503f81a.
- - - - -
1 changed file:
- tools/signing/gatekeeper-bundling.sh
Changes:
=====================================
tools/signing/gatekeeper-bundling.sh
=====================================
@@ -69,6 +69,9 @@ export PATH="$PATH:$tmpdir/libdmg-hfsplus:$tmpdir/hfsplus-tools"
cd $tmpdir/dmg
+cp ${tbb_version_type}.DS_Store .DS_Store
+rm *.DS_Store
+
tar -xf $macos_stapled_dir/"${proj_name}-${tbb_version}-notarized+stapled.tar.zst"
cd ..
View it on GitLab: https://gitlab.torproject.org/tpo/applications/tor-browser-build/-/commit/2…
--
View it on GitLab: https://gitlab.torproject.org/tpo/applications/tor-browser-build/-/commit/2…
You're receiving this email because of your account on gitlab.torproject.org.
1
0

[Git][tpo/applications/tor-browser] Pushed new branch tor-browser-115.10.0esr-13.5-1
by Pier Angelo Vendrame (@pierov) 10 Apr '24
by Pier Angelo Vendrame (@pierov) 10 Apr '24
10 Apr '24
Pier Angelo Vendrame pushed new branch tor-browser-115.10.0esr-13.5-1 at The Tor Project / Applications / Tor Browser
--
View it on GitLab: https://gitlab.torproject.org/tpo/applications/tor-browser/-/tree/tor-brows…
You're receiving this email because of your account on gitlab.torproject.org.
1
0

[Git][tpo/applications/tor-browser][base-browser-115.9.0esr-13.5-1] fixup! Adding issue and merge request templates
by richard (@richard) 09 Apr '24
by richard (@richard) 09 Apr '24
09 Apr '24
richard pushed to branch base-browser-115.9.0esr-13.5-1 at The Tor Project / Applications / Tor Browser
Commits:
adc4563c by Richard Pospesel at 2024-04-09T21:06:19+00:00
fixup! Adding issue and merge request templates
add an issue template to guide emergency bug fixes
- - - - -
1 changed file:
- + .gitlab/issue_templates/Emergency Security Issue.md
Changes:
=====================================
.gitlab/issue_templates/Emergency Security Issue.md
=====================================
@@ -0,0 +1,90 @@
+**NOTE** This is an issue template to standardise our process for responding to and fixing critical security and privacy vulnerabilities, exploits, etc.
+
+## Information
+
+### Related Issue
+- tor-browser#AAAAA
+- mullvad-browser#BBBBB
+- tor-browser-build#CCCCC
+
+#### Affected Platforms
+
+- [ ] Android
+- [ ] Desktop
+ - [ ] Windows
+ - [ ] macOS
+ - [ ] Linux
+
+### Type of Issue: What are we dealing with?
+
+- [ ] Security (sandbox escape, remote code execution, etc)
+- [ ] Proxy Bypass (traffic contents becoming MITM'able)
+- [ ] De-Anonymization (otherwise identifying which website a user is visiting)
+- [ ] Cross-Site Linkability (correlating sessions across circuits and websites)
+- [ ] Disk Leak (persisting session information to disk)
+- [ ] Other (please explain)
+
+### Involvement: Who needs to be consulted and or involved to fix this?
+
+- [ ] Applications Developers
+ - [ ] **boklm** : build, packaging, signing, release
+ - [ ] **clairehurst** : Android, macOS
+ - [ ] **dan** : Android, macOS
+ - [ ] **henry** : accessibility, frontend, localisation
+ - [ ] **ma1** : firefox internals
+ - [ ] **pierov** : updater, fonts, localisation, general
+ - [ ] **richard** : signing, release
+ - [ ] **thorin** : fingerprinting
+- [ ] Other Engineering Teams
+ - [ ] Networking (**ahf**, **dgoulet**)
+ - [ ] Anti-Censorship (**meskio**, **cohosh**)
+ - [ ] UX (**donuts**)
+ - [ ] TPA (**anarcat**, **lavamind**)
+- [ ] External Tor Partners
+ - [ ] Mozilla
+ - [ ] Mullvad
+ - [ ] Brave
+ - [ ] Guardian Project (Orbot, Onion Browser)
+ - [ ] Tails
+ - [ ] Other (please list)
+
+### Urgency: When do we need to act?
+
+- [ ] **ASAP** :rotating_light: Emergency release :rotating_light:
+- [ ] Next scheduled stable
+- [ ] Next scheduled alpha, then backport to stable
+- [ ] Next major release
+- [ ] Other (please explain)
+
+#### Justification
+
+<!-- Provide some paragraph here justifying the logic behind our estimated urgency -->
+
+### Side-Effects: Who will be affected by a fix for this?
+Sometimes fixes have side-effects: users lose their data, roadmaps need to be adjusted, services have to be upgraded, etc. Please enumerate the known downstream consequences a fix to this issue will likely incur.
+- [ ] End-Users (please list)
+- [ ] Internal Partners (please list)
+- [ ] External Partners (please list)
+
+## Todo:
+
+### Communications
+
+- [ ] Start an initial email thread with the following people:
+ - [ ] **bella**
+ - [ ] Relevant Applications Developers
+ - [ ] **(Optional)** **micah**
+ - if there are considerations or asks outside the Applications Team
+ - [ ] **(Optional)** Other Team Leads
+ - if there are considerations or asks outside the Applications Team
+ - [ ] **(Optional)** **gazebook**
+ - if there are consequences to the organisation or partners beyond a browser update, then a communication plan may be needed
+
+/cc @bella
+/cc @ma1
+/cc @micah
+/cc @richard
+
+/confidential
+
+Godspeed! :pray:
View it on GitLab: https://gitlab.torproject.org/tpo/applications/tor-browser/-/commit/adc4563…
--
View it on GitLab: https://gitlab.torproject.org/tpo/applications/tor-browser/-/commit/adc4563…
You're receiving this email because of your account on gitlab.torproject.org.
1
0

[Git][tpo/applications/tor-browser][tor-browser-115.9.0esr-13.5-1] fixup! Adding issue and merge request templates
by richard (@richard) 09 Apr '24
by richard (@richard) 09 Apr '24
09 Apr '24
richard pushed to branch tor-browser-115.9.0esr-13.5-1 at The Tor Project / Applications / Tor Browser
Commits:
00c2adf5 by Richard Pospesel at 2024-04-09T20:50:01+00:00
fixup! Adding issue and merge request templates
add an issue template to guide emergency bug fixes
- - - - -
1 changed file:
- + .gitlab/issue_templates/Emergency Security Issue.md
Changes:
=====================================
.gitlab/issue_templates/Emergency Security Issue.md
=====================================
@@ -0,0 +1,90 @@
+**NOTE** This is an issue template to standardise our process for responding to and fixing critical security and privacy vulnerabilities, exploits, etc.
+
+## Information
+
+### Related Issue
+- tor-browser#AAAAA
+- mullvad-browser#BBBBB
+- tor-browser-build#CCCCC
+
+#### Affected Platforms
+
+- [ ] Android
+- [ ] Desktop
+ - [ ] Windows
+ - [ ] macOS
+ - [ ] Linux
+
+### Type of Issue: What are we dealing with?
+
+- [ ] Security (sandbox escape, remote code execution, etc)
+- [ ] Proxy Bypass (traffic contents becoming MITM'able)
+- [ ] De-Anonymization (otherwise identifying which website a user is visiting)
+- [ ] Cross-Site Linkability (correlating sessions across circuits and websites)
+- [ ] Disk Leak (persisting session information to disk)
+- [ ] Other (please explain)
+
+### Involvement: Who needs to be consulted and or involved to fix this?
+
+- [ ] Applications Developers
+ - [ ] **boklm** : build, packaging, signing, release
+ - [ ] **clairehurst** : Android, macOS
+ - [ ] **dan** : Android, macOS
+ - [ ] **henry** : accessibility, frontend, localisation
+ - [ ] **ma1** : firefox internals
+ - [ ] **pierov** : updater, fonts, localisation, general
+ - [ ] **richard** : signing, release
+ - [ ] **thorin** : fingerprinting
+- [ ] Other Engineering Teams
+ - [ ] Networking (**ahf**, **dgoulet**)
+ - [ ] Anti-Censorship (**meskio**, **cohosh**)
+ - [ ] UX (**donuts**)
+ - [ ] TPA (**anarcat**, **lavamind**)
+- [ ] External Tor Partners
+ - [ ] Mozilla
+ - [ ] Mullvad
+ - [ ] Brave
+ - [ ] Guardian Project (Orbot, Onion Browser)
+ - [ ] Tails
+ - [ ] Other (please list)
+
+### Urgency: When do we need to act?
+
+- [ ] **ASAP** :rotating_light: Emergency release :rotating_light:
+- [ ] Next scheduled stable
+- [ ] Next scheduled alpha, then backport to stable
+- [ ] Next major release
+- [ ] Other (please explain)
+
+#### Justification
+
+<!-- Provide some paragraph here justifying the logic behind our estimated urgency -->
+
+### Side-Effects: Who will be affected by a fix for this?
+Sometimes fixes have side-effects: users lose their data, roadmaps need to be adjusted, services have to be upgraded, etc. Please enumerate the known downstream consequences a fix to this issue will likely incur.
+- [ ] End-Users (please list)
+- [ ] Internal Partners (please list)
+- [ ] External Partners (please list)
+
+## Todo:
+
+### Communications
+
+- [ ] Start an initial email thread with the following people:
+ - [ ] **bella**
+ - [ ] Relevant Applications Developers
+ - [ ] **(Optional)** **micah**
+ - if there are considerations or asks outside the Applications Team
+ - [ ] **(Optional)** Other Team Leads
+ - if there are considerations or asks outside the Applications Team
+ - [ ] **(Optional)** **gazebook**
+ - if there are consequences to the organisation or partners beyond a browser update, then a communication plan may be needed
+
+/cc @bella
+/cc @ma1
+/cc @micah
+/cc @richard
+
+/confidential
+
+Godspeed! :pray:
View it on GitLab: https://gitlab.torproject.org/tpo/applications/tor-browser/-/commit/00c2adf…
--
View it on GitLab: https://gitlab.torproject.org/tpo/applications/tor-browser/-/commit/00c2adf…
You're receiving this email because of your account on gitlab.torproject.org.
1
0

[Git][tpo/applications/tor-browser][tor-browser-115.9.0esr-13.5-1] 4 commits: fixup! Bug 31286: Implementation of bridge, proxy, and firewall settings in...
by richard (@richard) 09 Apr '24
by richard (@richard) 09 Apr '24
09 Apr '24
richard pushed to branch tor-browser-115.9.0esr-13.5-1 at The Tor Project / Applications / Tor Browser
Commits:
d4a4b72b by Henry Wilkes at 2024-04-09T19:54:28+00:00
fixup! Bug 31286: Implementation of bridge, proxy, and firewall settings in about:preferences#connection
Bug 42207: Migrate preferences strings to Fluent.
- - - - -
6b080bf1 by Henry Wilkes at 2024-04-09T19:54:28+00:00
fixup! Tor Browser strings
Bug 42207: Migrate preferences strings to Fluent.
- - - - -
7ff82efa by Henry Wilkes at 2024-04-09T19:54:28+00:00
fixup! Add TorStrings module for localization
Bug 42207: Migrate preferences strings to Fluent.
- - - - -
446e78a5 by Henry Wilkes at 2024-04-09T19:54:28+00:00
fixup! Tor Browser localization migration scripts.
Bug 42207: Migrate preferences to Fluent.
- - - - -
19 changed files:
- browser/components/torpreferences/content/bridgeQrDialog.js
- browser/components/torpreferences/content/bridgeQrDialog.xhtml
- browser/components/torpreferences/content/builtinBridgeDialog.js
- browser/components/torpreferences/content/builtinBridgeDialog.xhtml
- browser/components/torpreferences/content/connectionCategory.inc.xhtml
- browser/components/torpreferences/content/connectionPane.js
- browser/components/torpreferences/content/connectionPane.xhtml
- browser/components/torpreferences/content/connectionSettingsDialog.js
- browser/components/torpreferences/content/connectionSettingsDialog.xhtml
- browser/components/torpreferences/content/provideBridgeDialog.js
- browser/components/torpreferences/content/requestBridgeDialog.js
- browser/components/torpreferences/content/requestBridgeDialog.xhtml
- browser/components/torpreferences/content/torLogDialog.js
- browser/components/torpreferences/content/torLogDialog.xhtml
- browser/components/torpreferences/content/torPreferences.css
- browser/locales/en-US/browser/tor-browser.ftl
- toolkit/modules/TorStrings.sys.mjs
- toolkit/torbutton/chrome/locale/en-US/settings.properties
- + tools/torbrowser/l10n/migrations/bug-42207-settings.py
Changes:
=====================================
browser/components/torpreferences/content/bridgeQrDialog.js
=====================================
@@ -4,19 +4,11 @@ const { QRCode } = ChromeUtils.importESModule(
"resource://gre/modules/QRCode.sys.mjs"
);
-const { TorStrings } = ChromeUtils.importESModule(
- "resource://gre/modules/TorStrings.sys.mjs"
-);
-
window.addEventListener(
"DOMContentLoaded",
() => {
const bridgeString = window.arguments[0];
- document.documentElement.setAttribute(
- "title",
- TorStrings.settings.scanQrTitle
- );
const target = document.getElementById("bridgeQr-target");
const style = window.getComputedStyle(target);
// We are assuming that the style width and height have "px" units.
=====================================
browser/components/torpreferences/content/bridgeQrDialog.xhtml
=====================================
@@ -7,8 +7,13 @@
type="child"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
xmlns:html="http://www.w3.org/1999/xhtml"
+ data-l10n-id="bridge-qr-dialog-title"
>
<dialog id="bridgeQr-dialog" buttons="accept">
+ <linkset>
+ <html:link rel="localization" href="browser/tor-browser.ftl" />
+ </linkset>
+
<script src="chrome://browser/content/torpreferences/bridgeQrDialog.js" />
<html:div id="bridgeQr">
=====================================
browser/components/torpreferences/content/builtinBridgeDialog.js
=====================================
@@ -1,9 +1,5 @@
"use strict";
-const { TorStrings } = ChromeUtils.importESModule(
- "resource://gre/modules/TorStrings.sys.mjs"
-);
-
const { TorSettings, TorBridgeSource } = ChromeUtils.importESModule(
"resource://gre/modules/TorSettings.sys.mjs"
);
@@ -16,34 +12,10 @@ const gBuiltinBridgeDialog = {
init() {
this._result = window.arguments[0];
- document.documentElement.setAttribute(
- "title",
- TorStrings.settings.builtinBridgeHeader
- );
-
- document.getElementById(
- "torPreferences-builtinBridge-description"
- ).textContent = TorStrings.settings.builtinBridgeDescription2;
-
this._radioGroup = document.getElementById(
"torPreferences-builtinBridge-typeSelection"
);
- const typeStrings = {
- obfs4: {
- label: TorStrings.settings.builtinBridgeObfs4Title,
- descr: TorStrings.settings.builtinBridgeObfs4Description2,
- },
- snowflake: {
- label: TorStrings.settings.builtinBridgeSnowflake,
- descr: TorStrings.settings.builtinBridgeSnowflakeDescription2,
- },
- "meek-azure": {
- label: TorStrings.settings.builtinBridgeMeekAzure,
- descr: TorStrings.settings.builtinBridgeMeekAzureDescription2,
- },
- };
-
const currentBuiltinType =
TorSettings.bridges.enabled &&
TorSettings.bridges.source == TorBridgeSource.BuiltIn
@@ -56,16 +28,18 @@ const gBuiltinBridgeDialog = {
const radio = optionEl.querySelector("radio");
const type = radio.value;
optionEl.hidden = !TorSettings.builtinBridgeTypes.includes(type);
- radio.label = typeStrings[type].label;
+
const descriptionEl = optionEl.querySelector(
".builtin-bridges-option-description"
);
- descriptionEl.textContent = typeStrings[type].descr;
+ // Set an id to be used for the aria-describedby.
+ descriptionEl.id = `builtin-bridges-description-${type}`;
const currentBadge = optionEl.querySelector(".bridge-status-badge");
if (type === currentBuiltinType) {
const currentLabelEl = optionEl.querySelector(
".torPreferences-current-bridge-label"
);
+ currentLabelEl.id = `builtin-bridges-current-${type}`;
// Described by both the current badge and the full description.
// These will be concatenated together in the screen reader output.
radio.setAttribute(
@@ -77,6 +51,7 @@ const gBuiltinBridgeDialog = {
} else {
// No visible badge.
radio.setAttribute("aria-describedby", descriptionEl.id);
+ currentBadge.classList.remove("bridge-status-current-built-in");
}
}
@@ -117,10 +92,8 @@ const gBuiltinBridgeDialog = {
const connect = TorConnect.canBeginBootstrap;
this._result.connect = connect;
this._acceptButton.setAttribute(
- "label",
- connect
- ? TorStrings.settings.bridgeButtonConnect
- : TorStrings.settings.bridgeButtonAccept
+ "data-l10n-id",
+ connect ? "bridge-dialog-button-connect" : "bridge-dialog-button-accept"
);
},
=====================================
browser/components/torpreferences/content/builtinBridgeDialog.xhtml
=====================================
@@ -7,26 +7,30 @@
type="child"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
xmlns:html="http://www.w3.org/1999/xhtml"
+ data-l10n-id="built-in-dialog-title"
>
<dialog id="torPreferences-builtinBridge-dialog" buttons="accept,cancel">
<linkset>
+ <html:link rel="localization" href="branding/brand.ftl" />
<html:link rel="localization" href="browser/tor-browser.ftl" />
</linkset>
<script src="chrome://browser/content/torpreferences/builtinBridgeDialog.js" />
- <description id="torPreferences-builtinBridge-description"> </description>
+ <description data-l10n-id="built-in-dialog-introduction"></description>
<radiogroup id="torPreferences-builtinBridge-typeSelection">
<vbox class="builtin-bridges-option">
<hbox>
<!-- The radio option is described by both the "Current bridge" label
- and the full description. If the "Connected" label is hidden, then
- only the latter description should contribute. -->
- <radio value="obfs4" />
+ <radio
+ value="obfs4"
+ data-l10n-id="built-in-dialog-obfs4-radio-option"
+ />
<html:span class="bridge-status-badge">
<html:div class="bridge-status-icon"></html:div>
<html:span
- id="obfs-bridges-current"
class="torPreferences-current-bridge-label"
data-l10n-id="built-in-dialog-current-bridge-label"
>
@@ -34,18 +38,20 @@
</html:span>
</hbox>
<html:div
- id="obfs-bridges-description"
class="indent builtin-bridges-option-description"
+ data-l10n-id="tor-bridges-built-in-obfs4-description"
>
</html:div>
</vbox>
<vbox class="builtin-bridges-option">
<hbox>
- <radio value="snowflake" />
+ <radio
+ value="snowflake"
+ data-l10n-id="built-in-dialog-snowflake-radio-option"
+ />
<html:span class="bridge-status-badge">
<html:div class="bridge-status-icon"></html:div>
<html:span
- id="snowflake-bridges-current"
class="torPreferences-current-bridge-label"
data-l10n-id="built-in-dialog-current-bridge-label"
>
@@ -53,18 +59,20 @@
</html:span>
</hbox>
<html:div
- id="snowflake-bridges-description"
class="indent builtin-bridges-option-description"
+ data-l10n-id="tor-bridges-built-in-snowflake-description"
>
</html:div>
</vbox>
<vbox class="builtin-bridges-option">
<hbox>
- <radio value="meek-azure" />
+ <radio
+ value="meek-azure"
+ data-l10n-id="built-in-dialog-meek-azure-radio-option"
+ />
<html:span class="bridge-status-badge">
<html:div class="bridge-status-icon"></html:div>
<html:span
- id="meek-bridges-current"
class="torPreferences-current-bridge-label"
data-l10n-id="built-in-dialog-current-bridge-label"
>
@@ -72,8 +80,8 @@
</html:span>
</hbox>
<html:div
- id="meek-bridges-description"
class="indent builtin-bridges-option-description"
+ data-l10n-id="tor-bridges-built-in-meek-azure-description"
>
</html:div>
</vbox>
=====================================
browser/components/torpreferences/content/connectionCategory.inc.xhtml
=====================================
@@ -5,5 +5,5 @@
align="center"
hidden="true">
<image class="category-icon"/>
- <label id="torPreferences-labelCategory" class="category-name" flex="1" value="Connection"/>
+ <label class="category-name" flex="1" data-l10n-id="tor-connection-settings-heading"></label>
</richlistitem>
=====================================
browser/components/torpreferences/content/connectionPane.js
=====================================
@@ -1088,18 +1088,17 @@ const gBuiltinBridgesArea = {
* @type {Object<string,object>}
*/
_bridgeTypeStrings: {
- // TODO: Change to Fluent ids.
obfs4: {
- name: TorStrings.settings.builtinBridgeObfs4Title,
- description: TorStrings.settings.builtinBridgeObfs4Description2,
+ name: "tor-bridges-built-in-obfs4-name",
+ description: "tor-bridges-built-in-obfs4-description",
},
snowflake: {
- name: TorStrings.settings.builtinBridgeSnowflake,
- description: TorStrings.settings.builtinBridgeSnowflakeDescription2,
+ name: "tor-bridges-built-in-snowflake-name",
+ description: "tor-bridges-built-in-snowflake-description",
},
"meek-azure": {
- name: TorStrings.settings.builtinBridgeMeekAzure,
- description: TorStrings.settings.builtinBridgeMeekAzureDescription2,
+ name: "tor-bridges-built-in-meek-azure-name",
+ description: "tor-bridges-built-in-meek-azure-description",
},
},
@@ -1151,15 +1150,11 @@ const gBuiltinBridgesArea = {
const bridgeStrings = this._bridgeTypeStrings[bridgeType];
if (bridgeStrings) {
- /*
document.l10n.setAttributes(this._nameEl, bridgeStrings.name);
document.l10n.setAttributes(
this._descriptionEl,
bridgeStrings.description
);
- */
- this._nameEl.textContent = bridgeStrings.name;
- this._descriptionEl.textContent = bridgeStrings.description;
} else {
// Unknown type, or no type.
this._nameEl.removeAttribute("data-l10n-id");
@@ -2075,7 +2070,7 @@ const gBridgeSettings = {
// "Remove all bridges"?
document
.getElementById("tor-bridges-options-remove-all-menu-item")
- .addEventListener("click", () => {
+ .addEventListener("click", async () => {
// TODO: Should we only have a warning when not built-in?
const parentWindow =
Services.wm.getMostRecentWindow("navigator:browser");
@@ -2085,13 +2080,20 @@ const gBridgeSettings = {
Services.prompt.BUTTON_POS_0_DEFAULT +
Services.prompt.BUTTON_POS_1 * Services.prompt.BUTTON_TITLE_CANCEL;
+ const [titleString, bodyString, removeString] =
+ await document.l10n.formatValues([
+ { id: "remove-all-bridges-warning-title" },
+ { id: "remove-all-bridges-warning-description" },
+ { id: "remove-all-bridges-warning-remove-button" },
+ ]);
+
// TODO: Update the text, and remove old strings.
const buttonIndex = Services.prompt.confirmEx(
parentWindow,
- TorStrings.settings.bridgeRemoveAllDialogTitle,
- TorStrings.settings.bridgeRemoveAllDialogDescription,
+ titleString,
+ bodyString,
flags,
- TorStrings.settings.remove,
+ removeString,
null,
null,
null,
@@ -2289,36 +2291,13 @@ const gBridgeSettings = {
const gConnectionPane = (function () {
/* CSS selectors for all of the Tor Network DOM elements we need to access */
const selectors = {
- category: {
- title: "label#torPreferences-labelCategory",
- },
- torPreferences: {
- header: "h1#torPreferences-header",
- description: "span#torPreferences-description",
- learnMore: "label#torPreferences-learnMore",
- },
- quickstart: {
- header: "h2#torPreferences-quickstart-header",
- description: "span#torPreferences-quickstart-description",
- enableQuickstartCheckbox: "checkbox#torPreferences-quickstart-toggle",
- },
bridges: {
- header: "h1#torPreferences-bridges-header",
- description: "span#torPreferences-bridges-description",
- learnMore: "label#torPreferences-bridges-learnMore",
locationGroup: "#torPreferences-bridges-locationGroup",
locationLabel: "#torPreferences-bridges-locationLabel",
location: "#torPreferences-bridges-location",
locationEntries: "#torPreferences-bridges-locationEntries",
chooseForMe: "#torPreferences-bridges-buttonChooseBridgeForMe",
},
- advanced: {
- header: "h1#torPreferences-advanced-header",
- label: "#torPreferences-advanced-label",
- button: "#torPreferences-advanced-button",
- torLogsLabel: "label#torPreferences-torLogs",
- torLogsButton: "button#torPreferences-buttonTorLogs",
- },
}; /* selectors */
const retval = {
@@ -2342,96 +2321,62 @@ const gConnectionPane = (function () {
}
});
- document
- .querySelector(selectors.category.title)
- .setAttribute("value", TorStrings.settings.categoryTitle);
-
- const prefpane = document.getElementById("mainPrefPane");
-
- // Heading
- prefpane.querySelector(selectors.torPreferences.header).innerText =
- TorStrings.settings.categoryTitle;
- prefpane.querySelector(selectors.torPreferences.description).textContent =
- TorStrings.settings.torPreferencesDescription;
- {
- const learnMore = prefpane.querySelector(
- selectors.torPreferences.learnMore
- );
- learnMore.setAttribute("value", TorStrings.settings.learnMore);
- learnMore.setAttribute(
- "href",
- TorStrings.settings.learnMoreTorBrowserURL
- );
- if (TorStrings.settings.learnMoreTorBrowserURL.startsWith("about:")) {
- learnMore.setAttribute("useoriginprincipal", "true");
- }
- }
-
// Internet and Tor status
const internetStatus = document.getElementById(
"torPreferences-status-internet"
);
- internetStatus.querySelector(".torPreferences-status-name").textContent =
- TorStrings.settings.statusInternetLabel;
const internetResult = internetStatus.querySelector(
".torPreferences-status-result"
);
const internetTest = document.getElementById(
"torPreferences-status-internet-test"
);
- internetTest.setAttribute(
- "label",
- TorStrings.settings.statusInternetTest
- );
- internetTest.addEventListener("command", () => {
+ internetTest.addEventListener("click", () => {
this.onInternetTest();
});
const torConnectStatus = document.getElementById(
"torPreferences-status-tor-connect"
);
- torConnectStatus.querySelector(
- ".torPreferences-status-name"
- ).textContent = TorStrings.settings.statusTorLabel;
const torConnectResult = torConnectStatus.querySelector(
".torPreferences-status-result"
);
const torConnectButton = document.getElementById(
"torPreferences-status-tor-connect-button"
);
- torConnectButton.setAttribute(
- "label",
- TorStrings.torConnect.torConnectButton
- );
- torConnectButton.addEventListener("command", () => {
+ torConnectButton.addEventListener("click", () => {
TorConnect.openTorConnect({ beginBootstrap: true });
});
this._populateStatus = () => {
+ let internetId;
switch (this._internetStatus) {
case InternetStatus.Online:
internetStatus.classList.remove("offline");
- internetResult.textContent =
- TorStrings.settings.statusInternetOnline;
- internetResult.hidden = false;
+ internetId = "tor-connection-internet-status-online";
break;
case InternetStatus.Offline:
internetStatus.classList.add("offline");
- internetResult.textContent =
- TorStrings.settings.statusInternetOffline;
- internetResult.hidden = false;
+ internetId = "tor-connection-internet-status-offline";
break;
case InternetStatus.Unknown:
default:
internetStatus.classList.remove("offline");
- internetResult.hidden = true;
break;
}
+ if (internetId) {
+ document.l10n.setAttributes(internetResult, internetId);
+ internetResult.hidden = false;
+ } else {
+ internetResult.hidden = true;
+ }
+
+ let connectId;
// FIXME: What about the TorConnectState.Disabled state?
if (TorConnect.state === TorConnectState.Bootstrapped) {
torConnectStatus.classList.add("connected");
torConnectStatus.classList.remove("blocked");
- torConnectResult.textContent = TorStrings.settings.statusTorConnected;
+ connectId = "tor-connection-network-status-connected";
// NOTE: If the button is focused when we hide it, the focus may be
// lost. But we don't have an obvious place to put the focus instead.
torConnectButton.hidden = true;
@@ -2441,26 +2386,18 @@ const gConnectionPane = (function () {
"blocked",
TorConnect.potentiallyBlocked
);
- torConnectResult.textContent = TorConnect.potentiallyBlocked
- ? TorStrings.settings.statusTorBlocked
- : TorStrings.settings.statusTorNotConnected;
+ connectId = TorConnect.potentiallyBlocked
+ ? "tor-connection-network-status-blocked"
+ : "tor-connection-network-status-not-connected";
torConnectButton.hidden = false;
}
+ document.l10n.setAttributes(torConnectResult, connectId);
};
this._populateStatus();
// Quickstart
- prefpane.querySelector(selectors.quickstart.header).innerText =
- TorStrings.settings.quickstartHeading;
- prefpane.querySelector(selectors.quickstart.description).textContent =
- TorStrings.settings.quickstartDescription;
-
- this._enableQuickstartCheckbox = prefpane.querySelector(
- selectors.quickstart.enableQuickstartCheckbox
- );
- this._enableQuickstartCheckbox.setAttribute(
- "label",
- TorStrings.settings.quickstartCheckbox
+ this._enableQuickstartCheckbox = document.getElementById(
+ "torPreferences-quickstart-toggle"
);
this._enableQuickstartCheckbox.addEventListener("command", e => {
const checked = this._enableQuickstartCheckbox.checked;
@@ -2470,22 +2407,10 @@ const gConnectionPane = (function () {
this._enableQuickstartCheckbox.checked = TorSettings.quickstart.enabled;
Services.obs.addObserver(this, TorSettingsTopics.SettingsChanged);
- // Bridge setup
- prefpane.querySelector(selectors.bridges.header).innerText =
- TorStrings.settings.bridgesHeading;
- prefpane.querySelector(selectors.bridges.description).textContent =
- TorStrings.settings.bridgesDescription2;
- {
- 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:")) {
- learnMore.setAttribute("useoriginprincipal", "true");
- }
- }
-
// Location
{
+ const prefpane = document.getElementById("mainPrefPane");
+
const locationGroup = prefpane.querySelector(
selectors.bridges.locationGroup
);
@@ -2571,33 +2496,18 @@ const gConnectionPane = (function () {
}
// Advanced setup
- prefpane.querySelector(selectors.advanced.header).innerText =
- TorStrings.settings.advancedHeading;
- prefpane.querySelector(selectors.advanced.label).textContent =
- TorStrings.settings.advancedLabel;
- {
- const settingsButton = prefpane.querySelector(
- selectors.advanced.button
- );
- settingsButton.setAttribute(
- "label",
- TorStrings.settings.advancedButton
- );
- settingsButton.addEventListener("command", () => {
+ document
+ .getElementById("torPreferences-advanced-button")
+ .addEventListener("click", () => {
this.onAdvancedSettings();
});
- }
// Tor logs
- prefpane.querySelector(selectors.advanced.torLogsLabel).textContent =
- TorStrings.settings.showTorDaemonLogs;
- const torLogsButton = prefpane.querySelector(
- selectors.advanced.torLogsButton
- );
- torLogsButton.setAttribute("label", TorStrings.settings.showLogs);
- torLogsButton.addEventListener("command", () => {
- this.onViewTorLogs();
- });
+ document
+ .getElementById("torPreferences-buttonTorLogs")
+ .addEventListener("click", () => {
+ this.onViewTorLogs();
+ });
Services.obs.addObserver(this, TorConnectTopics.StateChange);
},
=====================================
browser/components/torpreferences/content/connectionPane.xhtml
=====================================
@@ -11,16 +11,21 @@
data-category="paneConnection"
hidden="true"
>
- <html:h1 id="torPreferences-header" />
+ <html:h1 data-l10n-id="tor-connection-settings-heading"></html:h1>
</hbox>
<groupbox data-category="paneConnection" hidden="true">
<description flex="1">
- <html:span id="torPreferences-description" class="tail-with-learn-more" />
+ <html:span
+ data-l10n-id="tor-connection-overview"
+ class="tail-with-learn-more"
+ ></html:span>
<label
- id="torPreferences-learnMore"
class="learnMore text-link"
is="text-link"
+ href="about:manual#about"
+ useoriginprincipal="true"
+ data-l10n-id="tor-connection-browser-learn-more-link"
/>
</description>
</groupbox>
@@ -36,33 +41,45 @@
class="torPreferences-status-grouping"
>
<image class="torPreferences-status-icon" />
- <html:span class="torPreferences-status-name"></html:span>
+ <html:span
+ class="torPreferences-status-name"
+ data-l10n-id="tor-connection-internet-status-label"
+ ></html:span>
<html:span class="torPreferences-status-result"></html:span>
- <button id="torPreferences-status-internet-test" />
+ <html:button
+ id="torPreferences-status-internet-test"
+ data-l10n-id="tor-connection-internet-status-test-button"
+ ></html:button>
</hbox>
<hbox
id="torPreferences-status-tor-connect"
class="torPreferences-status-grouping"
>
<image class="torPreferences-status-icon" />
- <html:span class="torPreferences-status-name"></html:span>
+ <html:span
+ class="torPreferences-status-name"
+ data-l10n-id="tor-connection-network-status-label"
+ ></html:span>
<html:span class="torPreferences-status-result"></html:span>
- <button id="torPreferences-status-tor-connect-button" />
+ <html:button
+ id="torPreferences-status-tor-connect-button"
+ data-l10n-id="tor-connection-network-status-connect-button"
+ ></html:button>
</hbox>
</hbox>
</groupbox>
<!-- Quickstart -->
- <groupbox
- id="torPreferences-quickstart-group"
- data-category="paneConnection"
- hidden="true"
- >
- <html:h2 id="torPreferences-quickstart-header" />
- <description flex="1">
- <html:span id="torPreferences-quickstart-description" />
+ <groupbox data-category="paneConnection" hidden="true">
+ <label>
+ <html:h2 data-l10n-id="tor-connection-quickstart-heading"></html:h2>
+ </label>
+ <description flex="1" data-l10n-id="tor-connection-quickstart-description">
</description>
- <checkbox id="torPreferences-quickstart-toggle" />
+ <checkbox
+ id="torPreferences-quickstart-toggle"
+ data-l10n-id="tor-connection-quickstart-checkbox"
+ />
</groupbox>
<!-- Bridges -->
@@ -71,6 +88,7 @@
id="torPreferences-bridges-header"
class="tor-focusable-heading"
tabindex="-1"
+ data-l10n-id="tor-bridges-heading"
></html:h1>
</hbox>
<groupbox
@@ -80,13 +98,15 @@
>
<description flex="1">
<html:span
- id="torPreferences-bridges-description"
class="tail-with-learn-more"
+ data-l10n-id="tor-bridges-overview"
/>
<label
- id="torPreferences-bridges-learnMore"
class="learnMore text-link"
is="text-link"
+ href="about:manual#bridges"
+ useoriginprincipal="true"
+ data-l10n-id="tor-bridges-learn-more-link"
/>
</description>
<hbox
@@ -479,7 +499,7 @@
<!-- Advanced -->
<hbox class="subcategory" data-category="paneConnection" hidden="true">
- <html:h1 id="torPreferences-advanced-header" />
+ <html:h1 data-l10n-id="tor-advanced-settings-heading"></html:h1>
</hbox>
<groupbox
id="torPreferences-advanced-group"
@@ -487,14 +507,20 @@
hidden="true"
>
<hbox align="center">
- <label id="torPreferences-advanced-label" flex="1" />
- <button id="torPreferences-advanced-button" class="accessory-button" />
+ <label data-l10n-id="tor-advanced-settings-description" flex="1" />
+ <html:button
+ id="torPreferences-advanced-button"
+ class="accessory-button"
+ data-l10n-id="tor-advanced-settings-button"
+ ></html:button>
</hbox>
<hbox align="center" data-subcategory="viewlogs">
- <label id="torPreferences-torLogs" flex="1" />
- <vbox>
- <button id="torPreferences-buttonTorLogs" class="accessory-button" />
- </vbox>
+ <label data-l10n-id="tor-view-log-description" flex="1" />
+ <html:button
+ id="torPreferences-buttonTorLogs"
+ class="accessory-button"
+ data-l10n-id="tor-view-log-button"
+ ></html:button>
</hbox>
</groupbox>
</html:template>
=====================================
browser/components/torpreferences/content/connectionSettingsDialog.js
=====================================
@@ -4,10 +4,6 @@ const { TorSettings, TorProxyType } = ChromeUtils.importESModule(
"resource://gre/modules/TorSettings.sys.mjs"
);
-const { TorStrings } = ChromeUtils.importESModule(
- "resource://gre/modules/TorStrings.sys.mjs"
-);
-
const gConnectionSettingsDialog = {
_useProxyCheckbox: null,
_proxyTypeLabel: null,
@@ -25,7 +21,6 @@ const gConnectionSettingsDialog = {
_allowedPortsTextbox: null,
selectors: {
- header: "#torPreferences-connection-header",
useProxyCheckbox: "checkbox#torPreferences-connection-toggleProxy",
proxyTypeLabel: "label#torPreferences-localProxy-type",
proxyTypeList: "menulist#torPreferences-localProxy-builtinList",
@@ -53,36 +48,27 @@ const gConnectionSettingsDialog = {
init() {
const selectors = this.selectors;
- document.documentElement.setAttribute(
- "title",
- TorStrings.settings.connectionSettingsDialogTitle
- );
- document.querySelector(selectors.header).textContent =
- TorStrings.settings.connectionSettingsDialogHeader;
-
// Local Proxy
this._useProxyCheckbox = document.querySelector(selectors.useProxyCheckbox);
- this._useProxyCheckbox.setAttribute(
- "label",
- TorStrings.settings.useLocalProxy
- );
this._useProxyCheckbox.addEventListener("command", e => {
const checked = this._useProxyCheckbox.checked;
this.onToggleProxy(checked);
});
this._proxyTypeLabel = document.querySelector(selectors.proxyTypeLabel);
- this._proxyTypeLabel.setAttribute("value", TorStrings.settings.proxyType);
let mockProxies = [
{
value: TorProxyType.Socks4,
- label: TorStrings.settings.proxyTypeSOCKS4,
+ l10nId: "tor-advanced-dialog-proxy-socks4-menuitem",
},
{
value: TorProxyType.Socks5,
- label: TorStrings.settings.proxyTypeSOCKS5,
+ l10nId: "tor-advanced-dialog-proxy-socks5-menuitem",
+ },
+ {
+ value: TorProxyType.HTTPS,
+ l10nId: "tor-advanced-dialog-proxy-http-menuitem",
},
- { value: TorProxyType.HTTPS, label: TorStrings.settings.proxyTypeHTTP },
];
this._proxyTypeMenulist = document.querySelector(selectors.proxyTypeList);
this._proxyTypeMenulist.addEventListener("command", e => {
@@ -92,24 +78,16 @@ const gConnectionSettingsDialog = {
for (let currentProxy of mockProxies) {
let menuEntry = window.document.createXULElement("menuitem");
menuEntry.setAttribute("value", currentProxy.value);
- menuEntry.setAttribute("label", currentProxy.label);
+ menuEntry.setAttribute("data-l10n-id", currentProxy.l10nId);
this._proxyTypeMenulist.querySelector("menupopup").appendChild(menuEntry);
}
this._proxyAddressLabel = document.querySelector(
selectors.proxyAddressLabel
);
- this._proxyAddressLabel.setAttribute(
- "value",
- TorStrings.settings.proxyAddress
- );
this._proxyAddressTextbox = document.querySelector(
selectors.proxyAddressTextbox
);
- this._proxyAddressTextbox.setAttribute(
- "placeholder",
- TorStrings.settings.proxyAddressPlaceholder
- );
this._proxyAddressTextbox.addEventListener("blur", e => {
let value = this._proxyAddressTextbox.value.trim();
let colon = value.lastIndexOf(":");
@@ -122,36 +100,19 @@ const gConnectionSettingsDialog = {
}
});
this._proxyPortLabel = document.querySelector(selectors.proxyPortLabel);
- this._proxyPortLabel.setAttribute("value", TorStrings.settings.proxyPort);
this._proxyPortTextbox = document.querySelector(selectors.proxyPortTextbox);
this._proxyUsernameLabel = document.querySelector(
selectors.proxyUsernameLabel
);
- this._proxyUsernameLabel.setAttribute(
- "value",
- TorStrings.settings.proxyUsername
- );
this._proxyUsernameTextbox = document.querySelector(
selectors.proxyUsernameTextbox
);
- this._proxyUsernameTextbox.setAttribute(
- "placeholder",
- TorStrings.settings.proxyUsernamePasswordPlaceholder
- );
this._proxyPasswordLabel = document.querySelector(
selectors.proxyPasswordLabel
);
- this._proxyPasswordLabel.setAttribute(
- "value",
- TorStrings.settings.proxyPassword
- );
this._proxyPasswordTextbox = document.querySelector(
selectors.proxyPasswordTextbox
);
- this._proxyPasswordTextbox.setAttribute(
- "placeholder",
- TorStrings.settings.proxyUsernamePasswordPlaceholder
- );
this.onToggleProxy(false);
if (TorSettings.proxy.enabled) {
@@ -167,10 +128,6 @@ const gConnectionSettingsDialog = {
this._useFirewallCheckbox = document.querySelector(
selectors.useFirewallCheckbox
);
- this._useFirewallCheckbox.setAttribute(
- "label",
- TorStrings.settings.useFirewall
- );
this._useFirewallCheckbox.addEventListener("command", e => {
const checked = this._useFirewallCheckbox.checked;
this.onToggleFirewall(checked);
@@ -178,17 +135,9 @@ const gConnectionSettingsDialog = {
this._allowedPortsLabel = document.querySelector(
selectors.firewallAllowedPortsLabel
);
- this._allowedPortsLabel.setAttribute(
- "value",
- TorStrings.settings.allowedPorts
- );
this._allowedPortsTextbox = document.querySelector(
selectors.firewallAllowedPortsTextbox
);
- this._allowedPortsTextbox.setAttribute(
- "placeholder",
- TorStrings.settings.allowedPortsPlaceholder
- );
this.onToggleFirewall(false);
if (TorSettings.firewall.enabled) {
=====================================
browser/components/torpreferences/content/connectionSettingsDialog.xhtml
=====================================
@@ -7,16 +7,31 @@
type="child"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
xmlns:html="http://www.w3.org/1999/xhtml"
+ data-l10n-id="tor-advanced-dialog-title"
>
<dialog id="torPreferences-connection-dialog" buttons="accept,cancel">
+ <linkset>
+ <html:link rel="localization" href="branding/brand.ftl" />
+ <html:link rel="localization" href="browser/tor-browser.ftl" />
+ </linkset>
+
<script src="chrome://browser/content/torpreferences/connectionSettingsDialog.js" />
- <html:h3 id="torPreferences-connection-header">​</html:h3>
+ <html:h3
+ id="torPreferences-connection-header"
+ data-l10n-id="tor-advanced-dialog-introduction"
+ ></html:h3>
<!-- Local Proxy -->
- <checkbox id="torPreferences-connection-toggleProxy" label="​" />
+ <checkbox
+ id="torPreferences-connection-toggleProxy"
+ data-l10n-id="tor-advanced-dialog-proxy-checkbox"
+ />
<box id="torPreferences-connection-grid">
<hbox class="indent" align="center">
- <label id="torPreferences-localProxy-type" />
+ <label
+ id="torPreferences-localProxy-type"
+ data-l10n-id="tor-advanced-dialog-proxy-type-selector-label"
+ />
</hbox>
<hbox align="center">
<spacer flex="1" />
@@ -28,15 +43,22 @@
</menulist>
</hbox>
<hbox class="indent" align="center">
- <label id="torPreferences-localProxy-address" />
+ <label
+ id="torPreferences-localProxy-address"
+ data-l10n-id="tor-advanced-dialog-proxy-address-input-label"
+ />
</hbox>
<hbox align="center">
<html:input
id="torPreferences-localProxy-textboxAddress"
type="text"
class="torMarginFix"
+ data-l10n-id="tor-advanced-dialog-proxy-address-input"
+ />
+ <label
+ id="torPreferences-localProxy-port"
+ data-l10n-id="tor-advanced-dialog-proxy-port-input-label"
/>
- <label id="torPreferences-localProxy-port" />
<!-- proxy-port-input class style pulled from preferences.css and used in the vanilla proxy setup menu -->
<html:input
id="torPreferences-localProxy-textboxPort"
@@ -49,27 +71,41 @@
/>
</hbox>
<hbox class="indent" align="center">
- <label id="torPreferences-localProxy-username" />
+ <label
+ id="torPreferences-localProxy-username"
+ data-l10n-id="tor-advanced-dialog-proxy-username-input-label"
+ />
</hbox>
<hbox align="center">
<html:input
id="torPreferences-localProxy-textboxUsername"
type="text"
class="torMarginFix"
+ data-l10n-id="tor-advanced-dialog-proxy-username-input"
+ />
+ <label
+ id="torPreferences-localProxy-password"
+ data-l10n-id="tor-advanced-dialog-proxy-password-input-label"
/>
- <label id="torPreferences-localProxy-password" />
<html:input
id="torPreferences-localProxy-textboxPassword"
class="torMarginFix"
type="password"
+ data-l10n-id="tor-advanced-dialog-proxy-password-input"
/>
</hbox>
</box>
<!-- Firewall -->
- <checkbox id="torPreferences-connection-toggleFirewall" label="​" />
+ <checkbox
+ id="torPreferences-connection-toggleFirewall"
+ data-l10n-id="tor-advanced-dialog-firewall-checkbox"
+ />
<box id="torPreferences-connection-firewall">
<hbox class="indent" align="center">
- <label id="torPreferences-connection-allowedPorts" />
+ <label
+ id="torPreferences-connection-allowedPorts"
+ data-l10n-id="tor-advanced-dialog-firewall-ports-input-label"
+ />
</hbox>
<hbox id="torPreferences-connection-hboxAllowedPorts" align="center">
<html:input
@@ -77,6 +113,7 @@
type="text"
class="torMarginFix"
value="80,443"
+ data-l10n-id="tor-advanced-dialog-firewall-ports-input"
/>
</hbox>
</box>
=====================================
browser/components/torpreferences/content/provideBridgeDialog.js
=====================================
@@ -1,9 +1,5 @@
"use strict";
-const { TorStrings } = ChromeUtils.importESModule(
- "resource://gre/modules/TorStrings.sys.mjs"
-);
-
const { TorSettings, TorBridgeSource, validateBridgeLines } =
ChromeUtils.importESModule("resource://gre/modules/TorSettings.sys.mjs");
@@ -191,10 +187,8 @@ const gProvideBridgeDialog = {
this._result.connect = connect;
this._acceptButton.setAttribute(
- "label",
- connect
- ? TorStrings.settings.bridgeButtonConnect
- : TorStrings.settings.bridgeButtonAccept
+ "data-l10n-id",
+ connect ? "bridge-dialog-button-connect" : "bridge-dialog-button-accept"
);
}
},
=====================================
browser/components/torpreferences/content/requestBridgeDialog.js
=====================================
@@ -3,9 +3,6 @@
const { BridgeDB } = ChromeUtils.importESModule(
"resource://gre/modules/BridgeDB.sys.mjs"
);
-const { TorStrings } = ChromeUtils.importESModule(
- "resource://gre/modules/TorStrings.sys.mjs"
-);
const { TorConnect, TorConnectTopics } = ChromeUtils.importESModule(
"resource://gre/modules/TorConnect.sys.mjs"
@@ -20,8 +17,6 @@ const gRequestBridgeDialog = {
"button#torPreferences-requestBridge-refreshCaptchaButton",
incorrectCaptchaHbox:
"hbox#torPreferences-requestBridge-incorrectCaptchaHbox",
- incorrectCaptchaLabel:
- "label#torPreferences-requestBridge-incorrectCaptchaError",
},
init() {
@@ -33,10 +28,6 @@ const gRequestBridgeDialog = {
"torPreferences-requestBridge-dialog"
);
- document.documentElement.setAttribute(
- "title",
- TorStrings.settings.requestBridgeDialogTitle
- );
// user may have opened a Request Bridge dialog in another tab, so update the
// CAPTCHA image or close out the dialog if we have a bridge list
this._dialog.addEventListener("focusin", () => {
@@ -59,7 +50,6 @@ const gRequestBridgeDialog = {
});
this._dialogHeader = this._dialog.querySelector(selectors.dialogHeader);
- this._dialogHeader.textContent = TorStrings.settings.contactingBridgeDB;
this._captchaImage = this._dialog.querySelector(selectors.captchaImage);
@@ -71,10 +61,6 @@ const gRequestBridgeDialog = {
this._captchaEntryTextbox = this._dialog.querySelector(
selectors.captchaEntryTextbox
);
- this._captchaEntryTextbox.setAttribute(
- "placeholder",
- TorStrings.settings.captchaTextboxPlaceholder
- );
this._captchaEntryTextbox.disabled = true;
// disable submit if entry textbox is empty
this._captchaEntryTextbox.oninput = () => {
@@ -89,13 +75,6 @@ const gRequestBridgeDialog = {
this._incorrectCaptchaHbox = this._dialog.querySelector(
selectors.incorrectCaptchaHbox
);
- this._incorrectCaptchaLabel = this._dialog.querySelector(
- selectors.incorrectCaptchaLabel
- );
- this._incorrectCaptchaLabel.setAttribute(
- "value",
- TorStrings.settings.incorrectCaptcha
- );
Services.obs.addObserver(this, TorConnectTopics.StateChange);
this.onAcceptStateChange();
@@ -111,10 +90,8 @@ const gRequestBridgeDialog = {
const connect = TorConnect.canBeginBootstrap;
this._result.connect = connect;
this._submitButton.setAttribute(
- "label",
- connect
- ? TorStrings.settings.bridgeButtonConnect
- : TorStrings.settings.submitCaptcha
+ "data-l10n-id",
+ connect ? "bridge-dialog-button-connect" : "bridge-dialog-button-submit"
);
},
@@ -129,7 +106,10 @@ const gRequestBridgeDialog = {
_setcaptchaImage(uri) {
if (uri != this._captchaImage.src) {
this._captchaImage.src = uri;
- this._dialogHeader.textContent = TorStrings.settings.solveTheCaptcha;
+ this._dialogHeader.setAttribute(
+ "data-l10n-id",
+ "request-bridge-dialog-top-solve"
+ );
this._setUIDisabled(false);
this._captchaEntryTextbox.focus();
this._captchaEntryTextbox.select();
@@ -185,7 +165,10 @@ const gRequestBridgeDialog = {
onRefreshCaptcha() {
this._setUIDisabled(true);
this._captchaImage.src = "";
- this._dialogHeader.textContent = TorStrings.settings.contactingBridgeDB;
+ this._dialogHeader.setAttribute(
+ "data-l10n-id",
+ "request-bridge-dialog-top-wait"
+ );
this._captchaEntryTextbox.value = "";
this._incorrectCaptchaHbox.style.visibility = "hidden";
=====================================
browser/components/torpreferences/content/requestBridgeDialog.xhtml
=====================================
@@ -7,20 +7,26 @@
type="child"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
xmlns:html="http://www.w3.org/1999/xhtml"
+ data-l10n-id="request-bridge-dialog-title"
>
<dialog id="torPreferences-requestBridge-dialog" buttons="accept,cancel">
+ <linkset>
+ <html:link rel="localization" href="browser/tor-browser.ftl" />
+ </linkset>
+
<script src="chrome://browser/content/torpreferences/requestBridgeDialog.js" />
- <!-- ok, so ​ is a zero-width space. We need to have *something* in the innerText so that XUL knows how tall the
- title node is so that it can determine how large to make the dialog element's inner draw area. If we have nothing
- in the innerText, then it collapse to 0 height, and the contents of the dialog ends up partially hidden >:( -->
- <html:h3 id="torPreferences-requestBridge-header">​</html:h3>
+ <html:h3
+ id="torPreferences-requestBridge-header"
+ data-l10n-id="request-bridge-dialog-top-solve"
+ ></html:h3>
<!-- init to transparent 400x125 png -->
<image id="torPreferences-requestBridge-captchaImage" flex="1" />
<hbox id="torPreferences-requestBridge-inputHbox">
<html:input
id="torPreferences-requestBridge-captchaTextbox"
type="text"
+ data-l10n-id="request-bridge-dialog-captcha-input"
/>
<button
id="torPreferences-requestBridge-refreshCaptchaButton"
@@ -30,7 +36,7 @@
</hbox>
<hbox id="torPreferences-requestBridge-incorrectCaptchaHbox" align="center">
<image id="torPreferences-requestBridge-errorIcon" />
- <label id="torPreferences-requestBridge-incorrectCaptchaError" flex="1" />
+ <label data-l10n-id="request-bridge-dialog-captcha-failed" flex="1" />
</hbox>
</dialog>
</window>
=====================================
browser/components/torpreferences/content/torLogDialog.js
=====================================
@@ -7,21 +7,13 @@ const { setTimeout, clearTimeout } = ChromeUtils.importESModule(
const { TorProviderBuilder } = ChromeUtils.importESModule(
"resource://gre/modules/TorProviderBuilder.sys.mjs"
);
-const { TorStrings } = ChromeUtils.importESModule(
- "resource://gre/modules/TorStrings.sys.mjs"
-);
window.addEventListener(
"DOMContentLoaded",
() => {
- document.documentElement.setAttribute(
- "title",
- TorStrings.settings.torLogDialogTitle
- );
-
const dialog = document.getElementById("torPreferences-torLog-dialog");
const copyLogButton = dialog.getButton("extra1");
- copyLogButton.setAttribute("label", TorStrings.settings.copyLog);
+ copyLogButton.setAttribute("data-l10n-id", "tor-log-dialog-copy-button");
const logText = document.getElementById(
"torPreferences-torDialog-textarea"
@@ -35,8 +27,10 @@ window.addEventListener(
);
clipboard.copyString(logText.value);
- const label = copyLogButton.querySelector("label");
- label.setAttribute("value", TorStrings.settings.copied);
+ copyLogButton.setAttribute(
+ "data-l10n-id",
+ "tor-log-dialog-copy-button-copied"
+ );
copyLogButton.classList.add("primary");
const RESTORE_TIME = 1200;
@@ -44,7 +38,10 @@ window.addEventListener(
clearTimeout(restoreButtonTimeout);
}
restoreButtonTimeout = setTimeout(() => {
- label.setAttribute("value", TorStrings.settings.copyLog);
+ copyLogButton.setAttribute(
+ "data-l10n-id",
+ "tor-log-dialog-copy-button"
+ );
copyLogButton.classList.remove("primary");
restoreButtonTimeout = null;
}, RESTORE_TIME);
=====================================
browser/components/torpreferences/content/torLogDialog.xhtml
=====================================
@@ -7,8 +7,13 @@
type="child"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
xmlns:html="http://www.w3.org/1999/xhtml"
+ data-l10n-id="tor-log-dialog-title"
>
<dialog id="torPreferences-torLog-dialog" buttons="accept,extra1">
+ <linkset>
+ <html:link rel="localization" href="browser/tor-browser.ftl" />
+ </linkset>
+
<script src="chrome://browser/content/torpreferences/torLogDialog.js" />
<html:textarea
=====================================
browser/components/torpreferences/content/torPreferences.css
=====================================
@@ -1023,6 +1023,11 @@ groupbox#torPreferences-bridges-group textarea {
}
/* Connection settings dialog */
+#torPreferences-connection-dialog label {
+ /* Do not wrap the labels. */
+ white-space: nowrap;
+}
+
#torPreferences-connection-header {
margin: 4px 0 14px 0;
}
=====================================
browser/locales/en-US/browser/tor-browser.ftl
=====================================
@@ -45,7 +45,55 @@ tor-browser-home-message-testing = This is an unstable version of Tor Browser fo
home-mode-choice-tor =
.label = Tor Browser Home
-## Tor Bridges Settings
+## Tor connection settings.
+
+# "Connection" refers to the Tor Browser's connection to the Tor network.
+tor-connection-settings-heading = Connection
+# -brand-short-name refers to 'Tor Browser', localized.
+tor-connection-overview = { -brand-short-name } routes your traffic over the Tor Network, run by thousands of volunteers around the world.
+tor-connection-browser-learn-more-link = Learn more
+tor-connection-quickstart-heading = Quickstart
+# -brand-short-name refers to 'Tor Browser', localized.
+tor-connection-quickstart-description = Quickstart connects { -brand-short-name } to the Tor Network automatically when launched, based on your last used connection settings.
+tor-connection-quickstart-checkbox =
+ .label = Always connect automatically
+
+# Prefix before the internet connection status.
+# "Internet" is not a proper noun, but is capitalized because it is the start of a sentence.
+tor-connection-internet-status-label = Internet:
+# Button to test the internet connection.
+# Here "Test" is a verb, as in "test the internet connection".
+# Uses sentence case in English (US).
+tor-connection-internet-status-test-button = Test
+# Shown when the user is connected to the internet.
+# Uses sentence case in English (US).
+tor-connection-internet-status-online = Online
+# Shown when the user is not connected to the internet.
+# Uses sentence case in English (US).
+tor-connection-internet-status-offline = Offline
+
+# Prefix before the Tor network connection status.
+# Uses sentence case in English (US).
+tor-connection-network-status-label = Tor network:
+# Shown when the user is connected to the Tor network.
+# Uses sentence case in English (US).
+tor-connection-network-status-connected = Connected
+# Shown when the user is not connected to the Tor network.
+# Uses sentence case in English (US).
+tor-connection-network-status-not-connected = Not connected
+# Shown when the user's Tor connection may be blocked.
+# Uses sentence case in English (US).
+tor-connection-network-status-blocked = Potentially blocked
+# Button shown when we are not yet connected to the Tor network.
+# It will open a page to start connecting to the Tor network.
+# Uses sentence case in English (US).
+tor-connection-network-status-connect-button = Connect
+
+## Tor Bridges Settings.
+
+tor-bridges-heading = Bridges
+tor-bridges-overview = Bridges help you securely access the Tor Network in places where Tor is blocked. Depending on where you are, one bridge may work better than another.
+tor-bridges-learn-more-link = Learn more
# Toggle button for enabling and disabling the use of bridges.
tor-bridges-use-bridges =
@@ -78,6 +126,16 @@ tor-bridges-menu-item-remove-all-bridges = Remove all bridges
# Shown when one of the built-in bridges is in use.
tor-bridges-built-in-status-connected = Connected
+# "obfs4" is a technical name, and likely should not be translated.
+tor-bridges-built-in-obfs4-name = obfs4
+tor-bridges-built-in-obfs4-description = Makes your Tor traffic look like random data. May not work in heavily censored regions.
+# "Snowflake" is a proper noun for a type of Tor bridge, and likely should not be translated.
+tor-bridges-built-in-snowflake-name = Snowflake
+# "Snowflake" is a proper noun for a type of Tor bridge, and likely should not be translated.
+tor-bridges-built-in-snowflake-description = Routes your connection through Snowflake proxies to make it look like you’re placing a video call, for example.
+# "meek-azure" is a technical name, and likely should not be translated.
+tor-bridges-built-in-meek-azure-name = meek-azure
+tor-bridges-built-in-meek-azure-description = Makes it look like you’re connected to a Microsoft website, instead of using Tor. May work in heavily censored regions, but is usually very slow.
# Shown at the start of a Tor bridge line.
# $type (String) - The Tor bridge type ("snowflake", "obfs4", "meek-azure").
@@ -195,6 +253,7 @@ tor-bridges-add-bridges-heading = Add bridges
# Shown as a heading when the user has existing bridges that can be replaced.
tor-bridges-replace-bridges-heading = Replace your bridges
+# -brand-short-name refers to 'Tor Browser', localized.
tor-bridges-select-built-in-description = Choose from one of { -brand-short-name }’s built-in bridges
tor-bridges-select-built-in-button = Select a built-in bridge…
@@ -233,6 +292,23 @@ tor-bridges-provider-email-instruction = Email { $address }
tor-bridges-request-from-browser = You can also get bridges from the bridge bot without leaving { -brand-short-name }.
tor-bridges-request-button = Request bridges…
+## Warning dialog when removing all bridges.
+
+remove-all-bridges-warning-title = Remove all bridges?
+remove-all-bridges-warning-description = If these bridges were received from torproject.org or added manually, this action cannot be undone
+remove-all-bridges-warning-remove-button = Remove
+
+## Bridge QR code dialog.
+
+bridge-qr-dialog-title =
+ .title = Scan the QR code
+
+## Common button used in bridge dialogs.
+
+bridge-dialog-button-connect = Connect
+bridge-dialog-button-accept = OK
+bridge-dialog-button-submit = Submit
+
## User provided bridge dialog.
# Used when the user is editing their existing bridge addresses.
@@ -300,11 +376,92 @@ user-provide-bridge-dialog-next-button =
## Built-in bridges dialog.
+built-in-dialog-title =
+ .title = Select a Built-In Bridge
+# -brand-short-name refers to 'Tor Browser', localized.
+built-in-dialog-introduction = { -brand-short-name } includes some specific types of bridges known as “pluggable transports”, which can help conceal the fact you’re using Tor.
+# "obfs4" is a technical name, and likely should not be translated.
+built-in-dialog-obfs4-radio-option =
+ .label = obfs4
+# "Snowflake" is a proper noun for a type of Tor bridge, and likely should not be translated.
+built-in-dialog-snowflake-radio-option =
+ .label = Snowflake
+# "meek-azure" is a technical name, and likely should not be translated.
+built-in-dialog-meek-azure-radio-option =
+ .label = meek-azure
# Label attached to the built-in bridge option that is already in use.
# The "aria-label" should use the same text, but include some ending punctuation to separate it from the sentence that follows. This is used for screen reader users.
built-in-dialog-current-bridge-label = Current bridge
.aria-label = Current bridge.
+request-bridge-dialog-title =
+ .title = Request Bridge
+request-bridge-dialog-top-wait = Contacting BridgeDB. Please Wait.
+request-bridge-dialog-top-solve = Solve the CAPTCHA to request a bridge.
+request-bridge-dialog-captcha-input =
+ .placeholder = Enter the characters from the image
+request-bridge-dialog-captcha-failed = The solution is not correct. Please try again.
+
+## Tor advanced settings.
+
+tor-advanced-settings-heading = Advanced
+tor-advanced-settings-description = Configure how { -brand-short-name } connects to the internet.
+# Button that opens the advanced connection settings dialog.
+# Uses sentence case in English (US).
+tor-advanced-settings-button = Settings…
+# "log" is a noun, referring to the recorded text output of the Tor process.
+tor-view-log-description = View the Tor log.
+# "log" is a noun, referring to the recorded text output of the Tor process.
+# Uses sentence case in English (US).
+tor-view-log-button = View log…
+
+## Tor log dialog.
+
+# "log" is a noun, referring to the recorded text output of the Tor process.
+tor-log-dialog-title =
+ .title = Tor log
+# "log" is a noun, referring to the recorded text output of the Tor process.
+tor-log-dialog-copy-button =
+ .label = Copy Tor log to clipboard
+# Button text changes for a short time after activating the button.
+tor-log-dialog-copy-button-copied =
+ .label = Copied!
+
+## Tor advanced connection settings dialog.
+
+tor-advanced-dialog-title =
+ .title = Connection settings
+tor-advanced-dialog-introduction = Configure how { -brand-short-name } connects to the internet.
+tor-advanced-dialog-proxy-checkbox =
+ .label = I use a proxy to connect to the internet
+tor-advanced-dialog-proxy-type-selector-label = Proxy type
+# SOCKS4 is a technical name, and should likely not be translated.
+tor-advanced-dialog-proxy-socks4-menuitem =
+ .label = SOCKS4
+# SOCKS5 is a technical name, and should likely not be translated.
+tor-advanced-dialog-proxy-socks5-menuitem =
+ .label = SOCKS5
+# HTTP and HTTPS are technical names, and should likely not be translated.
+# The "/" refers to "HTTP or HTTPS" and can be translated.
+tor-advanced-dialog-proxy-http-menuitem =
+ .label = HTTP/HTTPS
+# "address" is a noun, referring to an network IP address.
+tor-advanced-dialog-proxy-address-input-label = Address
+tor-advanced-dialog-proxy-address-input =
+ .placeholder = IP address or hostname
+tor-advanced-dialog-proxy-port-input-label = Port
+tor-advanced-dialog-proxy-username-input-label = Username
+tor-advanced-dialog-proxy-username-input =
+ .placeholder = Optional
+tor-advanced-dialog-proxy-password-input-label = Password
+tor-advanced-dialog-proxy-password-input =
+ .placeholder = Optional
+tor-advanced-dialog-firewall-checkbox =
+ .label = This computer goes through a firewall that only allows connections to certain ports
+tor-advanced-dialog-firewall-ports-input-label = Allowed ports
+tor-advanced-dialog-firewall-ports-input =
+ .placeholder = Comma-separated values
+
## About Tor Browser dialog.
# '<label data-l10n-name="project-link">' and '</label>' should wrap the link text for the Tor Project, and will link to the Tor Project web page.
=====================================
toolkit/modules/TorStrings.sys.mjs
=====================================
@@ -67,107 +67,23 @@ const Loader = {
*/
settings() {
const strings = {
- categoryTitle: "Connection",
// Message box
torPreferencesDescription:
"Tor Browser routes your traffic over the Tor Network, run by thousands of volunteers around the world.",
- // Status
- statusInternetLabel: "Internet:",
- statusInternetTest: "Test",
- statusInternetOnline: "Online",
- statusInternetOffline: "Offline",
- statusTorLabel: "Tor Network:",
- statusTorConnected: "Connected",
- statusTorNotConnected: "Not Connected",
- statusTorBlocked: "Potentially Blocked",
- learnMore: "Learn more",
// Quickstart
- quickstartHeading: "Quickstart",
- quickstartDescription:
- "Quickstart connects Tor Browser to the Tor Network automatically when launched, based on your last used connection settings.",
quickstartCheckbox: "Always connect automatically",
- // Bridge settings
- bridgesHeading: "Bridges",
- bridgesDescription2:
- "Bridges help you securely access the Tor Network in places where Tor is blocked. Depending on where you are, one bridge may work better than another.",
bridgeLocation: "Your location",
bridgeLocationAutomatic: "Automatic",
bridgeLocationFrequent: "Frequently selected locations",
bridgeLocationOther: "Other locations",
bridgeChooseForMe: "Choose a Bridge For Me…",
- remove: "Remove",
- bridgeDisableBuiltIn: "Disable built-in bridges",
- copied: "Copied!",
- bridgeRemoveAllDialogTitle: "Remove all bridges?",
- bridgeRemoveAllDialogDescription:
- "If these bridges were received from torproject.org or added manually, this action cannot be undone",
- // Advanced settings
- advancedHeading: "Advanced",
- advancedLabel: "Configure how Tor Browser connects to the internet",
- advancedButton: "Settings…",
- showTorDaemonLogs: "View the Tor logs",
- showLogs: "View Logs…",
- // Remove all bridges dialog
- removeBridgesQuestion: "Remove all the bridges?",
- removeBridgesWarning: "This action cannot be undone.",
- cancel: "Cancel",
- // Scan bridge QR dialog
- scanQrTitle: "Scan the QR code",
- // Builtin bridges dialog
- builtinBridgeHeader: "Select a Built-In Bridge",
- builtinBridgeDescription2:
- "Tor Browser includes some specific types of bridges known as “pluggable transports”, which can help conceal the fact you’re using Tor.",
- builtinBridgeObfs4Title: "obfs4 (Built-in)",
- builtinBridgeObfs4Description2:
- "Makes your Tor traffic look like random data. May not work in heavily censored regions.",
- builtinBridgeSnowflake: "Snowflake",
- builtinBridgeSnowflakeDescription2:
- "Routes your connection through Snowflake proxies to make it look like you’re placing a video call, for example.",
- builtinBridgeMeekAzure: "meek-azure",
- builtinBridgeMeekAzureDescription2:
- "Makes it look like you’re connected to a Microsoft website, instead of using Tor. May work in heavily censored regions, but is usually very slow.",
- bridgeButtonConnect: "Connect",
- bridgeButtonAccept: "OK",
- // Request bridges dialog
- requestBridgeDialogTitle: "Request Bridge",
- submitCaptcha: "Submit",
- contactingBridgeDB: "Contacting BridgeDB. Please Wait.",
- solveTheCaptcha: "Solve the CAPTCHA to request a bridge.",
- captchaTextboxPlaceholder: "Enter the characters from the image",
- incorrectCaptcha: "The solution is not correct. Please try again.",
- // Connection settings dialog
- connectionSettingsDialogTitle: "Connection Settings",
- connectionSettingsDialogHeader:
- "Configure how Tor Browser connects to the Internet",
- useLocalProxy: "I use a proxy to connect to the Internet",
- proxyType: "Proxy Type",
- proxyTypeSOCKS4: "SOCKS4",
- proxyTypeSOCKS5: "SOCKS5",
- proxyTypeHTTP: "HTTP/HTTPS",
- proxyAddress: "Address",
- proxyAddressPlaceholder: "IP address or hostname",
- proxyPort: "Port",
- proxyUsername: "Username",
- proxyPassword: "Password",
- proxyUsernamePasswordPlaceholder: "Optional",
- useFirewall:
- "This computer goes through a firewall that only allows connections to certain ports",
- allowedPorts: "Allowed Ports",
- allowedPortsPlaceholder: "Comma-seperated values",
- // Log dialog
- torLogDialogTitle: "Tor Logs",
- copyLog: "Copy Tor Log to Clipboard",
};
const tsb = new TorPropertyStringBundle(
"chrome://torbutton/locale/settings.properties",
"settings."
);
- return {
- ...tsb.getStrings(strings),
- learnMoreTorBrowserURL: "about:manual#about",
- learnMoreBridgesURL: "about:manual#bridges",
- };
+ return tsb.getStrings(strings);
} /* Tor Network Settings Strings */,
torConnect() {
=====================================
toolkit/torbutton/chrome/locale/en-US/settings.properties
=====================================
@@ -3,95 +3,17 @@
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-settings.categoryTitle=Connection
+# Still used in TorConnect.
# Message box
settings.torPreferencesDescription=Tor Browser routes your traffic over the Tor Network, run by thousands of volunteers around the world.
-# Status
-settings.statusInternetLabel=Internet:
-settings.statusInternetTest=Test
-settings.statusInternetOnline=Online
-settings.statusInternetOffline=Offline
-settings.statusTorLabel=Tor Network:
-settings.statusTorConnected=Connected
-settings.statusTorNotConnected=Not Connected
-settings.statusTorBlocked=Potentially Blocked
-settings.learnMore=Learn more
-
-# Quickstart
-settings.quickstartHeading=Quickstart
-settings.quickstartDescription=Quickstart connects Tor Browser to the Tor Network automatically when launched, based on your last used connection settings.
settings.quickstartCheckbox=Always connect automatically
-# Bridge settings
-settings.bridgesHeading=Bridges
-settings.bridgesDescription2=Bridges help you securely access the Tor Network in places where Tor is blocked. Depending on where you are, one bridge may work better than another.
+# Might be removed in tor-browser#42477
+
settings.bridgeLocation=Your location
settings.bridgeLocationAutomatic=Automatic
settings.bridgeLocationFrequent=Frequently selected locations
settings.bridgeLocationOther=Other locations
settings.bridgeChooseForMe=Choose a Bridge For Me…
-
-settings.remove=Remove
-settings.bridgeDisableBuiltIn=Disable built-in bridges
-settings.copied=Copied!
-settings.bridgeRemoveAllDialogTitle=Remove all bridges?
-settings.bridgeRemoveAllDialogDescription=If these bridges were received from torproject.org or added manually, this action cannot be undone
-
-# Advanced settings
-settings.advancedHeading=Advanced
-settings.advancedLabel=Configure how Tor Browser connects to the internet
-settings.advancedButton=Settings…
-settings.showTorDaemonLogs=View the Tor logs
-settings.showLogs=View Logs…
-
-# Remove all bridges dialog
-settings.removeBridgesQuestion=Remove all the bridges?
-settings.removeBridgesWarning=This action cannot be undone.
-settings.cancel=Cancel
-
-# Scan bridge QR dialog
-settings.scanQrTitle=Scan the QR code
-
-# Builtin bridges dialog
-settings.builtinBridgeHeader=Select a Built-In Bridge
-settings.builtinBridgeDescription2=Tor Browser includes some specific types of bridges known as “pluggable transports”, which can help conceal the fact you’re using Tor.
-settings.builtinBridgeObfs4Title=obfs4 (Built-in)
-settings.builtinBridgeObfs4Description2=Makes your Tor traffic look like random data. May not work in heavily censored regions.
-settings.builtinBridgeSnowflake=Snowflake
-settings.builtinBridgeSnowflakeDescription2=Routes your connection through Snowflake proxies to make it look like you’re placing a video call, for example.
-settings.builtinBridgeMeekAzure=meek-azure
-settings.builtinBridgeMeekAzureDescription2=Makes it look like you’re connected to a Microsoft website, instead of using Tor. May work in heavily censored regions, but is usually very slow.
-settings.bridgeButtonConnect=Connect
-settings.bridgeButtonAccept=OK
-
-# Request bridges dialog
-settings.requestBridgeDialogTitle=Request Bridge
-settings.submitCaptcha=Submit
-settings.contactingBridgeDB=Contacting BridgeDB. Please Wait.
-settings.solveTheCaptcha=Solve the CAPTCHA to request a bridge.
-settings.captchaTextboxPlaceholder=Enter the characters from the image
-settings.incorrectCaptcha=The solution is not correct. Please try again.
-
-# Connection settings dialog
-settings.connectionSettingsDialogTitle=Connection Settings
-settings.connectionSettingsDialogHeader=Configure how Tor Browser connects to the Internet
-settings.useLocalProxy=I use a proxy to connect to the Internet
-settings.proxyType=Proxy Type
-settings.proxyTypeSOCKS4=SOCKS4
-settings.proxyTypeSOCKS5=SOCKS5
-settings.proxyTypeHTTP=HTTP/HTTPS
-settings.proxyAddress=Address
-settings.proxyAddressPlaceholder=IP address or hostname
-settings.proxyPort=Port
-settings.proxyUsername=Username
-settings.proxyPassword=Password
-settings.proxyUsernamePasswordPlaceholder=Optional
-settings.useFirewall=This computer goes through a firewall that only allows connections to certain ports
-settings.allowedPorts=Allowed Ports
-settings.allowedPortsPlaceholder=Comma-separated values
-
-# Log dialog
-settings.torLogDialogTitle=Tor Logs
-settings.copyLog=Copy Tor Log to Clipboard
=====================================
tools/torbrowser/l10n/migrations/bug-42207-settings.py
=====================================
@@ -0,0 +1,88 @@
+from fluent.migrate.helpers import transforms_from
+
+
+def migrate(ctx):
+ legacy_path = "settings.properties"
+ ctx.add_transforms(
+ "tor-browser.ftl",
+ "tor-browser.ftl",
+ transforms_from(
+ """
+tor-connection-settings-heading = { COPY(path, "settings.categoryTitle") }
+tor-connection-browser-learn-more-link = { COPY(path, "settings.learnMore") }
+
+tor-connection-quickstart-heading = { COPY(path, "settings.quickstartHeading") }
+tor-connection-quickstart-checkbox =
+ .label = { COPY(path, "settings.quickstartCheckbox") }
+
+tor-connection-internet-status-label = { COPY(path, "settings.statusInternetLabel") }
+tor-connection-internet-status-test-button = { COPY(path, "settings.statusInternetTest") }
+tor-connection-internet-status-online = { COPY(path, "settings.statusInternetOnline") }
+tor-connection-internet-status-offline = { COPY(path, "settings.statusInternetOffline") }
+
+tor-bridges-heading = { COPY(path, "settings.bridgesHeading") }
+tor-bridges-overview = { COPY(path, "settings.bridgesDescription2") }
+tor-bridges-learn-more-link = { COPY(path, "settings.learnMore") }
+
+tor-bridges-built-in-obfs4-description = { COPY(path, "settings.builtinBridgeObfs4Description2") }
+tor-bridges-built-in-snowflake-name = { COPY(path, "settings.builtinBridgeSnowflake") }
+tor-bridges-built-in-snowflake-description = { COPY(path, "settings.builtinBridgeSnowflakeDescription2") }
+tor-bridges-built-in-meek-azure-name = { COPY(path, "settings.builtinBridgeMeekAzure") }
+tor-bridges-built-in-meek-azure-description = { COPY(path, "settings.builtinBridgeMeekAzureDescription2") }
+
+remove-all-bridges-warning-title = { COPY(path, "settings.bridgeRemoveAllDialogTitle") }
+remove-all-bridges-warning-description = { COPY(path, "settings.bridgeRemoveAllDialogDescription") }
+remove-all-bridges-warning-remove-button = { COPY(path, "settings.remove") }
+
+bridge-qr-dialog-title =
+ .title = { COPY(path, "settings.scanQrTitle") }
+
+bridge-dialog-button-connect = { COPY(path, "settings.bridgeButtonConnect") }
+bridge-dialog-button-accept = { COPY(path, "settings.bridgeButtonAccept") }
+bridge-dialog-button-submit = { COPY(path, "settings.submitCaptcha") }
+
+built-in-dialog-title =
+ .title = { COPY(path, "settings.builtinBridgeHeader") }
+built-in-dialog-snowflake-radio-option =
+ .label = { COPY(path, "settings.builtinBridgeSnowflake") }
+built-in-dialog-meek-azure-radio-option =
+ .label = { COPY(path, "settings.builtinBridgeMeekAzure") }
+
+request-bridge-dialog-title =
+ .title = { COPY(path, "settings.requestBridgeDialogTitle") }
+request-bridge-dialog-top-wait = { COPY(path, "settings.contactingBridgeDB") }
+request-bridge-dialog-top-solve = { COPY(path, "settings.solveTheCaptcha") }
+request-bridge-dialog-captcha-input =
+ .placeholder = { COPY(path, "settings.captchaTextboxPlaceholder") }
+request-bridge-dialog-captcha-failed = { COPY(path, "settings.incorrectCaptcha") }
+
+tor-advanced-settings-heading = { COPY(path, "settings.advancedHeading") }
+tor-advanced-settings-button = { COPY(path, "settings.advancedButton") }
+
+tor-log-dialog-copy-button-copied =
+ .label = { COPY(path, "settings.copied") }
+
+tor-advanced-dialog-proxy-socks4-menuitem =
+ .label = { COPY(path, "settings.proxyTypeSOCKS4") }
+tor-advanced-dialog-proxy-socks5-menuitem =
+ .label = { COPY(path, "settings.proxyTypeSOCKS5") }
+tor-advanced-dialog-proxy-http-menuitem =
+ .label = { COPY(path, "settings.proxyTypeHTTP") }
+tor-advanced-dialog-proxy-address-input-label = { COPY(path, "settings.proxyAddress") }
+tor-advanced-dialog-proxy-address-input =
+ .placeholder = { COPY(path, "settings.proxyAddressPlaceholder") }
+tor-advanced-dialog-proxy-port-input-label = { COPY(path, "settings.proxyPort") }
+tor-advanced-dialog-proxy-username-input-label = { COPY(path, "settings.proxyUsername") }
+tor-advanced-dialog-proxy-username-input =
+ .placeholder = { COPY(path, "settings.proxyUsernamePasswordPlaceholder") }
+tor-advanced-dialog-proxy-password-input-label = { COPY(path, "settings.proxyPassword") }
+tor-advanced-dialog-proxy-password-input =
+ .placeholder = { COPY(path, "settings.proxyUsernamePasswordPlaceholder") }
+tor-advanced-dialog-firewall-checkbox =
+ .label = { COPY(path, "settings.useFirewall") }
+tor-advanced-dialog-firewall-ports-input =
+ .placeholder = { COPY(path, "settings.allowedPortsPlaceholder") }
+""",
+ path=legacy_path,
+ ),
+ )
View it on GitLab: https://gitlab.torproject.org/tpo/applications/tor-browser/-/compare/3f77b1…
--
View it on GitLab: https://gitlab.torproject.org/tpo/applications/tor-browser/-/compare/3f77b1…
You're receiving this email because of your account on gitlab.torproject.org.
1
0

[Git][tpo/applications/tor-browser][tor-browser-115.9.0esr-13.5-1] 2 commits: fixup! Bug 40933: Add tor-launcher functionality
by richard (@richard) 09 Apr '24
by richard (@richard) 09 Apr '24
09 Apr '24
richard pushed to branch tor-browser-115.9.0esr-13.5-1 at The Tor Project / Applications / Tor Browser
Commits:
2b1f695a by Pier Angelo Vendrame at 2024-04-09T19:50:54+00:00
fixup! Bug 40933: Add tor-launcher functionality
Bug 42510: Do not call SETCONF when we do not own the tor daemon.
- - - - -
3f77b1ff by Pier Angelo Vendrame at 2024-04-09T19:50:54+00:00
fixup! Bug 40597: Implement TorSettings module
Bug 42511: Fixed a typo
TorConnectState.DisabledState -> TorConnectState.Disabled
- - - - -
2 changed files:
- toolkit/components/tor-launcher/TorProvider.sys.mjs
- toolkit/modules/TorConnect.sys.mjs
Changes:
=====================================
toolkit/components/tor-launcher/TorProvider.sys.mjs
=====================================
@@ -226,16 +226,18 @@ export class TorProvider {
throw e;
}
- try {
- await lazy.TorSettings.initializedPromise;
- await this.writeSettings(lazy.TorSettings.getSettings());
- } catch (e) {
- logger.warn(
- "Failed to initialize TorSettings or to write our settings, so uninitializing.",
- e
- );
- this.uninit();
- throw e;
+ if (this.ownsTorDaemon) {
+ try {
+ await lazy.TorSettings.initializedPromise;
+ await this.writeSettings(lazy.TorSettings.getSettings());
+ } catch (e) {
+ logger.warn(
+ "Failed to initialize TorSettings or to write our settings, so uninitializing.",
+ e
+ );
+ this.uninit();
+ throw e;
+ }
}
TorLauncherUtil.setProxyConfiguration(this.#socksSettings);
=====================================
toolkit/modules/TorConnect.sys.mjs
=====================================
@@ -723,7 +723,7 @@ class DisabledState extends StateCallback {
allowedTransitions = Object.freeze([]);
constructor() {
- super(TorConnectState.DisabledState);
+ super(TorConnectState.Disabled);
}
async run() {
View it on GitLab: https://gitlab.torproject.org/tpo/applications/tor-browser/-/compare/5dc406…
--
View it on GitLab: https://gitlab.torproject.org/tpo/applications/tor-browser/-/compare/5dc406…
You're receiving this email because of your account on gitlab.torproject.org.
1
0

[Git][tpo/applications/tor-browser-build][main] geckoview tools in tor-browser moved into their own directory (fat-aar)
by Pier Angelo Vendrame (@pierov) 09 Apr '24
by Pier Angelo Vendrame (@pierov) 09 Apr '24
09 Apr '24
Pier Angelo Vendrame pushed to branch main at The Tor Project / Applications / tor-browser-build
Commits:
872cff7c by Dan Ballard at 2024-04-09T11:41:30-07:00
geckoview tools in tor-browser moved into their own directory (fat-aar)
- - - - -
1 changed file:
- projects/geckoview/build
Changes:
=====================================
projects/geckoview/build
=====================================
@@ -89,8 +89,9 @@ export MOZ_SOURCE_CHANGESET=[% c("var/git_commit") %]
MOZCONFIG_EOF
echo "Starting the creation of the fake fat AAR $(date)"
- pushd tools/torbrowser
- make fat-aar ARCHS="[% c('arch') %]"
+ pushd tools/geckoview
+ touch android-env.sh
+ make fataar ARCHS="[% c('arch') %]"
popd
MOZCONFIG=mozconfig-android-all ./mach gradle \
geckoview:publishWithGeckoBinariesDebugPublicationToMavenLocal \
View it on GitLab: https://gitlab.torproject.org/tpo/applications/tor-browser-build/-/commit/8…
--
View it on GitLab: https://gitlab.torproject.org/tpo/applications/tor-browser-build/-/commit/8…
You're receiving this email because of your account on gitlab.torproject.org.
1
0

[Git][tpo/applications/tor-browser][tor-browser-115.9.0esr-13.5-1] fixup! Bug 41089: Add tor-browser build scripts + Makefile to tor-browser
by Pier Angelo Vendrame (@pierov) 09 Apr '24
by Pier Angelo Vendrame (@pierov) 09 Apr '24
09 Apr '24
Pier Angelo Vendrame pushed to branch tor-browser-115.9.0esr-13.5-1 at The Tor Project / Applications / Tor Browser
Commits:
5dc406d2 by Dan Ballard at 2024-04-09T10:18:53-07:00
fixup! Bug 41089: Add tor-browser build scripts + Makefile to tor-browser
add geckoview tools
- - - - -
11 changed files:
- + tools/geckoview/.gitignore
- + tools/geckoview/Makefile
- + tools/geckoview/android-env-linux-template.sh
- + tools/geckoview/android-env-macos-template.sh
- + tools/geckoview/build.sh
- + tools/geckoview/clobber.sh
- + tools/geckoview/config.sh
- tools/torbrowser/fataar.py → tools/geckoview/fataar.py
- + tools/geckoview/jslint.sh
- + tools/geckoview/package-gradle.sh
- tools/torbrowser/Makefile
Changes:
=====================================
tools/geckoview/.gitignore
=====================================
@@ -0,0 +1 @@
+android-env.sh
=====================================
tools/geckoview/Makefile
=====================================
@@ -0,0 +1,43 @@
+.DEFAULT_GOAL := all
+
+# one of armv7 aarch64 x86 x86_64
+ARCH=aarch64
+
+ARCHS=$(ARCH)
+OS="${shell uname}"
+
+# https://stackoverflow.com/questions/18136918/how-to-get-current-relative-di…
+mkfile_path := "$(shell dirname $(realpath $(firstword $(MAKEFILE_LIST))))"
+
+DEV_ROOT = "$(mkfile_path)/../.."
+
+clobber: env
+ ./clobber.sh $(DEV_ROOT) $(ARCH)
+
+config: env
+ ./config.sh $(DEV_ROOT) $(ARCH)
+
+build: env
+ ./build.sh $(DEV_ROOT) $(ARCH)
+
+fataar: env
+ bash -c "source android-env.sh && ./fataar.py $(DEV_ROOT) $(ARCHS)"
+
+package: env
+ ./package-gradle.sh $(DEV_ROOT) $(ARCH)
+
+show:
+ ls -lh ~/.m2/repository/org/mozilla/geckoview/geckoview-default-omni/
+ ls -lh ~/.m2/repository/org/mozilla/geckoview/geckoview-default-omni/$(shell ls ~/.m2/repository/org/mozilla/geckoview/geckoview-default-omni | tail -n 2 | head -n 1)
+
+env:
+ test -e android-env.sh || { echo "copy android-env-...-template.sh to android-env.sh and edit appropriatly"; exit 1; }
+
+all: env build package
+
+jslint:
+ ./jslint.sh $(DEV_ROOT) $(JS)
+
+clean:
+ rm -rf $(BUILD_OUTPUT)
+
=====================================
tools/geckoview/android-env-linux-template.sh
=====================================
@@ -0,0 +1,7 @@
+export MOZ_BUILD_DATE=20230710165010 # This should match the data in [firefox-android](https://gitlab.torproject.org/tpo/applications/firefox-and… ~ln 12's def of the variable *version*, the date component
+export JAVA_HOME=/usr/lib/jvm/java-11-openjdk-amd64
+export ANDROID_HOME=$HOME/.mozbuild/android-sdk-linux/ # or $HOME/Android/Sdk/ # Or .../android-toolchain/android-sdk-linux if you extract android-toolchain from tor-browser-build
+export ANDROID_NDK_HOME=$ANDROID_HOME/ndk/23.2.8568313/ # for 115esr
+export GRADLE_HOME=/FULL/PATH/TO/tor-browser-build/out/gradle/gradle-7.5.1 # Or the version that we currently use
+export LOCAL_DEV_BUILD=1
+export PATH=/FULL/PATH/TO/tor-browser-build/out/clang/clang-16.x.y-arm/bin/:$PATH # prepend our newly built and assembled clang to the path so it gets used to build geckoview
=====================================
tools/geckoview/android-env-macos-template.sh
=====================================
@@ -0,0 +1,7 @@
+export MOZ_BUILD_DATE=20230710165010 # This should match the data in [firefox-android](https://gitlab.torproject.org/tpo/applications/firefox-and… ~ln 12's def of the variable *version*, the date component
+export JAVA_HOME=/opt/homebrew/opt/openjdk(a)11/libexec/openjdk.jdk/Contents/Home/ # for arm64. Or JAVA_HOME=/usr/local/opt/openjdk(a)11/libexec/openjdk.jdk/Contents/Home/ for x86_64.
+export ANDROID_HOME=$HOME/Library/Android/sdk # or $HOME/.mozbuild/android-sdk-macosx/
+export ANDROID_NDK_HOME=$ANDROID_HOME/ndk/23.2.8568313 # will need to download NDK 23.2.8568313 via android studio
+export GRADLE_HOME=/opt/homebrew/Cellar/gradle(a)7/7.6.4 # for arm64 or /usr/local/Cellar/gradle(a)7/7.6.4 for x86_64. Make sure the version is up to date
+export LOCAL_DEV_BUILD=1
+export PATH=$ANDROID_HOME/ndk/25.2.9519653/toolchains/llvm/prebuilt/darwin-x86_64/bin/:$PATH # prepend android studios latest ndk to the path so it's clang gets used to build geckoview. NDK 25.2.9519653 uses clang 14.0.7, ideally we'd use clang 16 (to be the same as Linux) but that's not an option yet for android studio. NDK 26.1.10909125 uses clang 17.0.2, which we should evaluate with the esr128 migration
=====================================
tools/geckoview/build.sh
=====================================
@@ -0,0 +1,9 @@
+#!/bin/bash
+set -e
+DEV_ROOT=$1
+ARCH=$2
+
+source android-env.sh
+
+cd $DEV_ROOT
+MOZCONFIG=mozconfig-android-$ARCH ./mach build
=====================================
tools/geckoview/clobber.sh
=====================================
@@ -0,0 +1,10 @@
+#!/bin/bash
+set -e
+DEV_ROOT=$1
+ARCH=$2
+
+source android-env.sh
+
+cd $DEV_ROOT
+MOZCONFIG=mozconfig-android-$ARCH ./mach clobber
+MOZCONFIG=mozconfig-android-all ./mach clobber
=====================================
tools/geckoview/config.sh
=====================================
@@ -0,0 +1,9 @@
+#!/bin/bash
+set -e
+DEV_ROOT=$1
+ARCH=$2
+
+source android-env.sh
+
+cd $DEV_ROOT
+MOZCONFIG=mozconfig-android-$ARCH ./mach configure --without-wasm-sandboxed-libraries
=====================================
tools/torbrowser/fataar.py → tools/geckoview/fataar.py
=====================================
=====================================
tools/geckoview/jslint.sh
=====================================
@@ -0,0 +1,9 @@
+#!/bin/bash
+set -e
+DEV_ROOT=$1
+JS_FILE=$2
+
+source android-env.sh
+
+cd $DEV_ROOT
+./mach lint -l eslint --fix $JS_FILE
=====================================
tools/geckoview/package-gradle.sh
=====================================
@@ -0,0 +1,15 @@
+#!/bin/bash
+set -e
+DEV_ROOT=$1
+ARCH=$2
+
+source android-env.sh
+
+env ARCHS=$ARCH make fat-aar
+
+cd $DEV_ROOT
+MOZCONFIG=mozconfig-android-$ARCH ./mach build binaries
+MOZCONFIG=mozconfig-android-$ARCH ./mach gradle geckoview:publishWithGeckoBinariesDebugPublicationToMavenRepository
+MOZCONFIG=mozconfig-android-all ./mach gradle geckoview:publishWithGeckoBinariesDebugPublicationToMavenLocal exoplayer2:publishDebugPublicationToMavenLocal
+
+
=====================================
tools/torbrowser/Makefile
=====================================
@@ -47,9 +47,6 @@ build:
deploy:
./deploy.sh $(BINARIES) $(BUILD_OUTPUT)
-fat-aar:
- ./fataar.py $(DEV_ROOT) $(ARCHS)
-
all: build deploy
run:
View it on GitLab: https://gitlab.torproject.org/tpo/applications/tor-browser/-/commit/5dc406d…
--
View it on GitLab: https://gitlab.torproject.org/tpo/applications/tor-browser/-/commit/5dc406d…
You're receiving this email because of your account on gitlab.torproject.org.
1
0

[Git][tpo/applications/tor-browser][tor-browser-115.9.0esr-13.5-1] 17 commits: fixup! Lox integration
by Pier Angelo Vendrame (@pierov) 09 Apr '24
by Pier Angelo Vendrame (@pierov) 09 Apr '24
09 Apr '24
Pier Angelo Vendrame pushed to branch tor-browser-115.9.0esr-13.5-1 at The Tor Project / Applications / Tor Browser
Commits:
a2c8eab3 by Henry Wilkes at 2024-04-09T13:35:51+01:00
fixup! Lox integration
Bug 42489: Add a logger for the Lox module.
- - - - -
21115918 by Henry Wilkes at 2024-04-09T13:36:00+01:00
fixup! Lox integration
Bug 42489: Change "loxid" to "loxId".
This follows the camel case convention.
- - - - -
64fd04bf by Henry Wilkes at 2024-04-09T13:36:01+01:00
fixup! Lox integration
Bug 42489: Require a loxId argument for most methods.
This ensures that a method only works on the credentials of the
*expected* loxId, rather than the newest `TorSettings.bridges.lox_id`
value which may change during a session.
We also add `#activeLoxId` to stay in sync with
`TorSettings.brigdes.lox_id`. We merge `clearInvites` into its updater.
- - - - -
2411aa86 by Henry Wilkes at 2024-04-09T13:36:01+01:00
fixup! Lox integration
Bug 42489: Make loading the stored preferences unconditional on
the #credentials value.
Also change the type of `#events` to always be an Array.
- - - - -
2b7376cd by Henry Wilkes at 2024-04-09T13:36:03+01:00
fixup! Lox integration
Bug 42489: Generated loxId is unlikely to clash with existing ones, but
we add some free logic to guarantee this.
- - - - -
4a114a5d by Henry Wilkes at 2024-04-09T13:36:09+01:00
fixup! Lox integration
Bug 42489: Return copies of Lox module internals to ensure they cannot
be edited by a caller.
- - - - -
e7248fe1 by Henry Wilkes at 2024-04-09T13:57:23+01:00
fixup! Lox integration
Bug 42489: Add notifications to the Lox module.
We ensure changes to credentials pass through #changeCredentials to
check whether we should send a notification.
- - - - -
e8846a94 by Henry Wilkes at 2024-04-09T13:57:29+01:00
fixup! Lox integration
Bug 42489: Add #assertInitialized.
- - - - -
b459399f by Henry Wilkes at 2024-04-09T16:17:17+01:00
fixup! Lox integration
Bug 42489: Change LoxError.
Move the LoxErrors types into LoxError. Only set the type if it is
specific.
- - - - -
23921826 by Henry Wilkes at 2024-04-09T16:17:25+01:00
fixup! Lox integration
Bug 42489: Change the Lox Authority URL.
- - - - -
c9db0992 by Henry Wilkes at 2024-04-09T16:17:26+01:00
fixup! Lox integration
Bug 42489: Try and re fetch the pubKey, encTable and constants if they
failed before.
For example, if they fail via a domain front request, we should try
again with `fetch` when we are bootstrapped.
- - - - -
a9522e4e by Henry Wilkes at 2024-04-09T16:17:26+01:00
fixup! Lox integration
Bug 42489: Make sure trust level strings are converted to integers.
- - - - -
63e0f941 by Henry Wilkes at 2024-04-09T16:22:17+01:00
fixup! Lox integration
Bug 42489: Tidy #attemptUpgrade by returning early with a promise.
- - - - -
40ca47e1 by Henry Wilkes at 2024-04-09T16:22:18+01:00
fixup! Bug 31286: Implementation of bridge, proxy, and firewall settings in about:preferences#connection
Bug 42489: Listen for notifications from Lox module, and pass in loxId
to methods.
- - - - -
23b9aa5b by Henry Wilkes at 2024-04-09T16:22:29+01:00
fixup! Bug 40597: Implement TorSettings module
Bug 42489: Listen for notifications from Lox module.
Also, do not save the bridge_strings to the preferences if they come
from the Lox module.
In DomainFrontedRequests distinguish between reachability errors,
response errors and other errors in DomainFrontedRequest to improve Lox
error messaging.
- - - - -
46ac1528 by Henry Wilkes at 2024-04-09T16:22:53+01:00
fixup! Bug 40933: Add tor-launcher functionality
Bug 42489: Drop getLocalizedStringForError from TorLauncherUtil.
- - - - -
9abd099f by Henry Wilkes at 2024-04-09T16:22:53+01:00
fixup! Add TorStrings module for localization
Bug 42489: Drop nserror strings.
- - - - -
8 changed files:
- browser/components/torpreferences/content/connectionPane.js
- browser/components/torpreferences/content/loxInviteDialog.js
- browser/components/torpreferences/content/provideBridgeDialog.js
- toolkit/components/lox/Lox.sys.mjs
- toolkit/components/tor-launcher/TorLauncherUtil.sys.mjs
- toolkit/modules/DomainFrontedRequests.sys.mjs
- toolkit/modules/TorSettings.sys.mjs
- toolkit/torbutton/chrome/locale/en-US/torlauncher.properties
Changes:
=====================================
browser/components/torpreferences/content/connectionPane.js
=====================================
@@ -36,7 +36,7 @@ const { TorStrings } = ChromeUtils.importESModule(
"resource://gre/modules/TorStrings.sys.mjs"
);
-const { Lox } = ChromeUtils.importESModule(
+const { Lox, LoxTopics } = ChromeUtils.importESModule(
"resource://gre/modules/Lox.sys.mjs"
);
@@ -1319,27 +1319,18 @@ const gLoxStatus = {
this._invitesButton.addEventListener("click", () => {
gSubDialog.open(
"chrome://browser/content/torpreferences/loxInviteDialog.xhtml",
- {
- features: "resizable=yes",
- closedCallback: () => {
- // TODO: Listen for events from Lox, rather than call _updateInvites
- // directly.
- this._updateInvites();
- },
- }
+ { features: "resizable=yes" }
);
});
this._unlockAlertButton.addEventListener("click", () => {
- // TODO: Have a way to ensure that the cleared event data matches the
- // current _loxId
- Lox.clearEventData();
- // TODO: Listen for events from Lox, rather than call _updateUnlocks
- // directly.
- this._updateUnlocks();
+ Lox.clearEventData(this._loxId);
});
Services.obs.addObserver(this, TorSettingsTopics.SettingsChanged);
- // TODO: Listen for new events from Lox, when it is supported.
+ Services.obs.addObserver(this, LoxTopics.UpdateEvents);
+ Services.obs.addObserver(this, LoxTopics.UpdateNextUnlock);
+ Services.obs.addObserver(this, LoxTopics.UpdateRemainingInvites);
+ Services.obs.addObserver(this, LoxTopics.NewInvite);
// NOTE: Before initializedPromise completes, this area is hidden.
TorSettings.initializedPromise.then(() => {
@@ -1352,6 +1343,10 @@ const gLoxStatus = {
*/
uninit() {
Services.obs.removeObserver(this, TorSettingsTopics.SettingsChanged);
+ Services.obs.removeObserver(this, LoxTopics.UpdateEvents);
+ Services.obs.removeObserver(this, LoxTopics.UpdateNextUnlock);
+ Services.obs.removeObserver(this, LoxTopics.UpdateRemainingInvites);
+ Services.obs.removeObserver(this, LoxTopics.NewInvite);
},
observe(subject, topic, data) {
@@ -1365,6 +1360,18 @@ const gLoxStatus = {
this._updateLoxId();
}
break;
+ case LoxTopics.UpdateNextUnlock:
+ this._updateNextUnlock();
+ break;
+ case LoxTopics.UpdateEvents:
+ this._updatePendingEvents();
+ break;
+ case LoxTopics.UpdateRemainingInvites:
+ this._updateRemainingInvites();
+ break;
+ case LoxTopics.NewInvite:
+ this._updateHaveExistingInvites();
+ break;
}
},
@@ -1384,43 +1391,126 @@ const gLoxStatus = {
TorSettings.bridges.source === TorBridgeSource.Lox
? TorSettings.bridges.lox_id
: "";
- if (loxId !== this._loxId) {
- this._loxId = loxId;
- this._updateUnlocks();
- this._updateInvites();
+ if (loxId === this._loxId) {
+ return;
}
+ this._loxId = loxId;
+ // We unset _nextUnlock to ensure the areas no longer use the old value for
+ // the new loxId.
+ this._updateNextUnlock(true);
+ this._updateRemainingInvites();
+ this._updateHaveExistingInvites();
+ this._updatePendingEvents();
},
/**
- * Update the display of the current or next unlock.
+ * The remaining invites shown, or null if uninitialized or no loxId.
+ *
+ * @type {integer?}
*/
- async _updateUnlocks() {
- // Cache the loxId before we await.
- const loxId = this._loxId;
-
- if (!loxId) {
- // NOTE: This area should already be hidden by the change in Lox source,
- // but we clean up for the next non-empty id.
- this._area.classList.remove("show-unlock-alert");
- this._area.classList.remove("show-next-unlock");
+ _remainingInvites: null,
+ /**
+ * Update the shown value.
+ */
+ _updateRemainingInvites() {
+ const numInvites = this._loxId
+ ? Lox.getRemainingInviteCount(this._loxId)
+ : null;
+ if (numInvites === this._remainingInvites) {
return;
}
-
- let pendingEvents;
- let nextUnlock;
- let numInvites;
- // Fetch the latest events or details about the next unlock.
- try {
- nextUnlock = await Lox.getNextUnlock();
- pendingEvents = Lox.getEventData();
- numInvites = Lox.getRemainingInviteCount();
- } catch (e) {
- console.error("Failed get get lox updates", e);
+ this._remainingInvites = numInvites;
+ this._updateUnlockArea();
+ this._updateInvitesArea();
+ },
+ /**
+ * Whether we have existing invites, or null if uninitialized or no loxId.
+ *
+ * @type {boolean?}
+ */
+ _haveExistingInvites: null,
+ /**
+ * Update the shown value.
+ */
+ _updateHaveExistingInvites() {
+ const haveInvites = this._loxId ? !!Lox.getInvites().length : null;
+ if (haveInvites === this._haveExistingInvites) {
+ return;
+ }
+ this._haveExistingInvites = haveInvites;
+ this._updateInvitesArea();
+ },
+ /**
+ * Details about the next unlock, or null if uninitialized or no loxId.
+ *
+ * @type {UnlockData?}
+ */
+ _nextUnlock: null,
+ /**
+ * Tracker id to ensure that the results from later calls to _updateNextUnlock
+ * take priority over earlier calls.
+ *
+ * @type {integer}
+ */
+ _nextUnlockCallId: 0,
+ /**
+ * Update the shown value asynchronously.
+ *
+ * @param {boolean} [unset=false] - Whether to set the _nextUnlock value to
+ * null before waiting for the new value. I.e. ensure that the current value
+ * will not be used.
+ */
+ async _updateNextUnlock(unset = false) {
+ // NOTE: We do not expect the integer to exceed the maximum integer.
+ this._nextUnlockCallId++;
+ const callId = this._nextUnlockCallId;
+ if (unset) {
+ this._nextUnlock = null;
+ }
+ const nextUnlock = this._loxId
+ ? await Lox.getNextUnlock(this._loxId)
+ : null;
+ if (callId !== this._nextUnlockCallId) {
+ // Replaced by another update.
+ // E.g. if the _loxId changed. Or if getNextUnlock triggered
+ // LoxTopics.UpdateNextUnlock.
return;
}
+ // Should be safe to trigger the update, even when the value hasn't changed.
+ this._nextUnlock = nextUnlock;
+ this._updateUnlockArea();
+ },
+ /**
+ * The list of events the user has not yet cleared, or null if uninitialized
+ * or no loxId.
+ *
+ * @type {EventData[]?}
+ */
+ _pendingEvents: null,
+ /**
+ * Update the shown value.
+ */
+ _updatePendingEvents() {
+ // Should be safe to trigger the update, even when the value hasn't changed.
+ this._pendingEvents = this._loxId ? Lox.getEventData(this._loxId) : null;
+ this._updateUnlockArea();
+ },
- if (loxId !== this._loxId) {
- // Replaced during await.
+ /**
+ * Update the display of the current or next unlock.
+ */
+ _updateUnlockArea() {
+ if (
+ !this._loxId ||
+ this._pendingEvents === null ||
+ this._remainingInvites === null ||
+ this._nextUnlock === null
+ ) {
+ // Uninitialized or no Lox source.
+ // NOTE: This area may already be hidden by the change in Lox source,
+ // but we clean up for the next non-empty id.
+ this._area.classList.remove("show-unlock-alert");
+ this._area.classList.remove("show-next-unlock");
return;
}
@@ -1428,6 +1518,7 @@ const gLoxStatus = {
const alertHadFocus = this._unlockAlert.contains(document.activeElement);
const detailsHadFocus = this._detailsArea.contains(document.activeElement);
+ const pendingEvents = this._pendingEvents;
const showAlert = !!pendingEvents.length;
this._area.classList.toggle("show-unlock-alert", showAlert);
this._area.classList.toggle("show-next-unlock", !showAlert);
@@ -1479,7 +1570,7 @@ const gLoxStatus = {
document.l10n.setAttributes(
this._unlockAlertInviteItem,
"tor-bridges-lox-new-invites",
- { numInvites }
+ { numInvites: this._remainingInvites }
);
this._unlockAlert.classList.toggle(
"lox-unlock-upgrade",
@@ -1494,7 +1585,7 @@ const gLoxStatus = {
const numDays = Math.max(
1,
Math.ceil(
- (new Date(nextUnlock.date).getTime() - Date.now()) /
+ (new Date(this._nextUnlock.date).getTime() - Date.now()) /
(24 * 60 * 60 * 1000)
)
);
@@ -1505,9 +1596,9 @@ const gLoxStatus = {
);
// Gain 2 bridges from level 0 to 1. After that gain invites.
- const bridgeGain = nextUnlock.nextLevel === 1;
- const firstInvites = nextUnlock.nextLevel === 2;
- const moreInvites = nextUnlock.nextLevel > 2;
+ const bridgeGain = this._nextUnlock.nextLevel === 1;
+ const firstInvites = this._nextUnlock.nextLevel === 2;
+ const moreInvites = this._nextUnlock.nextLevel > 2;
this._detailsArea.classList.toggle("lox-next-gain-bridges", bridgeGain);
this._detailsArea.classList.toggle(
@@ -1529,24 +1620,19 @@ const gLoxStatus = {
/**
* Update the invites area.
*/
- _updateInvites() {
- if (!this._loxId) {
- return;
- }
-
- let remainingInvites;
- let existingInvites;
- // Fetch the latest events or details about the next unlock.
- try {
- remainingInvites = Lox.getRemainingInviteCount();
- existingInvites = Lox.getInvites().length;
- } catch (e) {
- console.error("Failed get get remaining invites", e);
- return;
+ _updateInvitesArea() {
+ let hasInvites;
+ if (
+ !this._loxId ||
+ this._remainingInvites === null ||
+ this._haveExistingInvites === null
+ ) {
+ // Not initialized yet.
+ hasInvites = false;
+ } else {
+ hasInvites = this._haveExistingInvites || !!this._remainingInvites;
}
- const hasInvites = !!existingInvites || !!remainingInvites;
-
if (!hasInvites) {
if (
this._remainingInvitesEl.contains(document.activeElement) ||
@@ -1563,11 +1649,13 @@ const gLoxStatus = {
// creating new ones.
this._detailsArea.classList.toggle("lox-has-invites", hasInvites);
- document.l10n.setAttributes(
- this._remainingInvitesEl,
- "tor-bridges-lox-remaining-invites",
- { numInvites: remainingInvites }
- );
+ if (hasInvites) {
+ document.l10n.setAttributes(
+ this._remainingInvitesEl,
+ "tor-bridges-lox-remaining-invites",
+ { numInvites: this._remainingInvites }
+ );
+ }
},
};
=====================================
browser/components/torpreferences/content/loxInviteDialog.js
=====================================
@@ -3,14 +3,14 @@
const { TorSettings, TorSettingsTopics, TorBridgeSource } =
ChromeUtils.importESModule("resource://gre/modules/TorSettings.sys.mjs");
-const { Lox, LoxErrors } = ChromeUtils.importESModule(
+const { Lox, LoxError, LoxTopics } = ChromeUtils.importESModule(
"resource://gre/modules/Lox.sys.mjs"
);
/**
* Fake Lox module
-const LoxErrors = {
+const LoxError = {
LoxServerUnreachable: "LoxServerUnreachable",
Other: "Other",
};
@@ -36,7 +36,7 @@ const Lox = {
return;
}
if (!this.remainingInvites) {
- rej({ type: LoxErrors.Other });
+ rej({ type: LoxError.Other });
return;
}
const invite = JSON.stringify({
@@ -104,7 +104,8 @@ const gLoxInvites = {
// NOTE: TorSettings should already be initialized when this dialog is
// opened.
Services.obs.addObserver(this, TorSettingsTopics.SettingsChanged);
- // TODO: Listen for new invites from Lox, when supported.
+ Services.obs.addObserver(this, LoxTopics.UpdateRemainingInvites);
+ Services.obs.addObserver(this, LoxTopics.NewInvite);
// Set initial _loxId value. Can close this dialog.
this._updateLoxId();
@@ -118,6 +119,8 @@ const gLoxInvites = {
*/
uninit() {
Services.obs.removeObserver(this, TorSettingsTopics.SettingsChanged);
+ Services.obs.removeObserver(this, LoxTopics.UpdateRemainingInvites);
+ Services.obs.removeObserver(this, LoxTopics.NewInvite);
},
observe(subject, topic, data) {
@@ -131,6 +134,12 @@ const gLoxInvites = {
this._updateLoxId();
}
break;
+ case LoxTopics.UpdateRemainingInvites:
+ this._updateRemainingInvites();
+ break;
+ case LoxTopics.NewInvite:
+ this._updateExistingInvites();
+ break;
}
},
@@ -204,7 +213,7 @@ const gLoxInvites = {
* Update the display of the remaining invites.
*/
_updateRemainingInvites() {
- this._remainingInvites = Lox.getRemainingInviteCount();
+ this._remainingInvites = Lox.getRemainingInviteCount(this._loxId);
document.l10n.setAttributes(
this._remainingInvitesEl,
@@ -254,7 +263,7 @@ const gLoxInvites = {
this._connectingEl.focus();
let lostFocus = false;
- Lox.generateInvite()
+ Lox.generateInvite(this._loxId)
.finally(() => {
// Fetch whether the connecting label still has focus before we hide it.
lostFocus = this._connectingEl.contains(document.activeElement);
@@ -275,15 +284,11 @@ const gLoxInvites = {
// message.
this._inviteListEl.focus();
}
-
- // TODO: When Lox sends out notifications, let the observer handle the
- // change rather than calling _updateRemainingInvites directly.
- this._updateRemainingInvites();
},
loxError => {
console.error("Failed to generate an invite", loxError);
- switch (loxError.type) {
- case LoxErrors.LoxServerUnreachable:
+ switch (loxError instanceof LoxError ? loxError.code : null) {
+ case LoxError.LoxServerUnreachable:
this._updateGenerateError("no-server");
break;
default:
=====================================
browser/components/torpreferences/content/provideBridgeDialog.js
=====================================
@@ -15,14 +15,14 @@ const { TorParsers } = ChromeUtils.importESModule(
"resource://gre/modules/TorParsers.sys.mjs"
);
-const { Lox, LoxErrors } = ChromeUtils.importESModule(
+const { Lox, LoxError } = ChromeUtils.importESModule(
"resource://gre/modules/Lox.sys.mjs"
);
/*
* Fake Lox module:
-const LoxErrors = {
+const LoxError = {
BadInvite: "BadInvite",
LoxServerUnreachable: "LoxServerUnreachable",
Other: "Other",
@@ -30,9 +30,9 @@ const LoxErrors = {
const Lox = {
failError: null,
- // failError: LoxErrors.BadInvite,
- // failError: LoxErrors.LoxServerUnreachable,
- // failError: LoxErrors.Other,
+ // failError: LoxError.BadInvite,
+ // failError: LoxError.LoxServerUnreachable,
+ // failError: LoxError.Other,
redeemInvite(invite) {
return new Promise((res, rej) => {
setTimeout(() => {
@@ -281,13 +281,13 @@ const gProvideBridgeDialog = {
},
loxError => {
console.error("Redeeming failed", loxError);
- switch (loxError.type) {
- case LoxErrors.BadInvite:
+ switch (loxError instanceof LoxError ? loxError.code : null) {
+ case LoxError.BadInvite:
// TODO: distinguish between a bad invite, an invite that has
// expired, and an invite that has already been redeemed.
this.updateError({ type: "bad-invite" });
break;
- case LoxErrors.LoxServerUnreachable:
+ case LoxError.LoxServerUnreachable:
this.updateError({ type: "no-server" });
break;
default:
=====================================
toolkit/components/lox/Lox.sys.mjs
=====================================
@@ -5,15 +5,32 @@ import {
} from "resource://gre/modules/Timer.sys.mjs";
const lazy = {};
+
+ChromeUtils.defineLazyGetter(lazy, "logger", () => {
+ let { ConsoleAPI } = ChromeUtils.importESModule(
+ "resource://gre/modules/Console.sys.mjs"
+ );
+ return new ConsoleAPI({
+ maxLogLevel: "warn",
+ maxLogLevelPref: "lox.log_level",
+ prefix: "Lox",
+ });
+});
+
ChromeUtils.defineESModuleGetters(lazy, {
DomainFrontRequestBuilder:
"resource://gre/modules/DomainFrontedRequests.sys.mjs",
+ DomainFrontRequestNetworkError:
+ "resource://gre/modules/DomainFrontedRequests.sys.mjs",
+ DomainFrontRequestResponseError:
+ "resource://gre/modules/DomainFrontedRequests.sys.mjs",
TorConnect: "resource://gre/modules/TorConnect.sys.mjs",
TorConnectState: "resource://gre/modules/TorConnect.sys.mjs",
TorSettings: "resource://gre/modules/TorSettings.sys.mjs",
TorSettingsTopics: "resource://gre/modules/TorSettings.sys.mjs",
TorBridgeSource: "resource://gre/modules/TorSettings.sys.mjs",
});
+
XPCOMUtils.defineLazyModuleGetters(lazy, {
init: "resource://gre/modules/lox_wasm.jsm",
open_invite: "resource://gre/modules/lox_wasm.jsm",
@@ -37,13 +54,22 @@ XPCOMUtils.defineLazyModuleGetters(lazy, {
handle_blockage_migration: "resource://gre/modules/lox_wasm.jsm",
});
-export const LoxErrors = Object.freeze({
- BadInvite: "BadInvite",
- MissingCredential: "MissingCredential",
- LoxServerUnreachable: "LoxServerUnreachable",
- NoInvitations: "NoInvitations",
- InitError: "InitializationError",
- NotInitialized: "NotInitialized",
+export const LoxTopics = Object.freeze({
+ // Whenever the bridges *might* have changed.
+ // getBridges only uses #credentials, so this will only fire when it changes.
+ UpdateBridges: "lox:update-bridges",
+ // Whenever we gain a new upgrade or blockage event, or clear events.
+ UpdateEvents: "lox:update-events",
+ // Whenever the next unlock *might* have changed.
+ // getNextUnlock uses #credentials and #constants, sow ill fire when either
+ // value changes.
+ UpdateNextUnlock: "lox:update-next-unlock",
+ // Whenever the remaining invites *might* have changed.
+ // getRemainingInviteCount only uses #credentials, so will only fire when it
+ // changes.
+ UpdateRemainingInvites: "lox:update-remaining-invites",
+ // Whenever we generate a new invite.
+ NewInvite: "lox:new-invite",
});
const LoxSettingsPrefs = Object.freeze({
@@ -56,10 +82,21 @@ const LoxSettingsPrefs = Object.freeze({
constants: "lox.settings.constants",
});
-class LoxError extends Error {
- constructor(type) {
- super("");
- this.type = type;
+/**
+ * Error class for Lox.
+ */
+export class LoxError extends Error {
+ static BadInvite = "BadInvite";
+ static LoxServerUnreachable = "LoxServerUnreachable";
+
+ /**
+ * @param {string} message - The error message.
+ * @param {string?} [code] - The specific error type, if any.
+ */
+ constructor(message, code = null) {
+ super(message);
+ this.name = "LoxError";
+ this.code = code;
}
}
@@ -70,14 +107,65 @@ class LoxImpl {
#encTablePromise = null;
#constantsPromise = null;
#domainFrontedRequests = null;
- #invites = null;
+ /**
+ * The list of invites generated.
+ *
+ * @type {string[]}
+ */
+ #invites = [];
#pubKeys = null;
#encTable = null;
#constants = null;
- #credentials = null;
+ /**
+ * The latest credentials for a given lox id.
+ *
+ * @type {Object<string, string>}
+ */
+ #credentials = {};
+ /**
+ * The list of accumulated blockage or upgrade events.
+ *
+ * This can be cleared when the user acknowledges the events.
+ *
+ * @type {EventData[]}
+ */
#events = [];
#backgroundInterval = null;
+ /**
+ * The lox ID that is currently active.
+ *
+ * Stays in sync with TorSettings.bridges.lox_id. null when uninitialized.
+ *
+ * @type {string?}
+ */
+ #activeLoxId = null;
+
+ /**
+ * Update the active lox id.
+ */
+ #updateActiveLoxId() {
+ const loxId = lazy.TorSettings.bridges.lox_id;
+ if (loxId === this.#activeLoxId) {
+ return;
+ }
+ lazy.logger.debug(
+ `#activeLoxId switching from "${this.#activeLoxId}" to "${loxId}"`
+ );
+ if (this.#activeLoxId !== null) {
+ lazy.logger.debug(
+ `Clearing event data and invites for "${this.#activeLoxId}"`
+ );
+ // If not initializing clear the metadata for the old lox ID when it
+ // changes.
+ this.clearEventData(this.#activeLoxId);
+ // TODO: Do we want to keep invites? See tor-browser#42453
+ this.#invites = [];
+ this.#store();
+ }
+ this.#activeLoxId = loxId;
+ }
+
observe(subject, topic, data) {
switch (topic) {
case lazy.TorSettingsTopics.SettingsChanged:
@@ -87,11 +175,8 @@ class LoxImpl {
changes.includes("bridges.source") ||
changes.includes("bridges.lox_id")
) {
- // if lox_id has changed, clear event and invite queues
- if (changes.includes("bridges.lox_id")) {
- this.clearEventData();
- this.clearInvites();
- }
+ // The lox_id may have changed.
+ this.#updateActiveLoxId();
// Only run background tasks if Lox is enabled
if (this.#inuse) {
@@ -108,6 +193,8 @@ class LoxImpl {
}
break;
case lazy.TorSettingsTopics.Ready:
+ // Set the initial #activeLoxId.
+ this.#updateActiveLoxId();
// Run background tasks every 12 hours if Lox is enabled
if (this.#inuse) {
this.#backgroundInterval = setInterval(
@@ -119,36 +206,86 @@ class LoxImpl {
}
}
+ /**
+ * Assert that the module is initialized.
+ */
+ #assertInitialized() {
+ if (!this.#initialized) {
+ throw new LoxError("Not initialized");
+ }
+ }
+
get #inuse() {
return (
+ Boolean(this.#activeLoxId) &&
lazy.TorSettings.bridges.enabled === true &&
- lazy.TorSettings.bridges.source === lazy.TorBridgeSource.Lox &&
- lazy.TorSettings.bridges.lox_id
+ lazy.TorSettings.bridges.source === lazy.TorBridgeSource.Lox
);
}
+ /**
+ * Change some existing credentials for an ID to a new value.
+ *
+ * @param {string} loxId - The ID to change the credentials for.
+ * @param {string} newCredentials - The new credentials to set.
+ */
+ #changeCredentials(loxId, newCredentials) {
+ // FIXME: Several async methods want to update the credentials, but they
+ // might race and conflict with each. tor-browser#42492
+ if (!newCredentials) {
+ // Avoid overwriting and losing our current credentials.
+ throw new LoxError(`Empty credentials being set for ${loxId}`);
+ }
+ if (!this.#credentials[loxId]) {
+ // Unexpected, but we still want to save the value to storage.
+ lazy.logger.warn(`Lox ID ${loxId} is missing existing credentials`);
+ }
+
+ this.#credentials[loxId] = newCredentials;
+ this.#store();
+
+ // NOTE: In principle we could determine within this module whether the
+ // bridges, remaining invites, or next unlock changes in value when
+ // switching credentials.
+ // However, this logic can be done by the topic observers, as needed. In
+ // particular, TorSettings.bridges.bridge_strings has its own logic
+ // determining whether its value has changed.
+
+ // Let TorSettings know about possibly new bridges.
+ Services.obs.notifyObservers(null, LoxTopics.UpdateBridges);
+ // Let UI know about changes.
+ Services.obs.notifyObservers(null, LoxTopics.UpdateRemainingInvites);
+ Services.obs.notifyObservers(null, LoxTopics.UpdateNextUnlock);
+ }
+
+ /**
+ * Fetch the latest credentials.
+ *
+ * @param {string} loxId - The ID to get the credentials for.
+ *
+ * @returns {string} - The credentials.
+ */
+ #getCredentials(loxId) {
+ const cred = loxId ? this.#credentials[loxId] : undefined;
+ if (!cred) {
+ throw new LoxError(`No credentials for ${loxId}`);
+ }
+ return cred;
+ }
+
/**
* Formats and returns bridges from the stored Lox credential.
*
- * @param {string} loxid The id string associated with a lox credential.
+ * @param {string} loxId The id string associated with a lox credential.
*
* @returns {string[]} An array of formatted bridge lines. The array is empty
* if there are no bridges.
*/
- getBridges(loxid) {
- if (!this.#initialized) {
- throw new LoxError(LoxErrors.NotInitialized);
- }
- if (loxid === null) {
- return [];
- }
- if (!this.#credentials[loxid]) {
- // This lox id doesn't correspond to a stored credential
- throw new LoxError(LoxErrors.MissingCredential);
- }
+ getBridges(loxId) {
+ this.#assertInitialized();
// Note: this is messy now but can be mostly removed after we have
// https://gitlab.torproject.org/tpo/anti-censorship/lox/-/issues/46
- let bridgelines = JSON.parse(this.#credentials[loxid]).bridgelines;
+ let bridgelines = JSON.parse(this.#getCredentials(loxId)).bridgelines;
let bridges = [];
for (const bridge of bridgelines) {
let addr = bridge.addr;
@@ -219,18 +356,12 @@ class LoxImpl {
}
#load() {
- if (this.#credentials === null) {
- let cred = Services.prefs.getStringPref(LoxSettingsPrefs.credentials, "");
- this.#credentials = cred !== "" ? JSON.parse(cred) : {};
- let invites = Services.prefs.getStringPref(LoxSettingsPrefs.invites, "");
- if (invites !== "") {
- this.#invites = JSON.parse(invites);
- }
- let events = Services.prefs.getStringPref(LoxSettingsPrefs.events, "");
- if (events !== "") {
- this.#events = JSON.parse(events);
- }
- }
+ const cred = Services.prefs.getStringPref(LoxSettingsPrefs.credentials, "");
+ this.#credentials = cred ? JSON.parse(cred) : {};
+ const invites = Services.prefs.getStringPref(LoxSettingsPrefs.invites, "");
+ this.#invites = invites ? JSON.parse(invites) : [];
+ const events = Services.prefs.getStringPref(LoxSettingsPrefs.events, "");
+ this.#events = events ? JSON.parse(events) : [];
this.#pubKeys = Services.prefs.getStringPref(
LoxSettingsPrefs.pubkeys,
null
@@ -246,16 +377,21 @@ class LoxImpl {
}
async #getPubKeys() {
+ // FIXME: We are always refetching #pubKeys, #encTable and #constants once
+ // per session, but they may change more frequently. tor-browser#42502
if (this.#pubKeyPromise === null) {
this.#pubKeyPromise = this.#makeRequest("pubkeys", [])
.then(pubKeys => {
this.#pubKeys = JSON.stringify(pubKeys);
this.#store();
})
- .catch(() => {
+ .catch(error => {
+ lazy.logger.debug("Failed to get pubkeys", error);
+ // Make the next call try again.
+ this.#pubKeyPromise = null;
// We always try to update, but if that doesn't work fall back to stored data
if (!this.#pubKeys) {
- throw new LoxError(LoxErrors.LoxServerUnreachable);
+ throw error;
}
});
}
@@ -269,10 +405,13 @@ class LoxImpl {
this.#encTable = JSON.stringify(encTable);
this.#store();
})
- .catch(() => {
+ .catch(error => {
+ lazy.logger.debug("Failed to get encTable", error);
+ // Make the next call try again.
+ this.#encTablePromise = null;
// Try to update first, but if that doesn't work fall back to stored data
if (!this.#encTable) {
- throw new LoxError(LoxErrors.LoxServerUnreachable);
+ throw error;
}
});
}
@@ -284,55 +423,96 @@ class LoxImpl {
// Try to update first, but if that doesn't work fall back to stored data
this.#constantsPromise = this.#makeRequest("constants", [])
.then(constants => {
+ const prevValue = this.#constants;
this.#constants = JSON.stringify(constants);
this.#store();
+ if (prevValue !== this.#constants) {
+ Services.obs.notifyObservers(null, LoxTopics.UpdateNextUnlock);
+ }
})
- .catch(() => {
+ .catch(error => {
+ lazy.logger.debug("Failed to get constants", error);
+ // Make the next call try again.
+ this.#constantsPromise = null;
if (!this.#constants) {
- throw new LoxError(LoxErrors.LoxServerUnreachable);
+ throw error;
}
});
}
await this.#constantsPromise;
}
+ /**
+ * Parse a decimal string to a non-negative integer.
+ *
+ * @param {string} str - The string to parse.
+ * @returns {integer} - The integer.
+ */
+ static #parseNonNegativeInteger(str) {
+ if (typeof str !== "string" || !/^[0-9]+$/.test(str)) {
+ throw new LoxError(`Expected a non-negative decimal integer: "${str}"`);
+ }
+ return parseInt(str, 10);
+ }
+
+ /**
+ * Get the current lox trust level.
+ *
+ * @param {string} loxId - The ID to fetch the level for.
+ * @returns {integer} - The trust level.
+ */
+ #getLevel(loxId) {
+ return LoxImpl.#parseNonNegativeInteger(
+ lazy.get_trust_level(this.#getCredentials(loxId))
+ );
+ }
+
/**
* Check for blockages and attempt to perform a levelup
*
* If either blockages or a levelup happened, add an event to the event queue
*/
async #backgroundTasks() {
- if (!this.#initialized) {
- throw new LoxError(LoxErrors.NotInitialized);
+ this.#assertInitialized();
+ let addedEvent = false;
+ // Only run background tasks for the active lox ID.
+ const loxId = this.#activeLoxId;
+ if (!loxId) {
+ lazy.logger.warn("No loxId for the background task");
+ return;
}
- const loxid = lazy.TorSettings.bridges.lox_id;
try {
- const levelup = await this.#attemptUpgrade(loxid);
+ const levelup = await this.#attemptUpgrade(loxId);
if (levelup) {
- const level = lazy.get_trust_level(this.#credentials[loxid]);
+ const level = this.#getLevel(loxId);
const newEvent = {
type: "levelup",
newlevel: level,
};
this.#events.push(newEvent);
this.#store();
+ addedEvent = true;
}
} catch (err) {
- console.log(err);
+ lazy.logger.error(err);
}
try {
- const leveldown = await this.#blockageMigration(loxid);
+ const leveldown = await this.#blockageMigration(loxId);
if (leveldown) {
- let level = lazy.get_trust_level(this.#credentials[loxid]);
+ let level = this.#getLevel(loxId);
const newEvent = {
type: "blockage",
newlevel: level,
};
this.#events.push(newEvent);
this.#store();
+ addedEvent = true;
}
} catch (err) {
- console.log(err);
+ lazy.logger.error(err);
+ }
+ if (addedEvent) {
+ Services.obs.notifyObservers(null, LoxTopics.UpdateEvents);
}
}
@@ -356,10 +536,8 @@ class LoxImpl {
await lazy.init(this.#window);
lazy.set_panic_hook();
if (typeof lazy.open_invite !== "function") {
- throw new LoxError(LoxErrors.InitError);
+ throw new LoxError("Initialization failed");
}
- this.#invites = [];
- this.#events = [];
this.#load();
this.#initialized = true;
}
@@ -376,14 +554,14 @@ class LoxImpl {
}
this.#initialized = false;
this.#window = null;
- this.#invites = null;
+ this.#invites = [];
this.#pubKeys = null;
this.#encTable = null;
this.#constants = null;
this.#pubKeyPromise = null;
this.#encTablePromise = null;
this.#constantsPromise = null;
- this.#credentials = null;
+ this.#credentials = {};
this.#events = [];
if (this.#backgroundInterval) {
clearInterval(this.#backgroundInterval);
@@ -398,13 +576,11 @@ class LoxImpl {
* @returns {bool} Whether the value passed in was a Lox invitation.
*/
validateInvitation(invite) {
- if (!this.#initialized) {
- throw new LoxError(LoxErrors.NotInitialized);
- }
+ this.#assertInitialized();
try {
lazy.invitation_is_trusted(invite);
} catch (err) {
- console.log(err);
+ lazy.logger.error(err);
return false;
}
return true;
@@ -413,11 +589,9 @@ class LoxImpl {
// Note: This is only here for testing purposes. We're going to be using telegram
// to issue open invitations for Lox bridges.
async requestOpenInvite() {
- if (!this.#initialized) {
- throw new LoxError(LoxErrors.NotInitialized);
- }
+ this.#assertInitialized();
let invite = await this.#makeRequest("invite", []);
- console.log(invite);
+ lazy.logger.debug(invite);
return invite;
}
@@ -425,36 +599,37 @@ class LoxImpl {
* Redeems a Lox invitation to obtain a credential and bridges.
*
* @param {string} invite A Lox invitation.
- * @returns {string} The loxid of the associated credential on success.
+ * @returns {string} The loxId of the associated credential on success.
*/
async redeemInvite(invite) {
- if (!this.#initialized) {
- throw new LoxError(LoxErrors.NotInitialized);
- }
+ this.#assertInitialized();
await this.#getPubKeys();
let request = await lazy.open_invite(JSON.parse(invite).invite);
- let id = this.#genLoxId();
- let response;
- try {
- response = await this.#makeRequest(
- "openreq",
- JSON.parse(request).request
- );
- } catch {
- throw new LoxError(LoxErrors.LoxServerUnreachable);
- }
- console.log("openreq response: ", response);
+ let response = await this.#makeRequest(
+ "openreq",
+ JSON.parse(request).request
+ );
+ lazy.logger.debug("openreq response: ", response);
if (response.hasOwnProperty("error")) {
- throw new LoxError(LoxErrors.BadInvite);
+ throw new LoxError(
+ `Error response to "openreq": ${response.error}`,
+ LoxError.BadInvite
+ );
}
let cred = lazy.handle_new_lox_credential(
request,
JSON.stringify(response),
this.#pubKeys
);
- this.#credentials[id] = cred;
+ // Generate an id that is not already in the #credentials map.
+ let loxId;
+ do {
+ loxId = this.#genLoxId();
+ } while (Object.hasOwn(this.#credentials, loxId));
+ // Set new credentials.
+ this.#credentials[loxId] = cred;
this.#store();
- return id;
+ return loxId;
}
/**
@@ -463,10 +638,9 @@ class LoxImpl {
* @returns {string[]} A list of all historical invites.
*/
getInvites() {
- if (!this.#initialized) {
- throw new LoxError(LoxErrors.NotInitialized);
- }
- return this.#invites;
+ this.#assertInitialized();
+ // Return a copy.
+ return structuredClone(this.#invites);
}
/**
@@ -477,212 +651,191 @@ class LoxImpl {
* - there is no saved Lox credential, or
* - the saved credential does not have any invitations available.
*
+ * @param {string} loxId - The ID to generate an invite for.
* @returns {string} A valid Lox invitation.
*/
- async generateInvite() {
- if (!this.#initialized) {
- throw new LoxError(LoxErrors.NotInitialized);
- }
- const loxid = lazy.TorSettings.bridges.lox_id;
- if (!loxid || !this.#credentials[loxid]) {
- throw new LoxError(LoxErrors.MissingCredential);
- }
+ async generateInvite(loxId) {
+ this.#assertInitialized();
await this.#getPubKeys();
await this.#getEncTable();
- let level = lazy.get_trust_level(this.#credentials[loxid]);
+ let level = this.#getLevel(loxId);
if (level < 1) {
- throw new LoxError(LoxErrors.NoInvitations);
+ throw new LoxError(`Cannot generate invites at level ${level}`);
}
let request = lazy.issue_invite(
- JSON.stringify(this.#credentials[loxid]),
+ JSON.stringify(this.#getCredentials(loxId)),
this.#encTable,
this.#pubKeys
);
- let response;
- try {
- response = await this.#makeRequest(
- "issueinvite",
- JSON.parse(request).request
- );
- } catch {
- throw new LoxError(LoxErrors.LoxServerUnreachable);
- }
+ let response = await this.#makeRequest(
+ "issueinvite",
+ JSON.parse(request).request
+ );
if (response.hasOwnProperty("error")) {
- console.log(response.error);
- throw new LoxError(LoxErrors.NoInvitations);
+ lazy.logger.error(response.error);
+ throw new LoxError(`Error response to "issueinvite": ${response.error}`);
} else {
- this.#credentials[loxid] = response;
const invite = lazy.prepare_invite(response);
this.#invites.push(invite);
// cap length of stored invites
if (this.#invites.len > 50) {
this.#invites.shift();
}
- return invite;
+ this.#store();
+ this.#changeCredentials(loxId, response);
+ Services.obs.notifyObservers(null, LoxTopics.NewInvite);
+ // Return a copy.
+ // Right now invite is just a string, but that might change in the future.
+ return structuredClone(invite);
}
}
/**
* Get the number of invites that a user has remaining.
*
+ * @param {string} loxId - The ID to check.
* @returns {int} The number of invites that can still be generated by a
* user's credential.
*/
- getRemainingInviteCount() {
- if (!this.#initialized) {
- throw new LoxError(LoxErrors.NotInitialized);
- }
- const loxid = lazy.TorSettings.bridges.lox_id;
- if (!loxid || !this.#credentials[loxid]) {
- throw new LoxError(LoxErrors.MissingCredential);
- }
- return parseInt(lazy.get_invites_remaining(this.#credentials[loxid]));
+ getRemainingInviteCount(loxId) {
+ this.#assertInitialized();
+ return LoxImpl.#parseNonNegativeInteger(
+ lazy.get_invites_remaining(this.#getCredentials(loxId))
+ );
}
- async #blockageMigration(loxid) {
- if (!loxid || !this.#credentials[loxid]) {
- throw new LoxError(LoxErrors.MissingCredential);
- }
+ async #blockageMigration(loxId) {
await this.#getPubKeys();
let request;
try {
- request = lazy.check_blockage(this.#credentials[loxid], this.#pubKeys);
+ request = lazy.check_blockage(this.#getCredentials(loxId), this.#pubKeys);
} catch {
- console.log("Not ready for blockage migration");
+ lazy.logger.log("Not ready for blockage migration");
return false;
}
let response = await this.#makeRequest("checkblockage", request);
if (response.hasOwnProperty("error")) {
- console.log(response.error);
- throw new LoxError(LoxErrors.LoxServerUnreachable);
+ lazy.logger.error(response.error);
+ throw new LoxError(
+ `Error response to "checkblockage": ${response.error}`
+ );
}
const migrationCred = lazy.handle_check_blockage(
- this.#credentials[loxid],
+ this.#getCredentials(loxId),
JSON.stringify(response)
);
request = lazy.blockage_migration(
- this.#credentials[loxid],
+ this.#getCredentials(loxId),
migrationCred,
this.#pubKeys
);
response = await this.#makeRequest("blockagemigration", request);
if (response.hasOwnProperty("error")) {
- console.log(response.error);
- throw new LoxError(LoxErrors.LoxServerUnreachable);
+ lazy.logger.error(response.error);
+ throw new LoxError(
+ `Error response to "blockagemigration": ${response.error}`
+ );
}
const cred = lazy.handle_blockage_migration(
- this.#credentials[loxid],
+ this.#getCredentials(loxId),
JSON.stringify(response),
this.#pubKeys
);
- this.#credentials[loxid] = cred;
- this.#store();
+ this.#changeCredentials(loxId, cred);
return true;
}
/** Attempts to upgrade the currently saved Lox credential.
* If an upgrade is available, save an event in the event list.
*
- * @returns {boolean} whether a levelup event occured
+ * @returns {boolean} Whether a levelup event occurred.
*/
- async #attemptUpgrade(loxid) {
- if (!loxid || !this.#credentials[loxid]) {
- throw new LoxError(LoxErrors.MissingCredential);
- }
+ async #attemptUpgrade(loxId) {
await this.#getPubKeys();
await this.#getEncTable();
await this.#getConstants();
- let success = false;
- let level = lazy.get_trust_level(this.#credentials[loxid]);
+ let level = this.#getLevel(loxId);
if (level < 1) {
// attempt trust promotion instead
- try {
- success = await this.#trustMigration();
- } catch (err) {
- console.log(err);
- return false;
- }
- } else {
- let request = lazy.level_up(
- this.#credentials[loxid],
- this.#encTable,
- this.#pubKeys
- );
- const response = await this.#makeRequest("levelup", request);
- if (response.hasOwnProperty("error")) {
- console.log(response.error);
- throw new LoxError(LoxErrors.LoxServerUnreachable);
- }
- const cred = lazy.handle_level_up(
- request,
- JSON.stringify(response),
- this.#pubKeys
- );
- this.#credentials[loxid] = cred;
- return true;
+ return this.#trustMigration(loxId);
+ }
+ let request = lazy.level_up(
+ this.#getCredentials(loxId),
+ this.#encTable,
+ this.#pubKeys
+ );
+ const response = await this.#makeRequest("levelup", request);
+ if (response.hasOwnProperty("error")) {
+ lazy.logger.error(response.error);
+ throw new LoxError(`Error response to "levelup": ${response.error}`);
}
- return success;
+ const cred = lazy.handle_level_up(
+ request,
+ JSON.stringify(response),
+ this.#pubKeys
+ );
+ this.#changeCredentials(loxId, cred);
+ return true;
}
/**
* Attempt to migrate from an untrusted to a trusted Lox credential
*
- * @returns {Promise<bool>} A bool value indicated whether the credential
- * was successfully migrated.
+ * @param {string} loxId - The ID to use.
+ * @returns {boolean} Whether the credential was successfully migrated.
*/
- async #trustMigration() {
- const loxid = lazy.TorSettings.bridges.lox_id;
- if (!loxid || !this.#credentials[loxid]) {
- throw new LoxError(LoxErrors.MissingCredential);
- }
+ async #trustMigration(loxId) {
await this.#getPubKeys();
return new Promise((resolve, reject) => {
let request = "";
try {
- request = lazy.trust_promotion(this.#credentials[loxid], this.#pubKeys);
+ request = lazy.trust_promotion(
+ this.#getCredentials(loxId),
+ this.#pubKeys
+ );
} catch (err) {
- console.log("Not ready to upgrade");
+ lazy.logger.debug("Not ready to upgrade");
resolve(false);
}
this.#makeRequest("trustpromo", JSON.parse(request).request)
.then(response => {
if (response.hasOwnProperty("error")) {
+ lazy.logger.error("Error response from trustpromo", response.error);
resolve(false);
}
- console.log("Got promotion cred");
- console.log(response);
- console.log(request);
+ lazy.logger.debug("Got promotion cred", response, request);
let promoCred = lazy.handle_trust_promotion(
request,
JSON.stringify(response)
);
- console.log("Formatted promotion cred");
+ lazy.logger.debug("Formatted promotion cred");
request = lazy.trust_migration(
- this.#credentials[loxid],
+ this.#getCredentials(loxId),
promoCred,
this.#pubKeys
);
- console.log("Formatted migration request");
+ lazy.logger.debug("Formatted migration request");
this.#makeRequest("trustmig", JSON.parse(request).request)
.then(response => {
if (response.hasOwnProperty("error")) {
+ lazy.logger.error(
+ "Error response from trustmig",
+ response.error
+ );
resolve(false);
}
- console.log("Got new credential");
+ lazy.logger.debug("Got new credential");
let cred = lazy.handle_trust_migration(request, response);
- this.#credentials[loxid] = cred;
- this.#store();
+ this.#changeCredentials(loxId, cred);
resolve(true);
})
.catch(err => {
- console.log(err);
- console.log("Failed trust migration");
+ lazy.logger.error("Failed trust migration", err);
resolve(false);
});
})
.catch(err => {
- console.log(err);
- console.log("Failed trust promotion");
+ lazy.logger.error("Failed trust promotion", err);
resolve(false);
});
});
@@ -701,88 +854,105 @@ class LoxImpl {
/**
* Get a list of accumulated events.
*
+ * @param {string} loxId - The ID to get events for.
* @returns {EventData[]} A list of the accumulated, unacknowledged events
* associated with a user's credential.
*/
- getEventData() {
- if (!this.#initialized) {
- throw new LoxError(LoxErrors.NotInitialized);
- }
- const loxid = lazy.TorSettings.bridges.lox_id;
- if (!loxid || !this.#credentials[loxid]) {
- throw new LoxError(LoxErrors.MissingCredential);
+ getEventData(loxId) {
+ this.#assertInitialized();
+ if (loxId !== this.#activeLoxId) {
+ lazy.logger.warn(
+ `No event data for loxId ${loxId} since it was replaced by ${
+ this.#activeLoxId
+ }`
+ );
+ return [];
}
- return this.#events;
+ // Return a copy.
+ return structuredClone(this.#events);
}
/**
* Clears accumulated event data.
+ *
+ * Should be called whenever the user acknowledges the existing events.
+ *
+ * @param {string} loxId - The ID to clear events for.
*/
- clearEventData() {
- if (!this.#initialized) {
- throw new LoxError(LoxErrors.NotInitialized);
+ clearEventData(loxId) {
+ this.#assertInitialized();
+ if (loxId !== this.#activeLoxId) {
+ lazy.logger.warn(
+ `Not clearing event data for loxId ${loxId} since it was replaced by ${
+ this.#activeLoxId
+ }`
+ );
+ return;
}
this.#events = [];
this.#store();
- }
-
- /**
- * Clears accumulated invitations.
- */
- clearInvites() {
- if (!this.#initialized) {
- throw new LoxError(LoxErrors.NotInitialized);
- }
- this.#invites = [];
- this.#store();
+ Services.obs.notifyObservers(null, LoxTopics.UpdateEvents);
}
/**
* @typedef {object} UnlockData
*
- * @property {string} date - The date-time for the next level up, formatted as YYYY-MM-DDTHH:mm:ssZ.
- * @property {integer} nextLevel - The next level. Levels count from 0, so this will be 1 or greater.
- *
+ * @property {string} date - The date-time for the next level up, formatted as
+ * YYYY-MM-DDTHH:mm:ssZ.
+ * @property {integer} nextLevel - The next level. Levels count from 0, so
+ * this will be 1 or greater.
*/
/**
* Get details about the next feature unlock.
*
+ * NOTE: A call to this method may trigger LoxTopics.UpdateNextUnlock.
+ *
+ * @param {string} loxId - The ID to get the unlock for.
* @returns {UnlockData} - Details about the next unlock.
*/
- async getNextUnlock() {
- if (!this.#initialized) {
- throw new LoxError(LoxErrors.NotInitialized);
- }
- const loxid = lazy.TorSettings.bridges.lox_id;
- if (!loxid || !this.#credentials[loxid]) {
- throw new LoxError(LoxErrors.MissingCredential);
- }
+ async getNextUnlock(loxId) {
+ this.#assertInitialized();
await this.#getConstants();
- let nextUnlocks = JSON.parse(
- lazy.get_next_unlock(this.#constants, this.#credentials[loxid])
+ let nextUnlock = JSON.parse(
+ lazy.get_next_unlock(this.#constants, this.#getCredentials(loxId))
);
- const level = parseInt(lazy.get_trust_level(this.#credentials[loxid]));
- const unlocks = {
- date: nextUnlocks.trust_level_unlock_date,
+ const level = this.#getLevel(loxId);
+ return {
+ date: nextUnlock.trust_level_unlock_date,
nextLevel: level + 1,
};
- return unlocks;
}
async #makeRequest(procedure, args) {
// TODO: Customize to for Lox
- const serviceUrl = "https://rdsys-frontend-01.torproject.org/lox";
+ const serviceUrl = "https://lox.torproject.org";
const url = `${serviceUrl}/${procedure}`;
if (lazy.TorConnect.state === lazy.TorConnectState.Bootstrapped) {
- const request = await fetch(url, {
- method: "POST",
- headers: {
- "Content-Type": "application/vnd.api+json",
- },
- body: JSON.stringify(args),
- });
+ let request;
+ try {
+ request = await fetch(url, {
+ method: "POST",
+ headers: {
+ "Content-Type": "application/vnd.api+json",
+ },
+ body: JSON.stringify(args),
+ });
+ } catch (error) {
+ lazy.logger.debug("fetch fail", url, args, error);
+ throw new LoxError(
+ `fetch "${procedure}" from Lox authority failed: ${error?.message}`,
+ LoxError.LoxServerUnreachable
+ );
+ }
+ if (!request.ok) {
+ lazy.logger.debug("fetch response", url, args, request);
+ // Do not treat as a LoxServerUnreachable type.
+ throw new LoxError(
+ `Lox authority responded to "${procedure}" with ${request.status}: ${request.statusText}`
+ );
+ }
return request.json();
}
@@ -803,7 +973,26 @@ class LoxImpl {
});
}
const builder = await this.#domainFrontedRequests;
- return builder.buildPostRequest(url, args);
+ try {
+ return await builder.buildPostRequest(url, args);
+ } catch (error) {
+ lazy.logger.debug("Domain front request fail", url, args, error);
+ if (error instanceof lazy.DomainFrontRequestNetworkError) {
+ throw new LoxError(
+ `Domain front fetch "${procedure}" from Lox authority failed: ${error?.message}`,
+ LoxError.LoxServerUnreachable
+ );
+ }
+ if (error instanceof lazy.DomainFrontRequestResponseError) {
+ // Do not treat as a LoxServerUnreachable type.
+ throw new LoxError(
+ `Lox authority responded to domain front "${procedure}" with ${error.status}: ${error.statusText}`
+ );
+ }
+ throw new LoxError(
+ `Domain front request for "${procedure}" from Lox authority failed: ${error?.message}`
+ );
+ }
}
}
=====================================
toolkit/components/tor-launcher/TorLauncherUtil.sys.mjs
=====================================
@@ -429,20 +429,6 @@ export const TorLauncherUtil = Object.freeze({
return aStringName;
},
- getLocalizedStringForError(aNSResult) {
- for (let prop in Cr) {
- if (Cr[prop] === aNSResult) {
- const key = "nsresult." + prop;
- const rv = this.getLocalizedString(key);
- if (rv !== key) {
- return rv;
- }
- return prop; // As a fallback, return the NS_ERROR... name.
- }
- }
- return undefined;
- },
-
getLocalizedBootstrapStatus(aStatusObj, aKeyword) {
if (!aStatusObj || !aKeyword) {
return "";
=====================================
toolkit/modules/DomainFrontedRequests.sys.mjs
=====================================
@@ -347,6 +347,31 @@ class MeekTransportAndroid {
}
}
+/**
+ * Corresponds to a Network error with the request.
+ */
+export class DomainFrontRequestNetworkError extends Error {
+ constructor(request, statusCode) {
+ super(`Error fetching ${request.name}: ${statusCode}`);
+ this.name = "DomainFrontRequestNetworkError";
+ this.statusCode = statusCode;
+ }
+}
+
+/**
+ * Corresponds to a non-ok response from the server.
+ */
+export class DomainFrontRequestResponseError extends Error {
+ constructor(request) {
+ super(
+ `Error response from ${request.name} server: ${request.responseStatus}`
+ );
+ this.name = "DomainFrontRequestResponseError";
+ this.status = request.responseStatus;
+ this.statusText = request.responseStatusText;
+ }
+}
+
/**
* Callback object to promisify the XPCOM request.
*/
@@ -379,12 +404,11 @@ class ResponseListener {
onStopRequest(request, status) {
try {
if (!Components.isSuccessCode(status)) {
- const errorMessage =
- lazy.TorLauncherUtil.getLocalizedStringForError(status);
- this.#reject(new Error(errorMessage));
+ // Assume this is a network error.
+ this.#reject(new DomainFrontRequestNetworkError(request, status));
}
if (request.responseStatus !== 200) {
- this.#reject(new Error(request.responseStatusText));
+ this.#reject(new DomainFrontRequestResponseError(request));
}
} catch (err) {
this.#reject(err);
=====================================
toolkit/modules/TorSettings.sys.mjs
=====================================
@@ -7,6 +7,7 @@ const lazy = {};
ChromeUtils.defineESModuleGetters(lazy, {
TorLauncherUtil: "resource://gre/modules/TorLauncherUtil.sys.mjs",
Lox: "resource://gre/modules/Lox.sys.mjs",
+ LoxTopics: "resource://gre/modules/Lox.sys.mjs",
TorParsers: "resource://gre/modules/TorParsers.sys.mjs",
TorProviderBuilder: "resource://gre/modules/TorProviderBuilder.sys.mjs",
});
@@ -330,7 +331,17 @@ class TorSettingsImpl {
if (!val) {
return;
}
- this.bridges.bridge_strings = lazy.Lox.getBridges(val);
+ let bridgeStrings;
+ try {
+ bridgeStrings = lazy.Lox.getBridges(val);
+ } catch (error) {
+ addError(`No bridges for lox_id ${val}: ${error?.message}`);
+ // Set as invalid, which will make the builtin_type "" and set the
+ // bridge_strings to be empty at the next #cleanupSettings.
+ this.bridges.source = TorBridgeSource.Invalid;
+ return;
+ }
+ this.bridges.bridge_strings = bridgeStrings;
},
},
});
@@ -692,7 +703,7 @@ class TorSettingsImpl {
try {
await lazy.Lox.init();
} catch (e) {
- lazy.logger.error("Could not initialize Lox.", e.type);
+ lazy.logger.error("Could not initialize Lox.", e);
}
if (
@@ -711,6 +722,8 @@ class TorSettingsImpl {
}
}
+ Services.obs.addObserver(this, lazy.LoxTopics.UpdateBridges);
+
lazy.logger.info("Ready");
}
@@ -718,9 +731,28 @@ class TorSettingsImpl {
* Unload or uninit our settings.
*/
async uninit() {
+ Services.obs.removeObserver(this, lazy.LoxTopics.UpdateBridges);
await lazy.Lox.uninit();
}
+ observe(subject, topic, data) {
+ switch (topic) {
+ case lazy.LoxTopics.UpdateBridges:
+ if (this.bridges.lox_id) {
+ // Fetch the newest bridges.
+ this.bridges.bridge_strings = lazy.Lox.getBridges(
+ this.bridges.lox_id
+ );
+ // No need to save to prefs since bridge_strings is not stored for Lox
+ // source. But we do pass on the changes to TorProvider.
+ // FIXME: This can compete with TorConnect to reach TorProvider.
+ // tor-browser#42316
+ this.applySettings();
+ }
+ break;
+ }
+ }
+
/**
* Check whether the object has been successfully initialized, and throw if
* it has not.
@@ -763,24 +795,32 @@ class TorSettingsImpl {
TorSettingsPrefs.bridges.source,
TorBridgeSource.Invalid
);
- this.bridges.lox_id = Services.prefs.getStringPref(
- TorSettingsPrefs.bridges.lox_id,
- ""
- );
- if (this.bridges.source == TorBridgeSource.BuiltIn) {
- this.bridges.builtin_type = Services.prefs.getStringPref(
- TorSettingsPrefs.bridges.builtin_type,
- ""
- );
- } else {
- const bridgeBranchPrefs = Services.prefs
- .getBranch(TorSettingsPrefs.bridges.bridge_strings)
- .getChildList("");
- this.bridges.bridge_strings = Array.from(bridgeBranchPrefs, pref =>
- Services.prefs.getStringPref(
- `${TorSettingsPrefs.bridges.bridge_strings}${pref}`
- )
- );
+ switch (this.bridges.source) {
+ case TorBridgeSource.BridgeDB:
+ case TorBridgeSource.UserProvided:
+ this.bridges.bridge_strings = Services.prefs
+ .getBranch(TorSettingsPrefs.bridges.bridge_strings)
+ .getChildList("")
+ .map(pref =>
+ Services.prefs.getStringPref(
+ `${TorSettingsPrefs.bridges.bridge_strings}${pref}`
+ )
+ );
+ break;
+ case TorBridgeSource.BuiltIn:
+ // bridge_strings is set via builtin_type.
+ this.bridges.builtin_type = Services.prefs.getStringPref(
+ TorSettingsPrefs.bridges.builtin_type,
+ ""
+ );
+ break;
+ case TorBridgeSource.Lox:
+ // bridge_strings is set via lox id.
+ this.bridges.lox_id = Services.prefs.getStringPref(
+ TorSettingsPrefs.bridges.lox_id,
+ ""
+ );
+ break;
}
/* Proxy */
this.proxy.enabled = Services.prefs.getBoolPref(
@@ -866,7 +906,10 @@ class TorSettingsImpl {
);
});
// write new ones
- if (this.bridges.source !== TorBridgeSource.BuiltIn) {
+ if (
+ this.bridges.source !== TorBridgeSource.Lox &&
+ this.bridges.source !== TorBridgeSource.BuiltIn
+ ) {
this.bridges.bridge_strings.forEach((string, index) => {
Services.prefs.setStringPref(
`${TorSettingsPrefs.bridges.bridge_strings}.${index}`,
=====================================
toolkit/torbutton/chrome/locale/en-US/torlauncher.properties
=====================================
@@ -55,7 +55,3 @@ torlauncher.bootstrapWarning.timeout=connection timeout
torlauncher.bootstrapWarning.noroute=no route to host
torlauncher.bootstrapWarning.ioerror=read/write error
torlauncher.bootstrapWarning.pt_missing=missing pluggable transport
-
-torlauncher.nsresult.NS_ERROR_NET_RESET=The connection to the server was lost.
-torlauncher.nsresult.NS_ERROR_CONNECTION_REFUSED=Could not connect to the server.
-torlauncher.nsresult.NS_ERROR_PROXY_CONNECTION_REFUSED=Could not connect to the proxy.
View it on GitLab: https://gitlab.torproject.org/tpo/applications/tor-browser/-/compare/4255b3…
--
View it on GitLab: https://gitlab.torproject.org/tpo/applications/tor-browser/-/compare/4255b3…
You're receiving this email because of your account on gitlab.torproject.org.
1
0