3 var mainThread = Services.tm.currentThread;
7 var prefs = Services.prefs;
9 // check that we don't lookup .onion
11 onLookupComplete(inRequest, inRecord, inStatus) {
12 Assert.ok(!Components.isSuccessCode(inStatus));
15 QueryInterface: ChromeUtils.generateQI(["nsIDNSListener"]),
18 // check that we do lookup .onion (via pref)
19 var listenerDontBlock = {
20 onLookupComplete(inRequest, inRecord, inStatus) {
21 inRecord.QueryInterface(Ci.nsIDNSAddrRecord);
22 var answer = inRecord.getNextAddrAsString();
23 Assert.ok(answer == "127.0.0.1" || answer == "::1");
26 QueryInterface: ChromeUtils.generateQI(["nsIDNSListener"]),
29 const defaultOriginAttributes = {};
31 function do_test_dontBlock() {
32 prefs.setBoolPref("network.dns.blockDotOnion", false);
33 Services.dns.asyncResolve(
35 Ci.nsIDNSService.RESOLVE_TYPE_DEFAULT,
40 defaultOriginAttributes
44 function do_test_block() {
45 prefs.setBoolPref("network.dns.blockDotOnion", true);
47 Services.dns.asyncResolve(
49 Ci.nsIDNSService.RESOLVE_TYPE_DEFAULT,
54 defaultOriginAttributes
57 // it is ok for this negative test to fail fast
64 // reset locally modified prefs
65 prefs.setCharPref("network.dns.localDomains", localdomainPref);
66 prefs.setBoolPref("network.dns.blockDotOnion", onionPref);
71 onionPref = prefs.getBoolPref("network.dns.blockDotOnion");
72 localdomainPref = prefs.getCharPref("network.dns.localDomains");
73 prefs.setCharPref("network.dns.localDomains", "private.onion");