Bug 1588142 - Prevent internal pages from flashing the URL on reload r=Gijs
authorKirk Steuber <ksteuber@mozilla.com>
Thu, 14 Nov 2019 00:17:52 +0000
changeset 501866 2b7c28c1173d3867aae18f67db7d8b55fec4ca34
parent 501865 a6d78953abb664f0938dfebeaa0874799a07ee81
child 501867 48829132cb50ae7cdcb69e1780aecb3f3737c27b
push id114172
push userdluca@mozilla.com
push dateTue, 19 Nov 2019 11:31:10 +0000
treeherdermozilla-inbound@b5c5ba07d3db [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersGijs
bugs1588142
milestone72.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1588142 - Prevent internal pages from flashing the URL on reload r=Gijs Converting about:preferences's root from a xul:window to an html:html involves moving the Fluent-translated title attribute to a title tag, which starts empty and is populated by Fluent. The initially-empty title tag causes the title bar to flash "about:preferences" on reload. This patch ignores empty title updates via DOMTitleChanged events to prevent this. This is only done for internal pages (i.e. pages with a system principal). Differential Revision: https://phabricator.services.mozilla.com/D52289
browser/base/content/tabbrowser.js
--- a/browser/base/content/tabbrowser.js
+++ b/browser/base/content/tabbrowser.js
@@ -5248,16 +5248,26 @@
         if (!tab || tab.hasAttribute("pending")) {
           return;
         }
 
         if (!browser.docShell || event.target != browser.docShell.document) {
           return;
         }
 
+        // Ignore empty title changes on internal pages. This prevents the title
+        // from changing while Fluent is populating the (initially-empty) title
+        // element.
+        if (
+          !browser.contentTitle &&
+          browser.contentPrincipal.isSystemPrincipal
+        ) {
+          return;
+        }
+
         var titleChanged = this.setTabTitle(tab);
         if (titleChanged && !tab.selected && !tab.hasAttribute("busy")) {
           tab.setAttribute("titlechanged", "true");
         }
       });
 
       this.addEventListener("oop-browser-crashed", event => {
         if (!event.isTrusted) {