[Solved] Changing circuit programmatically in Tor Browser not working anymore!
____ [Definitive Solution]: ____
TorDomainIsolator.newCircuitForDomain("google.com")
"google.com" used just as an example.
Issue fixed in Tor Browser 13.0.10
____ [Original Post]: ____
It was possible to change circuit programmatically by using the codes below:
Cc["@torproject.org/domain-isolator;1"].getService(Ci.nsISupports).wrappedJSObject.newCircuitForDomain("domain.com");
or
domainIsolator = Cc["@torproject.org/domain-isolator;1"].getService(Ci.nsISupports).wrappedJSObject;
domainIsolator.newCircuitForDomain("domain.com");
Now the codes don't work.
It is useful to change circuit programmatically in situations when "Domain 1" redirects to "Domain 2" because the "IP" is blocked, and when "New Circuit" button is triggered, the circuit for "Domain 2" is changed instead for "Domain 1", thus, "Domain 1" will keep redirecting to "Domain 2" because "Domain 1" circuit was not changed.
____ [Update]: ____
I found the code below so far, but it works exactly the same way as “New Circuit” button:
TorDomainIsolator.newCircuitForBrowser(gBrowser);
The function above somewhere calls the function below:
this.#newCircuitForDomain(firstPartyDomain);
So I tried the function calls below (but none worked):
this.#newCircuitForDomain("doamin.com");
TorDomainIsolator.#newCircuitForDomain("doamin.com");
TorDomainIsolator.newCircuitForDomain("doamin.com");
____ [Temporary Solution]: ____
Fake_gBrowser = {};
Fake_gBrowser.selectedBrowser = {};
Fake_gBrowser.selectedBrowser.contentPrincipal = {};
Fake_gBrowser.selectedBrowser.contentPrincipal.originAttributes = {};
Fake_gBrowser.selectedBrowser.contentPrincipal.originAttributes.firstPartyDomain = "google.com";
TorDomainIsolator.newCircuitForBrowser(Fake_gBrowser);
The above codes will change the circuit of a given domain by using "Fake_gBrowser".
The below code is just for testing purpose, "gBrowser" and "Fake_gBrowser" return different domains:
console.log( //"gBrowser" returns the domain of the current selected Tab
gBrowser.selectedBrowser.contentPrincipal.originAttributes.firstPartyDomain
+ "\n\n" +
Fake_gBrowser.selectedBrowser.contentPrincipal.originAttributes.firstPartyDomain
);
____ [Temporary Solution 2]: ____