Bug 1524873 - Enable SafeBrowsing in Safe Mode. r=gcp

This patch enables SafeBrowsing in Safe Mode because features based
on SafeBrowsing are essential for Firefox(For example, Enhanced Tracking Protection).

Since Safe Browsing update is nondeterministic, we disable periodical
SafeBrowsing update to make troubleshooting easier. Manually trigger an
update via about:classifier is still enabled.

Last, SafeBrowsing tables provided by Google will be ignored in Safe
Mode to ensure the SafeBrowsing warnings are update-to-date.

Differential Revision: https://phabricator.services.mozilla.com/D62708
This commit is contained in:
Dimi Lee
2020-02-18 10:48:47 +00:00
parent 163c8111df
commit a0881e4b7c
5 changed files with 42 additions and 11 deletions

View File

@@ -1564,6 +1564,17 @@ RefPtr<LookupCache> Classifier::GetLookupCache(const nsACString& aTable,
// '-proto'.
RefPtr<LookupCache> cache;
nsCString provider = GetProvider(aTable);
// Google requests SafeBrowsing related feature should only be enabled when
// the databases are update-to-date. Since we disable Safe Browsing update in
// Safe Mode, ignore tables provided by Google to ensure we don't show
// outdated warnings.
if (nsUrlClassifierUtils::IsInSafeMode()) {
if (provider.EqualsASCII("google") || provider.EqualsASCII("google4")) {
return nullptr;
}
}
if (StringEndsWith(aTable, NS_LITERAL_CSTRING("-proto"))) {
cache = new LookupCacheV4(aTable, provider, rootStoreDirectory);
} else {