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

Unified Diff: third_party/WebKit/Source/core/loader/DocumentLoader.cpp

Issue 2563423004: Always send a fail or finish notification for each navigation. (Closed)
Patch Set: Rebase Created 4 years 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
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 fb1e5eaeec63d178ac5092fb5ae2c4efadee3352..7328e4995ea61c863ae934427b1c18dea2be2ccf 100644
--- a/third_party/WebKit/Source/core/loader/DocumentLoader.cpp
+++ b/third_party/WebKit/Source/core/loader/DocumentLoader.cpp
@@ -132,6 +132,7 @@ DocumentLoader::~DocumentLoader() {
DCHECK(!m_frame);
DCHECK(!m_mainResource);
DCHECK(!m_applicationCacheHost);
+ DCHECK_EQ(m_state, SentDidFinishLoad);
}
DEFINE_TRACE(DocumentLoader) {
@@ -285,7 +286,6 @@ void DocumentLoader::notifyFinished(Resource* resource) {
if (m_applicationCacheHost)
m_applicationCacheHost->failedLoadingMainResource();
- m_state = MainResourceDone;
if (m_mainResource->resourceError().wasBlockedByResponse()) {
InspectorInstrumentation::canceledAfterReceivedResourceResponse(
@@ -326,8 +326,6 @@ void DocumentLoader::finishedLoading(double finishTime) {
m_applicationCacheHost->finishedLoadingMainResource();
endWriting();
- if (m_state < MainResourceDone)
- m_state = MainResourceDone;
clearMainResourceHandle();
// Shows the deprecation message and measures the impact of the new security
@@ -551,7 +549,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
@@ -633,6 +631,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()));
+
// If that load cancellation triggered another detach, leave.
// (fast/frames/detach-frame-nested-no-crash.html is an example of this.)
if (!m_frame)

Powered by Google App Engine
This is Rietveld 408576698