Bug 356581: focus the location bar after closing the tab so that Ctrl+W doesn't cause it to loose focus, patch by Simon Bünzli <zeniko@gmail.com>, r=me

This commit is contained in:
gavin@gavinsharp.com 2007-08-12 06:58:33 -07:00
parent 924d989283
commit c731b721e3

View File

@ -1658,21 +1658,15 @@ function BrowserCloseTabOrWindow()
}
#endif
if (gBrowser.tabContainer.childNodes.length > 1) {
// Just close up a tab.
if (gBrowser.tabContainer.childNodes.length > 1 ||
window.toolbar.visible && !gPrefService.getBoolPref("browser.tabs.autoHide")) {
// Just close the tab (and focus the address bar if it was the last one).
var isLastTab = gBrowser.tabContainer.childNodes.length == 1;
gBrowser.removeCurrentTab();
return;
}
#ifndef XP_MACOSX
if (window.toolbar.visible &&
!gPrefService.getBoolPref("browser.tabs.autoHide")) {
// Replace the remaining tab with a blank one and focus the address bar
gBrowser.removeCurrentTab();
if (gURLBar)
if (isLastTab && gURLBar)
setTimeout(function() { gURLBar.focus(); }, 0);
return;
}
#endif
closeWindow(true);
}