WebCore:
authorandersca <andersca@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 20 Jun 2007 00:23:48 +0000 (00:23 +0000)
committerandersca <andersca@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 20 Jun 2007 00:23:48 +0000 (00:23 +0000)
        Reviewed by Kevin Decker.

        <rdar://problem/5266289> REGRESSION (Safari 3 Beta 1): Incoming iChat messages are delayed

        Add a new m_deferMainResourceDataLoad that can be used to control whether a data load should be deferred using a timer or not.

        * loader/DocumentLoader.cpp:
        (WebCore::DocumentLoader::DocumentLoader):
        * loader/DocumentLoader.h:
        (WebCore::DocumentLoader::deferMainResourceDataLoad):
        * loader/MainResourceLoader.cpp:
        (WebCore::MainResourceLoader::handleDataLoadSoon):
        (WebCore::MainResourceLoader::loadNow):
        (WebCore::MainResourceLoader::setDefersLoading):

WebKit:

        Reviewed by Kevin Decker.

        <rdar://problem/5266289> REGRESSION (Safari 3 Beta 1): Incoming iChat messages are delayed

        * WebView/WebDocumentLoaderMac.mm:
        (needsAppKitWorkaround):
        New function which checks if the frame load delegate belongs to AppKit.

        (WebDocumentLoaderMac::setDataSource):
        If the frame load delegate belongs to AppKit, set m_deferMainResourceDataLoad to false.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@23627 268f45cc-cd09-0410-ab3c-d52691b4dbfc

WebCore/ChangeLog
WebCore/loader/DocumentLoader.cpp
WebCore/loader/DocumentLoader.h
WebCore/loader/MainResourceLoader.cpp
WebKit/ChangeLog
WebKit/WebKit.xcodeproj/project.pbxproj
WebKit/WebView/WebDocumentLoaderMac.mm

index 90538248e01dc1bcfff54574f70adbd6b855b85c..45b89fec98948a2038cd72c91b51827cb221750d 100644 (file)
@@ -1,3 +1,20 @@
+2007-06-19  Anders Carlsson  <andersca@apple.com>
+
+        Reviewed by Kevin Decker.
+
+        <rdar://problem/5266289> REGRESSION (Safari 3 Beta 1): Incoming iChat messages are delayed
+        
+        Add a new m_deferMainResourceDataLoad that can be used to control whether a data load should be deferred using a timer or not.
+        
+        * loader/DocumentLoader.cpp:
+        (WebCore::DocumentLoader::DocumentLoader):
+        * loader/DocumentLoader.h:
+        (WebCore::DocumentLoader::deferMainResourceDataLoad):
+        * loader/MainResourceLoader.cpp:
+        (WebCore::MainResourceLoader::handleDataLoadSoon):
+        (WebCore::MainResourceLoader::loadNow):
+        (WebCore::MainResourceLoader::setDefersLoading):
+
 2007-06-19  Patti Hoa <patti@apple.com>
 
         Reviewed by Justin Garcia.
index bde68113ec8c9ce96509f2d417f4398cb44741ca..40bcf7444a0540c90d41f61351fa6ff0f869a84f 100644 (file)
@@ -121,7 +121,8 @@ static void setAllDefersLoading(const ResourceLoaderSet& loaders, bool defers)
 }
 
 DocumentLoader::DocumentLoader(const ResourceRequest& req, const SubstituteData& substituteData)
-    : m_frame(0)
+    : m_deferMainResourceDataLoad(true)
+    , m_frame(0)
     , m_originalRequest(req)
     , m_substituteData(substituteData)
     , m_originalRequestCopy(req)
index ae228e9d18af1937811c799702242e1be0871300..c312d2e6f4b8aac45d40c5e5da5fe7186fb20b74 100644 (file)
@@ -150,6 +150,10 @@ namespace WebCore {
 
         void subresourceLoaderFinishedLoadingOnePart(ResourceLoader*);
         
+        bool deferMainResourceDataLoad() const { return m_deferMainResourceDataLoad; }
+    protected:
+        bool m_deferMainResourceDataLoad;
+
     private:
         void setupForReplace();
         void commitIfReady();
index 2feaa01fcc6a8db12820ebab428a0d161a18edba..19bb811317a59444b119ef8453af81fba3e050a9 100644 (file)
@@ -338,7 +338,11 @@ void MainResourceLoader::handleDataLoadNow(Timer<MainResourceLoader>*)
 void MainResourceLoader::handleDataLoadSoon(ResourceRequest& r)
 {
     m_initialRequest = r;
-    m_dataLoadTimer.startOneShot(0);
+    
+    if (m_documentLoader->deferMainResourceDataLoad())
+        m_dataLoadTimer.startOneShot(0);
+    else
+        handleDataLoadNow(0);
 }
 
 bool MainResourceLoader::loadNow(ResourceRequest& r)
@@ -364,7 +368,7 @@ bool MainResourceLoader::loadNow(ResourceRequest& r)
     if (shouldLoadEmptyBeforeRedirect && !shouldLoadEmpty && defersLoading())
         return true;
 
-    if (m_substituteData.isValid())
+    if (m_substituteData.isValid()) 
         handleDataLoadSoon(r);
     else if (shouldLoadEmpty || frameLoader()->representationExistsForURLScheme(url.protocol()))
         handleEmptyLoad(url, !shouldLoadEmpty);
@@ -411,8 +415,9 @@ void MainResourceLoader::setDefersLoading(bool defers)
         if (m_initialRequest.isNull())
             return;
         
-        if (m_substituteData.isValid())
-            m_dataLoadTimer.startOneShot(0);
+        if (m_substituteData.isValid() &&
+            m_documentLoader->deferMainResourceDataLoad())
+                m_dataLoadTimer.startOneShot(0);
         else {
             ResourceRequest r(m_initialRequest);
             m_initialRequest = ResourceRequest();
index 0056d1d0a9d7d551a270d4d03379d11f483aad17..41a3431c6b4eab01b266f4d41cc9bbc758eefe58 100644 (file)
@@ -1,3 +1,16 @@
+2007-06-19  Anders Carlsson  <andersca@apple.com>
+
+        Reviewed by Kevin Decker.
+
+        <rdar://problem/5266289> REGRESSION (Safari 3 Beta 1): Incoming iChat messages are delayed
+
+        * WebView/WebDocumentLoaderMac.mm:
+        (needsAppKitWorkaround):
+        New function which checks if the frame load delegate belongs to AppKit.
+        
+        (WebDocumentLoaderMac::setDataSource):
+        If the frame load delegate belongs to AppKit, set m_deferMainResourceDataLoad to false.
+
 2007-06-19  John Sullivan  <sullivan@apple.com>
 
         Reviewed by Tim Hatcher
index 1c8021f638e44d645bfe1f01900e3d7e6a3a3590..fb86ae98dd9ab2e12909acfad8191f0c6fe21040 100644 (file)
                0867D690FE84028FC02AAC07 /* Project object */ = {
                        isa = PBXProject;
                        buildConfigurationList = 149C283208902B0F008A9EFC /* Build configuration list for PBXProject "WebKit" */;
-                       compatibilityVersion = "Xcode 2.4";
                        hasScannedForEncodings = 1;
                        knownRegions = (
                                English,
index 4ab330ea9cf94e8becbb7e5185b07634b82215fa..0b1e64079957651ba11fda06f943ea0fe69f6759 100644 (file)
@@ -43,7 +43,21 @@ WebDocumentLoaderMac::WebDocumentLoaderMac(const ResourceRequest& request, const
 {
 }
 
-void WebDocumentLoaderMac::setDataSource(WebDataSource *dataSource, WebView* webView)
+static inline bool needsAppKitWorkaround(WebView *webView)
+{
+#ifndef BUILDING_ON_TIGER
+    return false;
+#else    
+    id frameLoadDelegate = [webView frameLoadDelegate];
+    if (!frameLoadDelegate)
+        return false;
+    
+    NSString *bundleIdentifier = [[NSBundle bundleForClass:[frameLoadDelegate class]] bundleIdentifier];
+    return [bundleIdentifier isEqualToString:@"com.apple.AppKit"];
+#endif
+}
+
+void WebDocumentLoaderMac::setDataSource(WebDataSource *dataSource, WebView *webView)
 {
     ASSERT(!m_dataSource);
     HardRetain(dataSource);
@@ -51,6 +65,11 @@ void WebDocumentLoaderMac::setDataSource(WebDataSource *dataSource, WebView* web
     
     m_resourceLoadDelegate = [webView resourceLoadDelegate];
     m_downloadDelegate = [webView downloadDelegate];
+    
+    // Possibly work around a bug in Tiger AppKit where timers do not fire sometimes
+    // See <rdar://problem/5266289>
+    if (needsAppKitWorkaround(webView))
+        m_deferMainResourceDataLoad = false;
 }
 
 WebDataSource *WebDocumentLoaderMac::dataSource() const