[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [Git][tpo/applications/tor-browser][tor-browser-153.4.0esr-16.0-1] 3 commits: fixup! TB 43817: Add tests for Tor Browser



Title: GitLab

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:

Changes:

  • testing/mochitest/runtests.py
    ... ... @@ -62,6 +62,7 @@ from mozserve import DoHServer, Http2Server, Http3Server, MozHttp2Server
    62 62
     try:
    
    63 63
         from marionette_driver.addons import Addons
    
    64 64
         from marionette_driver.marionette import Marionette
    
    65
    +    from marionette_driver.wait import Wait
    
    65 66
     except ImportError as e:  # noqa
    
    66 67
         error = e
    
    67 68
     
    
    ... ... @@ -1701,7 +1702,7 @@ class MochitestDesktop:
    1701 1702
     
    
    1702 1703
                 if options.testingModulesDir is not None:
    
    1703 1704
                     manifestFile.write(
    
    1704
    -                    f"resource testing-common file:///{options.testingModulesDir}\n"
    
    1705
    +                    f"resource testing-common {Path(options.testingModulesDir).as_uri()}/\n"
    
    1705 1706
                     )
    
    1706 1707
             if options.store_chrome_manifest:
    
    1707 1708
                 shutil.copyfile(manifest, options.store_chrome_manifest)
    
    ... ... @@ -2281,6 +2282,44 @@ toolbar#nav-bar {
    2281 2282
                     script, script_args=(self.start_script_kwargs,)
    
    2282 2283
                 )
    
    2283 2284
     
    
    2285
    +    def waitForTorBootstrap(self, timeout_ms=60 * 1000):
    
    2286
    +        # Mirrors TorBrowserMixin.bootstrap() in
    
    2287
    +        # testing/marionette/harness/marionette_harness/runner/mixins/tor_browser.py,
    
    2288
    +        # duplicated here because that mixin is written against
    
    2289
    +        # MarionetteTestCase, not the mochitest harness.
    
    2290
    +        with self.marionette.using_context("chrome"):
    
    2291
    +            did_bootstrap = self.marionette.execute_async_script(
    
    2292
    +                """
    
    2293
    +                const { TorConnect, TorConnectStage, TorConnectTopics } = ChromeUtils.importESModule(
    
    2294
    +                    "moz-src:///toolkit/modules/TorConnect.sys.mjs"
    
    2295
    +                );
    
    2296
    +                const [resolve] = arguments;
    
    2297
    +
    
    2298
    +                if (TorConnect.stage.name === TorConnectStage.Bootstrapped) {
    
    2299
    +                    resolve(false);
    
    2300
    +                    return;
    
    2301
    +                }
    
    2302
    +
    
    2303
    +                Services.obs.addObserver(function observer() {
    
    2304
    +                    Services.obs.removeObserver(observer, TorConnectTopics.BootstrapComplete);
    
    2305
    +                    resolve(true);
    
    2306
    +                }, TorConnectTopics.BootstrapComplete);
    
    2307
    +                TorConnect.beginBootstrapping();
    
    2308
    +                """,
    
    2309
    +                script_timeout=timeout_ms,
    
    2310
    +            )
    
    2311
    +
    
    2312
    +        # Bootstrapping completes before TorConnect's redirect from
    
    2313
    +        # about:torconnect to about:blank does. If we call execute_start_script
    
    2314
    +        # (which navigates the same window) while that redirect is still in
    
    2315
    +        # flight, the two navigations race and the mochitest-load event can be
    
    2316
    +        # lost. So wait for the redirect to actually land first.
    
    2317
    +        if did_bootstrap:
    
    2318
    +            Wait(self.marionette).until(
    
    2319
    +                lambda mn: mn.get_url() == "about:blank",
    
    2320
    +                message="Still not in about:blank after Tor bootstrap",
    
    2321
    +            )
    
    2322
    +
    
    2284 2323
         def fillCertificateDB(self, options):
    
    2285 2324
             # TODO: move -> mozprofile:
    
    2286 2325
             # https://bugzilla.mozilla.org/show_bug.cgi?id=746243#c35
    
    ... ... @@ -2626,6 +2665,13 @@ toolbar#nav-bar {
    2626 2665
             # after the run, so there's nothing to leak.
    
    2627 2666
             prefs["security.nocertdb"] = False
    
    2628 2667
     
    
    2668
    +        # Tell TorDomainIsolator the proxy it sees isn't really Tor, so it
    
    2669
    +        # doesn't try to rewrite mochitest's own local PAC-provided proxy (see
    
    2670
    +        # mozprofile.permissions.Permissions.pac_prefs, applied via
    
    2671
    +        # self.profile.set_proxy() below) into a broken SOCKS proxy. This is
    
    2672
    +        # needed for any mochitest content loading, not just --tor-bootstrap.
    
    2673
    +        prefs["extensions.torbutton.use_nontor_proxy"] = True
    
    2674
    +
    
    2629 2675
             # See if we should use fake media devices.
    
    2630 2676
             if options.useTestMediaDevices:
    
    2631 2677
                 prefs["media.audio_loopback_dev"] = self.mediaDevices["audio"]["name"]
    
    ... ... @@ -2845,6 +2891,7 @@ toolbar#nav-bar {
    2845 2891
             runFailures=False,
    
    2846 2892
             crashAsPass=False,
    
    2847 2893
             currentManifest=None,
    
    2894
    +        torBootstrap=False,
    
    2848 2895
         ):
    
    2849 2896
             """
    
    2850 2897
             Run the app, log the duration it took to execute, return the status code.
    
    ... ... @@ -3058,6 +3105,9 @@ toolbar#nav-bar {
    3058 3105
                             temp_file_paths.append(temp_addon_path)
    
    3059 3106
                             addons.install(temp_addon_path)
    
    3060 3107
     
    
    3108
    +                if torBootstrap:
    
    3109
    +                    self.waitForTorBootstrap()
    
    3110
    +
    
    3061 3111
                     self.execute_start_script()
    
    3062 3112
     
    
    3063 3113
                     # an open marionette session interacts badly with mochitest,
    
    ... ... @@ -4132,6 +4182,7 @@ toolbar#nav-bar {
    4132 4182
                         runFailures=options.runFailures,
    
    4133 4183
                         crashAsPass=options.crashAsPass,
    
    4134 4184
                         currentManifest=manifestToFilter,
    
    4185
    +                    torBootstrap=options.torBootstrap,
    
    4135 4186
                     )
    
    4136 4187
                     self.log.info(
    
    4137 4188
                         f"runtests.py | Running {scheme} tests: end. status: {ret}"
    

  • testing/specialpowers/api.js
    ... ... @@ -40,18 +40,6 @@ this.specialpowers = class extends ExtensionAPI {
    40 40
             uri,
    
    41 41
             resProto.ALLOW_CONTENT_ACCESS
    
    42 42
           );
    
    43
    -    } else {
    
    44
    -      // This is a hack!
    
    45
    -      // For some reason, this specific substituion has an extra `/` in the path.
    
    46
    -      // This is a workaround to fix it.
    
    47
    -      //
    
    48
    -      // TODO (#43545): Remove this once we have a proper fix.
    
    49
    -      let uri = resProto.getSubstitution("testing-common");
    
    50
    -      resProto.setSubstitution(
    
    51
    -        "testing-common",
    
    52
    -        Services.io.newURI(uri.spec.replace("file:////", "file:///")),
    
    53
    -        resProto.ALLOW_CONTENT_ACCESS
    
    54
    -      );
    
    55 43
         }
    
    56 44
     
    
    57 45
         SpecialPowersParent.registerActor();
    

  • _______________________________________________
    tor-commits mailing list -- tor-commits@xxxxxxxxxxxxxxxxxxxx
    To unsubscribe send an email to tor-commits-leave@xxxxxxxxxxxxxxxxxxxx