work toward resolving #853

pull/2/head
gorhill 8 years ago
parent c090fa175e
commit e9968713e4
No known key found for this signature in database
GPG Key ID: 25E1490B761470C2

@ -475,7 +475,7 @@ var canRemoveCookie = function(cookieKey, srcHostnames) {
srcHostname = cookieHostname; srcHostname = cookieHostname;
var pos; var pos;
for (;;) { for (;;) {
if ( srcHostnames.hasOwnProperty(srcHostname) ) { if ( srcHostnames.has(srcHostname) ) {
if ( µm.mustAllow(srcHostname, cookieHostname, 'cookie') ) { if ( µm.mustAllow(srcHostname, cookieHostname, 'cookie') ) {
return false; return false;
} }

@ -554,29 +554,21 @@ Matrix.prototype.evaluateSwitchZ = function(switchName, srcHostname) {
/******************************************************************************/ /******************************************************************************/
// TODO: In all likelyhood, will have to optmize here, i.e. keeping an Matrix.prototype.extractAllSourceHostnames = (function() {
// up-to-date collection of src hostnames with reference count etc. var cachedResult = new Set();
var readTime = 0;
Matrix.prototype.extractAllSourceHostnames = function() {
var srcHostnames = {}; return function() {
for ( var rule of this.rules.keys() ) { if ( readTime !== this.modifiedTime ) {
srcHostnames[rule.slice(0, rule.indexOf(' '))] = true; cachedResult.clear();
} for ( var rule of this.rules.keys() ) {
return srcHostnames; cachedResult.add(rule.slice(0, rule.indexOf(' ')));
}; }
readTime = this.modifiedTime;
/******************************************************************************/ }
return cachedResult;
// TODO: In all likelyhood, will have to optmize here, i.e. keeping an };
// up-to-date collection of src hostnames with reference count etc. })();
Matrix.prototype.extractAllDestinationHostnames = function() {
var desHostnames = {};
for ( var rule of this.rules.keys() ) {
desHostnames[this.desHostnameFromRule(rule)] = true;
}
return desHostnames;
};
/******************************************************************************/ /******************************************************************************/

Loading…
Cancel
Save