Bug 1445737: Simplify a bit now that we unconditionally shuffle the window attributes after init(). r=dao draft
authorEmilio Cobos Álvarez <emilio@crisal.io>
Fri, 16 Mar 2018 12:21:53 +0100
changeset 768509 f207b26a44cdfef6d46327f72835731508ef7be3
parent 768502 e53fd7c43960b12dd5bcd0d5b5b6739512122181
child 768563 3f1cb624a31d08bbff0a0043de2b562181c58d4f
child 768594 65a4751479d2886c07996d6d348fb0629f2b3c92
child 768597 82bea62c1c01e410541fd6ffe1ba6d3e65afd318
push id102885
push userbmo:emilio@crisal.io
push dateFri, 16 Mar 2018 11:23:24 +0000
reviewersdao
bugs1445737
milestone61.0a1
Bug 1445737: Simplify a bit now that we unconditionally shuffle the window attributes after init(). r=dao MozReview-Commit-ID: 78lPD2ZISWV
browser/base/content/browser-tabsintitlebar.js
browser/base/content/browser.js
--- a/browser/base/content/browser-tabsintitlebar.js
+++ b/browser/base/content/browser-tabsintitlebar.js
@@ -41,22 +41,17 @@ var TabsInTitlebar = {
       if (aArea == CustomizableUI.AREA_TABSTRIP || aArea == CustomizableUI.AREA_MENUBAR)
         this._update(true);
     };
     CustomizableUI.addListener(this);
 
     addEventListener("resolutionchange", this, false);
 
     this._initialized = true;
-    if (this._updateOnInit) {
-      // We don't need to call this with 'true', even if original calls
-      // (before init()) did, because this will be the first call and so
-      // we will update anyway.
-      this._update();
-    }
+    this._update();
   },
 
   allowedBy(condition, allow) {
     if (allow) {
       if (condition in this._disallowed) {
         delete this._disallowed[condition];
         this._update(true);
       }
@@ -91,17 +86,16 @@ var TabsInTitlebar = {
           mutation.attributeName == "autohide") {
         TabsInTitlebar._update(true);
         return;
       }
     }
   },
 
   _initialized: false,
-  _updateOnInit: false,
   _disallowed: {},
   _prefName: "browser.tabs.drawInTitlebar",
   _lastSizeMode: null,
 
   _readPref() {
     this.allowedBy("pref",
                    Services.prefs.getBoolPref(this._prefName));
   },
@@ -110,19 +104,17 @@ var TabsInTitlebar = {
     let $ = id => document.getElementById(id);
     let rect = ele => ele.getBoundingClientRect();
     let verticalMargins = cstyle => parseFloat(cstyle.marginBottom) + parseFloat(cstyle.marginTop);
 
     if (window.fullScreen)
       return;
 
     // In some edgecases it is possible for this to fire before we've initialized.
-    // Don't run now, but don't forget to run it when we do initialize.
     if (!this._initialized) {
-      this._updateOnInit = true;
       return;
     }
 
     if (!aForce) {
       // _update is called on resize events, because the window is not ready
       // after sizemode events. However, we only care about the event when the
       // sizemode is different from the last time we updated the appearance of
       // the tabs in the titlebar.
--- a/browser/base/content/browser.js
+++ b/browser/base/content/browser.js
@@ -1226,17 +1226,16 @@ var gBrowserInit = {
       document.documentElement.setAttribute("height", height);
 
       if (width < TARGET_WIDTH && height < TARGET_HEIGHT) {
         document.documentElement.setAttribute("sizemode", "maximized");
       }
     }
 
     TabsInTitlebar.init();
-    TabsInTitlebar.updateAppearance();
   },
 
   onDOMContentLoaded() {
     gBrowser = window._gBrowser;
     delete window._gBrowser;
     gBrowser.init();
 
     window.QueryInterface(Ci.nsIInterfaceRequestor)