From 0abc2a48aed57ce2d50b17d3a4a3bc3eace3cf98 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jes=C3=BAs?= Date: Sun, 15 Mar 2020 13:17:00 -0500 Subject: Cache resolved hostnames --- js/vapi-background.js | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'js') diff --git a/js/vapi-background.js b/js/vapi-background.js index 061ae29..d738504 100644 --- a/js/vapi-background.js +++ b/js/vapi-background.js @@ -34,6 +34,7 @@ Cu.import('chrome://ematrix/content/lib/HttpRequestHeaders.jsm'); Cu.import('chrome://ematrix/content/lib/PendingRequests.jsm'); Cu.import('chrome://ematrix/content/lib/Punycode.jsm'); + Cu.import('chrome://ematrix/content/lib/HostMap.jsm'); // Icon-related stuff vAPI.setIcon = function (tabId, iconId, badge) { @@ -427,6 +428,11 @@ let channelData = this.channelDataFromChannel(channel); if (ηMatrix.userSettings.resolveCname === true) { + if (HostMap.get(URI.host)) { + this.operate(channel, HostMap.get(URI.host), topic); + return; + } + let CC = Components.classes; let CI = Components.interfaces; @@ -446,6 +452,8 @@ let uri = ios.newURI(URI.scheme+'://'+addr, null, null); + HostMap.put(URI.host, addr); + vAPI.httpObserver.operate(channel, uri, topic); }, }; -- cgit v1.2.3