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 e3a8c51eae71d0c0d750835cbf63215175798993..1f4d1f494e8326fe82901d9c4fc13026dff0bd7a 100644 |
--- a/third_party/WebKit/Source/core/loader/DocumentLoader.cpp |
+++ b/third_party/WebKit/Source/core/loader/DocumentLoader.cpp |
@@ -402,23 +402,31 @@ void DocumentLoader::LoadFailed(const ResourceError& error) { |
} |
HistoryCommitType history_commit_type = LoadTypeToCommitType(load_type_); |
- FrameLoader& loader = GetFrameLoader(); |
- if (state_ < kCommitted) { |
- if (state_ == kNotStarted) |
+ switch (state_) { |
+ case kNotStarted: |
probe::frameClearedScheduledClientNavigation(frame_); |
- state_ = kSentDidFinishLoad; |
- GetLocalFrameClient().DispatchDidFailProvisionalLoad(error, |
- history_commit_type); |
- if (!frame_) |
- return; |
- loader.DetachProvisionalDocumentLoader(this); |
- } else if (state_ == kCommitted) { |
- if (frame_->GetDocument()->Parser()) |
- frame_->GetDocument()->Parser()->StopParsing(); |
- state_ = kSentDidFinishLoad; |
- GetLocalFrameClient().DispatchDidFailLoad(error, history_commit_type); |
+ // Fall-through |
+ case kProvisional: |
+ state_ = kSentDidFinishLoad; |
+ GetLocalFrameClient().DispatchDidFailProvisionalLoad(error, |
+ history_commit_type); |
+ if (frame_) |
+ GetFrameLoader().DetachProvisionalDocumentLoader(this); |
+ break; |
+ case kCommitted: |
+ if (frame_->GetDocument()->Parser()) |
+ frame_->GetDocument()->Parser()->StopParsing(); |
+ state_ = kSentDidFinishLoad; |
+ GetLocalFrameClient().DispatchDidFailLoad(error, history_commit_type); |
+ if (frame_) |
+ frame_->GetDocument()->CheckCompleted(); |
+ break; |
+ case kSentDidFinishLoad: |
+ // TODO(japhet): Why do we need to call DidFinishNavigation() again? |
+ GetFrameLoader().DidFinishNavigation(); |
+ break; |
} |
- loader.CheckCompleted(); |
+ DCHECK_EQ(kSentDidFinishLoad, state_); |
} |
void DocumentLoader::FinishedLoading(double finish_time) { |