<rdar://problem/
3942428> reproducible crash loading cbs.sportsline.com
This change reverts the fix for <rdar://problem/
3805311>, and
re-fixes it in a different (better) way. Instead of preventing
programmatic open from setting the parsing flag, instead make sure
that programmatic close resets it.
* khtml/khtml_part.cpp:
(KHTMLPart::openURL):
(KHTMLPart::didExplicitOpen):
(KHTMLPart::closeURL):
(KHTMLPart::begin):
(KHTMLPart::end):
(KHTMLPart::endIfNotLoading):
(KHTMLPart::slotFinishedParsing):
(KHTMLPart::checkEmitLoadEvent):
* khtml/khtml_part.h:
* khtml/khtmlpart_p.h:
(KHTMLPartPrivate::KHTMLPartPrivate):
* khtml/xml/dom_docimpl.cpp:
(DocumentImpl::open):
(DocumentImpl::implicitOpen):
(DocumentImpl::close):
(DocumentImpl::implicitClose):
* khtml/xml/dom_docimpl.h:
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@8597
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2005-02-15 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Darin.
+
+ <rdar://problem/3942428> reproducible crash loading cbs.sportsline.com
+
+ This change reverts the fix for <rdar://problem/3805311>, and
+ re-fixes it in a different (better) way. Instead of preventing
+ programmatic open from setting the parsing flag, instead make sure
+ that programmatic close resets it.
+
+ * khtml/khtml_part.cpp:
+ (KHTMLPart::openURL):
+ (KHTMLPart::didExplicitOpen):
+ (KHTMLPart::closeURL):
+ (KHTMLPart::begin):
+ (KHTMLPart::end):
+ (KHTMLPart::endIfNotLoading):
+ (KHTMLPart::slotFinishedParsing):
+ (KHTMLPart::checkEmitLoadEvent):
+ * khtml/khtml_part.h:
+ * khtml/khtmlpart_p.h:
+ (KHTMLPartPrivate::KHTMLPartPrivate):
+ * khtml/xml/dom_docimpl.cpp:
+ (DocumentImpl::open):
+ (DocumentImpl::implicitOpen):
+ (DocumentImpl::close):
+ (DocumentImpl::implicitClose):
+ * khtml/xml/dom_docimpl.h:
+
2005-02-15 David Harrison <harrison@apple.com>
Reviewed by Maciej.
SLOT( slotRedirection(KIO::Job*,const KURL&) ) );
d->m_bComplete = false;
+ d->m_bLoadingMainResource = true;
d->m_bLoadEventEmitted = false;
// delete old status bar msg's from kjs (if it _was_ activated on last URL)
return true;
}
+void KHTMLPart::didExplicitOpen()
+{
+ d->m_bComplete = false;
+ d->m_bLoadEventEmitted = false;
+}
+
+
bool KHTMLPart::closeURL()
{
if ( d->m_job )
}
d->m_bComplete = true; // to avoid emitting completed() in slotFinishedParsing() (David)
+ d->m_bLoadingMainResource = false;
d->m_bLoadEventEmitted = true; // don't want that one either
d->m_cachePolicy = KIO::CC_Verify; // Why here?
d->m_cacheId = 0;
d->m_bComplete = false;
d->m_bLoadEventEmitted = false;
+ d->m_bLoadingMainResource = true;
if(url.isValid()) {
#if APPLE_CHANGES
d->m_doc->setRestoreState(args.docState);
#endif
- d->m_doc->openInternal();
- d->m_doc->setParsing(true);
+ d->m_doc->implicitOpen();
// clear widget
if (d->m_view)
d->m_view->resizeContents( 0, 0 );
#if !APPLE_CHANGES
emit d->m_extension->enableAction( "print", true );
#endif
-
- d->m_doc->setParsing(true);
}
void KHTMLPart::write( const char *str, int len )
void KHTMLPart::end()
{
+ d->m_bLoadingMainResource = false;
+ endIfNotLoading();
+}
+
+void KHTMLPart::endIfNotLoading()
+{
+ if (d->m_bLoadingMainResource)
+ return;
+
// make sure nothing's left in there...
if (d->m_decoder)
write(d->m_decoder->flush());
void KHTMLPart::slotFinishedParsing()
{
d->m_doc->setParsing(false);
- disconnect(d->m_doc,SIGNAL(finishedParsing()),this,SLOT(slotFinishedParsing()));
if (!d->m_view)
return; // We are probably being destructed.
d->m_bLoadEventEmitted = true;
d->m_bUnloadEventEmitted = false;
if (d->m_doc)
- d->m_doc->close();
+ d->m_doc->implicitClose();
}
const KHTMLSettings *KHTMLPart::settings() const
*/
virtual bool openURL( const KURL &url );
+ void didExplicitOpen();
+
/**
* Stops loading the document and kill all data requests (for images, etc.)
*/
*/
virtual void end();
+ void endIfNotLoading();
+
/**
* Similar to end, but called to abort a load rather than cleanly end.
*/
m_kjs_lib = 0;
m_job = 0L;
m_bComplete = true;
+ m_bLoadingMainResource = false;
m_bLoadEventEmitted = true;
m_bUnloadEventEmitted = true;
m_cachePolicy = KIO::CC_Verify;
#endif
bool m_bComplete:1;
+ bool m_bLoadingMainResource:1;
bool m_bLoadEventEmitted:1;
bool m_bUnloadEventEmitted:1;
bool m_haveEncoding:1;
{
if (parsing()) return;
- openInternal();
+ implicitOpen();
+
+ if (part()) {
+ part()->didExplicitOpen();
+ }
// This is work that we should probably do in clear(), but we can't have it
- // happen when openInternal() is called unless we reorganize KHTMLPart code.
+ // happen when implicitOpen() is called unless we reorganize KHTMLPart code.
setURL(QString());
DocumentImpl *parent = parentDocument();
setBaseURL(parent ? parent->baseURL() : QString());
}
-void DocumentImpl::openInternal()
+void DocumentImpl::implicitOpen()
{
if (m_tokenizer)
close();
clear();
m_tokenizer = createTokenizer();
connect(m_tokenizer,SIGNAL(finishedParsing()),this,SIGNAL(finishedParsing()));
+ setParsing(true);
if (m_view && m_view->part()->jScript()) {
m_view->part()->jScript()->setSourceFile(m_url,""); //fixme
}
void DocumentImpl::close()
+{
+ if (part())
+ part()->endIfNotLoading();
+ implicitClose();
+}
+
+void DocumentImpl::implicitClose()
{
// First fire the onload.
return;
}
- // The initial layout happens here.
- DocumentImpl::closeInternal(!doload);
-
+ if (doload) {
+ // on an explicit document.close(), the tokenizer might still be waiting on scripts,
+ // and in that case we don't want to destroy it because that will prevent the
+ // scripts from getting processed.
+ // FIXME: this check may no longer be necessary, since now it should be impossible
+ // for parsing to be false while stil waiting for scripts
+ if (m_tokenizer && !m_tokenizer->isWaitingForScripts()) {
+ delete m_tokenizer;
+ m_tokenizer = 0;
+ }
+
+ if (m_view)
+ m_view->part()->checkEmitLoadEvent();
+ }
+
// Now do our painting/layout, but only if we aren't in a subframe or if we're in a subframe
// that has been sized already. Otherwise, our view size would be incorrect, so doing any
// layout/painting now would be pointless.
}
}
-void DocumentImpl::closeInternal( bool checkTokenizer )
-{
- if (parsing() || (checkTokenizer && !m_tokenizer)) return;
-
- // on an explicit document.close(), the tokenizer might still be waiting on scripts,
- // and in that case we don't want to destroy it because that will prevent the
- // scripts from getting processed.
- if (m_tokenizer && !m_tokenizer->isWaitingForScripts()) {
- delete m_tokenizer;
- m_tokenizer = 0;
- }
-
- if (m_view)
- m_view->part()->checkEmitLoadEvent();
-}
-
void DocumentImpl::setParsing(bool b)
{
m_bParsing = b;
void updateSelection();
void open();
- void openInternal();
+ void implicitOpen();
void close();
- void closeInternal ( bool checkTokenizer );
+ void implicitClose();
void write ( const DOMString &text );
void write ( const QString &text );
void writeln ( const DOMString &text );