0

TestRunner: Remove deactivated frame from loading

If a frame is navigated away before finishing loading, the navigation
is not responsible to call DidStopLoading for the old frame.
This can make TestRunner's |loading_frames_| list inconsistent, if no
other events manages the list.

If we enable same-site backward/forward cache, the situation happens.

This CL makes TestRunner work for the case.


Bug: 1132180
Change-Id: I260883b326781ff98187bfef44c63f6ab25925b8
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2509074
Commit-Queue: Hitoshi Yoshida <peria@chromium.org>
Reviewed-by: danakj <danakj@chromium.org>
Cr-Commit-Position: refs/heads/master@{#824486}
This commit is contained in:
Hitoshi Yoshida
2020-11-05 18:01:39 +00:00
committed by Commit Bot
parent 7782b103b6
commit de5221f1f8

@ -2571,6 +2571,9 @@ void TestRunner::OnFrameDeactivated(WebFrameTestProxy* frame) {
DCHECK(frame->IsMainFrame());
RemoveMainFrame(frame);
RemoveRenderView(frame->GetWebViewTestProxy());
if (frame->GetWebFrame()->IsLoading())
RemoveLoadingFrame(frame->GetWebFrame());
}
void TestRunner::OnFrameReactivated(WebFrameTestProxy* frame) {
@ -2579,6 +2582,10 @@ void TestRunner::OnFrameReactivated(WebFrameTestProxy* frame) {
DCHECK(frame->IsMainFrame());
if (frame->GetWebFrame()->IsLoading()) {
AddLoadingFrame(frame->GetWebFrame());
}
// A WorkQueueItem that navigates reports that it will start a load, but when
// a frame comes from the back/forward cache, it is already loaded so
// AddLoadingFrame() will not occur. This informs the system that the load is