Fix missing DevTool message for cross-site subframe download

The issue: Devtools msg missing when (1)Devtools is open before page load &&
(2)the message is logged in OnResponseStarted::OnResponseStarted && (3)the
response is a download && (4)the frame logging the message is a cross-site
subframe

This is rooted from calling the detach_callback in
TargetAutoAttacher::AutoAttachToFrame. Specifically, for a navigation to
download that occurs in a cross-site subframe, in
TargetAutoAttacher::AutoAttachToFrame, the |old_cross_process| is always true,
and the |new_cross_process| is false because RFH was set to null for download in
OnResponseStarted::OnResponseStarted.

The simplest fix seems to be we skip detaching the host when it's not going to
commit by checking if RFH is nullptr.

This CL also has another small fix: the check for |is_download_| is changed to
|is_download| in 2 sites in NavigationRequest::OnResponseStarted, as in those
2 sites, it should check whether the navigation has turned into a download,
regardless whether he download was intervened or not.

Bug: 961486
Change-Id: I2cc08dfd02bfe4d097c2ed3a3f1b8cfe425b8f01
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1614156
Reviewed-by: Camille Lamy <clamy@chromium.org>
Commit-Queue: Yao Xiao <yaoxia@chromium.org>
Cr-Commit-Position: refs/heads/master@{#661417}
2 files changed