commit b9229102ee6e5098c11af49a04ca0669a0c02fd4 Author: Kathy Brade brade@pearlcrescent.com Date: Tue May 27 14:03:20 2014 -0400
Bug #11510: about:tor should not report success if no tor.
If the remote check does not complete successfully, look at the status code associated with the underlying nsIRequest and fail the tor check when the status is "proxy connection refused." --- src/chrome/content/torbutton.js | 3 ++- src/components/torCheckService.js | 14 ++++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-)
diff --git a/src/chrome/content/torbutton.js b/src/chrome/content/torbutton.js index 6161995..ee49ae4 100644 --- a/src/chrome/content/torbutton.js +++ b/src/chrome/content/torbutton.js @@ -1852,7 +1852,8 @@ function torbutton_initiate_remote_tor_check() // If we received an error response from check.torproject.org, // set the status of the tor check to failure (we don't want // to indicate failure if we didn't receive a response). - if (ret == 2 || ret == 3 || ret == 5 || ret == 6 || ret == 7) { + if (ret == 2 || ret == 3 || ret == 5 || ret == 6 + || ret == 7 || ret == 8) { checkSvc.statusOfTorCheck = checkSvc.kCheckFailed; obsSvc.notifyObservers(null, k_tb_tor_check_failed_topic, null); } else if (ret == 4) { diff --git a/src/components/torCheckService.js b/src/components/torCheckService.js index 4972f05..04708d4 100644 --- a/src/components/torCheckService.js +++ b/src/components/torCheckService.js @@ -122,8 +122,22 @@ TBTorCheckService.prototype = } } } else { + if (0 == aReq.status) { + try { + var req = aReq.channel.QueryInterface(Ci.nsIRequest); + if (req.status == Cr.NS_ERROR_PROXY_CONNECTION_REFUSED) + { + this._logger.log(5, "Tor test failed. Proxy connection refused"); + ret = 8; + } + } catch (e) {} + } + + if (ret == 0) + { this._logger.log(5, "Tor test failed. HTTP Error: "+aReq.status); ret = -aReq.status; + } }
return ret;