| ... |
... |
@@ -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}"
|