Fixing bug 310825. Prevent window.focus() when called from a background tab from moving focus to the background tab. r=mrbkap@gmail.com, sr=dveditz@cruzio.com

This commit is contained in:
jst%mozilla.jstenback.com 2005-10-17 21:37:49 +00:00
parent a05a208a0d
commit b9f159aee3

View File

@ -3402,6 +3402,18 @@ nsGlobalWindow::Focus()
{
FORWARD_TO_OUTER(Focus, (), NS_ERROR_NOT_INITIALIZED);
nsCOMPtr<nsIBaseWindow> baseWin = do_QueryInterface(mDocShell);
PRBool isVisible = PR_FALSE;
if (baseWin) {
baseWin->GetVisibility(&isVisible);
}
if (!isVisible) {
// A hidden tab is being focused, ignore this call.
return NS_OK;
}
/*
* If caller is not chrome and dom.disable_window_flip is true,
* prevent bringing a window to the front if the window is not the