diff options
author | Alex Xu <alex_y_xu@yahoo.ca> | 2014-12-08 10:06:29 -0500 |
---|---|---|
committer | Alex Xu <alex_y_xu@yahoo.ca> | 2014-12-08 10:06:29 -0500 |
commit | 3a93c00d336cc9e9201e41a9bacfcd2e916368b7 (patch) | |
tree | ca6d7439177692413cd2595721c45de591eca2fb /src | |
parent | b8b74f38babd5186cc538b4aeae7c0dba7c7c8b6 (diff) | |
download | eib-3a93c00d336cc9e9201e41a9bacfcd2e916368b7.tar.xz eib-3a93c00d336cc9e9201e41a9bacfcd2e916368b7.zip |
Add features and whatnot.
Diffstat (limited to 'src')
-rw-r--r-- | src/bootstrap.js | 13 |
1 files changed, 5 insertions, 8 deletions
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) { |