From 1441478fb03b635ce27dc0d3f4faa7fca5bed648 Mon Sep 17 00:00:00 2001 From: Nihanth Subramanya Date: Thu, 2 Dec 2021 09:40:51 +0000 Subject: [PATCH] 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 --- modules/libpref/init/StaticPrefList.yaml | 8 ------ netwerk/dns/TRRService.cpp | 36 ------------------------ 2 files changed, 44 deletions(-) diff --git a/modules/libpref/init/StaticPrefList.yaml b/modules/libpref/init/StaticPrefList.yaml index 3be465dd411b..072c7efd8773 100644 --- a/modules/libpref/init/StaticPrefList.yaml +++ b/modules/libpref/init/StaticPrefList.yaml @@ -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 diff --git a/netwerk/dns/TRRService.cpp b/netwerk/dns/TRRService.cpp index 8b68da081bb8..3f407638cd8d 100644 --- a/netwerk/dns/TRRService.cpp +++ b/netwerk/dns/TRRService.cpp @@ -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 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();