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/. */
12 add_task(async function checkBlocklisting() {
13 Services.prefs.setBoolPref("network.trr.temp_blocklist", true);
14 Services.prefs.setBoolPref("network.trr.strict_native_fallback", true);
16 let trrServer = new TRRServer();
17 registerCleanupFunction(async () => {
18 await trrServer.stop();
20 await trrServer.start();
21 info(`port = ${trrServer.port}\n`);
23 Services.dns.clearCache(true);
24 Services.prefs.setCharPref(
26 `https://foo.example.com:${trrServer.port}/dns-query`
28 Services.prefs.setIntPref("network.trr.mode", Ci.nsIDNSService.MODE_TRRFIRST);
30 // Check that we properly fallback to native DNS for a variety of DNS rcodes
31 for (let i = 0; i <= 5; i++) {
32 info(`testing rcode=${i}`);
33 await trrServer.registerDoHAnswers(`sub${i}.blocklisted.com`, "A", {
36 await trrServer.registerDoHAnswers(`sub${i}.blocklisted.com`, "AAAA", {
40 await new TRRDNSListener(`sub${i}.blocklisted.com`, {
41 expectedAnswer: "127.0.0.1",
43 Services.dns.clearCache(true);
44 await new TRRDNSListener(`sub${i}.blocklisted.com`, {
45 expectedAnswer: "127.0.0.1",
47 await new TRRDNSListener(`sub.sub${i}.blocklisted.com`, {
48 expectedAnswer: "127.0.0.1",
50 Services.dns.clearCache(true);