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

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

TB 43604: fix DomainIsolator.#clearKnownCircuits on Android.

Window type "navigator:browser" does not match GeckoView sessions.
So, in addition to that, we iterate on "navigator:geckoview" windows.
parent aa3f4d82
Branches
Tags
1 merge request!1505BB/TB 43416: Rebased onto 135.0a1
......@@ -543,11 +543,12 @@ class TorDomainIsolatorImpl {
return;
}
const circuit = this.#knownCircuits.get(id);
logger.debug(
`Found new credentials ${username} ${password} for browser`,
browser
`Found new credentials ${username} ${password} for browser ${browser.browserId}.`,
browser,
circuit
);
const circuit = this.#knownCircuits.get(id);
if (circuit?.length) {
circuitIds.current = id;
if (circuitIds.pending === id) {
......@@ -634,15 +635,23 @@ class TorDomainIsolatorImpl {
*/
#clearKnownCircuits() {
logger.info("Running the circuit cleanup");
const getWindows = type => {
const windows = [];
const enumerator = Services.wm.getEnumerator("navigator:browser");
const enumerator = Services.wm.getEnumerator(type);
while (enumerator.hasMoreElements()) {
windows.push(enumerator.getNext());
}
const browsers = windows
.flatMap(win => win.gBrowser.browsers.map(b => b.browserId))
.filter(id => this.#browsers.has(id));
this.#browsers = new Map(browsers.map(id => [id, this.#browsers.get(id)]));
return windows;
};
const browserIds = [
...getWindows("navigator:browser").flatMap(win =>
win.gBrowser.browsers.map(b => b.browserId)
),
...getWindows("navigator:geckoview").map(gv => gv.browser.browserId),
].filter(id => this.#browsers.has(id));
this.#browsers = new Map(
browserIds.map(id => [id, this.#browsers.get(id)])
);
this.#knownCircuits = new Map(
Array.from(this.#browsers.values(), circuits =>
Array.from(circuits.values(), ids => {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment