commit e5b0e027aa8879e6971b6afb75023a0b9e13c3bb Author: Richard Pospesel richard@torproject.org Date: Mon Feb 15 16:21:26 2021 +0100
Bug 27476: about:torconnect fixes and new strings
- torlauncher.properties::torlauncher.copiedNLogMessagesShort : reduced verbosity version of torlauncher.copiednLogMessages for Copy Log button tooltip - network-settings.dtd::torConnect.copyLog : label for 'Copy Log' button in about:torconnect - added various new strings for about:torconnect to en_US network-settings.dtd - disables legacy launcher unless "TOR_USE_LEGACY_LAUNCHER" environet variable is defined --- src/chrome/locale/en-US/network-settings.dtd | 9 +++++++++ src/chrome/locale/en-US/torlauncher.properties | 2 ++ src/components/tl-process.js | 6 +++++- src/modules/tl-util.jsm | 15 +++++++++++++++ 4 files changed, 31 insertions(+), 1 deletion(-)
diff --git a/src/chrome/locale/en-US/network-settings.dtd b/src/chrome/locale/en-US/network-settings.dtd index d4c7def..81163a1 100644 --- a/src/chrome/locale/en-US/network-settings.dtd +++ b/src/chrome/locale/en-US/network-settings.dtd @@ -81,3 +81,12 @@ <!ENTITY torPreferences.viewTorLogs "View the Tor logs."> <!ENTITY torPreferences.viewLogs "View Logs…"> <!ENTITY torPreferences.torLogsDialogTitle "Tor Logs"> + +<!-- #24746 about:torconnect strings --> +<!ENTITY torConnect.tryAgain "Try Connecting Again"> +<!ENTITY torConnect.offline "Offline"> +<!ENTITY torConnect.connectMessage "Changes to Tor Settings will not take effect until you connect to the Tor Network"> +<!ENTITY torConnect.tryAgainMessage "Tor Browser has failed to establish a connection to the Tor Network"> +<!ENTITY torConnect.connectingConcise "Connecting…"> +<!ENTITY torConnect.connectedConcise "Connected"> +<!ENTITY torConnect.copyLog "Copy Tor Logs"> diff --git a/src/chrome/locale/en-US/torlauncher.properties b/src/chrome/locale/en-US/torlauncher.properties index 6ec8c40..7787698 100644 --- a/src/chrome/locale/en-US/torlauncher.properties +++ b/src/chrome/locale/en-US/torlauncher.properties @@ -93,3 +93,5 @@ 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. + +torlauncher.copiedNLogMessages=Copied %S Logs diff --git a/src/components/tl-process.js b/src/components/tl-process.js index e9d7cde..a4374f9 100644 --- a/src/components/tl-process.js +++ b/src/components/tl-process.js @@ -583,6 +583,10 @@ TorProcessService.prototype = if (aIsRunningTor) this._monitorTorProcessStartup();
+ if (!TorLauncherUtil.useLegacyLauncher) { + return; + } + var bridgeConfigIsBad = (this._defaultBridgesStatus == this.kDefaultBridgesStatus_BadConfig); if (TorLauncherUtil.shouldShowNetworkSettings || bridgeConfigIsBad) @@ -814,7 +818,7 @@ TorProcessService.prototype = this.mObsSvc.notifyObservers(errorObj, aNotifyTopic, null); }
- if (!errorObj.handled) + if (TorLauncherUtil.useLegacyLauncher && !errorObj.handled) { let msg = aMessage; if (aDetails) diff --git a/src/modules/tl-util.jsm b/src/modules/tl-util.jsm index b721372..76cdb5b 100644 --- a/src/modules/tl-util.jsm +++ b/src/modules/tl-util.jsm @@ -366,6 +366,17 @@ let TorLauncherUtil = // Public return this.getBoolPref(kPrefPromptForLocale, true); */ },
+ get useLegacyLauncher() { + const kEnvUseLegacyLauncher = "TOR_USE_LEGACY_LAUNCHER"; + const env = Cc["@mozilla.org/process/environment;1"].getService( + Ci.nsIEnvironment + ); + if (env.exists(kEnvUseLegacyLauncher)) { + return "1" == env.get(kEnvUseLegacyLauncher); + } + return false; + }, + get shouldShowNetworkSettings() { const kPrefPromptAtStartup = "extensions.torlauncher.prompt_at_startup"; @@ -379,6 +390,10 @@ let TorLauncherUtil = // Public return ("1" == env.get(kEnvForceShowNetConfig)); } catch(e) {}
+ if (!TorLauncherUtil.useLegacyLauncher) { + return true; + } + return this.getBoolPref(kPrefPromptAtStartup, true); },