Commit db7845b7 authored by Richard Pospesel's avatar Richard Pospesel Committed by Georg Koppen
Browse files

Added extensions.torlauncher.launch_delay debug pref handling to simulate slow tor launch

parent 07135db6
......@@ -3,6 +3,8 @@
//
// vim: set sw=2 sts=2 ts=8 et syntax=javascript:
const { setTimeout } = ChromeUtils.import("resource://gre/modules/Timer.jsm")
const Cc = Components.classes;
const Ci = Components.interfaces;
const Cr = Components.results;
......@@ -41,6 +43,8 @@ TorProcessService.prototype =
kPrefPromptAtStartup: "extensions.torlauncher.prompt_at_startup",
kPrefDefaultBridgeType: "extensions.torlauncher.default_bridge_type",
// useful for simulating slow tor daemon launch
kPrefTorDaemonLaunchDelay: "extensions.torlauncher.launch_delay",
kWizardProgressPageID: "progress",
......@@ -528,7 +532,17 @@ TorProcessService.prototype =
for (var i = 0; i < args.length; ++i)
TorLauncherLogger.log(2, " " + args[i]);
p.runwAsync(args, args.length, this, false);
const launchDelay = TorLauncherUtil.getIntPref(this.kPrefTorDaemonLaunchDelay, 0);
let runwAsync = () => p.runwAsync(args, args.length, this, false);
if (launchDelay > 0) {
setTimeout(() => {
runwAsync();
}, launchDelay);
} else {
runwAsync();
}
this.mTorProcess = p;
this.mTorProcessStartTime = Date.now();
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment