aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJesús <heckyel@hyperbola.info>2020-03-15 13:32:22 -0500
committerJesús <heckyel@hyperbola.info>2020-03-15 13:32:22 -0500
commit1f0b645b5fddcac822e9933e9b21f2e6903879f2 (patch)
tree25ae8646bda64ff97fd39f56163c22611acd8c4b
parent01c85372ae8e111c41e5a4cb48af53033d041879 (diff)
downloadematrix-1f0b645b5fddcac822e9933e9b21f2e6903879f2.tar.lz
ematrix-1f0b645b5fddcac822e9933e9b21f2e6903879f2.tar.xz
ematrix-1f0b645b5fddcac822e9933e9b21f2e6903879f2.zip
Change the HostMap key again
-rw-r--r--js/vapi-background.js10
-rw-r--r--lib/HostMap.jsm4
2 files changed, 7 insertions, 7 deletions
diff --git a/js/vapi-background.js b/js/vapi-background.js
index da32149..9611072 100644
--- a/js/vapi-background.js
+++ b/js/vapi-background.js
@@ -428,8 +428,9 @@
let channelData = this.channelDataFromChannel(channel);
if (ηMatrix.userSettings.resolveCname === true) {
- if (HostMap.get(URI)) {
- this.operate(channel, HostMap.get(URI), topic);
+ let key = URI.scheme + '://' + URI.host;
+ if (HostMap.get(key)) {
+ this.operate(channel, HostMap.get(key), topic);
return;
}
@@ -450,15 +451,14 @@
let addr = rec.canonicalName;
ηMatrix.logger.writeOne(tab, 'info',
- 'hostname "' + URI.host
- + '" translated to ' + addr);
+ URI.host + ' => ' + addr);
let ios = CC['@mozilla.org/network/io-service;1']
.createInstance(CI.nsIIOService);
let uri = ios.newURI(URI.scheme+'://'+addr, null, null);
- HostMap.put(URI, uri);
+ HostMap.put(key, uri);
vAPI.httpObserver.operate(channel, uri, topic);
},
diff --git a/lib/HostMap.jsm b/lib/HostMap.jsm
index 59d4f65..ecbce25 100644
--- a/lib/HostMap.jsm
+++ b/lib/HostMap.jsm
@@ -31,7 +31,7 @@ var map = new Map();
var HostMap = {
put: function (key, value) {
- if (!(key instanceof Ci.nsIURI) || !(value instanceof Ci.nsIURI)
+ if (typeof key !== 'string' || !(value instanceof Ci.nsIURI)
|| !key || !value) {
throw new Error('invalid argument(s)');
}
@@ -43,7 +43,7 @@ var HostMap = {
map.set(key, value);
},
get: function (key) {
- if (!(key instanceof Ci.nsIURI) || !key) {
+ if (typeof key !== 'string' || !key) {
throw new Error('invalid argument');
}