Bug 1588142 - Prevent internal pages from flashing the URL on reload r=Gijs
☠☠ backed out by b42b42456573 ☠ ☠
authorKirk Steuber <ksteuber@mozilla.com>
Tue, 12 Nov 2019 18:01:01 +0000
changeset 501810 2284a535c8bc5a34c448665c99bdf0d7ea2d73f2
parent 501809 939b6b3922c2802abedb336712b08e605687e716
child 501811 da8d5a96f3c8f93be0a4ca787eedd410dcf3b0c8
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) {