2007-09-01 02:31:20 +04:00
|
|
|
function run_test() {
|
2012-05-11 23:59:19 +04:00
|
|
|
check_localhost();
|
|
|
|
check_local_redirect();
|
|
|
|
}
|
|
|
|
|
|
|
|
function check_localhost() {
|
2007-09-01 02:31:20 +04:00
|
|
|
var dns = Components.classes["@mozilla.org/network/dns-service;1"]
|
|
|
|
.getService(Components.interfaces.nsIDNSService);
|
|
|
|
var rec = dns.resolve("localhost", 0);
|
2008-01-05 11:10:56 +03:00
|
|
|
var answer = rec.getNextAddrAsString();
|
|
|
|
do_check_true(answer == "127.0.0.1" || answer == "::1");
|
2007-09-01 02:31:20 +04:00
|
|
|
}
|
2012-05-11 23:59:19 +04:00
|
|
|
|
|
|
|
function check_local_redirect() {
|
|
|
|
var prefs = Components.classes["@mozilla.org/preferences-service;1"]
|
|
|
|
.getService(Components.interfaces.nsIPrefBranch);
|
|
|
|
prefs.setCharPref("network.dns.localDomains", "local.vingtetun.org");
|
|
|
|
|
|
|
|
var dns = Components.classes["@mozilla.org/network/dns-service;1"]
|
|
|
|
.getService(Components.interfaces.nsIDNSService);
|
|
|
|
var rec = dns.resolve("local.vingtetun.org", 0);
|
|
|
|
var answer = rec.getNextAddrAsString();
|
|
|
|
do_check_true(answer == "127.0.0.1" || answer == "::1");
|
|
|
|
|
|
|
|
prefs.clearUserPref("network.dns.localDomains");
|
|
|
|
}
|
|
|
|
|