Bug 331040 - Crash when removing parent iframe in onbeforunload handler. Patch by Feng Qian, r=bryner, sr=bzbarsky

git-svn-id: svn://10.0.0.236/trunk@193646 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
martijn.martijn%gmail.com
2006-04-05 23:57:30 +00:00
parent 973cf662d8
commit c5466a75d1
2 changed files with 13 additions and 4 deletions

View File

@@ -1150,15 +1150,15 @@ DocumentViewerImpl::PermitUnload(PRBool *aPermitUnload)
event.target = mDocument;
nsresult rv = NS_OK;
// In evil cases we might be destroyed while handling the
// onbeforeunload event, don't let that happen. (see also bug#331040)
nsRefPtr<DocumentViewerImpl> kungFuDeathGrip(this);
{
// Never permit popups from the beforeunload handler, no matter
// how we get here.
nsAutoPopupStatePusher popupStatePusher(openAbused, PR_TRUE);
// In evil cases we might be destroyed while handling the
// onbeforeunload event, don't let that happen.
nsRefPtr<DocumentViewerImpl> kungFuDeathGrip(this);
mInPermitUnload = PR_TRUE;
nsEventDispatcher::Dispatch(window, mPresContext, &event, nsnull, &status);
mInPermitUnload = PR_FALSE;