Commit 375f7364 authored by nyquist's avatar nyquist Committed by Commit bot

Fix issue with DOM Distiller viewer when renderer goes away.

If the user navigates away from a distilled web page or the
renderer crashes while the DomDistillerViewerSource is still
active, a request can still come in. However, using the
render_process_id and render_frame_id to find the live renderer
(RenderFrameHost) might fail.

That case used to be a DCHECK, but since this happens in the
wild and is reproducible, this CL removes the DCHECK and instead
just bails out early if that happens, since there is no renderer
to send the data to.

It also fixes another place in the same method where the
RenderFrameHost used to be looked up again, but now the one that
has been already found is just reused.

BUG=421949

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

Cr-Commit-Position: refs/heads/master@{#302481}
parent c9d938c5
...@@ -268,7 +268,7 @@ void DomDistillerViewerSource::StartDataRequest( ...@@ -268,7 +268,7 @@ void DomDistillerViewerSource::StartDataRequest(
const content::URLDataSource::GotDataCallback& callback) { const content::URLDataSource::GotDataCallback& callback) {
content::RenderFrameHost* render_frame_host = content::RenderFrameHost* render_frame_host =
content::RenderFrameHost::FromID(render_process_id, render_frame_id); content::RenderFrameHost::FromID(render_process_id, render_frame_id);
DCHECK(render_frame_host); if (!render_frame_host) return;
content::RenderViewHost* render_view_host = content::RenderViewHost* render_view_host =
render_frame_host->GetRenderViewHost(); render_frame_host->GetRenderViewHost();
DCHECK(render_view_host); DCHECK(render_view_host);
...@@ -290,9 +290,7 @@ void DomDistillerViewerSource::StartDataRequest( ...@@ -290,9 +290,7 @@ void DomDistillerViewerSource::StartDataRequest(
return; return;
} }
content::WebContents* web_contents = content::WebContents* web_contents =
content::WebContents::FromRenderFrameHost( content::WebContents::FromRenderFrameHost(render_frame_host);
content::RenderFrameHost::FromID(render_process_id,
render_frame_id));
DCHECK(web_contents); DCHECK(web_contents);
// An empty |path| is invalid, but guard against it. If not empty, assume // An empty |path| is invalid, but guard against it. If not empty, assume
// |path| starts with '?', which is stripped away. // |path| starts with '?', which is stripped away.
......
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