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

fixup! Bug 3455: Add DomainIsolator, for isolating circuit by domain.

Remove TorMonitorService and TorProtocolService references.
parent c801d620
Branches
No related tags found
1 merge request!717Bug 40938 (part 3): Start using the new control port methods
......@@ -12,6 +12,11 @@ import {
const lazy = {};
ChromeUtils.defineESModuleGetters(lazy, {
TorProviderBuilder: "resource://gre/modules/TorProviderBuilder.sys.mjs",
TorProviderTopics: "resource://gre/modules/TorProviderBuilder.sys.mjs",
});
XPCOMUtils.defineLazyServiceGetters(lazy, {
ProtocolProxyService: [
"@mozilla.org/network/protocol-proxy-service;1",
......@@ -19,11 +24,6 @@ XPCOMUtils.defineLazyServiceGetters(lazy, {
],
});
ChromeUtils.defineESModuleGetters(lazy, {
TorMonitorTopics: "resource://gre/modules/TorMonitorService.sys.mjs",
TorProtocolService: "resource://gre/modules/TorProtocolService.sys.mjs",
});
const logger = new ConsoleAPI({
prefix: "TorDomainIsolator",
maxLogLevel: "warn",
......@@ -143,7 +143,7 @@ class TorDomainIsolatorImpl {
Services.prefs.addObserver(NON_TOR_PROXY_PREF, this);
Services.obs.addObserver(this, NEW_IDENTITY_TOPIC);
Services.obs.addObserver(this, lazy.TorMonitorTopics.StreamSucceeded);
Services.obs.addObserver(this, lazy.TorProviderTopics.StreamSucceeded);
this.#cleanupIntervalId = setInterval(
this.#clearKnownCircuits.bind(this),
......@@ -158,7 +158,7 @@ class TorDomainIsolatorImpl {
uninit() {
Services.prefs.removeObserver(NON_TOR_PROXY_PREF, this);
Services.obs.removeObserver(this, NEW_IDENTITY_TOPIC);
Services.obs.removeObserver(this, lazy.TorMonitorTopics.StreamSucceeded);
Services.obs.removeObserver(this, lazy.TorProviderTopics.StreamSucceeded);
clearInterval(this.#cleanupIntervalId);
this.#cleanupIntervalId = null;
this.clearIsolation();
......@@ -257,12 +257,12 @@ class TorDomainIsolatorImpl {
);
this.clearIsolation();
try {
await lazy.TorProtocolService.newnym();
await lazy.TorProviderBuilder.build().newnym();
} catch (e) {
logger.error("Could not send the newnym command", e);
// TODO: What UX to use here? See tor-browser#41708
}
} else if (topic === lazy.TorMonitorTopics.StreamSucceeded) {
} else if (topic === lazy.TorProviderTopics.StreamSucceeded) {
const { username, password, circuit } = subject.wrappedJSObject;
this.#updateCircuit(username, password, circuit);
}
......@@ -553,7 +553,7 @@ class TorDomainIsolatorImpl {
data = await Promise.all(
circuit.map(fingerprint =>
lazy.TorProtocolService.getNodeInfo(fingerprint)
lazy.TorProviderBuilder.build().getNodeInfo(fingerprint)
)
);
this.#knownCircuits.set(id, data);
......
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment