let trrServer;
add_setup(async function setup() {
trr_test_setup();
Services.dns.clearCache(true);
Services.prefs.setBoolPref("network.trr.preserve_on_background", true);
// Verify that TRR connections survive the application-background cleanup that // Android uses to conserve power when Firefox goes to the background.
add_task(async function test_trr_connection_survives_background() { // Warm up the TRR connection.
await new TRRDNSListener("before.example.com", "1.2.3.4");
// Simulate the Android application-background event. This posts a cleanup // message to the socket thread that closes persistent connections for all // non-TRR entries.
Services.obs.notifyObservers(null, "application-background");
// This lookup must reuse the same TRR connection (same TCP port).
await new TRRDNSListener("after.example.com", "1.2.3.5");
let portLog = await trrServer.execute("global.gDoHPortsLog");
info(`Port log: ${JSON.stringify(portLog)}`);
// Collect the client ports seen for each domain. A and AAAA queries may // open separate TCP connections, so we get a set of ports per domain. const portsFor = domain => new Set(portLog.filter(([d]) => d === domain).map(([, p]) => p)); const beforePorts = portsFor("before.example.com"); const afterPorts = portsFor("after.example.com");
Assert.greater(beforePorts.size, 0, "before.example.com lookup was logged"); Assert.greater(afterPorts.size, 0, "after.example.com lookup was logged");
// At least one port must be shared, confirming the TRR connection was not // torn down by the background cleanup. const reused = [...afterPorts].some(p => beforePorts.has(p)); Assert.ok(
reused,
`TRR connection reused after application-background (before=${[...beforePorts]}, after=${[...afterPorts]})`
);
});
Messung V0.5 in Prozent
¤ Dauer der Verarbeitung: 0.13 Sekunden
(vorverarbeitet am 2026-09-29)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.