1 /* This Source Code Form is subject to the terms of the Mozilla Public
2 * License, v. 2.0. If a copy of the MPL was not distributed with this
3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
8 registerCleanupFunction(async () => {
13 add_task(async
function setup() {
14 trrServer
= new TRRServer();
15 registerCleanupFunction(async () => {
16 await trrServer
.stop();
18 await trrServer
.start();
19 dump(`port = ${trrServer.port()}\n`);
21 Services
.prefs
.setCharPref(
23 `https://foo.example.com:${trrServer.port()}/dns-query`
25 Services
.prefs
.setIntPref("network.trr.mode", Ci
.nsIDNSService
.MODE_TRRFIRST
);
28 add_task(async
function check_ttl_works() {
29 await trrServer
.registerDoHAnswers("example.com", "A", {
40 let { inRecord
} = await
new TRRDNSListener("example.com", {
41 expectedAnswer
: "1.2.3.4",
43 equal(inRecord
.QueryInterface(Ci
.nsIDNSAddrRecord
).ttl
, 55);
44 await trrServer
.registerDoHAnswers("example.org", "A", {
55 // Simple check to see that TRR works.
56 ({ inRecord
} = await
new TRRDNSListener("example.org", {
57 expectedAnswer
: "1.2.3.4",
59 equal(inRecord
.QueryInterface(Ci
.nsIDNSAddrRecord
).ttl
, 999);