Commit bf6691a2 authored by Jialiu Lin's avatar Jialiu Lin Committed by Commit Bot

Check if web_contents are valid before sending SB hit report

This CL is to fix the crash caused by invalid web_contents access in
safe_browsing::SafeBrowsingUIManager::MaybeReportSafeBrowsingHit

Bug: 888159
Change-Id: I6e7beaa5cd4d7c249d03465e3924635bead0d283
Reviewed-on: https://chromium-review.googlesource.com/1241314
Commit-Queue: Jialiu Lin <jialiul@chromium.org>
Reviewed-by: default avatarDaniel Rubery <drubery@chromium.org>
Cr-Commit-Position: refs/heads/master@{#593709}
parent 4f2e41be
...@@ -108,7 +108,8 @@ void SafeBrowsingUIManager::ShowBlockingPageForResource( ...@@ -108,7 +108,8 @@ void SafeBrowsingUIManager::ShowBlockingPageForResource(
bool SafeBrowsingUIManager::ShouldSendHitReport( bool SafeBrowsingUIManager::ShouldSendHitReport(
const HitReport& hit_report, const HitReport& hit_report,
const WebContents* web_contents) { const WebContents* web_contents) {
return hit_report.extended_reporting_level != SBER_LEVEL_OFF && return web_contents &&
hit_report.extended_reporting_level != SBER_LEVEL_OFF &&
!web_contents->GetBrowserContext()->IsOffTheRecord(); !web_contents->GetBrowserContext()->IsOffTheRecord();
} }
......
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