From 454cbf1f1059228597d11443751ac42b8cd38415 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?D=C3=A3o=20Gottwald?= Date: Sat, 6 Mar 2010 17:06:04 +0100 Subject: [PATCH] Bug 545583 - Don't try to append previews to a non-existent row when using the all-tabs panel's search field. r=mstange --- browser/base/content/browser-tabPreviews.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/browser/base/content/browser-tabPreviews.js b/browser/base/content/browser-tabPreviews.js index 479000ae9bac..8a5bf76c1932 100644 --- a/browser/base/content/browser-tabPreviews.js +++ b/browser/base/content/browser-tabPreviews.js @@ -820,15 +820,18 @@ var allTabs = { this.container.appendChild(document.createElement("hbox")); var row = this.container.firstChild; - var i = 0; + var colCount = 0; previews.forEach(function (preview) { + if (!preview.hidden && + ++colCount > this._columns) { + row = row.nextSibling; + colCount = 1; + } preview.setAttribute("minwidth", outerWidth); preview.setAttribute("height", outerHeight); preview.setAttribute("canvasstyle", canvasStyle); preview.removeAttribute("closebuttonhover"); row.appendChild(preview); - if (!preview.hidden) - row = this.container.childNodes[Math.floor(++i / this._columns)]; }, this); this._stack.width = maxWidth;