mirror of https://github.com/gorhill/uBlock.git
code review: fix bad lookup causing [hostname,domain] cache to never be hit
This commit is contained in:
parent
5a424791fe
commit
7bd76150a1
|
@ -286,13 +286,11 @@ URI.hostnameFromURI = function(uri) {
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
|
|
||||||
URI.domainFromHostname = function(hostname) {
|
URI.domainFromHostname = function(hostname) {
|
||||||
// Try to skip looking up the PSL database
|
let entry = domainCache.get(hostname);
|
||||||
var entry = domainCache[hostname];
|
|
||||||
if ( entry !== undefined ) {
|
if ( entry !== undefined ) {
|
||||||
entry.tstamp = Date.now();
|
entry.tstamp = Date.now();
|
||||||
return entry.domain;
|
return entry.domain;
|
||||||
}
|
}
|
||||||
// Meh.. will have to search it
|
|
||||||
if ( reIPAddressNaive.test(hostname) === false ) {
|
if ( reIPAddressNaive.test(hostname) === false ) {
|
||||||
return domainCacheAdd(hostname, psl.getDomain(hostname));
|
return domainCacheAdd(hostname, psl.getDomain(hostname));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue