Commit 33506f9f authored by Daniel Rubery's avatar Daniel Rubery Committed by Commit Bot

Fix crash when constructing ClientSideDetectionService

We are seeing crash stacks when constructing the
ClientSideDetectionService since the SafeBrowsingService has not yet
been notified of the creation of the Profile. This is because in
certain circumstances (e.g.
https://crash.corp.google.com/browse?reportid=defdca17c66310c3) a
renderer is created for this Profile before ProfileManagerObservers are
notified. We can solve this by checking for the
DisableClientSidePhishingDetection flag explicitly, instead of calling
into ClientSideDetectionServiceFactory, which has the side effect of
creating a ClientSideDetectionService if it does not yet exist.

Bug: 1131885
Change-Id: If9116613f1914ab1beee25296847840f91c52e78
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2451523Reviewed-by: default avatarBettina Dea <bdea@chromium.org>
Commit-Queue: Daniel Rubery <drubery@chromium.org>
Cr-Commit-Position: refs/heads/master@{#814472}
parent 0fb70eff
......@@ -2217,8 +2217,8 @@ void ChromeContentBrowserClient::AppendExtraCommandLineSwitches(
#if BUILDFLAG(SAFE_BROWSING_AVAILABLE)
bool client_side_detection_enabled =
safe_browsing::IsSafeBrowsingEnabled(*prefs) &&
safe_browsing::ClientSideDetectionServiceFactory::GetForProfile(
profile);
!base::CommandLine::ForCurrentProcess()->HasSwitch(
::switches::kDisableClientSidePhishingDetection);
#if BUILDFLAG(SAFE_BROWSING_DB_REMOTE)
client_side_detection_enabled &= base::FeatureList::IsEnabled(
safe_browsing::kClientSideDetectionForAndroid);
......
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