Commit 66c5625c authored by Rouslan Solomakhin's avatar Rouslan Solomakhin Committed by Chromium LUCI CQ

[Web Payment] Check WebContents not null.

This patch checks the result of WebContents::FromRenderFrameHost() for
null to avoid crashing.

Bug: 1064628
Change-Id: Ib755a014e72e2428e8343aa2aac2b3b707c484ab
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2572908Reviewed-by: default avatarLiquan (Max) Gu <maxlg@chromium.org>
Commit-Queue: Rouslan Solomakhin <rouslan@chromium.org>
Cr-Commit-Position: refs/heads/master@{#833816}
parent ff047835
......@@ -427,7 +427,10 @@ bool InstallablePaymentAppCrawler::DownloadAndDecodeWebAppIcon(
// TODO(crbug.com/1058840): Move this sanity check to ManifestIconDownloader
// after DownloadImage refactor is done.
auto* rfh = content::RenderFrameHost::FromID(initiator_frame_routing_id_);
if (!rfh || !rfh->IsCurrent()) {
auto* web_contents = rfh && rfh->IsCurrent()
? content::WebContents::FromRenderFrameHost(rfh)
: nullptr;
if (!web_contents) {
log_.Warn(
"Cannot download icons after the webpage has been closed (web app "
"manifest \"" +
......@@ -442,7 +445,6 @@ bool InstallablePaymentAppCrawler::DownloadAndDecodeWebAppIcon(
return false;
}
auto* web_contents = content::WebContents::FromRenderFrameHost(rfh);
gfx::NativeView native_view = web_contents->GetNativeView();
GURL best_icon_url = blink::ManifestIconSelector::FindBestMatchingIcon(
manifest_icons, IconSizeCalculator::IdealIconHeight(native_view),
......
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