import from UXP: Issue #2652 - Part 1: Add a way to programmatically clear the DNS cache. (f5ef3275)

This commit is contained in:
2024-11-21 21:43:07 +08:00
parent 1c3260b2e9
commit 7ca9f8abdb
3 changed files with 18 additions and 0 deletions
+7
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)
{
+6
View File
@@ -1053,6 +1053,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
{
+5
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.
*/