Skip to content
Snippets Groups Projects
Verified Commit 98e75e48 authored by Pier Angelo Vendrame's avatar Pier Angelo Vendrame :jack_o_lantern:
Browse files

fixup! Bug 40933: Add tor-launcher functionality

Added a newnym function
parent ff98f1b1
Branches
Tags
1 merge request!632Bug 41741: Refactor the domain isolator and new circuit
......@@ -4,6 +4,7 @@
var EXPORTED_SYMBOLS = ["TorProtocolService"];
const { ConsoleAPI } = ChromeUtils.import("resource://gre/modules/Console.jsm");
const { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
const { setTimeout } = ChromeUtils.import("resource://gre/modules/Timer.jsm");
ChromeUtils.defineModuleGetter(
......@@ -11,9 +12,6 @@ ChromeUtils.defineModuleGetter(
"FileUtils",
"resource://gre/modules/FileUtils.jsm"
);
const { XPCOMUtils } = ChromeUtils.import(
"resource://gre/modules/XPCOMUtils.jsm"
);
Cu.importGlobalProperties(["crypto"]);
......@@ -45,18 +43,9 @@ const TorTopics = Object.freeze({
ProcessRestarted: "TorProcessRestarted",
});
// Logger adapted from CustomizableUI.jsm
XPCOMUtils.defineLazyGetter(this, "logger", () => {
const { ConsoleAPI } = ChromeUtils.import(
"resource://gre/modules/Console.jsm"
);
// TODO: Use a preference to set the log level.
const consoleOptions = {
// maxLogLevel: "warn",
maxLogLevel: "all",
const logger = new ConsoleAPI({
maxLogLevel: "warn",
prefix: "TorProtocolService",
};
return new ConsoleAPI(consoleOptions);
});
// Manage the connection to tor's control port, to update its settings and query
......@@ -194,6 +183,10 @@ const TorProtocolService = {
TorMonitorService.retrieveBootstrapStatus();
},
async newnym() {
return this.sendCommand("SIGNAL NEWNYM");
},
// TODO: transform the following 4 functions in getters. At the moment they
// are also used in torbutton.
......
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment