From c9047b0c22a63fd16f48caf08083a35f7a315e20 Mon Sep 17 00:00:00 2001 From: "sspitzer%mozilla.org" Date: Wed, 22 Aug 2007 05:04:24 +0000 Subject: [PATCH] fix for bug #344587: dispatch tab open/close events in the correct order. thanks to simon for the fix. r=sspitzer,mano sr=mconnor git-svn-id: svn://10.0.0.236/trunk@232758 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/browser/base/content/tabbrowser.xml | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/mozilla/browser/base/content/tabbrowser.xml b/mozilla/browser/base/content/tabbrowser.xml index 013e2193980..7028b3b97b1 100644 --- a/mozilla/browser/base/content/tabbrowser.xml +++ b/mozilla/browser/base/content/tabbrowser.xml @@ -1341,16 +1341,8 @@ } setTimeout(_delayedUpdate, 0, this.mTabContainer); - // We're committed to closing the tab now. - // Dispatch a notification. - // We dispatch it before any teardown so that event listeners can - // inspect the tab that's about to close. - var evt = document.createEvent("Events"); - evt.initEvent("TabClose", true, false); - aTab.dispatchEvent(evt); - if (l == 1) { - // add a new blank tab to replace the one being closed + // add a new blank tab to replace the one we're about to close // (this ensures that the remaining tab is as good as new) this.addTab("about:blank"); l++; @@ -1362,6 +1354,14 @@ this.setStripVisibilityTo(false); } + // We're committed to closing the tab now. + // Dispatch a notification. + // We dispatch it before any teardown so that event listeners can + // inspect the tab that's about to close. + var evt = document.createEvent("Events"); + evt.initEvent("TabClose", true, false); + aTab.dispatchEvent(evt); + var index = -1; if (this.mCurrentTab == aTab) index = this.mTabContainer.selectedIndex;