Commit 32ea3ebe authored by Joe DeBlasio's avatar Joe DeBlasio Committed by Commit Bot

[MIX-DL] Speculatively handle missing web contents on Android.

This CL adds a nullptr check for a missing web contents during MIX-DL
infobar dismissal on Android.

The vast majority of the time, this web contents should be available.
In the event that it's missing, since this infobar is purely
informational, this CL just allows the download to continue rather
crashing.

Bug: 1136156
Change-Id: I914c5ecaeea983725e228d572eab6154832b09f1
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2458448
Commit-Queue: Joe DeBlasio <jdeblasio@chromium.org>
Commit-Queue: Xing Liu <xingliu@chromium.org>
Auto-Submit: Joe DeBlasio <jdeblasio@chromium.org>
Reviewed-by: default avatarXing Liu <xingliu@chromium.org>
Cr-Commit-Position: refs/heads/master@{#814883}
parent f22a5b8f
...@@ -1405,8 +1405,9 @@ void ChromeDownloadManagerDelegate::OnDownloadTargetDetermined( ...@@ -1405,8 +1405,9 @@ void ChromeDownloadManagerDelegate::OnDownloadTargetDetermined(
if (target_info->result == download::DOWNLOAD_INTERRUPT_REASON_NONE && if (target_info->result == download::DOWNLOAD_INTERRUPT_REASON_NONE &&
(mcs == download::DownloadItem::MixedContentStatus::BLOCK || (mcs == download::DownloadItem::MixedContentStatus::BLOCK ||
mcs == download::DownloadItem::MixedContentStatus::WARN)) { mcs == download::DownloadItem::MixedContentStatus::WARN)) {
auto* infobar_service = InfoBarService::FromWebContents( auto* web_contents = content::DownloadItemUtils::GetWebContents(item);
content::DownloadItemUtils::GetWebContents(item)); auto* infobar_service =
web_contents ? InfoBarService::FromWebContents(web_contents) : nullptr;
if (infobar_service) { if (infobar_service) {
// There is always an infobar service except when running in a unit test, // There is always an infobar service except when running in a unit test,
// and those tests assume no infobar is shown. // and those tests assume no infobar is shown.
......
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