[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[tor-commits] [tor-launcher/master] Bug #9445: Tor Launcher should be more relaxed about bridge line input.
commit b709f9ffbbad9867fb1041824b9a1df4d43fed73
Author: Kathy Brade <brade@xxxxxxxxxxxxxxxxx>
Date: Fri Aug 30 14:09:28 2013 -0400
Bug #9445: Tor Launcher should be more relaxed about bridge line input.
Show "Copy Tor Log To Clipboard" button in wizard if tor logs
a warning or error.
Fix regression in bridge validation.
Improve bridge list placeholder text.
---
src/chrome/content/network-settings.js | 24 ++++++++++++++++--------
src/chrome/locale/en/network-settings.dtd | 2 +-
src/components/tl-protocol.js | 25 +++++++++++++++++++++++--
3 files changed, 40 insertions(+), 11 deletions(-)
diff --git a/src/chrome/content/network-settings.js b/src/chrome/content/network-settings.js
index 35a1165..c9e43ce 100644
--- a/src/chrome/content/network-settings.js
+++ b/src/chrome/content/network-settings.js
@@ -22,6 +22,7 @@ const kTorProcessReadyTopic = "TorProcessIsReady";
const kTorProcessExitedTopic = "TorProcessExited";
const kTorProcessDidNotStartTopic = "TorProcessDidNotStart";
const kTorBootstrapErrorTopic = "TorBootstrapError";
+const kTorLogHasWarnOrErr = "TorLogHasWarnOrErr";
const kWizardProxyRadioGroup = "proxyRadioGroup";
const kWizardFirewallRadioGroup = "firewallRadioGroup";
@@ -116,8 +117,11 @@ function initDialog()
cancelBtn.parentNode.insertBefore(copyLogBtn, cancelBtn.nextSibling);
}
- if (gTorProcessService.TorBootstrapErrorOccurred)
+ if (gTorProcessService.TorBootstrapErrorOccurred ||
+ gProtocolSvc.TorLogHasWarnOrErr)
+ {
wizardShowCopyLogButton();
+ }
// Use "Connect" as the finish button label (on the last wizard page)..
var finishBtn = document.documentElement.getButton("finish");
@@ -139,6 +143,7 @@ function initDialog()
}
gObsService.addObserver(gObserver, kTorBootstrapErrorTopic, false);
+ gObsService.addObserver(gObserver, kTorLogHasWarnOrErr, false);
if (TorLauncherUtil.shouldStartAndOwnTor &&
!gTorProcessService.TorIsProcessReady)
@@ -211,7 +216,7 @@ function showWizardNavButtons(aShow)
var gObserver = {
observe: function(aSubject, aTopic, aData)
{
- if (kTorBootstrapErrorTopic == aTopic)
+ if ((kTorBootstrapErrorTopic == aTopic) || (kTorLogHasWarnOrErr == aTopic))
{
wizardShowCopyLogButton();
return;
@@ -956,14 +961,17 @@ function setBridgeListElemValue(aBridgeArray)
// To be consistent with bridges.torproject.org, pre-pend "bridge" to
// each line as it is displayed in the UI.
var bridgeList = [];
- for (var i = 0; i < aBridgeArray.length; ++i)
+ if (aBridgeArray)
{
- var s = aBridgeArray[i].trim();
- if (s.length > 0)
+ for (var i = 0; i < aBridgeArray.length; ++i)
{
- if (s.toLowerCase().indexOf("bridge") != 0)
- s = "bridge " + s;
- bridgeList.push(s);
+ var s = aBridgeArray[i].trim();
+ if (s.length > 0)
+ {
+ if (s.toLowerCase().indexOf("bridge") != 0)
+ s = "bridge " + s;
+ bridgeList.push(s);
+ }
}
}
diff --git a/src/chrome/locale/en/network-settings.dtd b/src/chrome/locale/en/network-settings.dtd
index 6ca8f2a..b9fedc3 100644
--- a/src/chrome/locale/en/network-settings.dtd
+++ b/src/chrome/locale/en/network-settings.dtd
@@ -44,7 +44,7 @@
<!ENTITY torsettings.firewall.allowedPorts "Allowed Ports:">
<!ENTITY torsettings.useBridges.checkbox "My Internet Service Provider (ISP) blocks connections to the Tor network">
<!ENTITY torsettings.useBridges.label "Enter one or more bridge relays (one per line).">
-<!ENTITY torsettings.useBridges.placeholder "address:port">
+<!ENTITY torsettings.useBridges.placeholder "address:port OR transport address:port">
<!ENTITY torsettings.copyLog "Copy Tor Log To Clipboard">
<!ENTITY torsettings.bridgeHelpTitle "Bridge Relay Help">
diff --git a/src/components/tl-protocol.js b/src/components/tl-protocol.js
index c4e14f9..2a68fbe 100644
--- a/src/components/tl-protocol.js
+++ b/src/components/tl-protocol.js
@@ -413,6 +413,22 @@ TorProtocolService.prototype =
this._waitForEventData();
},
+ // Returns true if the log messages we have captured contain WARN or ERR.
+ get TorLogHasWarnOrErr()
+ {
+ if (!this.mTorLog)
+ return false;
+
+ for (var i = this.mTorLog.length - 1; i >= 0; i--)
+ {
+ var logObj = this.mTorLog[i];
+ if ((logObj.type == "WARN") || (logObj.type == "ERR"))
+ return true;
+ }
+
+ return false;
+ },
+
// Returns captured log message as a text string (one message per line).
TorGetLog: function()
{
@@ -1203,11 +1219,16 @@ TorProtocolService.prototype =
let msg = s.substr(idx + 1);
switch (eventType)
{
+ case "WARN":
+ case "ERR":
+ // Notify so that Copy Log can be enabled.
+ var obsSvc = Cc["@mozilla.org/observer-service;1"]
+ .getService(Ci.nsIObserverService);
+ obsSvc.notifyObservers(null, "TorLogHasWarnOrErr", null);
+ // fallthru
case "DEBUG":
case "INFO":
case "NOTICE":
- case "WARN":
- case "ERR":
var now = new Date();
let logObj = { date: now, type: eventType, msg: msg };
if (!this.mTorLog)
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits