Bug 1128311 - Only flush the DNS cache when the last private browsing window is closed; r=mcmanus

This commit is contained in:
Ehsan Akhgari 2016-12-29 21:45:30 -05:00
parent 37e1e73a58
commit 1d19b4a99e

View File

@ -944,11 +944,17 @@ nsDNSService::Observe(nsISupports *subject, const char *topic, const char16_t *d
strcmp(topic, NS_NETWORK_LINK_TOPIC) == 0, strcmp(topic, NS_NETWORK_LINK_TOPIC) == 0,
"unexpected observe call"); "unexpected observe call");
bool flushCache = false;
if (!strcmp(topic, NS_NETWORK_LINK_TOPIC)) { if (!strcmp(topic, NS_NETWORK_LINK_TOPIC)) {
nsAutoCString converted = NS_ConvertUTF16toUTF8(data); nsAutoCString converted = NS_ConvertUTF16toUTF8(data);
if (mResolver && !strcmp(converted.get(), NS_NETWORK_LINK_DATA_CHANGED)) { if (mResolver && !strcmp(converted.get(), NS_NETWORK_LINK_DATA_CHANGED)) {
mResolver->FlushCache(); flushCache = true;
} }
} else if (!strcmp(topic, "last-pb-context-exited")) {
flushCache = true;
}
if (flushCache) {
mResolver->FlushCache();
return NS_OK; return NS_OK;
} }