http://bugs.webkit.org/show_bug.cgi?id=11554
Fix the above bug (in didFinishLoading) and also another potential bug in didFailWithError
in case the icon load fails after some data has been received.
* loader/icon/IconLoader.cpp:
(WebCore::IconLoader::didFailWithError): Clear the buffer so half-an-image isn't commited to the DB
on error. Also, as a loader re-factoring sanity check, added an assertion
(WebCore::IconLoader::didFinishLoading): If an icon loader resulted in an error-response, the icon
is already committed to the DB. Skip doing that step twice.
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@17702
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2006-11-10 Brady Eidson <beidson@apple.com>
+
+ Reviewed by Mitz
+
+ http://bugs.webkit.org/show_bug.cgi?id=11554
+ Fix the above bug (in didFinishLoading) and also another potential bug in didFailWithError
+ in case the icon load fails after some data has been received.
+
+ * loader/icon/IconLoader.cpp:
+ (WebCore::IconLoader::didFailWithError): Clear the buffer so half-an-image isn't commited to the DB
+ on error. Also, as a loader re-factoring sanity check, added an assertion
+ (WebCore::IconLoader::didFinishLoading): If an icon loader resulted in an error-response, the icon
+ is already committed to the DB. Skip doing that step twice.
+
2006-11-09 Oliver Hunt <oliver@apple.com>
Reviewed by Brady.
void IconLoader::didFailWithError(ResourceHandle* handle, const ResourceError&)
{
+ ASSERT(m_loadIsInProgress);
+ m_buffer.clear();
finishLoading(handle->url());
}
void IconLoader::didFinishLoading(ResourceHandle* handle)
{
- ASSERT(handle == m_handle);
- finishLoading(handle->url());
+ // If the icon load resulted in an error-response earlier, the ResourceHandle was killed and icon data commited via finishLoading().
+ // In that case this didFinishLoading callback is pointless and we bail. Otherwise, finishLoading() as expected
+ if (m_loadIsInProgress) {
+ ASSERT(handle == m_handle);
+ finishLoading(handle->url());
+ }
}
void IconLoader::finishLoading(const KURL& iconURL)