stifle infinite focus/activation recursion. bug 124299 r=hyatt,jst

This commit is contained in:
danm%netscape.com 2002-02-08 01:01:21 +00:00
Родитель 6b24a50e0a
Коммит 7b2e210da6
2 изменённых файлов: 10 добавлений и 0 удалений

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

@ -79,6 +79,7 @@ static NS_DEFINE_CID(kLookAndFeelCID, NS_LOOKANDFEEL_CID);
nsWebBrowser::nsWebBrowser() : mDocShellTreeOwner(nsnull),
mInitInfo(nsnull),
mContentType(typeContentWrapper),
mActivating(PR_FALSE),
mParentNativeWindow(nsnull),
mProgressListener(nsnull),
mBackgroundColor(0),
@ -1605,6 +1606,13 @@ NS_IMETHODIMP nsWebBrowser::GetPrimaryContentWindow(nsIDOMWindowInternal **aDOMW
/* void activate (); */
NS_IMETHODIMP nsWebBrowser::Activate(void)
{
// stop infinite recursion from windows with onfocus handlers that
// reactivate the window
if (mActivating)
return NS_OK;
mActivating = PR_TRUE;
// try to set focus on the last focused window as stored in the
// focus controller object.
nsCOMPtr<nsIDOMWindow> domWindowExternal;
@ -1664,6 +1672,7 @@ NS_IMETHODIMP nsWebBrowser::Activate(void)
}
}
mActivating = PR_FALSE;
return NS_OK;
}

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

@ -137,6 +137,7 @@ protected:
nsCOMPtr<nsIWindowWatcher> mWWatch;
nsWebBrowserInitInfo* mInitInfo;
PRUint32 mContentType;
PRBool mActivating;
nativeWindow mParentNativeWindow;
nsIWebProgressListener *mProgressListener;
nsCOMPtr<nsIWebProgress> mWebProgress;