1
0
mirror of https://github.com/gorhill/uBlock.git synced 2024-11-06 02:42:33 +01:00

code review: fix bad lookup causing [hostname,domain] cache to never be hit

This commit is contained in:
Raymond Hill 2018-06-04 08:18:13 -04:00
parent 5a424791fe
commit 7bd76150a1
No known key found for this signature in database
GPG Key ID: 25E1490B761470C2

View File

@ -286,13 +286,11 @@ URI.hostnameFromURI = function(uri) {
/******************************************************************************/
URI.domainFromHostname = function(hostname) {
// Try to skip looking up the PSL database
var entry = domainCache[hostname];
let entry = domainCache.get(hostname);
if ( entry !== undefined ) {
entry.tstamp = Date.now();
return entry.domain;
}
// Meh.. will have to search it
if ( reIPAddressNaive.test(hostname) === false ) {
return domainCacheAdd(hostname, psl.getDomain(hostname));
}