Title: [126325] trunk/Source/WebCore
Revision
126325
Author
[email protected]
Date
2012-08-22 11:44:37 -0700 (Wed, 22 Aug 2012)

Log Message

Failure to dispatch delegate callbacks if resource load fails synchronously
https://bugs.webkit.org/show_bug.cgi?id=94644

Reviewed by Antti Koivisto.

Resource loads can be triggered by layout after document load is
complete but before we have dispatched didFinishLoadForFrame callback.
In such cases, if the load fails synchronously due to the client
returning 0 from willSendRequest callback, we would fail to call
didFinishLoading. this was fixed for Font resources in r122446 for bug
91018. This fixes it in the general case by having CachedResourceLoader
call FrameLoader::checkLoadComplete() when it is done loading all
resources.

* css/CSSFontSelector.cpp:
(WebCore::CSSFontSelector::beginLoadTimerFired):
* loader/cache/CachedResourceLoader.cpp:
(WebCore::CachedResourceLoader::decrementRequestCount):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (126324 => 126325)


--- trunk/Source/WebCore/ChangeLog	2012-08-22 18:33:59 UTC (rev 126324)
+++ trunk/Source/WebCore/ChangeLog	2012-08-22 18:44:37 UTC (rev 126325)
@@ -1,3 +1,24 @@
+2012-08-22  Pratik Solanki  <[email protected]>
+
+        Failure to dispatch delegate callbacks if resource load fails synchronously
+        https://bugs.webkit.org/show_bug.cgi?id=94644
+
+        Reviewed by Antti Koivisto.
+
+        Resource loads can be triggered by layout after document load is
+        complete but before we have dispatched didFinishLoadForFrame callback.
+        In such cases, if the load fails synchronously due to the client
+        returning 0 from willSendRequest callback, we would fail to call
+        didFinishLoading. this was fixed for Font resources in r122446 for bug
+        91018. This fixes it in the general case by having CachedResourceLoader
+        call FrameLoader::checkLoadComplete() when it is done loading all
+        resources.
+
+        * css/CSSFontSelector.cpp:
+        (WebCore::CSSFontSelector::beginLoadTimerFired):
+        * loader/cache/CachedResourceLoader.cpp:
+        (WebCore::CachedResourceLoader::decrementRequestCount):
+
 2012-08-22  Kenneth Russell  <[email protected]>
 
         Unreviewed, rolling out r126319.

Modified: trunk/Source/WebCore/css/CSSFontSelector.cpp (126324 => 126325)


--- trunk/Source/WebCore/css/CSSFontSelector.cpp	2012-08-22 18:33:59 UTC (rev 126324)
+++ trunk/Source/WebCore/css/CSSFontSelector.cpp	2012-08-22 18:44:37 UTC (rev 126325)
@@ -589,10 +589,6 @@
     }
     // Ensure that if the request count reaches zero, the frame loader will know about it.
     cachedResourceLoader->loadDone();
-    // New font loads may be triggered by layout after the document load is complete but before we have dispatched
-    // didFinishLoading for the frame. Make sure the delegate is always dispatched by checking explicitly.
-    if (m_document && m_document->frame())
-        m_document->frame()->loader()->checkLoadComplete();
 }
 
 }

Modified: trunk/Source/WebCore/loader/cache/CachedResourceLoader.cpp (126324 => 126325)


--- trunk/Source/WebCore/loader/cache/CachedResourceLoader.cpp	2012-08-22 18:33:59 UTC (rev 126324)
+++ trunk/Source/WebCore/loader/cache/CachedResourceLoader.cpp	2012-08-22 18:44:37 UTC (rev 126325)
@@ -38,6 +38,7 @@
 #include "ContentSecurityPolicy.h"
 #include "DOMWindow.h"
 #include "Document.h"
+#include "DocumentLoader.h"
 #include "Frame.h"
 #include "FrameLoader.h"
 #include "FrameLoaderClient.h"
@@ -725,6 +726,12 @@
 
     --m_requestCount;
     ASSERT(m_requestCount > -1);
+
+    // New resource loads (e.g. font loads) may be triggered by layout after the document load is
+    // complete but before we have dispatched didFinishLoading for the frame. Make sure the delegate
+    // is always dispatched by checking explicitly once we are done loading all resources.
+    if (!m_requestCount && m_document && m_document->loader() && m_document->loader()->frameLoader())
+        m_document->loader()->frameLoader()->checkLoadComplete();
 }
     
 void CachedResourceLoader::preload(CachedResource::Type type, ResourceRequest& request, const String& charset, bool referencedFromBody)
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to