Backed out changeset b71c8c052463 (bug 1943846) for causing mass failures. CLOSED...
[gecko.git] / netwerk / test / unit / test_dns_disable_ipv6.js
blobd05c56091f651a67b11d90f1faa4eeea4f16fdb2
1 //
2 // Tests that calling asyncResolve with the RESOLVE_DISABLE_IPV6 flag doesn't
3 // return any IPv6 addresses.
4 //
6 "use strict";
8 var listener = {
9 onLookupComplete(inRequest, inRecord, inStatus) {
10 if (inStatus != Cr.NS_OK) {
11 Assert.equal(inStatus, Cr.NS_ERROR_UNKNOWN_HOST);
12 do_test_finished();
13 return;
16 while (true) {
17 try {
18 inRecord.QueryInterface(Ci.nsIDNSAddrRecord);
19 var answer = inRecord.getNextAddrAsString();
20 // If there is an answer it should be an IPv4 address
21 dump(answer);
22 Assert.ok(!answer.includes(":"));
23 Assert.ok(answer.includes("."));
24 } catch (e) {
25 break;
28 do_test_finished();
32 const defaultOriginAttributes = {};
34 function run_test() {
35 do_test_pending();
36 try {
37 Services.dns.asyncResolve(
38 "example.com",
39 Ci.nsIDNSService.RESOLVE_TYPE_DEFAULT,
40 Ci.nsIDNSService.RESOLVE_DISABLE_IPV6,
41 null, // resolverInfo
42 listener,
43 null,
44 defaultOriginAttributes
46 } catch (e) {
47 dump(e);
48 Assert.ok(false);
49 do_test_finished();