Bug 1931425 - Limit how often moz-label's #setStyles runs r=reusable-components-revie...
[gecko.git] / netwerk / test / unit / test_dns_localredirect.js
blob5907f15b06eae10bc5e63d8755ae0a280f3cd0a4
1 "use strict";
3 var prefs = Services.prefs;
5 var nextTest;
7 var listener = {
8 onLookupComplete(inRequest, inRecord) {
9 inRecord.QueryInterface(Ci.nsIDNSAddrRecord);
10 var answer = inRecord.getNextAddrAsString();
11 Assert.ok(answer == "127.0.0.1" || answer == "::1");
13 nextTest();
14 do_test_finished();
16 QueryInterface: ChromeUtils.generateQI(["nsIDNSListener"]),
19 const defaultOriginAttributes = {};
21 function run_test() {
22 prefs.setCharPref("network.dns.localDomains", "local.vingtetun.org");
24 var mainThread = Services.tm.currentThread;
25 nextTest = do_test_2;
26 Services.dns.asyncResolve(
27 "local.vingtetun.org",
28 Ci.nsIDNSService.RESOLVE_TYPE_DEFAULT,
30 null, // resolverInfo
31 listener,
32 mainThread,
33 defaultOriginAttributes
36 do_test_pending();
39 function do_test_2() {
40 var mainThread = Services.tm.currentThread;
41 nextTest = testsDone;
42 prefs.setCharPref("network.dns.forceResolve", "localhost");
43 Services.dns.asyncResolve(
44 "www.example.com",
45 Ci.nsIDNSService.RESOLVE_TYPE_DEFAULT,
47 null, // resolverInfo
48 listener,
49 mainThread,
50 defaultOriginAttributes
53 do_test_pending();
56 function testsDone() {
57 prefs.clearUserPref("network.dns.localDomains");
58 prefs.clearUserPref("network.dns.forceResolve");