From 7612c25d3900fd73253474a5cba7abbb4343380c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?D=C3=A3o=20Gottwald?= Date: Fri, 19 Sep 2008 11:34:33 +0200 Subject: [PATCH] Bug 446065 - Add tabs opened in the background to the top of the Ctrl+Tab list. ui-r=beltzner, r=gavin --- browser/base/content/browser-tabPreviews.js | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/browser/base/content/browser-tabPreviews.js b/browser/base/content/browser-tabPreviews.js index 5a98ef8f07e..6602f32afed 100644 --- a/browser/base/content/browser-tabPreviews.js +++ b/browser/base/content/browser-tabPreviews.js @@ -176,7 +176,7 @@ var ctrlTab = { this.tabs = []; Array.forEach(tabContainer.childNodes, function (tab) { - this.attachTab(tab, tab == gBrowser.selectedTab); + this.attachTab(tab, tab == gBrowser.selectedTab ? 0 : null); }, this); tabContainer.addEventListener("TabOpen", this, false); @@ -422,9 +422,11 @@ var ctrlTab = { } XULBrowserWindow.setOverLink(value, null); }, - attachTab: function (aTab, aSelected) { - if (aSelected) + attachTab: function (aTab, aPos) { + if (aPos == 0) this.tabs.unshift(aTab); + else if (aPos) + this.tabs.splice(aPos, 0, aTab); else this.tabs.push(aTab); }, @@ -506,7 +508,7 @@ var ctrlTab = { onTabSelect: function (aTab) { if (aTab.parentNode) { this.detachTab(aTab); - this.attachTab(aTab, true); + this.attachTab(aTab, 0); } }, handleEvent: function (event) { @@ -522,7 +524,7 @@ var ctrlTab = { this.onTabSelect(event.target); break; case "TabOpen": - this.attachTab(event.target); + this.attachTab(event.target, 1); break; case "TabClose": if (this.isOpen) {