
morgan pushed to branch tor-browser-128.1.0esr-14.0-1 at The Tor Project / Applications / Tor Browser Commits: a7f45e05 by Pier Angelo Vendrame at 2024-08-22T14:02:09+02:00 fixup! Bug 3455: Add DomainIsolator, for isolating circuit by domain. Bug 43074: Pass the browser to TorDomainIsolator.newCircuitForBrowser. - - - - - d25a948d by Pier Angelo Vendrame at 2024-08-22T14:03:09+02:00 fixup! Bug 41600: Add a tor circuit display panel. Bug 43074: Pass the browser to TorDomainIsolator.newCircuitForBrowser. - - - - - 6ca3c329 by Pier Angelo Vendrame at 2024-08-22T14:03:41+02:00 fixup! Bug 40209: Implement Basic Crypto Safety Bug 43074: Pass the browser to TorDomainIsolator.newCircuitForBrowser. - - - - - da2d11fa by Pier Angelo Vendrame at 2024-08-22T14:05:24+02:00 Bug 42247: Android helpers for the TorProvider Bug 42655: Add a backend function for the "New circuit for this site" functionality. - - - - - 9 changed files: - browser/actors/CryptoSafetyParent.sys.mjs - browser/base/content/appmenu-viewcache.inc.xhtml - browser/base/content/browser-menubar.inc - browser/base/content/browser-sets.inc - browser/base/content/navigator-toolbox.inc.xhtml - browser/components/torcircuit/content/torCircuitPanel.js - mobile/android/geckoview/src/main/java/org/mozilla/geckoview/GeckoSession.java - mobile/shared/modules/geckoview/GeckoViewContent.sys.mjs - toolkit/components/tor-launcher/TorDomainIsolator.sys.mjs Changes: ===================================== browser/actors/CryptoSafetyParent.sys.mjs ===================================== @@ -67,7 +67,7 @@ export class CryptoSafetyParent extends JSWindowActorParent { const browser = browsingContext.embedderElement; if (browser) { lazy.TorDomainIsolator.newCircuitForBrowser( - browser.ownerGlobal.gBrowser + browser.ownerGlobal.gBrowser.selectedBrowser ); } } ===================================== browser/base/content/appmenu-viewcache.inc.xhtml ===================================== @@ -56,7 +56,7 @@ class="subviewbutton" key="new-circuit-key" data-l10n-id="appmenuitem-new-tor-circuit" - oncommand="TorDomainIsolator.newCircuitForBrowser(gBrowser);"/> + oncommand="TorDomainIsolator.newCircuitForBrowser(gBrowser.selectedBrowser);"/> <toolbarseparator/> <toolbarbutton id="appMenu-bookmarks-button" class="subviewbutton subviewbutton-nav" ===================================== browser/base/content/browser-menubar.inc ===================================== @@ -33,7 +33,7 @@ key="new-identity-key" data-l10n-id="menu-new-identity"/> <menuitem id="menu_newCircuit" key="new-circuit-key" data-l10n-id="menu-new-tor-circuit" - oncommand="TorDomainIsolator.newCircuitForBrowser(gBrowser);"/> + oncommand="TorDomainIsolator.newCircuitForBrowser(gBrowser.selectedBrowser);"/> <menuseparator/> <menuitem id="menu_openLocation" hidden="true" ===================================== browser/base/content/browser-sets.inc ===================================== @@ -392,5 +392,5 @@ internal="true"/> #endif <key id="new-identity-key" modifiers="accel shift" key="U" oncommand="NewIdentityButton.onCommand(event)"/> - <key id="new-circuit-key" modifiers="accel shift" key="L" oncommand="TorDomainIsolator.newCircuitForBrowser(gBrowser)"/> + <key id="new-circuit-key" modifiers="accel shift" key="L" oncommand="TorDomainIsolator.newCircuitForBrowser(gBrowser.selectedBrowser)"/> </keyset> ===================================== browser/base/content/navigator-toolbox.inc.xhtml ===================================== @@ -621,7 +621,7 @@ <toolbarbutton id="new-circuit-button" class="toolbarbutton-1 chromeclass-toolbar-additional" data-l10n-id="toolbar-new-tor-circuit" - oncommand="TorDomainIsolator.newCircuitForBrowser(gBrowser);"/> + oncommand="TorDomainIsolator.newCircuitForBrowser(gBrowser.selectedBrowser);"/> <toolbarbutton id="fullscreen-button" class="toolbarbutton-1 chromeclass-toolbar-additional" observes="View:FullScreen" ===================================== browser/components/torcircuit/content/torCircuitPanel.js ===================================== @@ -127,7 +127,7 @@ var gTorCircuitPanel = { document .getElementById("tor-circuit-new-circuit") .addEventListener("command", () => { - TorDomainIsolator.newCircuitForBrowser(gBrowser); + TorDomainIsolator.newCircuitForBrowser(gBrowser.selectedBrowser); }); // Update the display just before opening. ===================================== mobile/android/geckoview/src/main/java/org/mozilla/geckoview/GeckoSession.java ===================================== @@ -2610,6 +2610,14 @@ public class GeckoSession { return mEventDispatcher.queryBundle("GeckoView:GetTorCircuit"); } + /** + * Change the circuit for this session. + */ + @UiThread + public void newTorCircuit() { + mEventDispatcher.dispatch("GeckoView:NewTorCircuit"); + } + /** * Set this GeckoSession as active or inactive, which represents if the session is currently * visible or not. Setting a GeckoSession to inactive will significantly reduce its memory ===================================== mobile/shared/modules/geckoview/GeckoViewContent.sys.mjs ===================================== @@ -40,6 +40,7 @@ export class GeckoViewContent extends GeckoViewModule { "GeckoView:ZoomToInput", "GeckoView:IsPdfJs", "GeckoView:GetTorCircuit", + "GeckoView:NewTorCircuit", ]); } @@ -313,6 +314,9 @@ export class GeckoViewContent extends GeckoViewModule { case "GeckoView:GetTorCircuit": this._getTorCircuit(aCallback); break; + case "GeckoView:NewTorCircuit": + this._newTorCircuit(aCallback); + break; } } @@ -437,6 +441,11 @@ export class GeckoViewContent extends GeckoViewModule { } } + _newTorCircuit(aCallback) { + lazy.TorDomainIsolator.newCircuitForBrowser(this.browser); + aCallback?.onSuccess(); + } + async _containsFormData(aCallback) { aCallback.onSuccess(await this.actor.containsFormData()); } ===================================== toolkit/components/tor-launcher/TorDomainIsolator.sys.mjs ===================================== @@ -225,11 +225,9 @@ class TorDomainIsolatorImpl { * Create a new nonce for the FP domain of the selected browser and reload the * tab with a new circuit. * - * @param {object} globalBrowser Should be the gBrowser from the context of - * the caller + * @param {object} browser The browser we want to change the circuit for. */ - newCircuitForBrowser(globalBrowser) { - const browser = globalBrowser.selectedBrowser; + newCircuitForBrowser(browser) { const firstPartyDomain = getDomainForBrowser(browser); this.newCircuitForDomain(firstPartyDomain); const { username, password } = this.#getSocksProxyCredentials( View it on GitLab: https://gitlab.torproject.org/tpo/applications/tor-browser/-/compare/3b18923... -- View it on GitLab: https://gitlab.torproject.org/tpo/applications/tor-browser/-/compare/3b18923... You're receiving this email because of your account on gitlab.torproject.org.