Issue #2652 - Part 1: Add a way to programmatically clear the DNS cache.

This commit is contained in:
Moonchild 2024-11-15 12:25:52 +01:00 • committed by roytam1
commit f5ef327563
3 changed files with 18 additions and 0 deletions

View file

@ -202,6 +202,13 @@ ChildDNSService::GetDNSCacheEntries(nsTArray<mozilla::net::DNSCacheEntries> *arg
return NS_ERROR_NOT_AVAILABLE;
}
NS_IMETHODIMP
ChildDNSService::ClearCache()
{
// Not available in IPC children.
return NS_ERROR_NOT_AVAILABLE;
}
NS_IMETHODIMP
ChildDNSService::GetMyHostName(nsACString &result)
{

View file

@ -1052,6 +1052,12 @@ nsDNSService::GetDNSCacheEntries(nsTArray<mozilla::net::DNSCacheEntries> *args)
return NS_OK;
}
NS_IMETHODIMP
nsDNSService::ClearCache() {
mResolver->FlushCache();
return NS_OK;
}
size_t
nsDNSService::SizeOfIncludingThis(mozilla::MallocSizeOf mallocSizeOf) const
{

View file

@ -115,6 +115,11 @@ interface nsIDNSService : nsISupports
*/
[noscript] void getDNSCacheEntries(in EntriesArray args);
/**
* Clears the DNS cache.
*/
void clearCache();
/**
* @return the hostname of the operating system.
*/