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

@@ -1106,3 +1106,19 @@ bool nsUrlClassifierUtils::IsTestTable(const nsACString& aTableName) {
return IsMozTestTable(aTableName) ||
StringBeginsWith(aTableName, NS_LITERAL_CSTRING("test"));
}
bool nsUrlClassifierUtils::IsInSafeMode() {
static Maybe<bool> sIsInSafeMode;
if (!sIsInSafeMode.isSome()) {
nsCOMPtr<nsIXULRuntime> appInfo =
do_GetService("@mozilla.org/xre/runtime;1");
if (appInfo) {
bool inSafeMode = false;
appInfo->GetInSafeMode(&inSafeMode);
sIsInSafeMode.emplace(inSafeMode);
}
}
return sIsInSafeMode.value();
}