commit a762819edb07559959c163dec4fa29768f7e021c Author: Alex Catarineu acat@torproject.org Date: Mon Apr 8 13:19:44 2019 +0200
Bugs 22538 and 22513: fix also for IP address hosts --- src/chrome/content/torbutton.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/src/chrome/content/torbutton.js b/src/chrome/content/torbutton.js index 2421548d..6ea51190 100644 --- a/src/chrome/content/torbutton.js +++ b/src/chrome/content/torbutton.js @@ -871,7 +871,14 @@ function torbutton_new_circuit() { let urlOrigin = new URL(origin); let { hostname } = new URL(urlOrigin.searchParams.get('u')); if (hostname) { - firstPartyDomain = Services.eTLD.getBaseDomainFromHost(hostname) || firstPartyDomain; + try { + firstPartyDomain = Services.eTLD.getBaseDomainFromHost(hostname); + } catch (e) { + if (e.result == Cr.NS_ERROR_HOST_IS_IP_ADDRESS || + e.result == Cr.NS_ERROR_INSUFFICIENT_DOMAIN_LEVELS) { + firstPartyDomain = hostname; + } + } } } catch (e) { torbutton_log(4, "Exception on new circuit" +e);
tbb-commits@lists.torproject.org