Commit c6edb33a authored by Hitoshi Yoshida's avatar Hitoshi Yoshida Committed by Commit Bot

WebTest: Remove RenderViewHost for main window

A flag to check if a new RenderFrameHost is really new in
WebTestControlHost::HandleNewRenderFrameHost(),
we check if its RenderViewHost is already contained in
|main_window_render_view_hosts_|.

This detection is based on our past design that we don't
delete RenderViewHosts in a web test, and we don't erase
entries of |main_window_render_view_hosts_|.
But it can happen if we start to swap RenderFrameHosts and
RenderViewHosts with Browsing Instance Swap and/or
Back-Forward Cache.

After deleting an old RenderViewHost, a new RenderViewHost
can be created on the address where the old one was allocated.
This address conflict can lead a misjudge of the check of
new RenderFrameHosts.

This CL handles delete events of RenderViewHosts for main
windows on WebTestControlHost, and removes their addresses
from the list.


Bug: 1136383, 1132180
Change-Id: I442ad67d2207a822dec37fb676d623dd035f0b9d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2462997
Commit-Queue: Hitoshi Yoshida <peria@chromium.org>
Reviewed-by: default avatarRakina Zata Amni <rakina@chromium.org>
Reviewed-by: default avatardanakj <danakj@chromium.org>
Reviewed-by: default avatarFergal Daly <fergal@chromium.org>
Cr-Commit-Position: refs/heads/master@{#816630}
parent f5932b96
......@@ -1065,6 +1065,10 @@ void WebTestControlHost::DidUpdateFaviconURL(
}
}
void WebTestControlHost::RenderViewDeleted(RenderViewHost* render_view_host) {
main_window_render_view_hosts_.erase(render_view_host);
}
void WebTestControlHost::RenderProcessHostDestroyed(
RenderProcessHost* render_process_host) {
render_process_host_observer_.Remove(render_process_host);
......
......@@ -159,6 +159,7 @@ class WebTestControlHost : public WebContentsObserver,
void DidUpdateFaviconURL(
RenderFrameHost* render_frame_host,
const std::vector<blink::mojom::FaviconURLPtr>& candidates) override;
void RenderViewDeleted(RenderViewHost* render_view_host) override;
// RenderProcessHostObserver implementation.
void RenderProcessHostDestroyed(
......
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