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
1 changed file:
Changes:
... | ... | @@ -418,22 +418,21 @@ ChromeUtils.defineLazyGetter(this, "NewIdentityButton", () => { |
418 | 418 | tbl.onLocationChange = (...args) => {
|
419 | 419 | tbl.onLocationChange = onLocationChange;
|
420 | 420 | tbl.onLocationChange(...args);
|
421 | - let displayAddress;
|
|
422 | - try {
|
|
423 | - const url = new URL(homeURL);
|
|
424 | - displayAddress = url.hostname;
|
|
425 | - if (!displayAddress) {
|
|
426 | - // no host, use full address and truncate if too long
|
|
427 | - const MAX_LEN = 32;
|
|
428 | - displayAddress = url.href;
|
|
429 | - if (displayAddress.length > MAX_LEN) {
|
|
430 | - displayAddress = `${displayAddress.substring(0, MAX_LEN)}…`;
|
|
431 | - }
|
|
432 | - }
|
|
433 | - } catch (e) {
|
|
421 | + const url = URL.parse(homeURL);
|
|
422 | + if (!url) {
|
|
434 | 423 | // malformed URL, bail out
|
435 | 424 | return;
|
436 | 425 | }
|
426 | + |
|
427 | + let displayAddress = url.hostname;
|
|
428 | + if (!displayAddress) {
|
|
429 | + // no host, use full address and truncate if too long
|
|
430 | + const MAX_LEN = 32;
|
|
431 | + displayAddress = url.href;
|
|
432 | + if (displayAddress.length > MAX_LEN) {
|
|
433 | + displayAddress = `${displayAddress.substring(0, MAX_LEN)}…`;
|
|
434 | + }
|
|
435 | + }
|
|
437 | 436 | const callback = () => {
|
438 | 437 | Services.prefs.setStringPref(trustedHomePref, homeURL);
|
439 | 438 | win.BrowserHome();
|