Bug 1737198 - Part 3: Remove TRR blocklist cleanup code. r=valentin,necko-reviewers

Reverts bug 1651672 / rev D86520. It's been a few releases,
we can remove this cleanup code.

Differential Revision: https://phabricator.services.mozilla.com/D132107
This commit is contained in:
Nihanth Subramanya 2021-12-02 09:40:51 +00:00
Родитель 9442c33260
Коммит 1441478fb0
2 изменённых файлов: 0 добавлений и 44 удалений

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

@ -9922,14 +9922,6 @@
value: true
mirror: always
# If this pref is false, a task will be dispatched to remove the file from the
# disk and the pref will be set to true.
# It can probably be removed after a few releases.
- name: network.trr.blocklist_cleanup_done
type: RelaxedAtomicBool
value: false
mirror: always
# If we should wait for captive portal confirmation before enabling TRR
- name: network.trr.wait-for-portal
type: RelaxedAtomicBool

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

@ -3,7 +3,6 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "nsAppDirectoryServiceDefs.h"
#include "nsCharSeparatedTokenizer.h"
#include "nsComponentManagerUtils.h"
#include "nsDirectoryServiceUtils.h"
@ -119,32 +118,6 @@ bool TRRService::CheckCaptivePortalIsPassed() {
return result;
}
static void RemoveTRRBlocklistFile() {
MOZ_ASSERT(NS_IsMainThread(), "Getting the profile dir on the main thread");
nsCOMPtr<nsIFile> file;
nsresult rv =
NS_GetSpecialDirectory(NS_APP_USER_PROFILE_50_DIR, getter_AddRefs(file));
if (NS_FAILED(rv)) {
return;
}
rv = file->AppendNative("TRRBlacklist.txt"_ns);
if (NS_FAILED(rv)) {
return;
}
// Dispatch an async task that removes the blocklist file from the profile.
rv = NS_DispatchBackgroundTask(
NS_NewRunnableFunction("RemoveTRRBlocklistFile::Remove",
[file] { file->Remove(false); }),
NS_DISPATCH_EVENT_MAY_BLOCK);
if (NS_FAILED(rv)) {
return;
}
Preferences::SetBool("network.trr.blocklist_cleanup_done", true);
}
static void EventTelemetryPrefChanged(const char* aPref, void* aData) {
Telemetry::SetEventRecordingEnabled(
"network.dns"_ns,
@ -194,15 +167,6 @@ nsresult TRRService::Init() {
}
sTRRBackgroundThread = thread;
if (!StaticPrefs::network_trr_blocklist_cleanup_done()) {
// Dispatch an idle task to the main thread that gets the profile dir
// then attempts to delete the blocklist file on a background thread.
Unused << NS_DispatchToMainThreadQueue(
NS_NewCancelableRunnableFunction("RemoveTRRBlocklistFile::GetDir",
[] { RemoveTRRBlocklistFile(); }),
EventQueuePriority::Idle);
}
}
mODoHService = new ODoHService();