Bug 1366870 - Part 2: Set initial tab title to URL's hostname until we know the actual page title. r?dao
We currently show a full URL as the initial tab title (e.g. "https://www.mozilla.org/en-US/") until the page loads and we know the actual page title. When loading multiple tabs, such as during session restore, many tabs will have the same undifferentiated tab title prefix like "https://www....". Since the URL scheme and "www." subdomain are not meaningful to users, just show the URL's hostname without any "www." prefix (e.g. "mozilla.org").
Other browsers' initial tab titles for comparison:
* Firefox 54 uses "Connecting...".
* IE11 uses the same "hostname without www" placeholder as this changeset.
* Edge uses "Blank page".
* Chrome uses "Loading..." on Windows and "Untitled" on Mac.
* Safari uses "Untitled".
MozReview-Commit-ID: JxLxvBjpIBh
--- a/browser/base/content/tabbrowser.xml
+++ b/browser/base/content/tabbrowser.xml
@@ -1467,16 +1467,19 @@
// Some tests pass in values that are not valid URLs, such as
// "example.com" with no scheme. Just show whatever was passed in
// until we know the page's actual title.
let hostname;
try {
const fixedURI = URIFixup.createFixupURI(uri, URIFixup.FIXUP_FLAG_NONE);
hostname = fixedURI.host;
} catch (e) {
+ }
+
+ if (!hostname) {
return uri;
}
return hostname.startsWith("www.") ? hostname.slice(4) : hostname;
}
]]></body>
</method>