Reviewed by Darin.
authoradele <adele@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 27 May 2005 22:55:24 +0000 (22:55 +0000)
committeradele <adele@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 27 May 2005 22:55:24 +0000 (22:55 +0000)
        fix for <rdar://problem/4121747> 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

LayoutTests/fast/loader/loadInProgress-expected.txt [new file with mode: 0644]
LayoutTests/fast/loader/loadInProgress.html [new file with mode: 0644]
WebCore/ChangeLog-2005-08-23
WebCore/khtml/misc/loader.cpp
WebCore/khtml/misc/loader.h

diff --git a/LayoutTests/fast/loader/loadInProgress-expected.txt b/LayoutTests/fast/loader/loadInProgress-expected.txt
new file mode 100644 (file)
index 0000000..30af02b
--- /dev/null
@@ -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 (file)
index 0000000..c510671
--- /dev/null
@@ -0,0 +1,26 @@
+<html>
+    <head>
+        <link rel="stylesheet" href="fake.css" type="text/css" >
+        <script>       
+                if (window.layoutTestController) {
+                    layoutTestController.dumpAsText();
+                }
+                function testForm() {
+                    if (document.LoginForm)
+                    {
+                        alert("Test passed: " + document.LoginForm);
+                    }
+                    else
+                    {
+                        alert("Test failed: " + document.LoginForm);
+                    }
+                }
+        </script>
+    </head>
+
+<body onLoad="testForm();">
+<form name="LoginForm"> 
+<embed src="" type="application/x-shockwave-flash"></embed>
+</form>                        
+</body>
+</html>
index 756ba06768868e4a99bcac1487576c0d25f4d4b5..35c2b1bdf979c7ac450adcc7511fe4e150b7afdf 100644 (file)
@@ -1,3 +1,20 @@
+2005-05-27  Adele Peterson  <adele@apple.com>
+
+        Reviewed by Darin.
+
+        fix for <rdar://problem/4121747> 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  <darin@apple.com>
 
         Reviewed by Vicki.
index d548d38c6df4a3ec0ce26d2a9755119f61590f0a..24a008a4b310aba7f1e0568967cd68941b4874f3 100644 (file)
@@ -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;
 }
 
index ac1a6a070186b7ef0dcc5c0a21fbcef81248b9f1..64d9c1628eaeab59d7781c89017ef4f62b4e766f 100644 (file)
@@ -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;
     };
 
     /**