From bfdaa330cc53766bb73b3ff788a3a61405a8239b Mon Sep 17 00:00:00 2001 From: mjs Date: Fri, 17 Jan 2003 01:43:56 +0000 Subject: [PATCH] Reviewed by Darin. - fixed 3144771 - Crash in KJS::WindowFunc::tryCall leaving www.smogcheck.org I fixed this by making sure we couldn't send the unload event twice, which was happening before in certain circumstances. * khtml/khtml_part.cpp: (KHTMLPart::closeURL): When emitting load event, note that unload event has not yet been sent. (KHTMLPart::checkEmitLoadEvent): Note when unload event has been sent to avoid sending it twice. * khtml/khtmlpart_p.h: git-svn-id: http://svn.webkit.org/repository/webkit/trunk@3343 268f45cc-cd09-0410-ab3c-d52691b4dbfc --- WebCore/ChangeLog-2003-10-25 | 16 ++++++++++++++++ WebCore/ChangeLog-2005-08-23 | 16 ++++++++++++++++ WebCore/khtml/khtml_part.cpp | 5 +++-- WebCore/khtml/khtmlpart_p.h | 2 ++ 4 files changed, 37 insertions(+), 2 deletions(-) diff --git a/WebCore/ChangeLog-2003-10-25 b/WebCore/ChangeLog-2003-10-25 index 4bbb933210e..31595ec7246 100644 --- a/WebCore/ChangeLog-2003-10-25 +++ b/WebCore/ChangeLog-2003-10-25 @@ -1,3 +1,19 @@ +2003-01-16 Maciej Stachowiak + + Reviewed by Darin. + + - fixed 3144771 - Crash in KJS::WindowFunc::tryCall leaving www.smogcheck.org + + I fixed this by making sure we couldn't send the unload event twice, which was + happening before in certain circumstances. + + * khtml/khtml_part.cpp: + (KHTMLPart::closeURL): When emitting load event, note that unload + event has not yet been sent. + (KHTMLPart::checkEmitLoadEvent): Note when unload event has been + sent to avoid sending it twice. + * khtml/khtmlpart_p.h: + 2003-01-16 Darin Adler Reviewed by John. diff --git a/WebCore/ChangeLog-2005-08-23 b/WebCore/ChangeLog-2005-08-23 index 4bbb933210e..31595ec7246 100644 --- a/WebCore/ChangeLog-2005-08-23 +++ b/WebCore/ChangeLog-2005-08-23 @@ -1,3 +1,19 @@ +2003-01-16 Maciej Stachowiak + + Reviewed by Darin. + + - fixed 3144771 - Crash in KJS::WindowFunc::tryCall leaving www.smogcheck.org + + I fixed this by making sure we couldn't send the unload event twice, which was + happening before in certain circumstances. + + * khtml/khtml_part.cpp: + (KHTMLPart::closeURL): When emitting load event, note that unload + event has not yet been sent. + (KHTMLPart::checkEmitLoadEvent): Note when unload event has been + sent to avoid sending it twice. + * khtml/khtmlpart_p.h: + 2003-01-16 Darin Adler Reviewed by John. diff --git a/WebCore/khtml/khtml_part.cpp b/WebCore/khtml/khtml_part.cpp index e33b5ff1122..fc791a476dd 100644 --- a/WebCore/khtml/khtml_part.cpp +++ b/WebCore/khtml/khtml_part.cpp @@ -501,11 +501,11 @@ bool KHTMLPart::closeURL() if ( d->m_doc && d->m_doc->isHTMLDocument() ) { HTMLDocumentImpl* hdoc = static_cast( d->m_doc ); - if ( hdoc->body() && d->m_bLoadEventEmitted ) { + if ( hdoc->body() && d->m_bLoadEventEmitted && !d->m_bUnloadEventEmitted ) { hdoc->body()->dispatchWindowEvent( EventImpl::UNLOAD_EVENT, false, false ); if ( d->m_doc ) d->m_doc->updateRendering(); - d->m_bLoadEventEmitted = false; + d->m_bUnloadEventEmitted = true; } } @@ -1715,6 +1715,7 @@ void KHTMLPart::checkEmitLoadEvent() } d->m_bLoadEventEmitted = true; + d->m_bUnloadEventEmitted = false; if (d->m_doc) d->m_doc->close(); } diff --git a/WebCore/khtml/khtmlpart_p.h b/WebCore/khtml/khtmlpart_p.h index 23b18685dbb..c86b834a069 100644 --- a/WebCore/khtml/khtmlpart_p.h +++ b/WebCore/khtml/khtmlpart_p.h @@ -106,6 +106,7 @@ public: m_job = 0L; m_bComplete = true; m_bLoadEventEmitted = true; + m_bUnloadEventEmitted = true; m_cachePolicy = KIO::CC_Verify; m_manager = 0L; m_settings = new KHTMLSettings(*KHTMLFactory::defaultHTMLSettings()); @@ -251,6 +252,7 @@ public: bool m_bComplete:1; bool m_bLoadEventEmitted:1; + bool m_bUnloadEventEmitted:1; bool m_haveEncoding:1; bool m_bHTTPRefresh:1; bool m_onlyLocalReferences :1; -- GitLab