Pier Angelo Vendrame pushed to branch tor-browser-102.6.0esr-12.5-1 at The Tor Project / Applications / Tor Browser

Commits:

1 changed file:

Changes:

  • toolkit/torbutton/chrome/content/tor-circuit-display.js
    ... ... @@ -306,21 +306,32 @@ let createTorCircuitDisplay = (function() {
    306 306
       // Obtains the circuit used by the given browser.
    
    307 307
       let currentCircuitData = function(browser) {
    
    308 308
         if (browser) {
    
    309
    -      let firstPartyDomain = getDomainForBrowser(browser);
    
    310
    -      let domain = firstPartyDomain || "--unknown--";
    
    311
    -      let domainMap = browserToCredentialsMap.get(browser);
    
    312
    -      let credentials = domainMap && domainMap.get(domain);
    
    309
    +      const firstPartyDomain = getDomainForBrowser(browser);
    
    310
    +      const userContextId =
    
    311
    +        browser.contentPrincipal.originAttributes.userContextId;
    
    312
    +      const key = firstPartyDomain
    
    313
    +        ? `${firstPartyDomain}:${userContextId}`
    
    314
    +        : "--unknown--";
    
    315
    +      const credentialMap = browserToCredentialsMap.get(browser);
    
    316
    +      const credentials = credentialMap && credentialMap.get(key);
    
    313 317
           if (credentials) {
    
    314
    -        let [SOCKS_username, SOCKS_password] = credentials;
    
    315
    -        let nodeData = credentialsToNodeDataMap.get(
    
    318
    +        const [SOCKS_username, SOCKS_password] = credentials;
    
    319
    +        const nodeData = credentialsToNodeDataMap.get(
    
    316 320
               `${SOCKS_username}|${SOCKS_password}`
    
    317 321
             );
    
    318
    -        let domain = SOCKS_username;
    
    319
    -        if (browser.documentURI.host.endsWith(".tor.onion")) {
    
    320
    -          const service = Cc[
    
    321
    -            "@torproject.org/onion-alias-service;1"
    
    322
    -          ].getService(Ci.IOnionAliasService);
    
    323
    -          domain = service.getOnionAlias(browser.documentURI.host);
    
    322
    +        let domain = firstPartyDomain;
    
    323
    +        try {
    
    324
    +          if (browser.documentURI.host.endsWith(".tor.onion")) {
    
    325
    +            const service = Cc[
    
    326
    +              "@torproject.org/onion-alias-service;1"
    
    327
    +            ].getService(Ci.IOnionAliasService);
    
    328
    +            domain = service.getOnionAlias(browser.documentURI.host);
    
    329
    +          }
    
    330
    +        } catch (e) {
    
    331
    +          logger.eclog(
    
    332
    +            3,
    
    333
    +            `[circuit display] Cannot verify if we are visiting an onion alias: ${e.message}\n${e.stack}`
    
    334
    +          );
    
    324 335
             }
    
    325 336
             return { domain, nodeData };
    
    326 337
           }