Bug 348031: [Mac] Pressing Cmd-W should always close the window when only one tab is visible, patch by Simon B�nzli <zeniko@gmail.com>, r=mano

This commit is contained in:
gavin%gavinsharp.com 2006-11-06 15:20:16 +00:00
parent 2cb00ac91c
commit 06a8bb8f40

View File

@ -1854,12 +1854,24 @@ function BrowserCloseTabOrWindow()
}
#endif
if (gBrowser.localName == "tabbrowser" && (gBrowser.tabContainer.childNodes.length > 1 ||
!gPrefService.getBoolPref("browser.tabs.autoHide") && window.toolbar.visible)) {
// XXXzeniko why do we check for gBrowser's localName (it's rather undefined
// than actually a different element, isn't it)?
if (gBrowser.localName == "tabbrowser" &&
gBrowser.tabContainer.childNodes.length > 1) {
// Just close up a tab.
gBrowser.removeCurrentTab();
return;
}
#ifndef XP_MACOSX
if (gBrowser.localName == "tabbrowser" && 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)
setTimeout(function() { gURLBar.focus(); }, 0);
return;
}
#endif
BrowserCloseWindow();
}