Adding unload event during window closing.

git-svn-id: svn://10.0.0.236/trunk@31519 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
joki%netscape.com
1999-05-13 23:51:25 +00:00
parent 7972adcafd
commit e674affbbe
2 changed files with 38 additions and 0 deletions

View File

@@ -897,6 +897,25 @@ nsWebShell::Destroy()
{
nsresult rv = NS_OK;
//Fire unload event before we blow anything away.
if (nsnull != mScriptGlobal) {
nsIDocumentViewer* docViewer;
if (nsnull != mContentViewer &&
NS_OK == mContentViewer->QueryInterface(kIDocumentViewerIID, (void**)&docViewer)) {
nsIPresContext *presContext;
if (NS_OK == docViewer->GetPresContext(presContext)) {
nsEventStatus status = nsEventStatus_eIgnore;
nsMouseEvent event;
event.eventStructType = NS_EVENT;
event.message = NS_PAGE_UNLOAD;
rv = mScriptGlobal->HandleDOMEvent(*presContext, &event, nsnull, NS_EVENT_FLAG_INIT, status);
NS_RELEASE(presContext);
}
NS_RELEASE(docViewer);
}
}
// Stop any URLs that are currently being loaded...
Stop();