brizental pushed to branch base-browser-140.2.0esr-15.0-1 at The Tor Project / 
Applications / Tor Browser


Commits:
4b154152 by Beatriz Rizental at 2025-08-21T15:39:24+02:00
fixup! BB 40926: Implemented the New Identity feature

- - - - -


1 changed file:

- browser/components/newidentity/content/newidentity.js


Changes:

=====================================
browser/components/newidentity/content/newidentity.js
=====================================
@@ -418,22 +418,21 @@ ChromeUtils.defineLazyGetter(this, "NewIdentityButton", 
() => {
             tbl.onLocationChange = (...args) => {
               tbl.onLocationChange = onLocationChange;
               tbl.onLocationChange(...args);
-              let displayAddress;
-              try {
-                const url = new URL(homeURL);
-                displayAddress = url.hostname;
-                if (!displayAddress) {
-                  // no host, use full address and truncate if too long
-                  const MAX_LEN = 32;
-                  displayAddress = url.href;
-                  if (displayAddress.length > MAX_LEN) {
-                    displayAddress = `${displayAddress.substring(0, 
MAX_LEN)}…`;
-                  }
-                }
-              } catch (e) {
+              const url = URL.parse(homeURL);
+              if (!url) {
                 // malformed URL, bail out
                 return;
               }
+
+              let displayAddress = url.hostname;
+              if (!displayAddress) {
+                // no host, use full address and truncate if too long
+                const MAX_LEN = 32;
+                displayAddress = url.href;
+                if (displayAddress.length > MAX_LEN) {
+                  displayAddress = `${displayAddress.substring(0, MAX_LEN)}…`;
+                }
+              }
               const callback = () => {
                 Services.prefs.setStringPref(trustedHomePref, homeURL);
                 win.BrowserHome();



View it on GitLab: 
https://gitlab.torproject.org/tpo/applications/tor-browser/-/commit/4b154152221134cb9244bfebd3c68992832cfbb4

-- 
View it on GitLab: 
https://gitlab.torproject.org/tpo/applications/tor-browser/-/commit/4b154152221134cb9244bfebd3c68992832cfbb4
You're receiving this email because of your account on gitlab.torproject.org.


_______________________________________________
tbb-commits mailing list -- tbb-commits@lists.torproject.org
To unsubscribe send an email to tbb-commits-le...@lists.torproject.org

Reply via email to