[tbb-commits] [torbutton/master] Bug 16990: Correctly get proxyInfo from multi-part channel

gk at torproject.org gk at torproject.org
Wed Jan 20 12:19:53 UTC 2016


commit e123feb185fa7cb8bf9daced6718c9801fe3e808
Author: Arthur Edelstein <arthuredelstein at gmail.com>
Date:   Wed Jan 6 10:59:45 2016 -0800

    Bug 16990: Correctly get proxyInfo from multi-part channel
---
 src/chrome/content/tor-circuit-display.js |   10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/src/chrome/content/tor-circuit-display.js b/src/chrome/content/tor-circuit-display.js
index 94a5346..d5ef3d3 100644
--- a/src/chrome/content/tor-circuit-display.js
+++ b/src/chrome/content/tor-circuit-display.js
@@ -228,11 +228,11 @@ let getSOCKSCredentialsForBrowser = function (browser) {
   if (docShell === null) return null;
   let channel = docShell.currentDocumentChannel;
   if (channel === null) return null;
-  try {
-    channel.QueryInterface(Ci.nsIProxiedChannel);
-  } catch (e) {
-    return null;
+  if (channel instanceof Ci.nsIMultiPartChannel) {
+    channel = channel.baseChannel;
   }
+  if (channel === null) return null;
+  if (!(channel instanceof Ci.nsIProxiedChannel)) return null;
   let proxyInfo = channel.proxyInfo;
   if (proxyInfo === null) return null;
   return proxyInfo.username + ":" + proxyInfo.password;
@@ -271,6 +271,8 @@ let updateCircuitDisplay = function () {
                            "<li>" + uiString("internet") + "</li>";
         document.getElementById("circuit-nodes").innerHTML = nodeInnerHTML;
       }
+    } else {
+      logger.eclog(5, "no SOCKS credentials found for current document.");
     }
     // Only show the Tor circuit if we have credentials and node data.
     showCircuitDisplay(credentials && nodeData);



More information about the tbb-commits mailing list