Crash in WebCore::SubresourceLoader::releaseResources when connection fails
authorjaphet@chromium.org <japhet@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 29 May 2013 05:29:54 +0000 (05:29 +0000)
committerjaphet@chromium.org <japhet@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 29 May 2013 05:29:54 +0000 (05:29 +0000)
commit7f4ef55fdcdffcb248ff8c3687036a6f99a10b57
tree239bf069e0d3c55efb98c88938c1f41ce8ca50a3
parent13fd42f459c556dbffb099abf15ace3efd5c304f
Crash in WebCore::SubresourceLoader::releaseResources when connection fails
https://bugs.webkit.org/show_bug.cgi?id=87743

Don't do anything complicated in SubresourceLoader::releaseResources(),
just clear variables. With this patch, releaseResources() will still
assert in debug builds if it is called twice, but it will safely execute
in release.

Reviewed by Darin Adler.

* loader/ResourceLoader.cpp:
(WebCore::ResourceLoader::cleanupForError): Pull shared cleanup code out of didFail()
    and cancel() into a helper.
(WebCore::ResourceLoader::cancel): Merge a couple variables into an enum, check for
    reentrancy from within didCancel().
* loader/ResourceLoader.h: Replace m_calledWillCancel and m_cancelled with an enum.
* loader/SubresourceLoader.cpp:
(WebCore::SubresourceLoader::didFinishLoading): Don't call ResourceLoader::didFinishLoading(),
    put finish() in the middle of the process.
(WebCore::SubresourceLoader::didFail): Don't call ResourceLoader::didFail(), put finish()
    in the middle of the process.
(WebCore::SubresourceLoader::didCancel):
(WebCore::SubresourceLoader::notifyDone): Do the non-trivial work previous done in releaseResources(),
    most importantly calling loadDone().
(WebCore::SubresourceLoader::releaseResources): Only do simple variable clearing here.
* loader/SubresourceLoader.h:
(SubresourceLoader):
* loader/cache/CachedResource.cpp: Split stopLoading() into cancelLoad() (which notifies clients)
    and clearLoader() (which just nulls m_loader).
* loader/cache/CachedResource.h:
* loader/chromium/ResourceLoaderChromium.cpp:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@150867 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Source/WebCore/ChangeLog
Source/WebCore/loader/ResourceLoader.cpp
Source/WebCore/loader/ResourceLoader.h
Source/WebCore/loader/SubresourceLoader.cpp
Source/WebCore/loader/SubresourceLoader.h
Source/WebCore/loader/cache/CachedResource.cpp
Source/WebCore/loader/cache/CachedResource.h