This is an automated email from the git hooks/post-receive script.
pierov pushed a commit to branch tor-browser-102.4.0esr-12.0-1 in repository tor-browser.
The following commit(s) were added to refs/heads/tor-browser-102.4.0esr-12.0-1 by this push: new 3d5f52ebdda4 fixup! Bug 40597: Implement TorSettings module 3d5f52ebdda4 is described below
commit 3d5f52ebdda4026d4891cc8a1079e8370c0ed5e5 Author: Pier Angelo Vendrame pierov@torproject.org AuthorDate: Fri Oct 21 19:13:09 2022 +0200
fixup! Bug 40597: Implement TorSettings module
Bug 41281: Opt-out Connection Assist traffic --- browser/modules/TorConnect.jsm | 32 +++++++++++++++++++++++--------- 1 file changed, 23 insertions(+), 9 deletions(-)
diff --git a/browser/modules/TorConnect.jsm b/browser/modules/TorConnect.jsm index 34a3a9ee7d33..7c458a41c17d 100644 --- a/browser/modules/TorConnect.jsm +++ b/browser/modules/TorConnect.jsm @@ -23,9 +23,6 @@ const { TorMonitorService } = ChromeUtils.import( const { TorBootstrapRequest } = ChromeUtils.import( "resource://gre/modules/TorBootstrapRequest.jsm" ); -const { TorLauncherUtil } = ChromeUtils.import( - "resource://gre/modules/TorLauncherUtil.jsm" -);
const { TorSettings, @@ -49,6 +46,7 @@ const TorLauncherPrefs = Object.freeze({
const TorConnectPrefs = Object.freeze({ censorship_level: "torbrowser.debug.censorship_level", + allow_internet_test: "torbrowser.bootstrap.allow_internet_test", });
const TorConnectState = Object.freeze({ @@ -251,30 +249,41 @@ const InternetStatus = Object.freeze({
class InternetTest { constructor() { + this._enabled = Services.prefs.getBoolPref( + TorConnectPrefs.allow_internet_test, + true + ); + this._status = InternetStatus.Unknown; this._error = null; this._pending = false; - this._timeout = setTimeout(() => { - this._timeout = null; - this.test(); - }, this.timeoutRand()); + if (this._enabled) { + this._timeout = setTimeout(() => { + this._timeout = null; + this.test(); + }, this.timeoutRand()); + } this.onResult = (online, date) => {}; this.onError = err => {}; }
test() { - if (this._pending) { + if (this._pending || !this._enabled) { return; } this.cancel(); this._pending = true;
+ console.log("TorConnect: starting the Internet test"); this._testAsync() .then(status => { this._pending = false; this._status = status.successful ? InternetStatus.Online : InternetStatus.Offline; + console.log( + `TorConnect: performed Internet test, outcome ${this._status}` + ); this.onResult(this.status, status.date); }) .catch(error => { @@ -322,6 +331,10 @@ class InternetTest { return this._error; }
+ get enabled() { + return this._enabled; + } + // We randomize the Internet test timeout to make fingerprinting it harder, at least a little bit... timeoutRand() { const offset = 30000; @@ -457,7 +470,8 @@ const TorConnect = (() => { const maybeTransitionToError = () => { if ( internetTest.status === InternetStatus.Unknown && - internetTest.error === null + internetTest.error === null && + internetTest.enabled ) { // We have been called by a failed bootstrap, but the internet test has not run yet - force // it to run immediately!
tor-commits@lists.torproject.org