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

[tor-commits] [tor-browser/tor-browser-68.8.0esr-9.5-1] Bug 34196: Update site info URL with the onion name



commit 00f5a4c995a911423e10af5a2bbeceef1ae76be6
Author: Alex Catarineu <acat@xxxxxxxxxxxxxx>
Date:   Wed May 13 11:13:24 2020 +0200

    Bug 34196: Update site info URL with the onion name
---
 browser/base/content/browser-siteIdentity.js | 12 +++++++-----
 browser/base/content/browser.js              |  3 ++-
 2 files changed, 9 insertions(+), 6 deletions(-)

diff --git a/browser/base/content/browser-siteIdentity.js b/browser/base/content/browser-siteIdentity.js
index 32e939787fb7..d1cbf8708dfc 100644
--- a/browser/base/content/browser-siteIdentity.js
+++ b/browser/base/content/browser-siteIdentity.js
@@ -464,13 +464,13 @@ var gIdentityHandler = {
    *        nsIURI for which the identity UI should be displayed, already
    *        processed by nsIURIFixup.createExposableURI.
    */
-  updateIdentity(state, uri) {
+  updateIdentity(state, uri, onionAliasURI) {
     let shouldHidePopup = this._uri && this._uri.spec != uri.spec;
     this._state = state;
 
     // Firstly, populate the state properties required to display the UI. See
     // the documentation of the individual properties for details.
-    this.setURI(uri);
+    this.setURI(uri, onionAliasURI);
     this._secInfo = gBrowser.securityUI.secInfo;
 
     // Then, update the user interface with the available data.
@@ -549,17 +549,18 @@ var gIdentityHandler = {
    * Attempt to provide proper IDN treatment for host names
    */
   getEffectiveHost() {
+    let uri = this._onionAliasURI || this._uri;
     if (!this._IDNService) {
       this._IDNService = Cc["@mozilla.org/network/idn-service;1"].getService(
         Ci.nsIIDNService
       );
     }
     try {
-      return this._IDNService.convertToDisplayIDN(this._uri.host, {});
+      return this._IDNService.convertToDisplayIDN(uri.host, {});
     } catch (e) {
       // If something goes wrong (e.g. host is an IP address) just fail back
       // to the full domain.
-      return this._uri.host;
+      return uri.host;
     }
   },
 
@@ -984,8 +985,9 @@ var gIdentityHandler = {
     ContentBlocking.toggleReportBreakageButton();
   },
 
-  setURI(uri) {
+  setURI(uri, onionAliasURI) {
     this._uri = uri;
+    this._onionAliasURI = onionAliasURI;
 
     try {
       // Account for file: urls and catch when "" is the value
diff --git a/browser/base/content/browser.js b/browser/base/content/browser.js
index 67a1977fef6a..251b11dda03f 100644
--- a/browser/base/content/browser.js
+++ b/browser/base/content/browser.js
@@ -6083,6 +6083,7 @@ var XULBrowserWindow = {
     // Don't need to do anything if the data we use to update the UI hasn't
     // changed
     let uri = gBrowser.currentURI;
+    let onionAliasURI = gBrowser.selectedBrowser.currentOnionAliasURI;
     let spec = uri.spec;
     if (this._state == aState && this._lastLocation == spec) {
       // Switching to a tab of the same URL doesn't change most security
@@ -6100,7 +6101,7 @@ var XULBrowserWindow = {
     try {
       uri = Services.uriFixup.createExposableURI(uri);
     } catch (e) {}
-    gIdentityHandler.updateIdentity(this._state, uri);
+    gIdentityHandler.updateIdentity(this._state, uri, onionAliasURI);
   },
 
   // simulate all change notifications after switching tabs



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