From 7bd76150a1dac25356d0b93afe4d3047cad35a40 Mon Sep 17 00:00:00 2001 From: Raymond Hill Date: Mon, 4 Jun 2018 08:18:13 -0400 Subject: [PATCH] code review: fix bad lookup causing [hostname,domain] cache to never be hit --- src/js/uritools.js | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/js/uritools.js b/src/js/uritools.js index 4e118bd47..3de6bbc3b 100644 --- a/src/js/uritools.js +++ b/src/js/uritools.js @@ -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)); }