[tor-commits] [tor-browser] 02/73: Bug 41050: HTTPS-Only Mode Alert's "Continue to HTTP Site" button doesn't work on IP addresses

gitolite role git at cupani.torproject.org
Thu Jul 21 10:27:19 UTC 2022


This is an automated email from the git hooks/post-receive script.

pierov pushed a commit to branch tor-browser-91.12.0esr-11.5-1
in repository tor-browser.

commit 5812fe97a4e8489913a78c72ba5a9511e847f583
Author: Pier Angelo Vendrame <pierov at torproject.org>
AuthorDate: Mon Jul 18 18:56:13 2022 +0200

    Bug 41050: HTTPS-Only Mode Alert's "Continue to HTTP Site" button doesn't work on IP addresses
    
    This bug has already been fixed upstream, so we should drop this patch
    when we update to 102.
    See also https://bugzilla.mozilla.org/show_bug.cgi?id=1697866.
---
 toolkit/actors/AboutHttpsOnlyErrorParent.jsm | 17 ++++++++++++++---
 1 file changed, 14 insertions(+), 3 deletions(-)

diff --git a/toolkit/actors/AboutHttpsOnlyErrorParent.jsm b/toolkit/actors/AboutHttpsOnlyErrorParent.jsm
index b949cb065a583..d269e915bc59e 100644
--- a/toolkit/actors/AboutHttpsOnlyErrorParent.jsm
+++ b/toolkit/actors/AboutHttpsOnlyErrorParent.jsm
@@ -82,6 +82,19 @@ class AboutHttpsOnlyErrorParent extends JSWindowActorParent {
     const oldOriginAttributes = aBrowser.contentPrincipal.originAttributes;
     const hasFpiAttribute = !!oldOriginAttributes.firstPartyDomain.length;
 
+    let firstPartyDomain = "";
+    if (hasFpiAttribute) {
+      // This try-catch to check whether a host is an IP address is used also in
+      // other parts of Firefox
+      try {
+        firstPartyDomain = Services.eTLD.getBaseDomain(newURI);
+      } catch (e) {
+        if (e.result == Cr.NS_ERROR_HOST_IS_IP_ADDRESS) {
+          firstPartyDomain = newURI.host;
+        }
+      }
+    }
+
     // Create new content principal for the permission. If first-party isolation
     // is enabled, we have to replace the about-page first-party domain with the
     // one from the exempt website.
@@ -89,9 +102,7 @@ class AboutHttpsOnlyErrorParent extends JSWindowActorParent {
       newURI,
       {
         ...oldOriginAttributes,
-        firstPartyDomain: hasFpiAttribute
-          ? Services.eTLD.getBaseDomain(newURI)
-          : "",
+        firstPartyDomain,
       }
     );
 

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the tor-commits mailing list