[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [torbutton/master] Bug 16990: Code cleanup



commit 53299a96c848d806d490e3b7068d81be352d7620
Author: Arthur Edelstein <arthuredelstein@xxxxxxxxx>
Date:   Wed Jan 6 13:48:27 2016 -0800

    Bug 16990: Code cleanup
---
 src/chrome/content/tor-circuit-display.js |   16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)

diff --git a/src/chrome/content/tor-circuit-display.js b/src/chrome/content/tor-circuit-display.js
index d5ef3d3..c99d25d 100644
--- a/src/chrome/content/tor-circuit-display.js
+++ b/src/chrome/content/tor-circuit-display.js
@@ -141,7 +141,7 @@ let collectIsolationData = function (aController, updateUI) {
         knownCircuitIDs[streamEvent.CircuitID] = true;
         let circuitStatus = yield getCircuitStatusByID(aController, streamEvent.CircuitID),
             credentials = circuitStatus ?
-                            (trimQuotes(circuitStatus.SOCKS_USERNAME) + ":" +
+                            (trimQuotes(circuitStatus.SOCKS_USERNAME) + "|" +
                              trimQuotes(circuitStatus.SOCKS_PASSWORD)) :
                             null;
         if (credentials) {
@@ -235,7 +235,7 @@ let getSOCKSCredentialsForBrowser = function (browser) {
   if (!(channel instanceof Ci.nsIProxiedChannel)) return null;
   let proxyInfo = channel.proxyInfo;
   if (proxyInfo === null) return null;
-  return proxyInfo.username + ":" + proxyInfo.password;
+  return [proxyInfo.username, proxyInfo.password];
 };
 
 // __onionSiteRelayLine__.
@@ -251,11 +251,12 @@ let updateCircuitDisplay = function () {
     let credentials = getSOCKSCredentialsForBrowser(selectedBrowser),
         nodeData = null;
     if (credentials) {
-    // Check if we have anything to show for these credentials.
-      nodeData = credentialsToNodeDataMap[credentials];
+      let [SOCKS_username, SOCKS_password] = credentials;
+      // Check if we have anything to show for these credentials.
+      nodeData = credentialsToNodeDataMap[SOCKS_username + "|" + SOCKS_password];
       if (nodeData) {
 	// Update the displayed domain.
-        let domain = credentials.split(":")[0];
+        let domain = SOCKS_username;
 	document.getElementById("domain").innerHTML = "(" + domain + "):";
 	// Update the displayed information for the relay nodes.
         let lines = nodeLines(nodeData),
@@ -310,8 +311,9 @@ let syncDisplayWithSelectedTab = (function() {
 
 // ## Main function
 
-// setupDisplay(host, port, password, enablePrefName)__.
-// Returns a function that lets you start/stop automatic display of the Tor circuit.
+// __setupDisplay(host, port, password, enablePrefName)__.
+// Once called, the Tor circuit display will be started whenever
+// the "enablePref" is set to true, and stopped when it is set to false.
 // A reference to this function (called createTorCircuitDisplay) is exported as a global.
 let setupDisplay = function (host, port, password, enablePrefName) {
   let myController = null,

_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits