зеркало из https://github.com/mozilla/gecko-dev.git
Adding unload event during window closing.
This commit is contained in:
Родитель
664a8f2a93
Коммит
1ad14866a3
|
@ -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();
|
||||
|
||||
|
|
|
@ -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();
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче