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

[tor-commits] [Git][tpo/applications/tor-browser][tor-browser-149.0a1-16.0-2] 2 commits: fixup! TB 27476: Implement about:torconnect captive portal within Tor Browser



Title: GitLab

morgan pushed to branch tor-browser-149.0a1-16.0-2 at The Tor Project / Applications / Tor Browser

Commits:

  • c80e93f9
    by Henry Wilkes at 2026-03-30T15:23:45+00:00
    fixup! TB 27476: Implement about:torconnect captive portal within Tor Browser
    
    TB 44781: Use a static title for `about:torconnect`.
    
    We now use Fluent to set the page `<title>`, this causes some delay
    between the page being loaded and the title being set. Which cause the
    `about:torconnect` URL to flash in the browser tab selector. Moreover,
    even the prior non-Fluent approach would have "New Tab" flash in the
    title just before "Connect to Tor" was set.
    
    As such, we adjust `tabbrowser.js` and `tabs.js` to:
    
    1. Set the `about:torconnect`'s tab label to the expected page title
       before the page has loaded and set it's title.
    2. Set the very first tab's label to the `about:torconnect` page title
       at startup, rather than "New Tab".
    
  • 5da6decb
    by Henry Wilkes at 2026-03-30T15:23:45+00:00
    fixup! Tor Browser strings
    
    TB 44781: Add the Fluent tor connect title.
    

5 changed files:

Changes:

  • browser/components/tabbrowser/content/tabbrowser.js
    ... ... @@ -133,6 +133,11 @@
    133 133
               true
    
    134 134
             );
    
    135 135
           });
    
    136
    +      // Add a synchronous localisation to get the about:torconnect title.
    
    137
    +      // See tor-browser#44781.
    
    138
    +      ChromeUtils.defineLazyGetter(this, "torconnectLocalization", () => {
    
    139
    +        return new Localization(["toolkit/global/tor-browser.ftl"], true);
    
    140
    +      });
    
    136 141
           XPCOMUtils.defineLazyPreferenceGetter(
    
    137 142
             this,
    
    138 143
             "_shouldExposeContentTitle",
    
    ... ... @@ -2113,6 +2118,39 @@
    2113 2118
             return false;
    
    2114 2119
           }
    
    2115 2120
     
    
    2121
    +      // We want to set the title for an about:torconnect tab prior to the page
    
    2122
    +      // being loaded. In particular, we need to wait for:
    
    2123
    +      //
    
    2124
    +      // 1. The first `<browser>` element to switch `currentURI` from
    
    2125
    +      //    `about:blank` to `about:torconnect`.
    
    2126
    +      // 2. The page's `<title>` to be set, which is delayed by the page load
    
    2127
    +      //    and the async FluentDOM.
    
    2128
    +      //
    
    2129
    +      // This avoids flashes of "New Tab" and the URL appearing in the tab
    
    2130
    +      // label. See tor-browser#44781.
    
    2131
    +      if (aTab._isFirstTabLoading) {
    
    2132
    +        if (!isURL && !isContentTitle) {
    
    2133
    +          // Wait until we have a proper title or URL.
    
    2134
    +          // NOTES:
    
    2135
    +          // 1. This is only expected for the first call to `onLocationChange`
    
    2136
    +          //    for the very first tab opened in a new window. In this scenario,
    
    2137
    +          //    we expect the page's `currentURI` to be `about:blank` (and not
    
    2138
    +          //    the actual `chrome:` path to `blanktab.html`). We use the
    
    2139
    +          //    `_isFirstTabLoading` condition as an extra protection.
    
    2140
    +          // 2. We have already set the title for this tab in
    
    2141
    +          //    `MozTabbrowserTabs.init`, depending on whether we expect this to
    
    2142
    +          //    turn into `about:torconnect` or a "New Tab" (`about:tor` or
    
    2143
    +          //    `blanktab.html`). So we don't need to make any changes here.
    
    2144
    +          return false;
    
    2145
    +        }
    
    2146
    +        delete aTab._isFirstTabLoading;
    
    2147
    +      }
    
    2148
    +      if (isURL && aLabel.startsWith("about:torconnect")) {
    
    2149
    +        aLabel = this.tabContainer.torconnectTitle;
    
    2150
    +        isContentTitle = true;
    
    2151
    +        isURL = false;
    
    2152
    +      }
    
    2153
    +
    
    2116 2154
           // If it's a long data: URI that uses base64 encoding, truncate to a
    
    2117 2155
           // reasonable length rather than trying to display the entire thing,
    
    2118 2156
           // which can hang or crash the browser.
    

  • browser/components/tabbrowser/content/tabs.js
    ... ... @@ -132,7 +132,16 @@
    132 132
           this._hiddenSoundPlayingTabs = new Set();
    
    133 133
           this.previewPanel = null;
    
    134 134
     
    
    135
    -      this.allTabs[0].label = this.emptyTabTitle;
    
    135
    +      // When a new application window is spawned, this will set the initial
    
    136
    +      // tab's displayed title. If `shouldShowTorConnect` is true, we expect
    
    137
    +      // this first page to be `about:torconnect`, so we show the corresponding
    
    138
    +      // title that will be used once the page is shown. See tor-browser#44781.
    
    139
    +      this.allTabs[0].label = TorConnect.shouldShowTorConnect
    
    140
    +        ? this.torconnectTitle
    
    141
    +        : this.emptyTabTitle;
    
    142
    +      // Mark this as the first tab that is still loading. This can be cleared
    
    143
    +      // once we have a definite title or URI.
    
    144
    +      this.allTabs[0]._isFirstTabLoading = true;
    
    136 145
     
    
    137 146
           // Hide the secondary text for locales where it is unsupported due to size constraints.
    
    138 147
           const language = Services.locale.appLocaleAsBCP47;
    
    ... ... @@ -807,6 +816,18 @@
    807 816
           return gBrowser.tabLocalization.formatValueSync(l10nId);
    
    808 817
         }
    
    809 818
     
    
    819
    +    /**
    
    820
    +     * The about:torconnect page <title>, to be fetched when about:torconnect
    
    821
    +     * has not yet been loaded.
    
    822
    +     *
    
    823
    +     * @type {string}
    
    824
    +     */
    
    825
    +    get torconnectTitle() {
    
    826
    +      return gBrowser.torconnectLocalization.formatValueSync(
    
    827
    +        "tor-connect-page-title"
    
    828
    +      );
    
    829
    +    }
    
    830
    +
    
    810 831
         get tabbox() {
    
    811 832
           return document.getElementById("tabbrowser-tabbox");
    
    812 833
         }
    

  • browser/components/torconnect/content/aboutTorConnect.html
    ... ... @@ -6,6 +6,8 @@
    6 6
           http-equiv="Content-Security-Policy"
    
    7 7
           content="default-src chrome:; object-src 'none'"
    
    8 8
         />
    
    9
    +    <title data-l10n-id="tor-connect-page-title"></title>
    
    10
    +
    
    9 11
         <link rel="stylesheet" href="">"chrome://global/skin/tor-common.css" />
    
    10 12
         <link
    
    11 13
           rel="stylesheet"
    
    ... ... @@ -14,6 +16,8 @@
    14 16
           media="all"
    
    15 17
         />
    
    16 18
     
    
    19
    +    <link rel="localization" href="">"toolkit/global/tor-browser.ftl" />
    
    20
    +
    
    17 21
         <script
    
    18 22
           type="module"
    
    19 23
           src="">"chrome://global/content/elements/moz-toggle.mjs"
    

  • browser/components/torconnect/content/aboutTorConnect.js
    ... ... @@ -229,7 +229,6 @@ class AboutTorConnect {
    229 229
         if (className) {
    
    230 230
           this.elements.title.classList.add(className);
    
    231 231
         }
    
    232
    -    document.title = title;
    
    233 232
       }
    
    234 233
     
    
    235 234
       setLongText(...args) {
    

  • toolkit/locales/en-US/toolkit/global/tor-browser.ftl
    ... ... @@ -9,6 +9,12 @@ appmenu-open-tor-manual =
    9 9
         .label = Tor Browser manual
    
    10 10
         .accesskey = m
    
    11 11
     
    
    12
    +## Tor connect page.
    
    13
    +
    
    14
    +# The tab name for the page.
    
    15
    +# Here "Tor" refers to the Tor network.
    
    16
    +tor-connect-page-title = Connect to Tor
    
    17
    +
    
    12 18
     ## Tor Browser home page.
    
    13 19
     
    
    14 20
     tor-browser-home-heading-stable = Explore. Privately.
    

  • _______________________________________________
    tor-commits mailing list -- tor-commits@xxxxxxxxxxxxxxxxxxxx
    To unsubscribe send an email to tor-commits-leave@xxxxxxxxxxxxxxxxxxxx