Index: Source/WebCore/loader/cache/CachedResource.cpp |
=================================================================== |
--- Source/WebCore/loader/cache/CachedResource.cpp (revision 105796) |
+++ Source/WebCore/loader/cache/CachedResource.cpp (working copy) |
@@ -139,6 +139,7 @@ |
, m_requestedFromNetworkingLayer(false) |
, m_inCache(false) |
, m_loading(false) |
+ , m_switchingClientsToRevalidatedResource(false) |
, m_type(type) |
, m_status(Pending) |
#ifndef NDEBUG |
@@ -520,6 +521,9 @@ |
void CachedResource::clearResourceToRevalidate() |
{ |
ASSERT(m_resourceToRevalidate); |
+ if (m_switchingClientsToRevalidatedResource) |
+ return; |
+ |
// A resource may start revalidation before this method has been called, so check that this resource is still the proxy resource before clearing it out. |
if (m_resourceToRevalidate->m_proxyResource == this) { |
m_resourceToRevalidate->m_proxyResource = 0; |
@@ -538,6 +542,7 @@ |
LOG(ResourceLoading, "CachedResource %p switchClientsToRevalidatedResource %p", this, m_resourceToRevalidate); |
+ m_switchingClientsToRevalidatedResource = true; |
HashSet<CachedResourceHandleBase*>::iterator end = m_handlesToRevalidate.end(); |
for (HashSet<CachedResourceHandleBase*>::iterator it = m_handlesToRevalidate.begin(); it != end; ++it) { |
CachedResourceHandleBase* handle = *it; |
@@ -565,10 +570,14 @@ |
for (unsigned n = 0; n < moveCount; ++n) |
m_resourceToRevalidate->addClientToSet(clientsToMove[n]); |
for (unsigned n = 0; n < moveCount; ++n) { |
+ // Calling didAddClient may do anything, including trying to cancel revalidation. |
+ // Assert that it didn't succeed. |
+ ASSERT(m_resourceToRevalidate); |
// Calling didAddClient for a client may end up removing another client. In that case it won't be in the set anymore. |
if (m_resourceToRevalidate->m_clients.contains(clientsToMove[n])) |
m_resourceToRevalidate->didAddClient(clientsToMove[n]); |
} |
+ m_switchingClientsToRevalidatedResource = false; |
} |
void CachedResource::updateResponseAfterRevalidation(const ResourceResponse& validatingResponse) |