From 7d0a6e2169d551d7a829fc30fb3d9bc9cd5da5f6 Mon Sep 17 00:00:00 2001 From: Owen Jones Date: Tue, 13 Mar 2012 00:33:54 +0100 Subject: [PATCH] Bug 603817 - Properly update personal-bookmarks contents when it's put in the tabs toolbar. r=mak --- .../components/places/content/browserPlacesViews.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/browser/components/places/content/browserPlacesViews.js b/browser/components/places/content/browserPlacesViews.js index a86e3e8f42eb..1f90637fd640 100644 --- a/browser/components/places/content/browserPlacesViews.js +++ b/browser/components/places/content/browserPlacesViews.js @@ -887,6 +887,14 @@ function PlacesToolbar(aPlace) { this._addEventListeners(this._rootElt, ["overflow", "underflow"], true); this._addEventListeners(window, ["resize", "unload"], false); + // If personal-bookmarks has been dragged to the tabs toolbar, + // we have to track addition and removals of tabs, to properly + // recalculate the available space for bookmarks. + // TODO (bug 734730): Use a performant mutation listener when available. + if (this._viewElt.parentNode.parentNode == document.getElementById("TabsToolbar")) { + this._addEventListeners(gBrowser.tabContainer, ["TabOpen", "TabClose"], false); + } + PlacesViewBase.call(this, aPlace); Services.telemetry.getHistogramById("FX_BOOKMARKS_TOOLBAR_INIT_MS") @@ -913,6 +921,7 @@ PlacesToolbar.prototype = { true); this._removeEventListeners(this._rootElt, ["overflow", "underflow"], true); this._removeEventListeners(window, ["resize", "unload"], false); + this._removeEventListeners(gBrowser.tabContainer, ["TabOpen", "TabClose"], false); PlacesViewBase.prototype.uninit.apply(this, arguments); }, @@ -1067,7 +1076,11 @@ PlacesToolbar.prototype = { if (aEvent.detail == 0) return; + this.updateChevron(); this._chevron.collapsed = true; + break; + case "TabOpen": + case "TabClose": this.updateChevron(); break; case "dragstart":