Bug 429926 - Make Cmd+T open a new window when no browser windows are open. r=jag, sr=Neil.

This commit is contained in:
stefanh%inbox.com 2008-05-04 18:24:46 +00:00
Родитель b33de73d9d
Коммит 61ce561951
1 изменённых файлов: 11 добавлений и 2 удалений

Просмотреть файл

@ -1273,13 +1273,22 @@ function BrowserOpenTab()
Components.interfaces.nsIPrefLocalizedString).data;
break;
case 2:
uriToLoad = getWebNavigation().currentURI.spec;
uriToLoad = gBrowser ? getWebNavigation().currentURI.spec
: Components.classes["@mozilla.org/browser/global-history;2"]
.getService(Components.interfaces.nsIBrowserHistory)
.lastPageVisited;
break;
}
} catch(e) {
uriToLoad = "about:blank";
}
// Open a new window if someone requests a new tab when no browser window is open
if (!gBrowser) {
openDialog(getBrowserURL(), "_blank", "chrome,all,dialog=no", uriToLoad);
return;
}
gBrowser.selectedTab = gBrowser.addTab(uriToLoad);
var navBar = document.getElementById("nav-bar");
if (uriToLoad == "about:blank" && !navBar.hidden && window.locationbar.visible)
@ -1713,7 +1722,7 @@ function hiddenWindowStartup()
window.focus();
// Disable menus which are not appropriate
var disabledItems = ['cmd_newNavigatorTab', 'cmd_close', 'Browser:SendPage',
var disabledItems = ['cmd_close', 'Browser:SendPage',
'Browser:EditPage', 'Browser:SavePage', 'cmd_printSetup',
'Browser:Print', 'canGoBack', 'canGoForward',
'Browser:AddBookmark', 'Browser:AddBookmarkAs',