summaryrefslogtreecommitdiff
path: root/data/extensions/https-everywhere-eff@eff.org/chrome/content/ruleset-tests-status.js
blob: 0bee33e4ccf82c61ce1cffc06181ff2f77586b9c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
var HTTPSEverywhere = null;

function updateStatusBar(current_test, total_tests) {
  var labelText = "Test "+current_test+" of "+total_tests;
  document.getElementById("progress-bar-label").value = labelText;

  var percent = current_test / total_tests;
  document.getElementById("progress-bar").value = percent;
}

function updateLog(msg) {
  document.getElementById("log").value += msg+'\n';
}

function cancel() {
  updateLog("Canceling early ...");
  HTTPSEverywhere.httpseRulesetTests.cancel = true;
}

function start() {
  HTTPSEverywhere = Components.classes["@eff.org/https-everywhere;1"]
    .getService(Components.interfaces.nsISupports)
    .wrappedJSObject;

  HTTPSEverywhere.httpseRulesetTests.updateStatusBar = updateStatusBar;
  HTTPSEverywhere.httpseRulesetTests.updateLog = updateLog;
  HTTPSEverywhere.httpseRulesetTests.cancel = false;

  updateLog("Starting ruleset tests ...");
  HTTPSEverywhere.httpseRulesetTests.testRunner();
}