From 3a93c00d336cc9e9201e41a9bacfcd2e916368b7 Mon Sep 17 00:00:00 2001 From: Alex Xu Date: Mon, 8 Dec 2014 10:06:29 -0500 Subject: Add features and whatnot. --- src/bootstrap.js | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/bootstrap.js b/src/bootstrap.js index 7d4bf8f..162c857 100644 --- a/src/bootstrap.js +++ b/src/bootstrap.js @@ -1,5 +1,3 @@ -const PORT = 26001; - if (typeof EIB === "undefined") var EIB = { headers: {}, @@ -17,7 +15,7 @@ function uninstall() {} EIB.listen = function () { this.serverSocket = Cc["@mozilla.org/network/server-socket;1"] .createInstance(Ci.nsIServerSocket); - this.serverSocket.init(PORT, true, -1); + this.serverSocket.init(26001, true, -1); const tm = Cc["@mozilla.org/thread-manager;1"].getService(); this.serverSocket.asyncListen({ onSocketAccepted: function (socket, transport) { @@ -110,7 +108,7 @@ var WindowListener = { var TrustedReparser = { observe: function () { EIB.trusted = EIB.prefs.prefHasUserValue("trusted") ? - JSON.parse(EIB.prefs.getCharPref("trusted")) : + JSON.parse(EIB.prefs.getCharPref("trusted").map(function (v) { return new RegExp(v); }) : []; } }; @@ -145,10 +143,9 @@ function shutdown(data, reason) { } function checkTrusted(href) { - for (var i = 0; i < EIB.trusted.length; i++) - if (href.indexOf(EIB.trusted[i]) === 0) - return true; - return false; + return EIB.trusted.some(function (v) { + return v.test(href); + }); } function injectCCPEVE(e) { -- cgit v1.2.3-70-g09d2