Bug 1445737: Simplify a bit now that we unconditionally shuffle the window attributes after init(). r=dao
MozReview-Commit-ID: 78lPD2ZISWV
--- 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)