From dab814d4bb63a6f61e1227b83b48609e14a17729 Mon Sep 17 00:00:00 2001 From: adele Date: Fri, 27 May 2005 22:55:24 +0000 Subject: [PATCH] Reviewed by Darin. fix for Cannot log into Cingular.com account page (load event delivered while still processing incoming data) * khtml/misc/loader.cpp: (DocLoader::DocLoader): Initialized m_loadInProgress to false. (DocLoader::setLoadInProgress): Added. (Loader::slotFinished): sets the m_loadInProgress flag to reflect the fact that we're not really done loading this request until we emit the signal with the request status. (Loader::numRequests): If there's a load in progress, we increment the number of requests so it doesn't seem like the load is done. * khtml/misc/loader.h: (khtml::DocLoader::loadInProgress): Added. Test cases added: * layout-tests/fast/loader/loadInProgress.html: Added * layout-tests/fast/loader/loadInProgress-expected.html: Added git-svn-id: https://svn.webkit.org/repository/webkit/trunk@9226 268f45cc-cd09-0410-ab3c-d52691b4dbfc --- .../fast/loader/loadInProgress-expected.txt | 2 ++ LayoutTests/fast/loader/loadInProgress.html | 26 +++++++++++++++++++ WebCore/ChangeLog-2005-08-23 | 17 ++++++++++++ WebCore/khtml/misc/loader.cpp | 21 +++++++++++---- WebCore/khtml/misc/loader.h | 4 +++ 5 files changed, 65 insertions(+), 5 deletions(-) create mode 100644 LayoutTests/fast/loader/loadInProgress-expected.txt create mode 100644 LayoutTests/fast/loader/loadInProgress.html diff --git a/LayoutTests/fast/loader/loadInProgress-expected.txt b/LayoutTests/fast/loader/loadInProgress-expected.txt new file mode 100644 index 000000000000..30af02b2a61f --- /dev/null +++ b/LayoutTests/fast/loader/loadInProgress-expected.txt @@ -0,0 +1,2 @@ +ALERT: Test passed: [object FORM] + diff --git a/LayoutTests/fast/loader/loadInProgress.html b/LayoutTests/fast/loader/loadInProgress.html new file mode 100644 index 000000000000..c510671cd01d --- /dev/null +++ b/LayoutTests/fast/loader/loadInProgress.html @@ -0,0 +1,26 @@ + + + + + + + +
+ +
+ + diff --git a/WebCore/ChangeLog-2005-08-23 b/WebCore/ChangeLog-2005-08-23 index 756ba0676886..35c2b1bdf979 100644 --- a/WebCore/ChangeLog-2005-08-23 +++ b/WebCore/ChangeLog-2005-08-23 @@ -1,3 +1,20 @@ +2005-05-27 Adele Peterson + + Reviewed by Darin. + + fix for Cannot log into Cingular.com account page (load event delivered while still processing incoming data) + + * khtml/misc/loader.cpp: + (DocLoader::DocLoader): Initialized m_loadInProgress to false. + (DocLoader::setLoadInProgress): Added. + (Loader::slotFinished): sets the m_loadInProgress flag to reflect the fact that we're not really done loading this request until we emit the signal with the request status. + (Loader::numRequests): If there's a load in progress, we increment the number of requests so it doesn't seem like the load is done. + * khtml/misc/loader.h: (khtml::DocLoader::loadInProgress): Added. + + Test cases added: + * layout-tests/fast/loader/loadInProgress.html: Added + * layout-tests/fast/loader/loadInProgress-expected.html: Added + 2005-05-27 Darin Adler Reviewed by Vicki. diff --git a/WebCore/khtml/misc/loader.cpp b/WebCore/khtml/misc/loader.cpp index d548d38c6df4..24a008a4b310 100644 --- a/WebCore/khtml/misc/loader.cpp +++ b/WebCore/khtml/misc/loader.cpp @@ -1257,6 +1257,7 @@ DocLoader::DocLoader(KHTMLPart* part, DocumentImpl* doc) m_showAnimations = KHTMLSettings::KAnimationEnabled; m_part = part; m_doc = doc; + m_loadInProgress = false; #if APPLE_CHANGES Cache::init(); @@ -1469,6 +1470,11 @@ void DocLoader::removeCachedObject( CachedObject* o ) const m_docObjects.removeRef( o ); } +void DocLoader::setLoadInProgress(bool load) +{ + m_loadInProgress = load; +} + // ------------------------------------------------------------------------------------------ Loader::Loader() : QObject() @@ -1571,7 +1577,7 @@ void Loader::slotFinished( KIO::Job* job) if ( !r ) return; - + if (j->error() || j->isErrorPage()) { kdDebug(6060) << "Loader::slotFinished, with error. job->error()= " << j->error() << " job->isErrorPage()=" << j->isErrorPage() << endl; @@ -1580,8 +1586,7 @@ void Loader::slotFinished( KIO::Job* job) } else { - r->object->data(r->m_buffer, true); - + r->object->data(r->m_buffer, true); emit requestDone( r->m_docLoader, r->object ); time_t expireDate = j->queryMetaData("expire-date").toLong(); kdDebug(6060) << "Loader::slotFinished, url = " << j->url().url() << " expires " << ctime(&expireDate) << endl; @@ -1620,16 +1625,19 @@ void Loader::slotFinished( KIO::Job* job, NSData *allData) callback->handleError(); } else { + docLoader->setLoadInProgress(true); r->object->error( job->error(), job->errorText().ascii() ); + docLoader->setLoadInProgress(false); emit requestFailed( docLoader, object ); Cache::removeCacheEntry( object ); } } else { + docLoader->setLoadInProgress(true); object->data(r->m_buffer, true); - r->object->setAllData(allData); - + docLoader->setLoadInProgress(false); + // Let the background image decoder trigger the done signal. if (!backgroundImageDecoding) emit requestDone( docLoader, object ); @@ -1706,6 +1714,9 @@ int Loader::numRequests( DocLoader* dl ) const res++; #endif + if (dl->loadInProgress()) + res++; + return res; } diff --git a/WebCore/khtml/misc/loader.h b/WebCore/khtml/misc/loader.h index ac1a6a070186..64d9c1628eae 100644 --- a/WebCore/khtml/misc/loader.h +++ b/WebCore/khtml/misc/loader.h @@ -491,6 +491,9 @@ protected: void setCachePolicy( KIO::CacheControl cachePolicy ); void setShowAnimations( KHTMLSettings::KAnimationAdvice ); void removeCachedObject( CachedObject*) const; + + void setLoadInProgress(bool); + bool loadInProgress() const { return m_loadInProgress; } private: bool needReload(const KURL &fullUrl); @@ -506,6 +509,7 @@ protected: KHTMLSettings::KAnimationAdvice m_showAnimations : 2; KHTMLPart* m_part; DOM::DocumentImpl* m_doc; + bool m_loadInProgress; }; /** -- 2.36.0