From c265e849e070edf49a73f14007bf35f2a8a34656 Mon Sep 17 00:00:00 2001 From: Raymond Hill Date: Sat, 14 Sep 2024 11:50:10 -0400 Subject: [PATCH] Fetch and cache cname of collated hostnames in page store Related feedback: https://github.com/uBlockOrigin/uBlock-issues/discussions/3376 --- src/js/messaging.js | 5 ++--- src/js/pagestore.js | 1 + 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/js/messaging.js b/src/js/messaging.js index ebfc5c7d4..0142a1261 100644 --- a/src/js/messaging.js +++ b/src/js/messaging.js @@ -288,9 +288,8 @@ const getHostnameDict = function(hostnameDetailsMap, out) { const cnMap = []; const createDictEntry = (domain, hostname, details) => { - const cname = vAPI.net.canonicalNameFromHostname(hostname); - if ( cname !== undefined ) { - cnMap.push([ cname, hostname ]); + if ( details.cname ) { + cnMap.push([ details.cname, hostname ]); } hnDict[hostname] = { domain, counts: details.counts }; }; diff --git a/src/js/pagestore.js b/src/js/pagestore.js index 227352d5d..d6f52b8cd 100644 --- a/src/js/pagestore.js +++ b/src/js/pagestore.js @@ -312,6 +312,7 @@ const HostnameDetails = class { } init(hostname) { this.hostname = hostname; + this.cname = vAPI.net.canonicalNameFromHostname(hostname); this.counts.reset(); } dispose() {