fixes bug 93924 "PAC - dnsResolve should have one-element cache"

patch=tingley@sundell.net r=bbaetz, sr=darin, a=roc+moz
This commit is contained in:
darin%netscape.com 2001-08-30 01:35:26 +00:00
Родитель 1a61256de5
Коммит c75f83945e
1 изменённых файлов: 15 добавлений и 5 удалений

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

@ -128,14 +128,24 @@ nsProxyAutoConfig.prototype = {
}
}
// Synchronous calls to nsDNSService::Resolve ignore the cache! (bug 97097)
// Keep a simple one of our own.
var dnsResolveCachedHost = null;
var dnsResolveCachedIp = null;
// wrapper for dns.resolve to catch exception on failure
function dnsResolve(host) {
try {
var ip = dns.resolve(host);
return ip;
if (host == dnsResolveCachedHost) {
return dnsResolveCachedIp;
}
catch (e) {}
return null;
dnsResolveCachedHost = host;
try {
dnsResolveCachedIp = dns.resolve(host);
}
catch (e) {
dnsResolveCachedIp = null;
}
return dnsResolveCachedIp;
}
var pacModule = new Object();