Index: third_party/WebKit/Source/core/loader/DocumentLoader.cpp |
diff --git a/third_party/WebKit/Source/core/loader/DocumentLoader.cpp b/third_party/WebKit/Source/core/loader/DocumentLoader.cpp |
index cd0ad37635b8179069d1bfc7e22ee43e7f2f4497..9e7d9aab88292d096812dacfe2d77a67a7e6974c 100644 |
--- a/third_party/WebKit/Source/core/loader/DocumentLoader.cpp |
+++ b/third_party/WebKit/Source/core/loader/DocumentLoader.cpp |
@@ -131,6 +131,7 @@ DocumentLoader::~DocumentLoader() { |
DCHECK(!m_frame); |
DCHECK(!m_mainResource); |
DCHECK(!m_applicationCacheHost); |
+ DCHECK_EQ(m_state, SentDidFinishLoad); |
} |
DEFINE_TRACE(DocumentLoader) { |
@@ -280,7 +281,6 @@ void DocumentLoader::notifyFinished(Resource* resource) { |
if (m_applicationCacheHost) |
m_applicationCacheHost->failedLoadingMainResource(); |
- m_state = MainResourceDone; |
frameLoader()->loadFailed(this, m_mainResource->resourceError()); |
clearMainResourceHandle(); |
} |
@@ -314,8 +314,6 @@ void DocumentLoader::finishedLoading(double finishTime) { |
m_applicationCacheHost->finishedLoadingMainResource(); |
endWriting(); |
- if (m_state < MainResourceDone) |
- m_state = MainResourceDone; |
clearMainResourceHandle(); |
} |
@@ -550,7 +548,7 @@ void DocumentLoader::ensureWriter(const AtomicString& mimeType, |
} |
void DocumentLoader::commitData(const char* bytes, size_t length) { |
- DCHECK_LT(m_state, MainResourceDone); |
+ DCHECK_EQ(m_state, Committed); |
ensureWriter(m_response.mimeType()); |
// This can happen if document.close() is called by an event handler while |
@@ -632,6 +630,9 @@ void DocumentLoader::detachFromFrame() { |
// frame have any loads active, so go ahead and kill all the loads. |
m_fetcher->stopFetching(); |
+ if (frameLoader() && !sentDidFinishLoad()) |
+ frameLoader()->loadFailed(this, ResourceError::cancelledError(url())); |
Nate Chapin
2016/12/12 21:40:37
This feels a little hacky, but it ensures we alway
gsennton
2016/12/13 13:59:55
I'm not sure I understand when we should receive a
|
+ |
// If that load cancellation triggered another detach, leave. |
// (fast/frames/detach-frame-nested-no-crash.html is an example of this.) |
if (!m_frame) |