Skip to content
This repository has been archived by the owner on Nov 6, 2023. It is now read-only.

Commit

Permalink
De-dupe test targets more comprehensively
Browse files Browse the repository at this point in the history
  • Loading branch information
pde committed Sep 4, 2014
1 parent 4a45bad commit da636a6
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/chrome/content/ruleset-tests.js
Expand Up @@ -25,10 +25,16 @@ function openStatus() {
gBrowser.selectedTab = statusTab;
}

// FIXME use a class rather than global state
var left_star = new RegExp("^\\*\\."); // *.example.com
var accepted_test_targets = {}

function addTestTarget(urls, target, ruleset_ids) {
// Add one target and associated metadata to the list of
// URLs to be tested, performing housekeeping along the way
var active_ids = [];
if (target in accepted_test_targets) return;

for (var n = 0; n < ruleset_ids.length; n++) {
var rs_id = ruleset_ids[n];
var rs = HTTPSEverywhere.https_rules.rulesetsByID[rs_id];
Expand All @@ -52,7 +58,6 @@ function addTestTarget(urls, target, ruleset_ids) {
}
}

var left_star = new RegExp("^\\*\\."); // *.example.com

function testRunner() {
Components.utils.import("resource://gre/modules/PopupNotifications.jsm");
Expand All @@ -64,6 +69,7 @@ function testRunner() {
var num = 0;
var targets_to_ids = HTTPSEverywhere.https_rules.targets;
var ruleset_ids;
accepted_test_targets = {}; // reset each time

for(var target in targets_to_ids) {
ruleset_ids = targets_to_ids[target];
Expand All @@ -77,9 +83,7 @@ function testRunner() {
HTTPSEverywhere.log(5, "WARNING target with illegal 2nd star");
continue;
}
if (!(t in targets_to_ids)) {
addTestTarget(urls, t, ruleset_ids);
}
addTestTarget(urls, t, ruleset_ids);
}
}

Expand Down

0 comments on commit da636a6

Please sign in to comment.