Bug 1599379 - Create a DBService instance in GetWorker API when it doesn't exist. r=baku

There are two places using DBService during a page load at startup:
1. nsChannelClassifier::Start, used by Phishing Protection
2. AsyncChannelClassifier::CheckChannel, used by Tracking Protection

Tracking protection checks happen before establishing a network connection, so it happens
prior to phishing protection checkes. When we load a page at
startup, ::CheckChannel API is called, but DBService is not yet created.

This patch fixes this issue by creating a DBService instance when
::GetWorker API is called without a DBService instance.

Differential Revision: https://phabricator.services.mozilla.com/D55248

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Dimi Lee 2019-12-02 14:37:25 +00:00
Родитель b0a4cb0d30
Коммит 97ee7956bf
1 изменённых файлов: 5 добавлений и 2 удалений

Просмотреть файл

@ -2402,11 +2402,14 @@ bool nsUrlClassifierDBService::ShutdownHasStarted() {
// static
nsUrlClassifierDBServiceWorker* nsUrlClassifierDBService::GetWorker() {
if (!sUrlClassifierDBService) {
nsresult rv;
RefPtr<nsUrlClassifierDBService> service =
nsUrlClassifierDBService::GetInstance(&rv);
if (!service) {
return nullptr;
}
return sUrlClassifierDBService->mWorker;
return service->mWorker;
}
NS_IMETHODIMP