Commit fd506b0a authored by Nate Chapin's avatar Nate Chapin Committed by Commit Bot

Fix detach with open()ed document leaving parent loading indefinitely

Change-Id: I26c2a054b9f1e5eb076acd677e1223058825f6d6

Bug: 803416
Test: fast/loader/document-open-iframe-then-detach.html
Change-Id: I26c2a054b9f1e5eb076acd677e1223058825f6d6
Reviewed-on: https://chromium-review.googlesource.com/887298Reviewed-by: default avatarMike West <mkwst@chromium.org>
Commit-Queue: Nate Chapin <japhet@chromium.org>
Cr-Commit-Position: refs/heads/master@{#532967}
parent 91310914
PASS if no timeout.
<iframe id="i"></iframe>
<script>
if (window.testRunner)
testRunner.dumpAsText();
i.contentDocument.open();
setTimeout(function() {
i.remove();
}, 0);
</script>
......@@ -773,14 +773,15 @@ void DocumentLoader::AppendRedirect(const KURL& url) {
redirect_chain_.push_back(url);
}
void DocumentLoader::DetachFromFrame() {
DCHECK(frame_);
// It never makes sense to have a document loader that is detached from its
// frame have any loads active, so go ahead and kill all the loads.
void DocumentLoader::StopLoading() {
fetcher_->StopFetching();
if (frame_ && !SentDidFinishLoad())
LoadFailed(ResourceError::CancelledError(Url()));
}
void DocumentLoader::DetachFromFrame() {
DCHECK(frame_);
StopLoading();
fetcher_->ClearContext();
// If that load cancellation triggered another detach, leave.
......
......@@ -172,6 +172,7 @@ class CORE_EXPORT DocumentLoader
HistoryItem* GetHistoryItem() const { return history_item_; }
void StartLoading();
void StopLoading();
DocumentLoadTiming& GetTiming() { return document_load_timing_; }
const DocumentLoadTiming& GetTiming() const { return document_load_timing_; }
......
......@@ -988,7 +988,7 @@ void FrameLoader::StopAllLoaders() {
if (in_stop_all_loaders_)
return;
in_stop_all_loaders_ = true;
AutoReset<bool> in_stop_all_loaders(&in_stop_all_loaders_, true);
for (Frame* child = frame_->Tree().FirstChild(); child;
child = child->Tree().NextSibling()) {
......@@ -998,21 +998,11 @@ void FrameLoader::StopAllLoaders() {
frame_->GetDocument()->CancelParsing();
if (document_loader_)
document_loader_->Fetcher()->StopFetching();
document_loader_->StopLoading();
if (!protect_provisional_loader_)
DetachDocumentLoader(provisional_document_loader_);
frame_->GetNavigationScheduler().Cancel();
// It's possible that the above actions won't have stopped loading if load
// completion had been blocked on parsing or if we were in the middle of
// committing an empty document. In that case, emulate a failed navigation.
if (document_loader_ && !document_loader_->SentDidFinishLoad()) {
document_loader_->LoadFailed(
ResourceError::CancelledError(document_loader_->Url()));
}
in_stop_all_loaders_ = false;
DidFinishNavigation();
TakeObjectSnapshot();
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment