Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(302)

Unified Diff: Source/WebCore/loader/DocumentThreadableLoader.cpp

Issue 10765006: Merge 120845 (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/1132/
Patch Set: Created 8 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « LayoutTests/http/tests/xmlhttprequest/reentrant-cancel-expected.txt ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/WebCore/loader/DocumentThreadableLoader.cpp
===================================================================
--- Source/WebCore/loader/DocumentThreadableLoader.cpp (revision 122143)
+++ Source/WebCore/loader/DocumentThreadableLoader.cpp (working copy)
@@ -146,7 +146,8 @@
void DocumentThreadableLoader::cancel()
{
- if (m_client) {
+ // Cacnel can re-enter and m_resource might be null here as a result.
+ if (m_client && m_resource) {
ResourceError error(errorDomainWebKitInternal, 0, m_resource->url(), "Load cancelled");
error.setIsCancellation(true);
didFail(error);
@@ -163,9 +164,13 @@
void DocumentThreadableLoader::clearResource()
{
- if (m_resource) {
- m_resource->removeClient(this);
+ // Script can cancel and restart a request reentrantly within removeClient(),
+ // which could lead to calling CachedResource::removeClient() multiple times for
+ // this DocumentThreadableLoader. Save off a copy of m_resource and clear it to
+ // prevent the reentrancy.
+ if (CachedResourceHandle<CachedRawResource> resource = m_resource) {
m_resource = 0;
+ resource->removeClient(this);
}
}
« no previous file with comments | « LayoutTests/http/tests/xmlhttprequest/reentrant-cancel-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698