Commit cf932f00 authored by clamy's avatar clamy Committed by Commit bot

PlzNavigate: Send EnableViewSourceMode at commit time when reusing a RFH

This CL ensures that we properly send an EnableViewSourceMode IPC to the
RnederView of a reused RenderFrameHost at commit time when the request is for a
view source mode navigation. This is needed because on error a RenderView could
exit the view source mode. This fixes the
RenderFrameHostManagerTest.AlwaysSendEnableViewSourceMode test with PlzNavigate
enabled.

BUG=439423

Review URL: https://codereview.chromium.org/1035983002

Cr-Commit-Position: refs/heads/master@{#322561}
parent 449e7155
......@@ -702,6 +702,18 @@ void NavigatorImpl::CommitNavigation(FrameTreeNode* frame_tree_node,
RenderFrameHostImpl* render_frame_host =
frame_tree_node->render_manager()->GetFrameHostForNavigation(
*navigation_request);
// The renderer can exit view source mode when any error or cancellation
// happen. When reusing the same renderer, overwrite to recover the mode.
if (navigation_request->is_view_source() &&
render_frame_host ==
frame_tree_node->render_manager()->current_frame_host()) {
DCHECK(!render_frame_host->GetParent());
render_frame_host->render_view_host()->Send(
new ViewMsg_EnableViewSourceMode(
render_frame_host->render_view_host()->GetRoutingID()));
}
CheckWebUIRendererDoesNotDisplayNormalURL(
render_frame_host, navigation_request->common_params().url);
......
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