Pier Angelo Vendrame pushed to branch tor-browser-153.4.0esr-16.0-1 at The Tor Project / Applications / Tor Browser Commits: 00be24bc by Beatriz Rizental at 2026-10-06T16:08:54-03:00 fixup! TB 43817: Add tests for Tor Browser Bug 44820: This change was part of tor-browser#2251 but during some of the commit handling I must have dropped it. - - - - - 8259d390 by Beatriz Rizental at 2026-10-06T16:10:27-03:00 fixup! BB 43535: Enable tests This reverts commit e42d7f1136aa55573c01c91a87dec69bbfbdb529. - - - - - ef53f9d9 by Beatriz Rizental at 2026-10-06T16:11:14-03:00 fixup! BB 45120: Add tests for Base Browser Bug 44820: The mochitest harness built the testing-common resource mapping as "file:///" + testingModulesDir. On Linux and macOS testingModulesDir is already an absolute path, so this produced "file:////home/...", which content processes fail to load from. - - - - - 2 changed files: - testing/mochitest/runtests.py - testing/specialpowers/api.js Changes: ===================================== testing/mochitest/runtests.py ===================================== @@ -62,6 +62,7 @@ from mozserve import DoHServer, Http2Server, Http3Server, MozHttp2Server try: from marionette_driver.addons import Addons from marionette_driver.marionette import Marionette + from marionette_driver.wait import Wait except ImportError as e: # noqa error = e @@ -1701,7 +1702,7 @@ class MochitestDesktop: if options.testingModulesDir is not None: manifestFile.write( - f"resource testing-common file:///{options.testingModulesDir}\n" + f"resource testing-common {Path(options.testingModulesDir).as_uri()}/\n" ) if options.store_chrome_manifest: shutil.copyfile(manifest, options.store_chrome_manifest) @@ -2281,6 +2282,44 @@ toolbar#nav-bar { script, script_args=(self.start_script_kwargs,) ) + def waitForTorBootstrap(self, timeout_ms=60 * 1000): + # Mirrors TorBrowserMixin.bootstrap() in + # testing/marionette/harness/marionette_harness/runner/mixins/tor_browser.py, + # duplicated here because that mixin is written against + # MarionetteTestCase, not the mochitest harness. + with self.marionette.using_context("chrome"): + did_bootstrap = self.marionette.execute_async_script( + """ + const { TorConnect, TorConnectStage, TorConnectTopics } = ChromeUtils.importESModule( + "moz-src:///toolkit/modules/TorConnect.sys.mjs" + ); + const [resolve] = arguments; + + if (TorConnect.stage.name === TorConnectStage.Bootstrapped) { + resolve(false); + return; + } + + Services.obs.addObserver(function observer() { + Services.obs.removeObserver(observer, TorConnectTopics.BootstrapComplete); + resolve(true); + }, TorConnectTopics.BootstrapComplete); + TorConnect.beginBootstrapping(); + """, + script_timeout=timeout_ms, + ) + + # Bootstrapping completes before TorConnect's redirect from + # about:torconnect to about:blank does. If we call execute_start_script + # (which navigates the same window) while that redirect is still in + # flight, the two navigations race and the mochitest-load event can be + # lost. So wait for the redirect to actually land first. + if did_bootstrap: + Wait(self.marionette).until( + lambda mn: mn.get_url() == "about:blank", + message="Still not in about:blank after Tor bootstrap", + ) + def fillCertificateDB(self, options): # TODO: move -> mozprofile: # https://bugzilla.mozilla.org/show_bug.cgi?id=746243#c35 @@ -2626,6 +2665,13 @@ toolbar#nav-bar { # after the run, so there's nothing to leak. prefs["security.nocertdb"] = False + # Tell TorDomainIsolator the proxy it sees isn't really Tor, so it + # doesn't try to rewrite mochitest's own local PAC-provided proxy (see + # mozprofile.permissions.Permissions.pac_prefs, applied via + # self.profile.set_proxy() below) into a broken SOCKS proxy. This is + # needed for any mochitest content loading, not just --tor-bootstrap. + prefs["extensions.torbutton.use_nontor_proxy"] = True + # See if we should use fake media devices. if options.useTestMediaDevices: prefs["media.audio_loopback_dev"] = self.mediaDevices["audio"]["name"] @@ -2845,6 +2891,7 @@ toolbar#nav-bar { runFailures=False, crashAsPass=False, currentManifest=None, + torBootstrap=False, ): """ Run the app, log the duration it took to execute, return the status code. @@ -3058,6 +3105,9 @@ toolbar#nav-bar { temp_file_paths.append(temp_addon_path) addons.install(temp_addon_path) + if torBootstrap: + self.waitForTorBootstrap() + self.execute_start_script() # an open marionette session interacts badly with mochitest, @@ -4132,6 +4182,7 @@ toolbar#nav-bar { runFailures=options.runFailures, crashAsPass=options.crashAsPass, currentManifest=manifestToFilter, + torBootstrap=options.torBootstrap, ) self.log.info( f"runtests.py | Running {scheme} tests: end. status: {ret}" ===================================== testing/specialpowers/api.js ===================================== @@ -40,18 +40,6 @@ this.specialpowers = class extends ExtensionAPI { uri, resProto.ALLOW_CONTENT_ACCESS ); - } else { - // This is a hack! - // For some reason, this specific substituion has an extra `/` in the path. - // This is a workaround to fix it. - // - // TODO (#43545): Remove this once we have a proper fix. - let uri = resProto.getSubstitution("testing-common"); - resProto.setSubstitution( - "testing-common", - Services.io.newURI(uri.spec.replace("file:////", "file:///")), - resProto.ALLOW_CONTENT_ACCESS - ); } SpecialPowersParent.registerActor(); View it on GitLab: https://gitlab.torproject.org/tpo/applications/tor-browser/-/compare/e0d4d96... -- View it on GitLab: https://gitlab.torproject.org/tpo/applications/tor-browser/-/compare/e0d4d96... You're receiving this email because of your account on gitlab.torproject.org. Manage all notifications: https://gitlab.torproject.org/-/profile/notifications | Help: https://gitlab.torproject.org/help
participants (1)
-
Pier Angelo Vendrame (@pierov)