Commits:
-
bf38c314
by Beatriz Rizental at 2026-09-30T18:02:26+02:00
fixup! BB 45120: Add tests for Base Browser
Bug 44820: Disable HTTPS-only mode when running mochitests
-
8d3f622b
by Beatriz Rizental at 2026-09-30T18:02:26+02:00
fixup! TB 43817: Add tests for Tor Browser
Bug 44820: Modify mochi runtests scripts to work in Tor Browser.
-
88ee7239
by Beatriz Rizental at 2026-09-30T18:02:26+02:00
fixup! TB3: Tor Browser's official .mozconfigs.
Bug 44820: Make TOR_BROWSER config is available to gradle
-
97193106
by Beatriz Rizental at 2026-09-30T18:02:26+02:00
fixup! BB 45120: Add tests for Base Browser
Bug 44820: Upstream geckoiew's own manifest requests
ACCESS_NETWORK_STATE. Tor Browser comments that line
out so geckoview doesn't ask for network-state access,
but the test app needs it. So we add it back.
-
b06b7fca
by Beatriz Rizental at 2026-09-30T18:02:26+02:00
fixup! Firefox preference overrides.
Bug 44820: Add note about prefs modified for mochitests
6 changed files:
Changes:
browser/app/profile/001-base-profile.js
| ... |
... |
@@ -57,6 +57,7 @@ pref("browser.disableResetPrompt", true); |
|
57
|
57
|
pref("browser.privatebrowsing.autostart", true);
|
|
58
|
58
|
pref("browser.cache.disk.enable", false);
|
|
59
|
59
|
pref("permissions.memory_only", true);
|
|
|
60
|
+// Note: toggled for mochitests (see testing/mochitest/runtests.py).
|
|
60
|
61
|
pref("security.nocertdb", true);
|
|
61
|
62
|
|
|
62
|
63
|
// tor-browser#42094: do not collect stats about WebRTC.
|
| ... |
... |
@@ -171,9 +172,13 @@ pref("clipboard.imageAsFile.enabled", false); |
|
171
|
172
|
pref("clipboard.copyPrivateDataToClipboardCloudOrHistory", false);
|
|
172
|
173
|
|
|
173
|
174
|
// Enable HTTPS-Only mode (tor-browser#19850)
|
|
|
175
|
+//
|
|
|
176
|
+// Note: toggled for mochitests (see testing/mochitest/runtests.py).
|
|
174
|
177
|
pref("dom.security.https_only_mode", true);
|
|
175
|
178
|
// The previous pref automatically sets this to true (see StaticPrefList.yaml),
|
|
176
|
179
|
// but set it anyway only as a defense-in-depth.
|
|
|
180
|
+//
|
|
|
181
|
+// Note: toggled for mochitests (see testing/mochitest/runtests.py).
|
|
177
|
182
|
pref("dom.security.https_only_mode_pbm", true);
|
|
178
|
183
|
// tor-browser#43197, defense in depth if ever https-only got disabled
|
|
179
|
184
|
pref("dom.security.https_first_add_exception_on_failure", false);
|
mobile/android/test_runner/src/main/AndroidManifest.xml
| ... |
... |
@@ -11,6 +11,7 @@ |
|
11
|
11
|
<uses-permission android:name="android.permission.CAMERA"/>
|
|
12
|
12
|
<uses-permission android:name="android.permission.FOREGROUND_SERVICE"/>
|
|
13
|
13
|
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
|
|
|
14
|
+ <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
|
|
14
|
15
|
|
|
15
|
16
|
<application
|
|
16
|
17
|
android:allowBackup="true"
|
moz.configure
| ... |
... |
@@ -1019,6 +1019,7 @@ set_define("BASE_BROWSER_VERSION_QUOTED", base_browser_version_quoted) |
|
1019
|
1019
|
# We always want Tor Browser to be defined. Since we do not need any
|
|
1020
|
1020
|
# value for it, just always set it to True.
|
|
1021
|
1021
|
set_define("TOR_BROWSER", True)
|
|
|
1022
|
+set_config("TOR_BROWSER", True)
|
|
1022
|
1023
|
|
|
1023
|
1024
|
|
|
1024
|
1025
|
# Please do not add configure checks from here on.
|
testing/mochitest/mochitest_options.py
| ... |
... |
@@ -7,7 +7,7 @@ import os |
|
7
|
7
|
import sys
|
|
8
|
8
|
import tempfile
|
|
9
|
9
|
from abc import ABCMeta, abstractmethod, abstractproperty
|
|
10
|
|
-from argparse import SUPPRESS, ArgumentParser
|
|
|
10
|
+from argparse import SUPPRESS, ArgumentParser, BooleanOptionalAction
|
|
11
|
11
|
from itertools import chain
|
|
12
|
12
|
from shutil import which
|
|
13
|
13
|
from urllib.parse import urlparse
|
| ... |
... |
@@ -163,6 +163,20 @@ class MochitestArguments(ArgumentContainer): |
|
163
|
163
|
"help": "Only run tests of this flavor.",
|
|
164
|
164
|
},
|
|
165
|
165
|
],
|
|
|
166
|
+ [
|
|
|
167
|
+ ["--tor-bootstrap"],
|
|
|
168
|
+ {
|
|
|
169
|
+ "action": BooleanOptionalAction,
|
|
|
170
|
+ "dest": "torBootstrap",
|
|
|
171
|
+ "default": True,
|
|
|
172
|
+ "help": "Wait for the Tor connection to finish bootstrapping "
|
|
|
173
|
+ "before loading the first test. The prefs/env needed for "
|
|
|
174
|
+ "mochitest content to load at all in Tor Browser (disabling "
|
|
|
175
|
+ "HTTPS-Only, TorDomainIsolator's non-Tor-proxy exemption, "
|
|
|
176
|
+ "and the mock TorProvider) are applied regardless of this "
|
|
|
177
|
+ "flag. Pass --no-tor-bootstrap to skip the wait.",
|
|
|
178
|
+ },
|
|
|
179
|
+ ],
|
|
166
|
180
|
[
|
|
167
|
181
|
["--keep-open"],
|
|
168
|
182
|
{
|
testing/mochitest/runtests.py
| ... |
... |
@@ -2136,6 +2136,11 @@ toolbar#nav-bar { |
|
2136
|
2136
|
# via the commandline at your own risk.
|
|
2137
|
2137
|
browserEnv["XPCOM_DEBUG_BREAK"] = "stack"
|
|
2138
|
2138
|
|
|
|
2139
|
+ # Default to the mock Tor provider so mochitest runs
|
|
|
2140
|
+ # don't depend on a real tor daemon/network.
|
|
|
2141
|
+ # --setenv TOR_PROVIDER=... below can still override this.
|
|
|
2142
|
+ browserEnv.setdefault("TOR_PROVIDER", "mock")
|
|
|
2143
|
+
|
|
2139
|
2144
|
# interpolate environment passed with options
|
|
2140
|
2145
|
try:
|
|
2141
|
2146
|
browserEnv.update(
|
| ... |
... |
@@ -2604,6 +2609,23 @@ toolbar#nav-bar { |
|
2604
|
2609
|
if getattr(self, "testRootAbs", None):
|
|
2605
|
2610
|
prefs["mochitest.testRoot"] = self.testRootAbs
|
|
2606
|
2611
|
|
|
|
2612
|
+ # 001-base-profile.js forces HTTPS-Only mode on, which upgrades
|
|
|
2613
|
+ # requests to the (plain http) mochitest web server and breaks test
|
|
|
2614
|
+ # content loading. Unlike a real Tor Browser install, that hardening
|
|
|
2615
|
+ # has nothing to do with what these tests exercise, and it applies
|
|
|
2616
|
+ # regardless of whether --tor-bootstrap is used.
|
|
|
2617
|
+ prefs["dom.security.https_only_mode"] = False
|
|
|
2618
|
+ prefs["dom.security.https_only_mode_pbm"] = False
|
|
|
2619
|
+
|
|
|
2620
|
+ # 001-base-profile.js sets security.nocertdb, so NSS never loads the
|
|
|
2621
|
+ # on-disk cert DB that fillCertificateDB() populates with mochitest's
|
|
|
2622
|
+ # test CA, and any HTTPS test content would fail with an
|
|
|
2623
|
+ # untrusted-issuer error. Persisting a cert DB is exactly what
|
|
|
2624
|
+ # nocertdb exists to prevent in a real Tor Browser profile for
|
|
|
2625
|
+ # privacy, but that doesn't apply here: this profile is thrown away
|
|
|
2626
|
+ # after the run, so there's nothing to leak.
|
|
|
2627
|
+ prefs["security.nocertdb"] = False
|
|
|
2628
|
+
|
|
2607
|
2629
|
# See if we should use fake media devices.
|
|
2608
|
2630
|
if options.useTestMediaDevices:
|
|
2609
|
2631
|
prefs["media.audio_loopback_dev"] = self.mediaDevices["audio"]["name"]
|
testing/mochitest/runtestsremote.py
| ... |
... |
@@ -352,11 +352,16 @@ class MochiRemote(MochitestDesktop): |
|
352
|
352
|
runFailures=False,
|
|
353
|
353
|
crashAsPass=False,
|
|
354
|
354
|
currentManifest=None,
|
|
|
355
|
+ torBootstrap=False,
|
|
355
|
356
|
):
|
|
356
|
357
|
"""
|
|
357
|
358
|
Run the app, log the duration it took to execute, return the status code.
|
|
358
|
359
|
Kill the app if it outputs nothing for |timeout| seconds.
|
|
359
|
360
|
"""
|
|
|
361
|
+ # torBootstrap is accepted for signature compatibility with the
|
|
|
362
|
+ # shared doTests() call site, but not implemented here: unlike
|
|
|
363
|
+ # MochitestDesktop.runApp, this launches the app via adb/activity
|
|
|
364
|
+ # rather than a Marionette session, so there's nothing to wait on.
|
|
360
|
365
|
|
|
361
|
366
|
if timeout == -1:
|
|
362
|
367
|
timeout = self.DEFAULT_TIMEOUT
|
|