mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-27 14:52:16 +00:00
Bug 1596845
- Make DNSServices available as Services.dns
r=necko-reviewers,webdriver-reviewers,kershaw
Depends on D164347 Differential Revision: https://phabricator.services.mozilla.com/D164856
This commit is contained in:
parent
b65942a662
commit
6ca2987fe1
@ -285,7 +285,6 @@ XPCOMUtils.defineLazyServiceGetters(this, {
|
||||
"nsIURIClassifier",
|
||||
],
|
||||
Favicons: ["@mozilla.org/browser/favicon-service;1", "nsIFaviconService"],
|
||||
gDNSService: ["@mozilla.org/network/dns-service;1", "nsIDNSService"],
|
||||
WindowsUIUtils: ["@mozilla.org/windows-ui-utils;1", "nsIWindowsUIUtils"],
|
||||
BrowserHandler: ["@mozilla.org/browser/clh;1", "nsIBrowserHandler"],
|
||||
});
|
||||
|
@ -79,13 +79,6 @@ XPCOMUtils.defineLazyServiceGetter(
|
||||
"nsICaptivePortalService"
|
||||
);
|
||||
|
||||
XPCOMUtils.defineLazyServiceGetter(
|
||||
lazy,
|
||||
"gDNSService",
|
||||
"@mozilla.org/network/dns-service;1",
|
||||
"nsIDNSService"
|
||||
);
|
||||
|
||||
XPCOMUtils.defineLazyServiceGetter(
|
||||
lazy,
|
||||
"gNetworkLinkService",
|
||||
@ -369,7 +362,7 @@ const DoHController = {
|
||||
};
|
||||
|
||||
if (results.steeredProvider) {
|
||||
lazy.gDNSService.setDetectedTrrURI(results.steeredProvider.uri);
|
||||
Services.dns.setDetectedTrrURI(results.steeredProvider.uri);
|
||||
resultsForTelemetry.steeredProvider = results.steeredProvider.id;
|
||||
}
|
||||
|
||||
|
@ -17,13 +17,6 @@ const { XPCOMUtils } = ChromeUtils.importESModule(
|
||||
|
||||
const lazy = {};
|
||||
|
||||
XPCOMUtils.defineLazyServiceGetter(
|
||||
lazy,
|
||||
"gDNSService",
|
||||
"@mozilla.org/network/dns-service;1",
|
||||
"nsIDNSService"
|
||||
);
|
||||
|
||||
XPCOMUtils.defineLazyServiceGetter(
|
||||
lazy,
|
||||
"gNetworkLinkService",
|
||||
@ -139,7 +132,7 @@ async function dnsLookup(hostname, resolveCanonicalName = false) {
|
||||
Ci.nsIDNSService.RESOLVE_BYPASS_CACHE |
|
||||
Ci.nsIDNSService.RESOLVE_CANONICAL_NAME;
|
||||
try {
|
||||
request = lazy.gDNSService.asyncResolve(
|
||||
request = Services.dns.asyncResolve(
|
||||
hostname,
|
||||
Ci.nsIDNSService.RESOLVE_TYPE_DEFAULT,
|
||||
dnsFlags,
|
||||
|
@ -44,13 +44,6 @@ XPCOMUtils.defineLazyServiceGetter(
|
||||
"nsICaptivePortalService"
|
||||
);
|
||||
|
||||
XPCOMUtils.defineLazyServiceGetter(
|
||||
lazy,
|
||||
"gDNSService",
|
||||
"@mozilla.org/network/dns-service;1",
|
||||
"nsIDNSService"
|
||||
);
|
||||
|
||||
// The canonical domain whose subdomains we will be resolving.
|
||||
XPCOMUtils.defineLazyPreferenceGetter(
|
||||
lazy,
|
||||
@ -110,11 +103,11 @@ class DNSLookup {
|
||||
this.retryCount++;
|
||||
try {
|
||||
this.usedDomain = this._domain || getRandomSubdomain();
|
||||
lazy.gDNSService.asyncResolve(
|
||||
Services.dns.asyncResolve(
|
||||
this.usedDomain,
|
||||
Ci.nsIDNSService.RESOLVE_TYPE_DEFAULT,
|
||||
Ci.nsIDNSService.RESOLVE_BYPASS_CACHE,
|
||||
lazy.gDNSService.newAdditionalInfo(this.trrServer, -1),
|
||||
Services.dns.newAdditionalInfo(this.trrServer, -1),
|
||||
this,
|
||||
Services.tm.currentThread,
|
||||
{}
|
||||
|
@ -48,12 +48,16 @@ add_task(async function testProviderSteering() {
|
||||
// We need this check because this topic is observed once immediately
|
||||
// after the network change when the URI is reset, and then when the
|
||||
// provider steering heuristic runs and sets it to our uri.
|
||||
return gDNSService.currentTrrURI == expectedURI;
|
||||
return Services.dns.currentTrrURI == expectedURI;
|
||||
}
|
||||
);
|
||||
simulateNetworkChange();
|
||||
await trrURIChanged;
|
||||
is(gDNSService.currentTrrURI, expectedURI, `TRR URI set to ${expectedURI}`);
|
||||
is(
|
||||
Services.dns.currentTrrURI,
|
||||
expectedURI,
|
||||
`TRR URI set to ${expectedURI}`
|
||||
);
|
||||
await checkHeuristicsTelemetry(
|
||||
heuristicsDecision,
|
||||
"netchange",
|
||||
|
@ -14,13 +14,6 @@ XPCOMUtils.defineLazyModuleGetters(this, {
|
||||
RemoteSettings: "resource://services-settings/remote-settings.js",
|
||||
});
|
||||
|
||||
XPCOMUtils.defineLazyServiceGetter(
|
||||
this,
|
||||
"gDNSService",
|
||||
"@mozilla.org/network/dns-service;1",
|
||||
"nsIDNSService"
|
||||
);
|
||||
|
||||
XPCOMUtils.defineLazyServiceGetter(
|
||||
this,
|
||||
"gDNSOverride",
|
||||
|
@ -148,9 +148,7 @@ LocalDevice.prototype = {
|
||||
// TODO: Bug 1180997: Find the right way to expose an editable name
|
||||
this.name = Services.sysinfo.get("device");
|
||||
} else {
|
||||
this.name = Cc["@mozilla.org/network/dns-service;1"].getService(
|
||||
Ci.nsIDNSService
|
||||
).myHostName;
|
||||
this.name = Services.dns.myHostName;
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -16,8 +16,7 @@ ChromeUtils.defineESModuleGetters(lazy, {
|
||||
loader.lazyGetter(this, "hostname", () => {
|
||||
try {
|
||||
// On some platforms (Linux according to try), this service does not exist and fails.
|
||||
return Cc["@mozilla.org/network/dns-service;1"].getService(Ci.nsIDNSService)
|
||||
.myHostName;
|
||||
return Services.dns.myHostName;
|
||||
} catch (e) {
|
||||
return "";
|
||||
}
|
||||
|
@ -43,13 +43,6 @@ XPCOMUtils.defineLazyServiceGetter(
|
||||
"nsIFileProtocolHandler"
|
||||
);
|
||||
|
||||
XPCOMUtils.defineLazyServiceGetter(
|
||||
lazy,
|
||||
"gDNSService",
|
||||
"@mozilla.org/network/dns-service;1",
|
||||
"nsIDNSService"
|
||||
);
|
||||
|
||||
XPCOMUtils.defineLazyServiceGetter(
|
||||
lazy,
|
||||
"handlerService",
|
||||
@ -628,7 +621,7 @@ URIFixup.prototype = {
|
||||
}
|
||||
|
||||
Services.obs.notifyObservers(null, "uri-fixup-check-dns");
|
||||
lazy.gDNSService.asyncResolve(
|
||||
Services.dns.asyncResolve(
|
||||
lookupName,
|
||||
Ci.nsIDNSService.RESOLVE_TYPE_DEFAULT,
|
||||
0,
|
||||
|
@ -14,13 +14,6 @@ XPCOMUtils.defineLazyServiceGetter(
|
||||
"nsINativeDNSResolverOverride"
|
||||
);
|
||||
|
||||
XPCOMUtils.defineLazyServiceGetter(
|
||||
lazy,
|
||||
"gDNSService",
|
||||
"@mozilla.org/network/dns-service;1",
|
||||
"nsIDNSService"
|
||||
);
|
||||
|
||||
add_task(async function setup() {
|
||||
Services.prefs.setStringPref("browser.fixup.alternate.prefix", "www.");
|
||||
Services.prefs.setStringPref("browser.fixup.alternate.suffix", ".com");
|
||||
@ -95,7 +88,7 @@ add_task(async function test_uri_with_force_fixup() {
|
||||
);
|
||||
|
||||
lazy.gDNSOverride.clearHostOverride(fixedURI.displayHost);
|
||||
lazy.gDNSService.clearCache(false);
|
||||
Services.dns.clearCache(false);
|
||||
});
|
||||
|
||||
add_task(async function test_uri_with_get_fixup() {
|
||||
@ -112,7 +105,7 @@ add_task(async function test_uri_with_get_fixup() {
|
||||
);
|
||||
|
||||
lazy.gDNSOverride.clearHostOverride(uri.displayHost);
|
||||
lazy.gDNSService.clearCache(false);
|
||||
Services.dns.clearCache(false);
|
||||
});
|
||||
|
||||
add_task(async function test_intranet_like_uri() {
|
||||
@ -132,7 +125,7 @@ add_task(async function test_intranet_like_uri() {
|
||||
|
||||
lazy.gDNSOverride.clearHostOverride(uri.displayHost);
|
||||
lazy.gDNSOverride.clearHostOverride(uri.displayHost + ".");
|
||||
lazy.gDNSService.clearCache(false);
|
||||
Services.dns.clearCache(false);
|
||||
});
|
||||
|
||||
add_task(async function test_intranet_like_uri_without_fixup() {
|
||||
@ -156,7 +149,7 @@ add_task(async function test_intranet_like_uri_without_fixup() {
|
||||
|
||||
lazy.gDNSOverride.clearHostOverride(uri.displayHost);
|
||||
lazy.gDNSOverride.clearHostOverride(uri.displayHost + ".");
|
||||
lazy.gDNSService.clearCache(false);
|
||||
Services.dns.clearCache(false);
|
||||
});
|
||||
|
||||
add_task(async function test_ip_address() {
|
||||
@ -185,6 +178,6 @@ add_task(async function test_ip_address() {
|
||||
);
|
||||
|
||||
lazy.gDNSOverride.clearHostOverride(uri.displayHost);
|
||||
lazy.gDNSService.clearCache(false);
|
||||
Services.dns.clearCache(false);
|
||||
Services.obs.removeObserver(observer, topic);
|
||||
});
|
||||
|
@ -114,8 +114,11 @@ Classes = [
|
||||
'headers': ['mozilla/net/Dashboard.h'],
|
||||
},
|
||||
{
|
||||
'name': 'DNS',
|
||||
'js_name': 'dns',
|
||||
'cid': '{b0ff4572-dae4-4bef-a092-83c1b88f6be9}',
|
||||
'contract_ids': ['@mozilla.org/network/dns-service;1'],
|
||||
'interfaces': ['nsIDNSService'],
|
||||
'singleton': True,
|
||||
'type': 'nsIDNSService',
|
||||
'constructor': 'nsDNSService::GetXPCOMSingleton',
|
||||
|
@ -14,7 +14,6 @@ const { NodeServer } = ChromeUtils.import("resource://testing-common/httpd.js");
|
||||
const { AppConstants } = ChromeUtils.importESModule(
|
||||
"resource://gre/modules/AppConstants.sys.mjs"
|
||||
);
|
||||
let gDNS;
|
||||
|
||||
/// Sets the TRR related prefs and adds the certificate we use for the HTTP2
|
||||
/// server.
|
||||
@ -139,18 +138,12 @@ class TRRDNSListener {
|
||||
);
|
||||
const currentThread = threadManager.currentThread;
|
||||
|
||||
if (!gDNS) {
|
||||
gDNS = Cc["@mozilla.org/network/dns-service;1"].getService(
|
||||
Ci.nsIDNSService
|
||||
);
|
||||
}
|
||||
|
||||
this.additionalInfo =
|
||||
trrServer == "" && port == -1
|
||||
? null
|
||||
: gDNS.newAdditionalInfo(trrServer, port);
|
||||
: Services.dns.newAdditionalInfo(trrServer, port);
|
||||
try {
|
||||
this.request = gDNS.asyncResolve(
|
||||
this.request = Services.dns.asyncResolve(
|
||||
this.name,
|
||||
this.type,
|
||||
this.options.flags || 0,
|
||||
@ -240,7 +233,7 @@ class TRRDNSListener {
|
||||
}
|
||||
|
||||
cancel(aStatus = Cr.NS_ERROR_ABORT) {
|
||||
gDNS.cancelAsyncResolve(
|
||||
Services.dns.cancelAsyncResolve(
|
||||
this.name,
|
||||
this.type,
|
||||
this.options.flags || 0,
|
||||
|
@ -8,10 +8,6 @@ ChromeUtils.import("resource://gre/modules/NetUtil.jsm");
|
||||
|
||||
let h2Port;
|
||||
|
||||
const dns = Cc["@mozilla.org/network/dns-service;1"].getService(
|
||||
Ci.nsIDNSService
|
||||
);
|
||||
|
||||
const { TestUtils } = ChromeUtils.importESModule(
|
||||
"resource://testing-common/TestUtils.sys.mjs"
|
||||
);
|
||||
@ -27,6 +23,7 @@ add_setup(async function setup() {
|
||||
});
|
||||
|
||||
if (mozinfo.socketprocess_networking) {
|
||||
Services.dns; // Needed to trigger socket process.
|
||||
await TestUtils.waitForCondition(() => Services.io.socketProcessLaunched);
|
||||
}
|
||||
|
||||
@ -44,7 +41,7 @@ add_task(async function testTXTResolve() {
|
||||
);
|
||||
|
||||
let { inRecord } = await new TRRDNSListener("_esni.example.com", {
|
||||
type: dns.RESOLVE_TYPE_TXT,
|
||||
type: Ci.nsIDNSService.RESOLVE_TYPE_TXT,
|
||||
});
|
||||
|
||||
let answer = inRecord
|
||||
@ -60,7 +57,7 @@ add_task(async function testTXTRecordPushPart1() {
|
||||
"https://foo.example.com:" + h2Port + "/txt-dns-push"
|
||||
);
|
||||
let { inRecord } = await new TRRDNSListener("_esni_push.example.com", {
|
||||
type: dns.RESOLVE_TYPE_DEFAULT,
|
||||
type: Ci.nsIDNSService.RESOLVE_TYPE_DEFAULT,
|
||||
expectedAnswer: "127.0.0.1",
|
||||
});
|
||||
|
||||
@ -78,7 +75,7 @@ add_task(async function testTXTRecordPushPart2() {
|
||||
"https://foo.example.com:" + h2Port + "/404"
|
||||
);
|
||||
let { inRecord } = await new TRRDNSListener("_esni_push.example.com", {
|
||||
type: dns.RESOLVE_TYPE_TXT,
|
||||
type: Ci.nsIDNSService.RESOLVE_TYPE_TXT,
|
||||
});
|
||||
|
||||
let answer = inRecord
|
||||
|
@ -1,7 +1,5 @@
|
||||
"use strict";
|
||||
|
||||
var dns = Cc["@mozilla.org/network/dns-service;1"].getService(Ci.nsIDNSService);
|
||||
|
||||
var hostname1 = "";
|
||||
var hostname2 = "";
|
||||
var possible = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
|
||||
@ -51,7 +49,7 @@ function run_test() {
|
||||
var flags = Ci.nsIDNSService.RESOLVE_BYPASS_CACHE;
|
||||
|
||||
// This one will be canceled with cancelAsyncResolve.
|
||||
dns.asyncResolve(
|
||||
Services.dns.asyncResolve(
|
||||
hostname2,
|
||||
Ci.nsIDNSService.RESOLVE_TYPE_DEFAULT,
|
||||
flags,
|
||||
@ -60,7 +58,7 @@ function run_test() {
|
||||
mainThread,
|
||||
defaultOriginAttributes
|
||||
);
|
||||
dns.cancelAsyncResolve(
|
||||
Services.dns.cancelAsyncResolve(
|
||||
hostname2,
|
||||
Ci.nsIDNSService.RESOLVE_TYPE_DEFAULT,
|
||||
flags,
|
||||
@ -71,7 +69,7 @@ function run_test() {
|
||||
);
|
||||
|
||||
// This one will not be canceled.
|
||||
requestList1NotCanceled = dns.asyncResolve(
|
||||
requestList1NotCanceled = Services.dns.asyncResolve(
|
||||
hostname1,
|
||||
Ci.nsIDNSService.RESOLVE_TYPE_DEFAULT,
|
||||
flags,
|
||||
@ -82,7 +80,7 @@ function run_test() {
|
||||
);
|
||||
|
||||
// This one will be canceled with cancel(Cr.NS_ERROR_ABORT).
|
||||
requestList1Canceled2 = dns.asyncResolve(
|
||||
requestList1Canceled2 = Services.dns.asyncResolve(
|
||||
hostname1,
|
||||
Ci.nsIDNSService.RESOLVE_TYPE_DEFAULT,
|
||||
flags,
|
||||
@ -94,7 +92,7 @@ function run_test() {
|
||||
requestList1Canceled2.cancel(Cr.NS_ERROR_ABORT);
|
||||
|
||||
// This one will not be canceled.
|
||||
requestList2NotCanceled = dns.asyncResolve(
|
||||
requestList2NotCanceled = Services.dns.asyncResolve(
|
||||
hostname1,
|
||||
Ci.nsIDNSService.RESOLVE_TYPE_DEFAULT,
|
||||
flags,
|
||||
@ -105,7 +103,7 @@ function run_test() {
|
||||
);
|
||||
|
||||
// This one will be canceled with cancel(Cr.NS_ERROR_ABORT).
|
||||
requestList2Canceled = dns.asyncResolve(
|
||||
requestList2Canceled = Services.dns.asyncResolve(
|
||||
hostname2,
|
||||
Ci.nsIDNSService.RESOLVE_TYPE_DEFAULT,
|
||||
flags,
|
||||
|
@ -5,7 +5,6 @@
|
||||
|
||||
"use strict";
|
||||
|
||||
var dns = Cc["@mozilla.org/network/dns-service;1"].getService(Ci.nsIDNSService);
|
||||
const gOverride = Cc["@mozilla.org/network/native-dns-override;1"].getService(
|
||||
Ci.nsINativeDNSResolverOverride
|
||||
);
|
||||
@ -21,7 +20,7 @@ add_task(async function test_none() {
|
||||
QueryInterface: ChromeUtils.generateQI(["nsIDNSListener"]),
|
||||
};
|
||||
|
||||
dns.asyncResolve(
|
||||
Services.dns.asyncResolve(
|
||||
"example.org",
|
||||
Ci.nsIDNSService.RESOLVE_TYPE_DEFAULT,
|
||||
Ci.nsIDNSService.RESOLVE_DISABLE_IPV4,
|
||||
@ -41,7 +40,7 @@ add_task(async function test_none() {
|
||||
});
|
||||
|
||||
add_task(async function test_some() {
|
||||
dns.clearCache(true);
|
||||
Services.dns.clearCache(true);
|
||||
gOverride.addIPOverride("example.com", "1.1.1.1");
|
||||
gOverride.addIPOverride("example.org", "::1:2:3");
|
||||
let [, inRecord] = await new Promise(resolve => {
|
||||
@ -52,7 +51,7 @@ add_task(async function test_some() {
|
||||
QueryInterface: ChromeUtils.generateQI(["nsIDNSListener"]),
|
||||
};
|
||||
|
||||
dns.asyncResolve(
|
||||
Services.dns.asyncResolve(
|
||||
"example.org",
|
||||
Ci.nsIDNSService.RESOLVE_TYPE_DEFAULT,
|
||||
Ci.nsIDNSService.RESOLVE_DISABLE_IPV4,
|
||||
|
@ -5,8 +5,6 @@
|
||||
|
||||
"use strict";
|
||||
|
||||
var dns = Cc["@mozilla.org/network/dns-service;1"].getService(Ci.nsIDNSService);
|
||||
|
||||
var listener = {
|
||||
onLookupComplete(inRequest, inRecord, inStatus) {
|
||||
if (inStatus != Cr.NS_OK) {
|
||||
@ -36,7 +34,7 @@ const defaultOriginAttributes = {};
|
||||
function run_test() {
|
||||
do_test_pending();
|
||||
try {
|
||||
dns.asyncResolve(
|
||||
Services.dns.asyncResolve(
|
||||
"example.com",
|
||||
Ci.nsIDNSService.RESOLVE_TYPE_DEFAULT,
|
||||
Ci.nsIDNSService.RESOLVE_DISABLE_IPV6,
|
||||
|
@ -1,8 +1,5 @@
|
||||
"use strict";
|
||||
|
||||
const dns = Cc["@mozilla.org/network/dns-service;1"].getService(
|
||||
Ci.nsIDNSService
|
||||
);
|
||||
const override = Cc["@mozilla.org/network/native-dns-override;1"].getService(
|
||||
Ci.nsINativeDNSResolverOverride
|
||||
);
|
||||
@ -37,7 +34,7 @@ function do_test({ dnsDisabled, mustBlock, testDomain, expectedAnswer }) {
|
||||
return new Promise(resolve => {
|
||||
Services.prefs.setBoolPref("network.dns.disabled", dnsDisabled);
|
||||
try {
|
||||
dns.asyncResolve(
|
||||
Services.dns.asyncResolve(
|
||||
testDomain,
|
||||
Ci.nsIDNSService.RESOLVE_TYPE_DEFAULT,
|
||||
0,
|
||||
|
@ -1,6 +1,5 @@
|
||||
"use strict";
|
||||
|
||||
var dns = Cc["@mozilla.org/network/dns-service;1"].getService(Ci.nsIDNSService);
|
||||
var prefs = Services.prefs;
|
||||
|
||||
var nextTest;
|
||||
@ -24,7 +23,7 @@ function run_test() {
|
||||
|
||||
var mainThread = Services.tm.currentThread;
|
||||
nextTest = do_test_2;
|
||||
dns.asyncResolve(
|
||||
Services.dns.asyncResolve(
|
||||
"local.vingtetun.org",
|
||||
Ci.nsIDNSService.RESOLVE_TYPE_DEFAULT,
|
||||
0,
|
||||
@ -41,7 +40,7 @@ function do_test_2() {
|
||||
var mainThread = Services.tm.currentThread;
|
||||
nextTest = testsDone;
|
||||
prefs.setCharPref("network.dns.forceResolve", "localhost");
|
||||
dns.asyncResolve(
|
||||
Services.dns.asyncResolve(
|
||||
"www.example.com",
|
||||
Ci.nsIDNSService.RESOLVE_TYPE_DEFAULT,
|
||||
0,
|
||||
|
@ -1,6 +1,5 @@
|
||||
"use strict";
|
||||
|
||||
var dns = Cc["@mozilla.org/network/dns-service;1"].getService(Ci.nsIDNSService);
|
||||
var ioService = Services.io;
|
||||
var prefs = Services.prefs;
|
||||
var mainThread = Services.tm.currentThread;
|
||||
@ -44,7 +43,7 @@ function run_test() {
|
||||
prefs.setBoolPref("network.proxy.allow_hijacking_localhost", true);
|
||||
ioService.offline = true;
|
||||
try {
|
||||
dns.asyncResolve(
|
||||
Services.dns.asyncResolve(
|
||||
"localhost",
|
||||
Ci.nsIDNSService.RESOLVE_TYPE_DEFAULT,
|
||||
0,
|
||||
@ -70,7 +69,7 @@ function test2() {
|
||||
}
|
||||
|
||||
function test2Continued() {
|
||||
dns.asyncResolve(
|
||||
Services.dns.asyncResolve(
|
||||
"localhost",
|
||||
Ci.nsIDNSService.RESOLVE_TYPE_DEFAULT,
|
||||
0,
|
||||
@ -89,7 +88,7 @@ function test3() {
|
||||
}
|
||||
|
||||
function test3Continued() {
|
||||
dns.asyncResolve(
|
||||
Services.dns.asyncResolve(
|
||||
"localhost",
|
||||
Ci.nsIDNSService.RESOLVE_TYPE_DEFAULT,
|
||||
0,
|
||||
|
@ -1,6 +1,5 @@
|
||||
"use strict";
|
||||
|
||||
var dns = Cc["@mozilla.org/network/dns-service;1"].getService(Ci.nsIDNSService);
|
||||
var mainThread = Services.tm.currentThread;
|
||||
|
||||
var onionPref;
|
||||
@ -31,7 +30,7 @@ const defaultOriginAttributes = {};
|
||||
|
||||
function do_test_dontBlock() {
|
||||
prefs.setBoolPref("network.dns.blockDotOnion", false);
|
||||
dns.asyncResolve(
|
||||
Services.dns.asyncResolve(
|
||||
"private.onion",
|
||||
Ci.nsIDNSService.RESOLVE_TYPE_DEFAULT,
|
||||
0,
|
||||
@ -45,7 +44,7 @@ function do_test_dontBlock() {
|
||||
function do_test_block() {
|
||||
prefs.setBoolPref("network.dns.blockDotOnion", true);
|
||||
try {
|
||||
dns.asyncResolve(
|
||||
Services.dns.asyncResolve(
|
||||
"private.onion",
|
||||
Ci.nsIDNSService.RESOLVE_TYPE_DEFAULT,
|
||||
0,
|
||||
|
@ -1,6 +1,5 @@
|
||||
"use strict";
|
||||
|
||||
var dns = Cc["@mozilla.org/network/dns-service;1"].getService(Ci.nsIDNSService);
|
||||
var prefs = Services.prefs;
|
||||
var mainThread = Services.tm.currentThread;
|
||||
|
||||
@ -41,7 +40,7 @@ const secondOriginAttributes = { userContextId: 2 };
|
||||
function run_test() {
|
||||
do_test_pending();
|
||||
prefs.setBoolPref("network.proxy.allow_hijacking_localhost", true);
|
||||
dns.asyncResolve(
|
||||
Services.dns.asyncResolve(
|
||||
"localhost",
|
||||
Ci.nsIDNSService.RESOLVE_TYPE_DEFAULT,
|
||||
0,
|
||||
@ -56,7 +55,7 @@ function run_test() {
|
||||
// correctly.
|
||||
function test2() {
|
||||
do_test_pending();
|
||||
dns.asyncResolve(
|
||||
Services.dns.asyncResolve(
|
||||
"localhost",
|
||||
Ci.nsIDNSService.RESOLVE_TYPE_DEFAULT,
|
||||
Ci.nsIDNSService.RESOLVE_OFFLINE,
|
||||
@ -73,7 +72,7 @@ function test2() {
|
||||
function test3() {
|
||||
do_test_pending();
|
||||
try {
|
||||
dns.asyncResolve(
|
||||
Services.dns.asyncResolve(
|
||||
"localhost",
|
||||
Ci.nsIDNSService.RESOLVE_TYPE_DEFAULT,
|
||||
Ci.nsIDNSService.RESOLVE_OFFLINE,
|
||||
|
@ -1,8 +1,5 @@
|
||||
"use strict";
|
||||
|
||||
const dns = Cc["@mozilla.org/network/dns-service;1"].getService(
|
||||
Ci.nsIDNSService
|
||||
);
|
||||
const override = Cc["@mozilla.org/network/native-dns-override;1"].getService(
|
||||
Ci.nsINativeDNSResolverOverride
|
||||
);
|
||||
@ -77,7 +74,7 @@ add_task(async function test_bad_IPs() {
|
||||
add_task(async function test_ipv4() {
|
||||
let listener = new Listener();
|
||||
override.addIPOverride(DOMAIN, "1.2.3.4");
|
||||
dns.asyncResolve(
|
||||
Services.dns.asyncResolve(
|
||||
DOMAIN,
|
||||
Ci.nsIDNSService.RESOLVE_TYPE_DEFAULT,
|
||||
0,
|
||||
@ -88,14 +85,14 @@ add_task(async function test_ipv4() {
|
||||
);
|
||||
Assert.equal(await listener.firstAddress(), "1.2.3.4");
|
||||
|
||||
dns.clearCache(false);
|
||||
Services.dns.clearCache(false);
|
||||
override.clearOverrides();
|
||||
});
|
||||
|
||||
add_task(async function test_ipv6() {
|
||||
let listener = new Listener();
|
||||
override.addIPOverride(DOMAIN, "fe80::6a99:9b2b:6ccc:6e1b");
|
||||
dns.asyncResolve(
|
||||
Services.dns.asyncResolve(
|
||||
DOMAIN,
|
||||
Ci.nsIDNSService.RESOLVE_TYPE_DEFAULT,
|
||||
0,
|
||||
@ -106,14 +103,14 @@ add_task(async function test_ipv6() {
|
||||
);
|
||||
Assert.equal(await listener.firstAddress(), "fe80::6a99:9b2b:6ccc:6e1b");
|
||||
|
||||
dns.clearCache(false);
|
||||
Services.dns.clearCache(false);
|
||||
override.clearOverrides();
|
||||
});
|
||||
|
||||
add_task(async function test_clearOverrides() {
|
||||
let listener = new Listener();
|
||||
override.addIPOverride(DOMAIN, "1.2.3.4");
|
||||
dns.asyncResolve(
|
||||
Services.dns.asyncResolve(
|
||||
DOMAIN,
|
||||
Ci.nsIDNSService.RESOLVE_TYPE_DEFAULT,
|
||||
0,
|
||||
@ -124,11 +121,11 @@ add_task(async function test_clearOverrides() {
|
||||
);
|
||||
Assert.equal(await listener.firstAddress(), "1.2.3.4");
|
||||
|
||||
dns.clearCache(false);
|
||||
Services.dns.clearCache(false);
|
||||
override.clearOverrides();
|
||||
|
||||
listener = new Listener();
|
||||
dns.asyncResolve(
|
||||
Services.dns.asyncResolve(
|
||||
DOMAIN,
|
||||
Ci.nsIDNSService.RESOLVE_TYPE_DEFAULT,
|
||||
0,
|
||||
@ -140,7 +137,7 @@ add_task(async function test_clearOverrides() {
|
||||
Assert.notEqual(await listener.firstAddress(), "1.2.3.4");
|
||||
|
||||
await new Promise(resolve => do_timeout(1000, resolve));
|
||||
dns.clearCache(false);
|
||||
Services.dns.clearCache(false);
|
||||
override.clearOverrides();
|
||||
});
|
||||
|
||||
@ -149,7 +146,7 @@ add_task(async function test_clearHostOverride() {
|
||||
override.addIPOverride(OTHER, "2.2.2.2");
|
||||
override.clearHostOverride(DOMAIN);
|
||||
let listener = new Listener();
|
||||
dns.asyncResolve(
|
||||
Services.dns.asyncResolve(
|
||||
DOMAIN,
|
||||
Ci.nsIDNSService.RESOLVE_TYPE_DEFAULT,
|
||||
0,
|
||||
@ -162,7 +159,7 @@ add_task(async function test_clearHostOverride() {
|
||||
Assert.notEqual(await listener.firstAddress(), "2.2.2.2");
|
||||
|
||||
listener = new Listener();
|
||||
dns.asyncResolve(
|
||||
Services.dns.asyncResolve(
|
||||
OTHER,
|
||||
Ci.nsIDNSService.RESOLVE_TYPE_DEFAULT,
|
||||
0,
|
||||
@ -181,7 +178,7 @@ add_task(async function test_clearHostOverride() {
|
||||
// If the next task ever starts failing, with an IP that is not in this
|
||||
// file, then likely the timeout is too small.
|
||||
await new Promise(resolve => do_timeout(1000, resolve));
|
||||
dns.clearCache(false);
|
||||
Services.dns.clearCache(false);
|
||||
override.clearOverrides();
|
||||
});
|
||||
|
||||
@ -191,7 +188,7 @@ add_task(async function test_multiple_IPs() {
|
||||
override.addIPOverride(DOMAIN, "::1");
|
||||
override.addIPOverride(DOMAIN, "fe80::6a99:9b2b:6ccc:6e1b");
|
||||
let listener = new Listener();
|
||||
dns.asyncResolve(
|
||||
Services.dns.asyncResolve(
|
||||
DOMAIN,
|
||||
Ci.nsIDNSService.RESOLVE_TYPE_DEFAULT,
|
||||
0,
|
||||
@ -207,7 +204,7 @@ add_task(async function test_multiple_IPs() {
|
||||
"fe80::6a99:9b2b:6ccc:6e1b",
|
||||
]);
|
||||
|
||||
dns.clearCache(false);
|
||||
Services.dns.clearCache(false);
|
||||
override.clearOverrides();
|
||||
});
|
||||
|
||||
@ -217,7 +214,7 @@ add_task(async function test_address_family_flags() {
|
||||
override.addIPOverride(DOMAIN, "::1");
|
||||
override.addIPOverride(DOMAIN, "fe80::6a99:9b2b:6ccc:6e1b");
|
||||
let listener = new Listener();
|
||||
dns.asyncResolve(
|
||||
Services.dns.asyncResolve(
|
||||
DOMAIN,
|
||||
Ci.nsIDNSService.RESOLVE_TYPE_DEFAULT,
|
||||
Ci.nsIDNSService.RESOLVE_DISABLE_IPV4,
|
||||
@ -232,7 +229,7 @@ add_task(async function test_address_family_flags() {
|
||||
]);
|
||||
|
||||
listener = new Listener();
|
||||
dns.asyncResolve(
|
||||
Services.dns.asyncResolve(
|
||||
DOMAIN,
|
||||
Ci.nsIDNSService.RESOLVE_TYPE_DEFAULT,
|
||||
Ci.nsIDNSService.RESOLVE_DISABLE_IPV6,
|
||||
@ -243,14 +240,14 @@ add_task(async function test_address_family_flags() {
|
||||
);
|
||||
Assert.deepEqual(await listener.addresses(), ["2.2.2.2", "1.1.1.1"]);
|
||||
|
||||
dns.clearCache(false);
|
||||
Services.dns.clearCache(false);
|
||||
override.clearOverrides();
|
||||
});
|
||||
|
||||
add_task(async function test_cname_flag() {
|
||||
override.addIPOverride(DOMAIN, "2.2.2.2");
|
||||
let listener = new Listener();
|
||||
dns.asyncResolve(
|
||||
Services.dns.asyncResolve(
|
||||
DOMAIN,
|
||||
Ci.nsIDNSService.RESOLVE_TYPE_DEFAULT,
|
||||
0,
|
||||
@ -269,7 +266,7 @@ add_task(async function test_cname_flag() {
|
||||
Assert.equal(inRecord.getNextAddrAsString(), "2.2.2.2");
|
||||
|
||||
listener = new Listener();
|
||||
dns.asyncResolve(
|
||||
Services.dns.asyncResolve(
|
||||
DOMAIN,
|
||||
Ci.nsIDNSService.RESOLVE_TYPE_DEFAULT,
|
||||
Ci.nsIDNSService.RESOLVE_CANONICAL_NAME,
|
||||
@ -283,13 +280,13 @@ add_task(async function test_cname_flag() {
|
||||
Assert.equal(inRecord.canonicalName, DOMAIN, "No canonical name specified");
|
||||
Assert.equal(inRecord.getNextAddrAsString(), "2.2.2.2");
|
||||
|
||||
dns.clearCache(false);
|
||||
Services.dns.clearCache(false);
|
||||
override.clearOverrides();
|
||||
|
||||
override.addIPOverride(DOMAIN, "2.2.2.2");
|
||||
override.setCnameOverride(DOMAIN, OTHER);
|
||||
listener = new Listener();
|
||||
dns.asyncResolve(
|
||||
Services.dns.asyncResolve(
|
||||
DOMAIN,
|
||||
Ci.nsIDNSService.RESOLVE_TYPE_DEFAULT,
|
||||
Ci.nsIDNSService.RESOLVE_CANONICAL_NAME,
|
||||
@ -303,14 +300,14 @@ add_task(async function test_cname_flag() {
|
||||
Assert.equal(inRecord.canonicalName, OTHER, "Must have correct CNAME");
|
||||
Assert.equal(inRecord.getNextAddrAsString(), "2.2.2.2");
|
||||
|
||||
dns.clearCache(false);
|
||||
Services.dns.clearCache(false);
|
||||
override.clearOverrides();
|
||||
});
|
||||
|
||||
add_task(async function test_nxdomain() {
|
||||
override.addIPOverride(DOMAIN, "N/A");
|
||||
let listener = new Listener();
|
||||
dns.asyncResolve(
|
||||
Services.dns.asyncResolve(
|
||||
DOMAIN,
|
||||
Ci.nsIDNSService.RESOLVE_TYPE_DEFAULT,
|
||||
Ci.nsIDNSService.RESOLVE_CANONICAL_NAME,
|
||||
|
@ -1,8 +1,5 @@
|
||||
"use strict";
|
||||
|
||||
const dns = Cc["@mozilla.org/network/dns-service;1"].getService(
|
||||
Ci.nsIDNSService
|
||||
);
|
||||
const override = Cc["@mozilla.org/network/native-dns-override;1"].getService(
|
||||
Ci.nsINativeDNSResolverOverride
|
||||
);
|
||||
@ -54,7 +51,7 @@ DOMAINS.forEach(domain => {
|
||||
});
|
||||
|
||||
// Verify that loopback host names are not overridden.
|
||||
dns.asyncResolve(
|
||||
Services.dns.asyncResolve(
|
||||
domain,
|
||||
Ci.nsIDNSService.RESOLVE_TYPE_DEFAULT,
|
||||
0,
|
||||
@ -73,7 +70,7 @@ DOMAINS.forEach(domain => {
|
||||
// registered above are taken into account.
|
||||
Services.prefs.setBoolPref("network.proxy.allow_hijacking_localhost", true);
|
||||
let listener2 = new Listener();
|
||||
dns.asyncResolve(
|
||||
Services.dns.asyncResolve(
|
||||
domain,
|
||||
Ci.nsIDNSService.RESOLVE_TYPE_DEFAULT,
|
||||
0,
|
||||
@ -89,7 +86,7 @@ DOMAINS.forEach(domain => {
|
||||
);
|
||||
Services.prefs.clearUserPref("network.proxy.allow_hijacking_localhost");
|
||||
|
||||
dns.clearCache(false);
|
||||
Services.dns.clearCache(false);
|
||||
override.clearOverrides();
|
||||
});
|
||||
});
|
||||
|
@ -24,9 +24,6 @@ XPCOMUtils.defineLazyGetter(this, "URL6b", function() {
|
||||
return `http://example6b.com:${httpServerIPv6.identity.primaryPort}${testpath}`;
|
||||
});
|
||||
|
||||
const dns = Cc["@mozilla.org/network/dns-service;1"].getService(
|
||||
Ci.nsIDNSService
|
||||
);
|
||||
const ncs = Cc[
|
||||
"@mozilla.org/network/network-connectivity-service;1"
|
||||
].getService(Ci.nsINetworkConnectivityService);
|
||||
@ -77,6 +74,7 @@ add_task(async function test_setup() {
|
||||
await trrServer.start();
|
||||
|
||||
if (mozinfo.socketprocess_networking) {
|
||||
Services.dns; // Needed to trigger socket process.
|
||||
await TestUtils.waitForCondition(() => Services.io.socketProcessLaunched);
|
||||
}
|
||||
|
||||
@ -126,7 +124,7 @@ async function registerDoHAnswers(ipv4, ipv6) {
|
||||
});
|
||||
}
|
||||
|
||||
dns.clearCache(true);
|
||||
Services.dns.clearCache(true);
|
||||
}
|
||||
|
||||
let StatusCounter = function() {
|
||||
@ -273,7 +271,7 @@ add_task(async function test_prefer_address_version_fail_trr3_1() {
|
||||
// Make IPv6 connectivity check fail
|
||||
await setup_connectivity(false, true);
|
||||
|
||||
dns.clearCache(true);
|
||||
Services.dns.clearCache(true);
|
||||
|
||||
// This will succeed as we query both DNS records
|
||||
await make_request(URL6a, true, true);
|
||||
@ -305,7 +303,7 @@ add_task(async function test_prefer_address_version_fail_trr3_2() {
|
||||
// Make IPv6 connectivity check fail
|
||||
await setup_connectivity(false, true);
|
||||
|
||||
dns.clearCache(true);
|
||||
Services.dns.clearCache(true);
|
||||
|
||||
// This will succeed as we query both DNS records
|
||||
await make_request(URL6b, false, true);
|
||||
|
@ -1,8 +1,5 @@
|
||||
"use strict";
|
||||
|
||||
const dns = Cc["@mozilla.org/network/dns-service;1"].getService(
|
||||
Ci.nsIDNSService
|
||||
);
|
||||
const defaultOriginAttributes = {};
|
||||
const mainThread = Services.tm.currentThread;
|
||||
|
||||
@ -36,7 +33,7 @@ const ADDR2 = "::1";
|
||||
|
||||
add_task(async function test_dns_localhost() {
|
||||
let listener = new Listener();
|
||||
dns.asyncResolve(
|
||||
Services.dns.asyncResolve(
|
||||
"localhost",
|
||||
Ci.nsIDNSService.RESOLVE_TYPE_DEFAULT,
|
||||
0,
|
||||
@ -53,7 +50,7 @@ add_task(async function test_dns_localhost() {
|
||||
|
||||
add_task(async function test_idn_cname() {
|
||||
let listener = new Listener();
|
||||
dns.asyncResolve(
|
||||
Services.dns.asyncResolve(
|
||||
DOMAIN_IDN,
|
||||
Ci.nsIDNSService.RESOLVE_TYPE_DEFAULT,
|
||||
Ci.nsIDNSService.RESOLVE_CANONICAL_NAME,
|
||||
@ -76,7 +73,7 @@ add_task(
|
||||
let listener = new Listener();
|
||||
let domain = "a".repeat(253);
|
||||
overrideService.addIPOverride(domain, "1.2.3.4");
|
||||
dns.asyncResolve(
|
||||
Services.dns.asyncResolve(
|
||||
domain,
|
||||
Ci.nsIDNSService.RESOLVE_TYPE_DEFAULT,
|
||||
Ci.nsIDNSService.RESOLVE_CANONICAL_NAME,
|
||||
@ -96,7 +93,7 @@ add_task(
|
||||
|
||||
if (mozinfo.socketprocess_networking) {
|
||||
// When using the socket process, the call fails asynchronously.
|
||||
dns.asyncResolve(
|
||||
Services.dns.asyncResolve(
|
||||
domain,
|
||||
Ci.nsIDNSService.RESOLVE_TYPE_DEFAULT,
|
||||
Ci.nsIDNSService.RESOLVE_CANONICAL_NAME,
|
||||
@ -110,7 +107,7 @@ add_task(
|
||||
} else {
|
||||
Assert.throws(
|
||||
() => {
|
||||
dns.asyncResolve(
|
||||
Services.dns.asyncResolve(
|
||||
domain,
|
||||
Ci.nsIDNSService.RESOLVE_TYPE_DEFAULT,
|
||||
Ci.nsIDNSService.RESOLVE_CANONICAL_NAME,
|
||||
@ -128,7 +125,7 @@ add_task(
|
||||
listener = new Listener();
|
||||
domain = "a".repeat(254);
|
||||
Services.prefs.setBoolPref("network.dns.limit_253_chars", false);
|
||||
dns.asyncResolve(
|
||||
Services.dns.asyncResolve(
|
||||
domain,
|
||||
Ci.nsIDNSService.RESOLVE_TYPE_DEFAULT,
|
||||
Ci.nsIDNSService.RESOLVE_CANONICAL_NAME,
|
||||
|
@ -13,9 +13,6 @@ let h2Port;
|
||||
let h3Port;
|
||||
let trrServer;
|
||||
|
||||
const dns = Cc["@mozilla.org/network/dns-service;1"].getService(
|
||||
Ci.nsIDNSService
|
||||
);
|
||||
const { TestUtils } = ChromeUtils.importESModule(
|
||||
"resource://testing-common/TestUtils.sys.mjs"
|
||||
);
|
||||
@ -35,6 +32,7 @@ add_setup(async function setup() {
|
||||
trr_test_setup();
|
||||
|
||||
if (mozinfo.socketprocess_networking) {
|
||||
Services.dns; // Needed to trigger socket process.
|
||||
await TestUtils.waitForCondition(() => Services.io.socketProcessLaunched);
|
||||
}
|
||||
|
||||
@ -772,7 +770,7 @@ add_task(async function testTwoFastFallbackTimers() {
|
||||
|
||||
Services.obs.notifyObservers(null, "net:prune-all-connections");
|
||||
Services.obs.notifyObservers(null, "network:reset-http3-excluded-list");
|
||||
dns.clearCache(true);
|
||||
Services.dns.clearCache(true);
|
||||
|
||||
// Do the same test again, but with a different configuration.
|
||||
Services.prefs.setIntPref(
|
||||
|
@ -8,10 +8,6 @@ ChromeUtils.import("resource://gre/modules/NetUtil.jsm");
|
||||
|
||||
let trrServer;
|
||||
|
||||
const dns = Cc["@mozilla.org/network/dns-service;1"].getService(
|
||||
Ci.nsIDNSService
|
||||
);
|
||||
|
||||
function setup() {
|
||||
trr_test_setup();
|
||||
|
||||
@ -101,7 +97,7 @@ add_task(async function testEchConfigEnabled() {
|
||||
});
|
||||
|
||||
let { inRecord } = await new TRRDNSListener("test.bar.com", {
|
||||
type: dns.RESOLVE_TYPE_HTTPSSVC,
|
||||
type: Ci.nsIDNSService.RESOLVE_TYPE_HTTPSSVC,
|
||||
});
|
||||
|
||||
checkResult(inRecord, false, false, {
|
||||
@ -122,10 +118,10 @@ add_task(async function testEchConfigEnabled() {
|
||||
checkResult(inRecord, true, true);
|
||||
|
||||
Services.prefs.setBoolPref("network.dns.echconfig.enabled", true);
|
||||
dns.clearCache(true);
|
||||
Services.dns.clearCache(true);
|
||||
|
||||
({ inRecord } = await new TRRDNSListener("test.bar.com", {
|
||||
type: dns.RESOLVE_TYPE_HTTPSSVC,
|
||||
type: Ci.nsIDNSService.RESOLVE_TYPE_HTTPSSVC,
|
||||
}));
|
||||
|
||||
checkResult(inRecord, false, false, {
|
||||
@ -156,7 +152,7 @@ add_task(async function testEchConfigEnabled() {
|
||||
// When network.dns.http3_echconfig.enabled is false, we should try to
|
||||
// connect with h2 and echConfig.
|
||||
add_task(async function testTwoRecordsHaveEchConfig() {
|
||||
dns.clearCache(true);
|
||||
Services.dns.clearCache(true);
|
||||
|
||||
let trrServer = new TRRServer();
|
||||
await trrServer.start();
|
||||
@ -203,7 +199,7 @@ add_task(async function testTwoRecordsHaveEchConfig() {
|
||||
});
|
||||
|
||||
let { inRecord } = await new TRRDNSListener("test.foo.com", {
|
||||
type: dns.RESOLVE_TYPE_HTTPSSVC,
|
||||
type: Ci.nsIDNSService.RESOLVE_TYPE_HTTPSSVC,
|
||||
});
|
||||
|
||||
checkResult(inRecord, false, false, {
|
||||
@ -224,9 +220,9 @@ add_task(async function testTwoRecordsHaveEchConfig() {
|
||||
checkResult(inRecord, true, true);
|
||||
|
||||
Services.prefs.setBoolPref("network.dns.http3_echconfig.enabled", true);
|
||||
dns.clearCache(true);
|
||||
Services.dns.clearCache(true);
|
||||
({ inRecord } = await new TRRDNSListener("test.foo.com", {
|
||||
type: dns.RESOLVE_TYPE_HTTPSSVC,
|
||||
type: Ci.nsIDNSService.RESOLVE_TYPE_HTTPSSVC,
|
||||
}));
|
||||
|
||||
checkResult(inRecord, false, false, {
|
||||
@ -255,7 +251,7 @@ add_task(async function testTwoRecordsHaveEchConfig() {
|
||||
// When network.dns.http3_echconfig.enabled is false, we should use the record
|
||||
// that supports h3 and h2 (the alpn is h2).
|
||||
add_task(async function testTwoRecordsHaveEchConfig1() {
|
||||
dns.clearCache(true);
|
||||
Services.dns.clearCache(true);
|
||||
|
||||
let trrServer = new TRRServer();
|
||||
await trrServer.start();
|
||||
@ -302,7 +298,7 @@ add_task(async function testTwoRecordsHaveEchConfig1() {
|
||||
});
|
||||
|
||||
let { inRecord } = await new TRRDNSListener("test.foo.com", {
|
||||
type: dns.RESOLVE_TYPE_HTTPSSVC,
|
||||
type: Ci.nsIDNSService.RESOLVE_TYPE_HTTPSSVC,
|
||||
});
|
||||
|
||||
checkResult(inRecord, false, false, {
|
||||
@ -327,9 +323,9 @@ add_task(async function testTwoRecordsHaveEchConfig1() {
|
||||
});
|
||||
|
||||
Services.prefs.setBoolPref("network.dns.http3_echconfig.enabled", true);
|
||||
dns.clearCache(true);
|
||||
Services.dns.clearCache(true);
|
||||
({ inRecord } = await new TRRDNSListener("test.foo.com", {
|
||||
type: dns.RESOLVE_TYPE_HTTPSSVC,
|
||||
type: Ci.nsIDNSService.RESOLVE_TYPE_HTTPSSVC,
|
||||
}));
|
||||
|
||||
checkResult(inRecord, false, false, {
|
||||
@ -361,7 +357,7 @@ add_task(async function testTwoRecordsHaveEchConfig1() {
|
||||
// There are two records: only one support h3 and only one has echConfig.
|
||||
// This test is about never usng the record without echConfig.
|
||||
add_task(async function testOneRecordsHasEchConfig() {
|
||||
dns.clearCache(true);
|
||||
Services.dns.clearCache(true);
|
||||
|
||||
let trrServer = new TRRServer();
|
||||
await trrServer.start();
|
||||
@ -405,7 +401,7 @@ add_task(async function testOneRecordsHasEchConfig() {
|
||||
});
|
||||
|
||||
let { inRecord } = await new TRRDNSListener("test.foo.com", {
|
||||
type: dns.RESOLVE_TYPE_HTTPSSVC,
|
||||
type: Ci.nsIDNSService.RESOLVE_TYPE_HTTPSSVC,
|
||||
});
|
||||
|
||||
checkResult(inRecord, false, false, {
|
||||
@ -426,9 +422,9 @@ add_task(async function testOneRecordsHasEchConfig() {
|
||||
checkResult(inRecord, true, true);
|
||||
|
||||
Services.prefs.setBoolPref("network.dns.http3_echconfig.enabled", true);
|
||||
dns.clearCache(true);
|
||||
Services.dns.clearCache(true);
|
||||
({ inRecord } = await new TRRDNSListener("test.foo.com", {
|
||||
type: dns.RESOLVE_TYPE_HTTPSSVC,
|
||||
type: Ci.nsIDNSService.RESOLVE_TYPE_HTTPSSVC,
|
||||
}));
|
||||
|
||||
checkResult(inRecord, false, false, {
|
||||
@ -455,7 +451,7 @@ add_task(async function testOneRecordsHasEchConfig() {
|
||||
// Test the case that "network.http.http3.enable" and
|
||||
// "network.http.http2.enabled" are true/false.
|
||||
add_task(async function testHttp3AndHttp2Pref() {
|
||||
dns.clearCache(true);
|
||||
Services.dns.clearCache(true);
|
||||
|
||||
let trrServer = new TRRServer();
|
||||
await trrServer.start();
|
||||
@ -503,7 +499,7 @@ add_task(async function testHttp3AndHttp2Pref() {
|
||||
});
|
||||
|
||||
let { inRecord } = await new TRRDNSListener("test.foo.com", {
|
||||
type: dns.RESOLVE_TYPE_HTTPSSVC,
|
||||
type: Ci.nsIDNSService.RESOLVE_TYPE_HTTPSSVC,
|
||||
});
|
||||
|
||||
checkResult(inRecord, false, false, {
|
||||
|
@ -8,10 +8,6 @@ ChromeUtils.import("resource://gre/modules/NetUtil.jsm");
|
||||
|
||||
let trrServer;
|
||||
|
||||
const dns = Cc["@mozilla.org/network/dns-service;1"].getService(
|
||||
Ci.nsIDNSService
|
||||
);
|
||||
|
||||
const { TestUtils } = ChromeUtils.importESModule(
|
||||
"resource://testing-common/TestUtils.sys.mjs"
|
||||
);
|
||||
@ -28,6 +24,7 @@ add_setup(async function setup() {
|
||||
});
|
||||
|
||||
if (mozinfo.socketprocess_networking) {
|
||||
Services.dns; // Needed to trigger socket process.
|
||||
await TestUtils.waitForCondition(() => Services.io.socketProcessLaunched);
|
||||
}
|
||||
});
|
||||
@ -55,7 +52,7 @@ function checkResult(inRecord, noHttp2, noHttp3, result) {
|
||||
}
|
||||
|
||||
add_task(async function testSortedAlpnH3() {
|
||||
dns.clearCache(true);
|
||||
Services.dns.clearCache(true);
|
||||
|
||||
trrServer = new TRRServer();
|
||||
await trrServer.start();
|
||||
@ -83,7 +80,7 @@ add_task(async function testSortedAlpnH3() {
|
||||
});
|
||||
|
||||
let { inRecord } = await new TRRDNSListener("test.alpn.com", {
|
||||
type: dns.RESOLVE_TYPE_HTTPSSVC,
|
||||
type: Ci.nsIDNSService.RESOLVE_TYPE_HTTPSSVC,
|
||||
});
|
||||
|
||||
checkResult(inRecord, false, false, {
|
||||
@ -178,7 +175,7 @@ add_task(async function testSortedAlpnH3() {
|
||||
});
|
||||
|
||||
add_task(async function testSortedAlpnH2() {
|
||||
dns.clearCache(true);
|
||||
Services.dns.clearCache(true);
|
||||
|
||||
Services.prefs.setIntPref("network.trr.mode", 3);
|
||||
Services.prefs.setCharPref(
|
||||
@ -202,7 +199,7 @@ add_task(async function testSortedAlpnH2() {
|
||||
});
|
||||
|
||||
let { inRecord } = await new TRRDNSListener("test.alpn_2.com", {
|
||||
type: dns.RESOLVE_TYPE_HTTPSSVC,
|
||||
type: Ci.nsIDNSService.RESOLVE_TYPE_HTTPSSVC,
|
||||
});
|
||||
|
||||
checkResult(inRecord, false, false, {
|
||||
|
@ -6,10 +6,6 @@
|
||||
|
||||
ChromeUtils.import("resource://gre/modules/NetUtil.jsm");
|
||||
|
||||
const dns = Cc["@mozilla.org/network/dns-service;1"].getService(
|
||||
Ci.nsIDNSService
|
||||
);
|
||||
|
||||
const certOverrideService = Cc[
|
||||
"@mozilla.org/security/certoverride;1"
|
||||
].getService(Ci.nsICertOverrideService);
|
||||
@ -56,6 +52,7 @@ add_setup(async function setup() {
|
||||
});
|
||||
|
||||
if (mozinfo.socketprocess_networking) {
|
||||
Services.dns; // Needed to trigger socket process.
|
||||
await TestUtils.waitForCondition(() => Services.io.socketProcessLaunched);
|
||||
}
|
||||
|
||||
@ -115,7 +112,7 @@ EventSinkListener.prototype.QueryInterface = ChromeUtils.generateQI([
|
||||
|
||||
// Test if the request is upgraded to https with a HTTPSSVC record.
|
||||
add_task(async function testUseHTTPSSVCAsHSTS() {
|
||||
dns.clearCache(true);
|
||||
Services.dns.clearCache(true);
|
||||
// Do DNS resolution before creating the channel, so the HTTPSSVC record will
|
||||
// be resolved from the cache.
|
||||
await new TRRDNSListener("test.httpssvc.com", {
|
||||
@ -147,7 +144,7 @@ add_task(async function testUseHTTPSSVCAsHSTS() {
|
||||
// nsHttpChannel::OnHTTPSRRAvailable is called after
|
||||
// nsHttpChannel::MaybeUseHTTPSRRForUpgrade.
|
||||
add_task(async function testInvalidDNSResult() {
|
||||
dns.clearCache(true);
|
||||
Services.dns.clearCache(true);
|
||||
|
||||
let httpserv = new HttpServer();
|
||||
let content = "ok";
|
||||
@ -173,7 +170,7 @@ add_task(async function testInvalidDNSResult() {
|
||||
// The same test as above, but nsHttpChannel::MaybeUseHTTPSRRForUpgrade is
|
||||
// called after nsHttpChannel::OnHTTPSRRAvailable.
|
||||
add_task(async function testInvalidDNSResult1() {
|
||||
dns.clearCache(true);
|
||||
Services.dns.clearCache(true);
|
||||
|
||||
let httpserv = new HttpServer();
|
||||
let content = "ok";
|
||||
@ -202,7 +199,7 @@ add_task(async function testInvalidDNSResult1() {
|
||||
channel.suspend();
|
||||
|
||||
new TRRDNSListener("foo.notexisted.com", {
|
||||
type: dns.RESOLVE_TYPE_HTTPSSVC,
|
||||
type: Ci.nsIDNSService.RESOLVE_TYPE_HTTPSSVC,
|
||||
expectedSuccess: false,
|
||||
}).then(() => channel.resume());
|
||||
}
|
||||
@ -232,7 +229,7 @@ add_task(async function testLiteralIP() {
|
||||
// Test the case that an HTTPS RR is available and the server returns a 307
|
||||
// for redirecting back to http.
|
||||
add_task(async function testEndlessUpgradeDowngrade() {
|
||||
dns.clearCache(true);
|
||||
Services.dns.clearCache(true);
|
||||
|
||||
let httpserv = new HttpServer();
|
||||
let content = "okok";
|
||||
@ -257,7 +254,7 @@ add_task(async function testEndlessUpgradeDowngrade() {
|
||||
});
|
||||
|
||||
add_task(async function testHttpRequestBlocked() {
|
||||
dns.clearCache(true);
|
||||
Services.dns.clearCache(true);
|
||||
|
||||
let dnsRequestObserver = {
|
||||
register() {
|
||||
@ -324,7 +321,7 @@ function createPrincipal(url) {
|
||||
// Test if the Origin header stays the same after an internal HTTPS upgrade
|
||||
// caused by HTTPS RR.
|
||||
add_task(async function testHTTPSRRUpgradeWithOriginHeader() {
|
||||
dns.clearCache(true);
|
||||
Services.dns.clearCache(true);
|
||||
|
||||
const url = "http://test.httpssvc.com:80/origin_header";
|
||||
const originURL = "http://example.com";
|
||||
|
@ -9,9 +9,6 @@ ChromeUtils.import("resource://gre/modules/NetUtil.jsm");
|
||||
let h2Port;
|
||||
let trrServer;
|
||||
|
||||
const dns = Cc["@mozilla.org/network/dns-service;1"].getService(
|
||||
Ci.nsIDNSService
|
||||
);
|
||||
const certOverrideService = Cc[
|
||||
"@mozilla.org/security/certoverride;1"
|
||||
].getService(Ci.nsICertOverrideService);
|
||||
@ -38,6 +35,7 @@ add_setup(async function setup() {
|
||||
});
|
||||
|
||||
if (mozinfo.socketprocess_networking) {
|
||||
Services.dns; // Needed to trigger socket process.
|
||||
await TestUtils.waitForCondition(() => Services.io.socketProcessLaunched);
|
||||
}
|
||||
});
|
||||
@ -175,7 +173,7 @@ function channelOpenPromise(chan, flags) {
|
||||
|
||||
// Test if we can connect to the server with the IP hint address.
|
||||
add_task(async function testConnectionWithIPHint() {
|
||||
dns.clearCache(true);
|
||||
Services.dns.clearCache(true);
|
||||
Services.prefs.setIntPref("network.trr.mode", 3);
|
||||
Services.prefs.setCharPref(
|
||||
"network.trr.uri",
|
||||
@ -263,7 +261,7 @@ add_task(async function testIPHintWithFreshDNS() {
|
||||
});
|
||||
|
||||
let { inRecord } = await new TRRDNSListener("test.iphint.org", {
|
||||
type: dns.RESOLVE_TYPE_HTTPSSVC,
|
||||
type: Ci.nsIDNSService.RESOLVE_TYPE_HTTPSSVC,
|
||||
});
|
||||
|
||||
let answer = inRecord.QueryInterface(Ci.nsIDNSHTTPSSVCRecord).records;
|
||||
|
@ -12,10 +12,6 @@ registerCleanupFunction(async () => {
|
||||
Services.prefs.clearUserPref("network.dns.echconfig.enabled");
|
||||
});
|
||||
|
||||
const dns = Cc["@mozilla.org/network/dns-service;1"].getService(
|
||||
Ci.nsIDNSService
|
||||
);
|
||||
|
||||
add_task(async function testPriorityAndECHConfig() {
|
||||
let trrServer = new TRRServer();
|
||||
registerCleanupFunction(async () => {
|
||||
@ -99,7 +95,7 @@ add_task(async function testPriorityAndECHConfig() {
|
||||
Assert.equal(answer[3].name, "test.p4.com");
|
||||
|
||||
Services.prefs.setBoolPref("network.dns.echconfig.enabled", true);
|
||||
dns.clearCache(true);
|
||||
Services.dns.clearCache(true);
|
||||
({ inRecord } = await new TRRDNSListener("test.priority.com", {
|
||||
type: Ci.nsIDNSService.RESOLVE_TYPE_HTTPSSVC,
|
||||
}));
|
||||
|
@ -13,9 +13,6 @@ let trrServer;
|
||||
let h3Port;
|
||||
let h3EchConfig;
|
||||
|
||||
const dns = Cc["@mozilla.org/network/dns-service;1"].getService(
|
||||
Ci.nsIDNSService
|
||||
);
|
||||
const certOverrideService = Cc[
|
||||
"@mozilla.org/security/certoverride;1"
|
||||
].getService(Ci.nsICertOverrideService);
|
||||
@ -250,7 +247,7 @@ add_task(async function testEchRetry() {
|
||||
// eslint-disable-next-line mozilla/no-arbitrary-setTimeout
|
||||
await new Promise(resolve => setTimeout(resolve, 1000));
|
||||
|
||||
dns.clearCache(true);
|
||||
Services.dns.clearCache(true);
|
||||
|
||||
const ECH_CONFIG_TRUSTED_RETRY =
|
||||
"AEn+DQBFTQAgACCKB1Y5SfrGIyk27W82xPpzWTDs3q72c04xSurDWlb9CgAEAAMAA2QWZWNoLXB1YmxpYy5leGFtcGxlLmNvbQAA";
|
||||
@ -411,7 +408,7 @@ add_task(async function testH3ConnectWithECH() {
|
||||
});
|
||||
|
||||
add_task(async function testH3ConnectWithECHRetry() {
|
||||
dns.clearCache(true);
|
||||
Services.dns.clearCache(true);
|
||||
Services.obs.notifyObservers(null, "net:cancel-all-connections");
|
||||
// eslint-disable-next-line mozilla/no-arbitrary-setTimeout
|
||||
await new Promise(resolve => setTimeout(resolve, 1000));
|
||||
|
@ -145,6 +145,7 @@ add_task(async function testSimpleRequestAfterCrash() {
|
||||
info("wait socket process restart...");
|
||||
// eslint-disable-next-line mozilla/no-arbitrary-setTimeout
|
||||
await new Promise(resolve => setTimeout(resolve, 1000));
|
||||
Services.dns; // Needed to trigger socket process.
|
||||
await TestUtils.waitForCondition(() => Services.io.socketProcessLaunched);
|
||||
|
||||
await doTestSimpleRequest(true);
|
||||
|
@ -52,6 +52,7 @@ add_setup(async function setup() {
|
||||
});
|
||||
|
||||
if (mozinfo.socketprocess_networking) {
|
||||
Services.dns; // Needed to trigger socket process.
|
||||
await TestUtils.waitForCondition(() => Services.io.socketProcessLaunched);
|
||||
}
|
||||
|
||||
@ -97,7 +98,7 @@ async function ODoHConfigTest(query, ODoHHost, expectedResult = false) {
|
||||
}
|
||||
|
||||
await topicObserved("odoh-service-activated");
|
||||
Assert.equal(dns.ODoHActivated, expectedResult);
|
||||
Assert.equal(Services.dns.ODoHActivated, expectedResult);
|
||||
}
|
||||
|
||||
add_task(async function testODoHConfig1() {
|
||||
@ -127,12 +128,12 @@ add_task(async function testODoHConfig6() {
|
||||
|
||||
// This is triggered by the expiration of the TTL.
|
||||
await topicObserved("odoh-service-activated");
|
||||
Assert.ok(!dns.ODoHActivated);
|
||||
Assert.ok(!Services.dns.ODoHActivated);
|
||||
Services.prefs.clearUserPref("network.trr.odoh.min_ttl");
|
||||
});
|
||||
|
||||
add_task(async function testODoHConfig7() {
|
||||
dns.clearCache(true);
|
||||
Services.dns.clearCache(true);
|
||||
Services.prefs.setIntPref("network.trr.mode", 2); // TRR-first
|
||||
Services.prefs.setBoolPref("network.trr.odoh.enabled", true);
|
||||
// At this point, we've queried the ODoHConfig, but there is no usable config
|
||||
@ -147,11 +148,11 @@ async function ODoHConfigTestHTTP(configUri, expectedResult) {
|
||||
Services.prefs.setCharPref("network.trr.odoh.configs_uri", configUri);
|
||||
|
||||
await topicObserved("odoh-service-activated");
|
||||
Assert.equal(dns.ODoHActivated, expectedResult);
|
||||
Assert.equal(Services.dns.ODoHActivated, expectedResult);
|
||||
}
|
||||
|
||||
add_task(async function testODoHConfig8() {
|
||||
dns.clearCache(true);
|
||||
Services.dns.clearCache(true);
|
||||
Services.prefs.setCharPref("network.trr.uri", "");
|
||||
|
||||
await ODoHConfigTestHTTP(
|
||||
@ -178,7 +179,7 @@ add_task(async function testODoHConfig9() {
|
||||
Services.prefs.clearUserPref("network.trr.odoh.configs_uri");
|
||||
|
||||
await topicObserved("odoh-service-activated");
|
||||
Assert.ok(dns.ODoHActivated);
|
||||
Assert.ok(Services.dns.ODoHActivated);
|
||||
|
||||
await ODoHConfigTestHTTP(
|
||||
`https://foo.example.com:${h2Port}/odohconfig?downloadFrom=http`,
|
||||
@ -187,7 +188,7 @@ add_task(async function testODoHConfig9() {
|
||||
|
||||
// This is triggered by the expiration of the TTL.
|
||||
await topicObserved("odoh-service-activated");
|
||||
Assert.ok(dns.ODoHActivated);
|
||||
Assert.ok(Services.dns.ODoHActivated);
|
||||
Services.prefs.clearUserPref("network.trr.odoh.min_ttl");
|
||||
});
|
||||
|
||||
@ -269,7 +270,7 @@ add_task(test_no_retry_without_doh);
|
||||
add_task(test_connection_reuse_and_cycling).skip(); // Bug 1742743
|
||||
|
||||
add_task(async function testODoHConfigNotAvailableInMode3() {
|
||||
dns.clearCache(true);
|
||||
Services.dns.clearCache(true);
|
||||
Services.prefs.setIntPref("network.trr.mode", 3);
|
||||
Services.prefs.setCharPref("network.trr.uri", "");
|
||||
|
||||
@ -284,7 +285,7 @@ add_task(async function testODoHConfigNotAvailableInMode3() {
|
||||
});
|
||||
|
||||
add_task(async function testODoHConfigNotAvailableInMode2() {
|
||||
dns.clearCache(true);
|
||||
Services.dns.clearCache(true);
|
||||
Services.prefs.setIntPref("network.trr.mode", 2);
|
||||
Services.prefs.setCharPref("network.trr.uri", "");
|
||||
|
||||
|
@ -10,9 +10,6 @@ const { TestUtils } = ChromeUtils.importESModule(
|
||||
const override = Cc["@mozilla.org/network/native-dns-override;1"].getService(
|
||||
Ci.nsINativeDNSResolverOverride
|
||||
);
|
||||
const dns = Cc["@mozilla.org/network/dns-service;1"].getService(
|
||||
Ci.nsIDNSService
|
||||
);
|
||||
|
||||
class ConsoleListener {
|
||||
messages = [];
|
||||
@ -111,7 +108,7 @@ add_task(async function test_bug1724345() {
|
||||
override.clearOverrides();
|
||||
override.addIPOverride("example.org", "N/A");
|
||||
override.addIPOverride("null", "127.0.0.1");
|
||||
dns.clearCache(true);
|
||||
Services.dns.clearCache(true);
|
||||
|
||||
let chan = NetUtil.newChannel({
|
||||
uri: `http://example.org:1234/`,
|
||||
|
@ -98,7 +98,7 @@ add_task(async function test_trr_flags() {
|
||||
Ci.nsIRequest.TRR_FIRST_MODE,
|
||||
Ci.nsIRequest.TRR_ONLY_MODE,
|
||||
]) {
|
||||
dns.clearCache(true);
|
||||
Services.dns.clearCache(true);
|
||||
let chan = makeChan(URL, flag);
|
||||
let expectTRR =
|
||||
([2, 3].includes(mode) && flag != Ci.nsIRequest.TRR_DISABLED_MODE) ||
|
||||
@ -127,7 +127,7 @@ add_task(test_A_record);
|
||||
|
||||
add_task(async function test_push() {
|
||||
info("Verify DOH push");
|
||||
dns.clearCache(true);
|
||||
Services.dns.clearCache(true);
|
||||
info("Asking server to push us a record");
|
||||
setModeAndURI(3, "doh?responseIP=5.5.5.5&push=true");
|
||||
|
||||
@ -188,7 +188,7 @@ add_task(test_connection_closed);
|
||||
|
||||
add_task(async function test_clearCacheOnURIChange() {
|
||||
info("Check that the TRR cache should be cleared by a pref change.");
|
||||
dns.clearCache(true);
|
||||
Services.dns.clearCache(true);
|
||||
Services.prefs.setBoolPref("network.trr.clear-cache-on-pref-change", true);
|
||||
setModeAndURI(2, "doh?responseIP=7.7.7.7");
|
||||
|
||||
@ -207,7 +207,7 @@ add_task(async function test_clearCacheOnURIChange() {
|
||||
add_task(async function test_dnsSuffix() {
|
||||
info("Checking that domains matching dns suffix list use Do53");
|
||||
async function checkDnsSuffixInMode(mode) {
|
||||
dns.clearCache(true);
|
||||
Services.dns.clearCache(true);
|
||||
setModeAndURI(mode, "doh?responseIP=1.2.3.4&push=true");
|
||||
await new TRRDNSListener("example.org", "1.2.3.4");
|
||||
await new TRRDNSListener("push.example.org", "2018::2018");
|
||||
@ -253,7 +253,7 @@ add_task(async function test_dnsSuffix() {
|
||||
|
||||
add_task(async function test_async_resolve_with_trr_server() {
|
||||
info("Checking asyncResolveWithTrrServer");
|
||||
dns.clearCache(true);
|
||||
Services.dns.clearCache(true);
|
||||
Services.prefs.setIntPref("network.trr.mode", 0); // TRR-disabled
|
||||
|
||||
await new TRRDNSListener(
|
||||
@ -268,7 +268,7 @@ add_task(async function test_async_resolve_with_trr_server() {
|
||||
await new TRRDNSListener("bar_with_trr1.example.com", "127.0.0.1");
|
||||
|
||||
// Mode 2
|
||||
dns.clearCache(true);
|
||||
Services.dns.clearCache(true);
|
||||
setModeAndURI(2, "doh?responseIP=2.2.2.2");
|
||||
|
||||
await new TRRDNSListener(
|
||||
@ -283,7 +283,7 @@ add_task(async function test_async_resolve_with_trr_server() {
|
||||
await new TRRDNSListener("bar_with_trr2.example.com", "2.2.2.2");
|
||||
|
||||
// Mode 3
|
||||
dns.clearCache(true);
|
||||
Services.dns.clearCache(true);
|
||||
setModeAndURI(3, "doh?responseIP=2.2.2.2");
|
||||
|
||||
await new TRRDNSListener(
|
||||
@ -298,7 +298,7 @@ add_task(async function test_async_resolve_with_trr_server() {
|
||||
await new TRRDNSListener("bar_with_trr3.example.com", "2.2.2.2");
|
||||
|
||||
// Mode 5
|
||||
dns.clearCache(true);
|
||||
Services.dns.clearCache(true);
|
||||
setModeAndURI(5, "doh?responseIP=2.2.2.2");
|
||||
|
||||
// When dns is resolved in socket process, we can't set |expectEarlyFail| to true.
|
||||
@ -316,7 +316,7 @@ add_task(async function test_async_resolve_with_trr_server() {
|
||||
await new TRRDNSListener("bar_with_trr3.example.com", "127.0.0.1");
|
||||
|
||||
// Check that cache is ignored when server is different
|
||||
dns.clearCache(true);
|
||||
Services.dns.clearCache(true);
|
||||
setModeAndURI(3, "doh?responseIP=2.2.2.2");
|
||||
|
||||
await new TRRDNSListener("bar_with_trr4.example.com", "2.2.2.2", true);
|
||||
@ -340,7 +340,7 @@ add_task(async function test_async_resolve_with_trr_server() {
|
||||
);
|
||||
|
||||
// Check no fallback and no blocklisting upon failure
|
||||
dns.clearCache(true);
|
||||
Services.dns.clearCache(true);
|
||||
setModeAndURI(2, "doh?responseIP=2.2.2.2");
|
||||
|
||||
let { inStatus } = await new TRRDNSListener(
|
||||
@ -358,7 +358,7 @@ add_task(async function test_async_resolve_with_trr_server() {
|
||||
await new TRRDNSListener("bar_with_trr6.example.com", "2.2.2.2", true);
|
||||
|
||||
// Check that DoH push doesn't work
|
||||
dns.clearCache(true);
|
||||
Services.dns.clearCache(true);
|
||||
setModeAndURI(2, "doh?responseIP=2.2.2.2");
|
||||
|
||||
await new TRRDNSListener(
|
||||
@ -384,7 +384,7 @@ add_task(async function test_async_resolve_with_trr_server() {
|
||||
await new TRRDNSListener("push.example.org", "127.0.0.1");
|
||||
|
||||
// Check confirmation is ignored
|
||||
dns.clearCache(true);
|
||||
Services.dns.clearCache(true);
|
||||
setModeAndURI(2, "doh?responseIP=1::ffff");
|
||||
Services.prefs.clearUserPref("network.trr.useGET");
|
||||
Services.prefs.clearUserPref("network.trr.disable-ECS");
|
||||
@ -405,7 +405,7 @@ add_task(async function test_async_resolve_with_trr_server() {
|
||||
Services.prefs.setCharPref("network.trr.confirmationNS", "skip");
|
||||
|
||||
// Bad port
|
||||
dns.clearCache(true);
|
||||
Services.dns.clearCache(true);
|
||||
setModeAndURI(2, "doh?responseIP=2.2.2.2");
|
||||
|
||||
({ inStatus } = await new TRRDNSListener(
|
||||
@ -429,7 +429,7 @@ add_task(test_fetch_time);
|
||||
|
||||
add_task(async function test_content_encoding_gzip() {
|
||||
info("Checking gzip content encoding");
|
||||
dns.clearCache(true);
|
||||
Services.dns.clearCache(true);
|
||||
Services.prefs.setBoolPref(
|
||||
"network.trr.send_empty_accept-encoding_headers",
|
||||
false
|
||||
@ -446,7 +446,7 @@ add_task(async function test_redirect() {
|
||||
info("Check handling of redirect");
|
||||
|
||||
// GET
|
||||
dns.clearCache(true);
|
||||
Services.dns.clearCache(true);
|
||||
setModeAndURI(3, "doh?redirect=4.4.4.4{&dns}");
|
||||
Services.prefs.setBoolPref("network.trr.useGET", true);
|
||||
Services.prefs.setBoolPref("network.trr.disable-ECS", true);
|
||||
@ -454,7 +454,7 @@ add_task(async function test_redirect() {
|
||||
await new TRRDNSListener("ecs.example.com", "4.4.4.4");
|
||||
|
||||
// POST
|
||||
dns.clearCache(true);
|
||||
Services.dns.clearCache(true);
|
||||
Services.prefs.setBoolPref("network.trr.useGET", false);
|
||||
setModeAndURI(3, "doh?redirect=4.4.4.4");
|
||||
|
||||
@ -469,7 +469,7 @@ add_task(async function test_redirect() {
|
||||
// and wait-for-confirmation pref is true
|
||||
add_task(async function test_confirmation() {
|
||||
info("Checking that we fall back correctly when confirmation is pending");
|
||||
dns.clearCache(true);
|
||||
Services.dns.clearCache(true);
|
||||
Services.prefs.setBoolPref("network.trr.wait-for-confirmation", true);
|
||||
setModeAndURI(2, "doh?responseIP=7.7.7.7&slowConfirm=true");
|
||||
Services.prefs.setCharPref(
|
||||
@ -487,7 +487,7 @@ add_task(async function test_confirmation() {
|
||||
info("Check that confirmation is skipped in mode 3");
|
||||
// This is just a smoke test to make sure lookups succeed immediately
|
||||
// in mode 3 without waiting for confirmation.
|
||||
dns.clearCache(true);
|
||||
Services.dns.clearCache(true);
|
||||
setModeAndURI(3, "doh?responseIP=1::ffff&slowConfirm=true");
|
||||
Services.prefs.setCharPref(
|
||||
"network.trr.confirmationNS",
|
||||
@ -499,7 +499,7 @@ add_task(async function test_confirmation() {
|
||||
// Reset between each test to force re-confirm
|
||||
Services.prefs.setCharPref("network.trr.confirmationNS", "skip");
|
||||
|
||||
dns.clearCache(true);
|
||||
Services.dns.clearCache(true);
|
||||
Services.prefs.setBoolPref("network.trr.wait-for-confirmation", false);
|
||||
setModeAndURI(2, "doh?responseIP=7.7.7.7&slowConfirm=true");
|
||||
Services.prefs.setCharPref(
|
||||
@ -514,7 +514,7 @@ add_task(async function test_confirmation() {
|
||||
Services.prefs.setCharPref("network.trr.confirmationNS", "skip");
|
||||
|
||||
// Fallback when confirmation fails
|
||||
dns.clearCache(true);
|
||||
Services.dns.clearCache(true);
|
||||
Services.prefs.setBoolPref("network.trr.wait-for-confirmation", true);
|
||||
setModeAndURI(2, "404");
|
||||
Services.prefs.setCharPref(
|
||||
@ -535,7 +535,7 @@ add_task(test_fqdn);
|
||||
|
||||
add_task(async function test_detected_uri() {
|
||||
info("Test setDetectedTrrURI");
|
||||
dns.clearCache(true);
|
||||
Services.dns.clearCache(true);
|
||||
Services.prefs.setIntPref("network.trr.mode", 3);
|
||||
Services.prefs.clearUserPref("network.trr.uri");
|
||||
let defaultURI = gDefaultPref.getCharPref("network.trr.default_provider_uri");
|
||||
@ -544,25 +544,25 @@ add_task(async function test_detected_uri() {
|
||||
`https://foo.example.com:${h2Port}/doh?responseIP=3.4.5.6`
|
||||
);
|
||||
await new TRRDNSListener("domainA.example.org.", "3.4.5.6");
|
||||
dns.setDetectedTrrURI(
|
||||
Services.dns.setDetectedTrrURI(
|
||||
`https://foo.example.com:${h2Port}/doh?responseIP=1.2.3.4`
|
||||
);
|
||||
await new TRRDNSListener("domainB.example.org.", "1.2.3.4");
|
||||
gDefaultPref.setCharPref("network.trr.default_provider_uri", defaultURI);
|
||||
|
||||
// With a user-set doh uri this time.
|
||||
dns.clearCache(true);
|
||||
Services.dns.clearCache(true);
|
||||
setModeAndURI(2, "doh?responseIP=4.5.6.7");
|
||||
await new TRRDNSListener("domainA.example.org.", "4.5.6.7");
|
||||
|
||||
// This should be a no-op, since we have a user-set URI
|
||||
dns.setDetectedTrrURI(
|
||||
Services.dns.setDetectedTrrURI(
|
||||
`https://foo.example.com:${h2Port}/doh?responseIP=1.2.3.4`
|
||||
);
|
||||
await new TRRDNSListener("domainB.example.org.", "4.5.6.7");
|
||||
|
||||
// Test network link status change
|
||||
dns.clearCache(true);
|
||||
Services.dns.clearCache(true);
|
||||
Services.prefs.setIntPref("network.trr.mode", 3);
|
||||
Services.prefs.clearUserPref("network.trr.uri");
|
||||
gDefaultPref.setCharPref(
|
||||
@ -570,7 +570,7 @@ add_task(async function test_detected_uri() {
|
||||
`https://foo.example.com:${h2Port}/doh?responseIP=3.4.5.6`
|
||||
);
|
||||
await new TRRDNSListener("domainA.example.org.", "3.4.5.6");
|
||||
dns.setDetectedTrrURI(
|
||||
Services.dns.setDetectedTrrURI(
|
||||
`https://foo.example.com:${h2Port}/doh?responseIP=1.2.3.4`
|
||||
);
|
||||
await new TRRDNSListener("domainB.example.org.", "1.2.3.4");
|
||||
@ -605,7 +605,7 @@ add_task(async function test_pref_changes() {
|
||||
if (expectChange) {
|
||||
await uriChanged;
|
||||
}
|
||||
equal(dns.currentTrrURI, expectedURI);
|
||||
equal(Services.dns.currentTrrURI, expectedURI);
|
||||
}
|
||||
|
||||
// setting the default value of the pref should be reflected in the URI
|
||||
@ -643,7 +643,9 @@ add_task(async function test_pref_changes() {
|
||||
|
||||
// When the URI is set by the rollout addon, detection is allowed
|
||||
await doThenCheckURI(() => {
|
||||
dns.setDetectedTrrURI(`https://foo.example.com:${h2Port}/doh?detected`);
|
||||
Services.dns.setDetectedTrrURI(
|
||||
`https://foo.example.com:${h2Port}/doh?detected`
|
||||
);
|
||||
}, `https://foo.example.com:${h2Port}/doh?detected`);
|
||||
|
||||
// Should switch back to the default provided by the rollout addon
|
||||
@ -670,7 +672,9 @@ add_task(async function test_pref_changes() {
|
||||
// Detection should not work with a user set pref
|
||||
await doThenCheckURI(
|
||||
() => {
|
||||
dns.setDetectedTrrURI(`https://foo.example.com:${h2Port}/doh?detected`);
|
||||
Services.dns.setDetectedTrrURI(
|
||||
`https://foo.example.com:${h2Port}/doh?detected`
|
||||
);
|
||||
},
|
||||
`https://foo.example.com:${h2Port}/doh?user`,
|
||||
false
|
||||
@ -702,11 +706,11 @@ add_task(async function test_dohrollout_mode() {
|
||||
Services.prefs.clearUserPref("network.trr.mode");
|
||||
Services.prefs.clearUserPref("doh-rollout.mode");
|
||||
|
||||
equal(dns.currentTrrMode, 0);
|
||||
equal(Services.dns.currentTrrMode, 0);
|
||||
|
||||
async function doThenCheckMode(trrMode, rolloutMode, expectedMode, message) {
|
||||
let modeChanged;
|
||||
if (dns.currentTrrMode != expectedMode) {
|
||||
if (Services.dns.currentTrrMode != expectedMode) {
|
||||
modeChanged = topicObserved("network:trr-mode-changed");
|
||||
}
|
||||
|
||||
@ -721,7 +725,7 @@ add_task(async function test_dohrollout_mode() {
|
||||
if (modeChanged) {
|
||||
await modeChanged;
|
||||
}
|
||||
equal(dns.currentTrrMode, expectedMode, message);
|
||||
equal(Services.dns.currentTrrMode, expectedMode, message);
|
||||
}
|
||||
|
||||
await doThenCheckMode(2, undefined, 2);
|
||||
@ -755,9 +759,9 @@ add_task(async function test_dohrollout_mode() {
|
||||
await doThenCheckMode(3, undefined, 3);
|
||||
|
||||
Services.prefs.clearUserPref("network.trr.mode");
|
||||
equal(dns.currentTrrMode, 2);
|
||||
equal(Services.dns.currentTrrMode, 2);
|
||||
Services.prefs.clearUserPref("doh-rollout.mode");
|
||||
equal(dns.currentTrrMode, 0);
|
||||
equal(Services.dns.currentTrrMode, 0);
|
||||
});
|
||||
|
||||
add_task(test_ipv6_trr_fallback);
|
||||
@ -790,7 +794,7 @@ add_task(async function test_purge_trr_cache_on_mode_change() {
|
||||
});
|
||||
|
||||
add_task(async function test_old_bootstrap_pref() {
|
||||
dns.clearCache(true);
|
||||
Services.dns.clearCache(true);
|
||||
// Note this is a remote address. Setting this pref should have no effect,
|
||||
// as this is the old name for the bootstrap pref.
|
||||
// If this were to be used, the test would crash when accessing a non-local
|
||||
@ -811,22 +815,22 @@ add_task(async function test_padding() {
|
||||
ecsPadding
|
||||
) {
|
||||
Services.prefs.setIntPref("network.trr.padding.length", pad_length);
|
||||
dns.clearCache(true);
|
||||
Services.dns.clearCache(true);
|
||||
Services.prefs.setBoolPref("network.trr.padding", false);
|
||||
Services.prefs.setBoolPref("network.trr.disable-ECS", false);
|
||||
await new TRRDNSListener(request, none);
|
||||
|
||||
dns.clearCache(true);
|
||||
Services.dns.clearCache(true);
|
||||
Services.prefs.setBoolPref("network.trr.padding", false);
|
||||
Services.prefs.setBoolPref("network.trr.disable-ECS", true);
|
||||
await new TRRDNSListener(request, ecs);
|
||||
|
||||
dns.clearCache(true);
|
||||
Services.dns.clearCache(true);
|
||||
Services.prefs.setBoolPref("network.trr.padding", true);
|
||||
Services.prefs.setBoolPref("network.trr.disable-ECS", false);
|
||||
await new TRRDNSListener(request, padding);
|
||||
|
||||
dns.clearCache(true);
|
||||
Services.dns.clearCache(true);
|
||||
Services.prefs.setBoolPref("network.trr.padding", true);
|
||||
Services.prefs.setBoolPref("network.trr.disable-ECS", true);
|
||||
await new TRRDNSListener(request, ecsPadding);
|
||||
|
@ -4,10 +4,6 @@
|
||||
|
||||
"use strict";
|
||||
|
||||
const dns = Cc["@mozilla.org/network/dns-service;1"].getService(
|
||||
Ci.nsIDNSService
|
||||
);
|
||||
|
||||
trr_test_setup();
|
||||
registerCleanupFunction(async () => {
|
||||
trr_clear_prefs();
|
||||
@ -43,7 +39,7 @@ add_task(async function setup_server() {
|
||||
});
|
||||
|
||||
add_task(async function test_parse_additional_section() {
|
||||
dns.clearCache(true);
|
||||
Services.dns.clearCache(true);
|
||||
Services.prefs.setIntPref("network.trr.mode", 3);
|
||||
Services.prefs.setCharPref(
|
||||
"network.trr.uri",
|
||||
@ -306,7 +302,7 @@ add_task(async function test_additional_after_resolve() {
|
||||
// record field and this addditional record was previously unsuccessfully
|
||||
// resolved
|
||||
add_task(async function test_additional_cached_record_override() {
|
||||
dns.clearCache(true);
|
||||
Services.dns.clearCache(true);
|
||||
Services.prefs.setIntPref("network.trr.mode", 2);
|
||||
Services.prefs.setCharPref(
|
||||
"network.trr.uri",
|
||||
|
@ -4,10 +4,6 @@
|
||||
|
||||
"use strict";
|
||||
|
||||
const dns = Cc["@mozilla.org/network/dns-service;1"].getService(
|
||||
Ci.nsIDNSService
|
||||
);
|
||||
|
||||
const gOverride = Cc["@mozilla.org/network/native-dns-override;1"].getService(
|
||||
Ci.nsINativeDNSResolverOverride
|
||||
);
|
||||
@ -35,7 +31,7 @@ add_task(async function start_trr_server() {
|
||||
|
||||
add_task(async function unspec_first() {
|
||||
gOverride.clearOverrides();
|
||||
dns.clearCache(true);
|
||||
Services.dns.clearCache(true);
|
||||
|
||||
gOverride.addIPOverride("example.org", "1.1.1.1");
|
||||
gOverride.addIPOverride("example.org", "::1");
|
||||
@ -66,7 +62,7 @@ add_task(async function unspec_first() {
|
||||
|
||||
add_task(async function A_then_AAAA_fails() {
|
||||
gOverride.clearOverrides();
|
||||
dns.clearCache(true);
|
||||
Services.dns.clearCache(true);
|
||||
|
||||
gOverride.addIPOverride("example.org", "1.1.1.1");
|
||||
gOverride.addIPOverride("example.org", "::1");
|
||||
@ -96,7 +92,7 @@ add_task(async function A_then_AAAA_fails() {
|
||||
|
||||
add_task(async function just_AAAA_fails() {
|
||||
gOverride.clearOverrides();
|
||||
dns.clearCache(true);
|
||||
Services.dns.clearCache(true);
|
||||
|
||||
gOverride.addIPOverride("example.org", "1.1.1.1");
|
||||
gOverride.addIPOverride("example.org", "::1");
|
||||
|
@ -4,9 +4,6 @@
|
||||
|
||||
"use strict";
|
||||
|
||||
const dns = Cc["@mozilla.org/network/dns-service;1"].getService(
|
||||
Ci.nsIDNSService
|
||||
);
|
||||
const override = Cc["@mozilla.org/network/native-dns-override;1"].getService(
|
||||
Ci.nsINativeDNSResolverOverride
|
||||
);
|
||||
@ -25,7 +22,7 @@ add_task(async function checkBlocklisting() {
|
||||
await trrServer.start();
|
||||
info(`port = ${trrServer.port}\n`);
|
||||
|
||||
dns.clearCache(true);
|
||||
Services.dns.clearCache(true);
|
||||
Services.prefs.setCharPref(
|
||||
"network.trr.uri",
|
||||
`https://foo.example.com:${trrServer.port}/dns-query`
|
||||
@ -43,7 +40,7 @@ add_task(async function checkBlocklisting() {
|
||||
|
||||
// Clear the cache so that we need to consult the blocklist and not simply
|
||||
// return the cached DNS record.
|
||||
dns.clearCache(true);
|
||||
Services.dns.clearCache(true);
|
||||
await new TRRDNSListener("sub.top.test.com", {
|
||||
expectedAnswer: "2.2.2.2",
|
||||
});
|
||||
@ -68,7 +65,7 @@ add_task(async function checkBlocklisting() {
|
||||
|
||||
// The blocklist should instantly expire.
|
||||
Services.prefs.setIntPref("network.trr.temp_blocklist_duration_sec", 0);
|
||||
dns.clearCache(true);
|
||||
Services.dns.clearCache(true);
|
||||
await new TRRDNSListener("sub.top.test.com", {
|
||||
expectedAnswer: "2.2.2.2",
|
||||
});
|
||||
|
@ -4,10 +4,6 @@
|
||||
|
||||
"use strict";
|
||||
|
||||
const dns = Cc["@mozilla.org/network/dns-service;1"].getService(
|
||||
Ci.nsIDNSService
|
||||
);
|
||||
|
||||
trr_test_setup();
|
||||
registerCleanupFunction(async () => {
|
||||
trr_clear_prefs();
|
||||
@ -70,7 +66,7 @@ add_task(
|
||||
equal(await trrServer.requestCount("example.org", "A"), 1);
|
||||
|
||||
// Now we cancel both of them
|
||||
dns.clearCache(true);
|
||||
Services.dns.clearCache(true);
|
||||
r1 = new TRRDNSListener("example.org", { expectedSuccess: false });
|
||||
r2 = new TRRDNSListener("example.org", { expectedSuccess: false });
|
||||
r1.cancel();
|
||||
@ -85,7 +81,7 @@ add_task(
|
||||
);
|
||||
|
||||
add_task(async function cancel_delayed() {
|
||||
dns.clearCache(true);
|
||||
Services.dns.clearCache(true);
|
||||
await trrServer.registerDoHAnswers("example.com", "A", {
|
||||
answers: [
|
||||
{
|
||||
@ -108,7 +104,7 @@ add_task(async function cancel_delayed() {
|
||||
});
|
||||
|
||||
add_task(async function cancel_after_completed() {
|
||||
dns.clearCache(true);
|
||||
Services.dns.clearCache(true);
|
||||
await trrServer.registerDoHAnswers("example.com", "A", {
|
||||
answers: [
|
||||
{
|
||||
@ -129,7 +125,7 @@ add_task(async function cancel_after_completed() {
|
||||
});
|
||||
|
||||
add_task(async function clearCacheWhileResolving() {
|
||||
dns.clearCache(true);
|
||||
Services.dns.clearCache(true);
|
||||
await trrServer.registerDoHAnswers("example.com", "A", {
|
||||
answers: [
|
||||
{
|
||||
@ -145,7 +141,7 @@ add_task(async function clearCacheWhileResolving() {
|
||||
// Check that calling clearCache does not leave the request hanging.
|
||||
let r1 = new TRRDNSListener("example.com", { expectedAnswer: "3.3.3.3" });
|
||||
let r2 = new TRRDNSListener("example.com", { expectedAnswer: "3.3.3.3" });
|
||||
dns.clearCache(true);
|
||||
Services.dns.clearCache(true);
|
||||
await r1;
|
||||
await r2;
|
||||
|
||||
@ -172,11 +168,11 @@ add_task(async function clearCacheWhileResolving() {
|
||||
let r4 = new TRRDNSListener("httpsvc.com", {
|
||||
type: Ci.nsIDNSService.RESOLVE_TYPE_HTTPSSVC,
|
||||
});
|
||||
dns.clearCache(true);
|
||||
Services.dns.clearCache(true);
|
||||
await r3;
|
||||
await r4;
|
||||
equal(await trrServer.requestCount("httpsvc.com", "HTTPS"), 1);
|
||||
dns.clearCache(true);
|
||||
Services.dns.clearCache(true);
|
||||
await new TRRDNSListener("httpsvc.com", {
|
||||
type: Ci.nsIDNSService.RESOLVE_TYPE_HTTPSSVC,
|
||||
});
|
||||
|
@ -4,10 +4,6 @@
|
||||
|
||||
"use strict";
|
||||
|
||||
const dns = Cc["@mozilla.org/network/dns-service;1"].getService(
|
||||
Ci.nsIDNSService
|
||||
);
|
||||
|
||||
trr_test_setup();
|
||||
registerCleanupFunction(async () => {
|
||||
trr_clear_prefs();
|
||||
@ -41,7 +37,7 @@ add_task(async function test_trr_casing() {
|
||||
let [, resp] = await channelOpenPromise(chan);
|
||||
equal(resp, "<h1> 404 Path not found: /test?bla=some</h1>");
|
||||
|
||||
dns.clearCache(true);
|
||||
Services.dns.clearCache(true);
|
||||
Services.prefs.setIntPref("network.trr.mode", 3);
|
||||
Services.prefs.setCharPref(
|
||||
"network.trr.uri",
|
||||
|
@ -4,9 +4,6 @@
|
||||
|
||||
"use strict";
|
||||
|
||||
const dns = Cc["@mozilla.org/network/dns-service;1"].getService(
|
||||
Ci.nsIDNSService
|
||||
);
|
||||
let trrServer;
|
||||
|
||||
function makeChan(url) {
|
||||
@ -42,7 +39,7 @@ add_setup(async function setup() {
|
||||
let [, resp] = await channelOpenPromise(chan);
|
||||
equal(resp, "<h1> 404 Path not found: /test?bla=some</h1>");
|
||||
|
||||
dns.clearCache(true);
|
||||
Services.dns.clearCache(true);
|
||||
Services.prefs.setIntPref("network.trr.mode", 3);
|
||||
Services.prefs.setCharPref(
|
||||
"network.trr.uri",
|
||||
@ -226,7 +223,7 @@ add_task(async function test_cname_nodata() {
|
||||
});
|
||||
|
||||
let { inStatus } = await new TRRDNSListener("first.bar", {
|
||||
type: dns.RESOLVE_TYPE_HTTPSSVC,
|
||||
type: Ci.nsIDNSService.RESOLVE_TYPE_HTTPSSVC,
|
||||
});
|
||||
Assert.ok(Components.isSuccessCode(inStatus), `${inStatus} should work`);
|
||||
equal(await trrServer.requestCount("first.bar", "HTTPS"), 1);
|
||||
|
@ -4,21 +4,22 @@
|
||||
|
||||
"use strict";
|
||||
|
||||
const dns = Cc["@mozilla.org/network/dns-service;1"].getService(
|
||||
Ci.nsIDNSService
|
||||
);
|
||||
const { TestUtils } = ChromeUtils.importESModule(
|
||||
"resource://testing-common/TestUtils.sys.mjs"
|
||||
);
|
||||
|
||||
async function waitForConfirmationState(state, msToWait = 0) {
|
||||
await TestUtils.waitForCondition(
|
||||
() => dns.currentTrrConfirmationState == state,
|
||||
`Timed out waiting for ${state}. Currently ${dns.currentTrrConfirmationState}`,
|
||||
() => Services.dns.currentTrrConfirmationState == state,
|
||||
`Timed out waiting for ${state}. Currently ${Services.dns.currentTrrConfirmationState}`,
|
||||
1,
|
||||
msToWait
|
||||
);
|
||||
equal(dns.currentTrrConfirmationState, state, "expected confirmation state");
|
||||
equal(
|
||||
Services.dns.currentTrrConfirmationState,
|
||||
state,
|
||||
"expected confirmation state"
|
||||
);
|
||||
}
|
||||
|
||||
const CONFIRM_OFF = 0;
|
||||
@ -73,7 +74,7 @@ add_task(async function start_trr_server() {
|
||||
function trigger15Failures() {
|
||||
// We need to clear the cache in case a previous call to this method
|
||||
// put the results in the DNS cache.
|
||||
dns.clearCache(true);
|
||||
Services.dns.clearCache(true);
|
||||
|
||||
let dnsRequests = [];
|
||||
// There are actually two TRR requests sent for A and AAAA records, so doing
|
||||
@ -113,9 +114,9 @@ add_task(async function confirm_off() {
|
||||
"network.trr.mode",
|
||||
Ci.nsIDNSService.MODE_NATIVEONLY
|
||||
);
|
||||
equal(dns.currentTrrConfirmationState, CONFIRM_OFF);
|
||||
equal(Services.dns.currentTrrConfirmationState, CONFIRM_OFF);
|
||||
Services.prefs.setIntPref("network.trr.mode", Ci.nsIDNSService.MODE_TRROFF);
|
||||
equal(dns.currentTrrConfirmationState, CONFIRM_OFF);
|
||||
equal(Services.dns.currentTrrConfirmationState, CONFIRM_OFF);
|
||||
});
|
||||
|
||||
add_task(async function confirm_disabled() {
|
||||
@ -124,14 +125,14 @@ add_task(async function confirm_disabled() {
|
||||
"confirm.example.com"
|
||||
);
|
||||
Services.prefs.setIntPref("network.trr.mode", Ci.nsIDNSService.MODE_TRRONLY);
|
||||
equal(dns.currentTrrConfirmationState, CONFIRM_DISABLED);
|
||||
equal(Services.dns.currentTrrConfirmationState, CONFIRM_DISABLED);
|
||||
Services.prefs.setCharPref("network.trr.confirmationNS", "skip");
|
||||
Services.prefs.setIntPref("network.trr.mode", Ci.nsIDNSService.MODE_TRRFIRST);
|
||||
equal(dns.currentTrrConfirmationState, CONFIRM_DISABLED);
|
||||
equal(Services.dns.currentTrrConfirmationState, CONFIRM_DISABLED);
|
||||
});
|
||||
|
||||
add_task(async function confirm_ok() {
|
||||
dns.clearCache(true);
|
||||
Services.dns.clearCache(true);
|
||||
Services.prefs.setCharPref(
|
||||
"network.trr.confirmationNS",
|
||||
"confirm.example.com"
|
||||
@ -154,7 +155,7 @@ add_task(async function confirm_ok() {
|
||||
);
|
||||
Services.prefs.setIntPref("network.trr.mode", Ci.nsIDNSService.MODE_TRRFIRST);
|
||||
equal(
|
||||
dns.currentTrrConfirmationState,
|
||||
Services.dns.currentTrrConfirmationState,
|
||||
CONFIRM_TRYING_OK,
|
||||
"Should be CONFIRM_TRYING_OK"
|
||||
);
|
||||
@ -169,13 +170,13 @@ add_task(async function confirm_ok() {
|
||||
);
|
||||
Services.prefs.setIntPref("network.trr.mode", Ci.nsIDNSService.MODE_TRRFIRST);
|
||||
equal(
|
||||
dns.currentTrrConfirmationState,
|
||||
Services.dns.currentTrrConfirmationState,
|
||||
CONFIRM_TRYING_OK,
|
||||
"Should be CONFIRM_TRYING_OK"
|
||||
);
|
||||
await new Promise(resolve => do_timeout(100, resolve));
|
||||
equal(
|
||||
dns.currentTrrConfirmationState,
|
||||
Services.dns.currentTrrConfirmationState,
|
||||
CONFIRM_TRYING_OK,
|
||||
"Confirmation should still be pending"
|
||||
);
|
||||
@ -187,11 +188,11 @@ add_task(async function confirm_timeout() {
|
||||
"network.trr.mode",
|
||||
Ci.nsIDNSService.MODE_NATIVEONLY
|
||||
);
|
||||
equal(dns.currentTrrConfirmationState, CONFIRM_OFF);
|
||||
equal(Services.dns.currentTrrConfirmationState, CONFIRM_OFF);
|
||||
await registerNS(7000);
|
||||
Services.prefs.setIntPref("network.trr.mode", Ci.nsIDNSService.MODE_TRRFIRST);
|
||||
equal(
|
||||
dns.currentTrrConfirmationState,
|
||||
Services.dns.currentTrrConfirmationState,
|
||||
CONFIRM_TRYING_OK,
|
||||
"Should be CONFIRM_TRYING_OK"
|
||||
);
|
||||
@ -206,13 +207,13 @@ add_task(async function confirm_fail_fast() {
|
||||
"network.trr.mode",
|
||||
Ci.nsIDNSService.MODE_NATIVEONLY
|
||||
);
|
||||
equal(dns.currentTrrConfirmationState, CONFIRM_OFF);
|
||||
equal(Services.dns.currentTrrConfirmationState, CONFIRM_OFF);
|
||||
await trrServer.registerDoHAnswers("confirm.example.com", "NS", {
|
||||
error: 404,
|
||||
});
|
||||
Services.prefs.setIntPref("network.trr.mode", Ci.nsIDNSService.MODE_TRRFIRST);
|
||||
equal(
|
||||
dns.currentTrrConfirmationState,
|
||||
Services.dns.currentTrrConfirmationState,
|
||||
CONFIRM_TRYING_OK,
|
||||
"Should be CONFIRM_TRYING_OK"
|
||||
);
|
||||
@ -224,12 +225,12 @@ add_task(async function multiple_failures() {
|
||||
"network.trr.mode",
|
||||
Ci.nsIDNSService.MODE_NATIVEONLY
|
||||
);
|
||||
equal(dns.currentTrrConfirmationState, CONFIRM_OFF);
|
||||
equal(Services.dns.currentTrrConfirmationState, CONFIRM_OFF);
|
||||
|
||||
await registerNS(100);
|
||||
Services.prefs.setIntPref("network.trr.mode", Ci.nsIDNSService.MODE_TRRFIRST);
|
||||
equal(
|
||||
dns.currentTrrConfirmationState,
|
||||
Services.dns.currentTrrConfirmationState,
|
||||
CONFIRM_TRYING_OK,
|
||||
"Should be CONFIRM_TRYING_OK"
|
||||
);
|
||||
@ -241,7 +242,7 @@ add_task(async function multiple_failures() {
|
||||
// Check that failures during confirmation are ignored.
|
||||
await trigger15Failures();
|
||||
equal(
|
||||
dns.currentTrrConfirmationState,
|
||||
Services.dns.currentTrrConfirmationState,
|
||||
CONFIRM_TRYING_OK,
|
||||
"Should be CONFIRM_TRYING_OK"
|
||||
);
|
||||
@ -260,7 +261,7 @@ add_task(async function test_connectivity_change() {
|
||||
);
|
||||
Services.prefs.setIntPref("network.trr.mode", Ci.nsIDNSService.MODE_TRRFIRST);
|
||||
equal(
|
||||
dns.currentTrrConfirmationState,
|
||||
Services.dns.currentTrrConfirmationState,
|
||||
CONFIRM_TRYING_OK,
|
||||
"Should be CONFIRM_TRYING_OK"
|
||||
);
|
||||
@ -276,7 +277,7 @@ add_task(async function test_connectivity_change() {
|
||||
);
|
||||
// This means a CP check completed successfully. But no CP was previously
|
||||
// detected, so this is mostly a no-op.
|
||||
equal(dns.currentTrrConfirmationState, CONFIRM_OK);
|
||||
equal(Services.dns.currentTrrConfirmationState, CONFIRM_OK);
|
||||
|
||||
Services.obs.notifyObservers(
|
||||
null,
|
||||
@ -285,7 +286,7 @@ add_task(async function test_connectivity_change() {
|
||||
);
|
||||
// This basically a successful CP login event. Wasn't captive before.
|
||||
// Still treating as a no-op.
|
||||
equal(dns.currentTrrConfirmationState, CONFIRM_OK);
|
||||
equal(Services.dns.currentTrrConfirmationState, CONFIRM_OK);
|
||||
|
||||
// This makes the TRR service set mCaptiveIsPassed=false
|
||||
Services.obs.notifyObservers(
|
||||
@ -309,7 +310,7 @@ add_task(async function test_connectivity_change() {
|
||||
);
|
||||
// The notification should cause us to send a new confirmation request
|
||||
equal(
|
||||
dns.currentTrrConfirmationState,
|
||||
Services.dns.currentTrrConfirmationState,
|
||||
CONFIRM_TRYING_OK,
|
||||
"Should be CONFIRM_TRYING_OK"
|
||||
);
|
||||
@ -326,10 +327,10 @@ add_task(async function test_network_change() {
|
||||
"confirm.example.com",
|
||||
"NS"
|
||||
);
|
||||
equal(dns.currentTrrConfirmationState, CONFIRM_OK);
|
||||
equal(Services.dns.currentTrrConfirmationState, CONFIRM_OK);
|
||||
|
||||
Services.obs.notifyObservers(null, "network:link-status-changed", "up");
|
||||
equal(dns.currentTrrConfirmationState, CONFIRM_OK);
|
||||
equal(Services.dns.currentTrrConfirmationState, CONFIRM_OK);
|
||||
equal(
|
||||
await trrServer.requestCount("confirm.example.com", "NS"),
|
||||
confirmationCount
|
||||
@ -342,7 +343,7 @@ add_task(async function test_network_change() {
|
||||
// The network up event should reset the confirmation to TRYING_OK and do
|
||||
// another NS req
|
||||
Services.obs.notifyObservers(null, "network:link-status-changed", "up");
|
||||
equal(dns.currentTrrConfirmationState, CONFIRM_TRYING_OK);
|
||||
equal(Services.dns.currentTrrConfirmationState, CONFIRM_TRYING_OK);
|
||||
await waitForConfirmationState(CONFIRM_OK, 1000);
|
||||
// two extra confirmation events should have been received by the server
|
||||
equal(
|
||||
@ -356,12 +357,12 @@ add_task(async function test_uri_pref_change() {
|
||||
"confirm.example.com",
|
||||
"NS"
|
||||
);
|
||||
equal(dns.currentTrrConfirmationState, CONFIRM_OK);
|
||||
equal(Services.dns.currentTrrConfirmationState, CONFIRM_OK);
|
||||
Services.prefs.setCharPref(
|
||||
"network.trr.uri",
|
||||
`https://foo.example.com:${trrServer.port}/dns-query?changed`
|
||||
);
|
||||
equal(dns.currentTrrConfirmationState, CONFIRM_TRYING_OK);
|
||||
equal(Services.dns.currentTrrConfirmationState, CONFIRM_TRYING_OK);
|
||||
await waitForConfirmationState(CONFIRM_OK, 1000);
|
||||
equal(
|
||||
await trrServer.requestCount("confirm.example.com", "NS"),
|
||||
@ -385,10 +386,10 @@ add_task(async function test_autodetected_uri() {
|
||||
"confirm.example.com",
|
||||
"NS"
|
||||
);
|
||||
dns.setDetectedTrrURI(
|
||||
Services.dns.setDetectedTrrURI(
|
||||
`https://foo.example.com:${trrServer.port}/dns-query?changed2`
|
||||
);
|
||||
equal(dns.currentTrrConfirmationState, CONFIRM_TRYING_OK);
|
||||
equal(Services.dns.currentTrrConfirmationState, CONFIRM_TRYING_OK);
|
||||
await waitForConfirmationState(CONFIRM_OK, 1000);
|
||||
equal(
|
||||
await trrServer.requestCount("confirm.example.com", "NS"),
|
||||
|
@ -10,9 +10,6 @@
|
||||
// Immediately after the native DNS starts working, it should connect to the
|
||||
// TRR server and start working.
|
||||
|
||||
const dns = Cc["@mozilla.org/network/dns-service;1"].getService(
|
||||
Ci.nsIDNSService
|
||||
);
|
||||
const override = Cc["@mozilla.org/network/native-dns-override;1"].getService(
|
||||
Ci.nsINativeDNSResolverOverride
|
||||
);
|
||||
@ -37,7 +34,7 @@ add_task(async function intermittent_dns_mode3() {
|
||||
});
|
||||
await trrServer.start();
|
||||
info(`port = ${trrServer.port}\n`);
|
||||
dns.clearCache(true);
|
||||
Services.dns.clearCache(true);
|
||||
Services.prefs.setCharPref(
|
||||
"network.trr.uri",
|
||||
`https://foo.example.com:${trrServer.port}/dns-query`
|
||||
@ -83,7 +80,7 @@ add_task(async function intermittent_dns_mode2() {
|
||||
await trrServer.start();
|
||||
info(`port = ${trrServer.port}\n`);
|
||||
|
||||
dns.clearCache(true);
|
||||
Services.dns.clearCache(true);
|
||||
Services.prefs.setIntPref(
|
||||
"network.trr.mode",
|
||||
Ci.nsIDNSService.MODE_NATIVEONLY
|
||||
|
@ -4,10 +4,6 @@
|
||||
|
||||
"use strict";
|
||||
|
||||
const dns = Cc["@mozilla.org/network/dns-service;1"].getService(
|
||||
Ci.nsIDNSService
|
||||
);
|
||||
|
||||
trr_test_setup();
|
||||
registerCleanupFunction(async () => {
|
||||
trr_clear_prefs();
|
||||
@ -58,10 +54,10 @@ add_task(async function test_enterprise_policy_locked() {
|
||||
"example.com,example.org"
|
||||
);
|
||||
equal(Services.prefs.prefIsLocked("network.trr.excluded-domains"), true);
|
||||
equal(dns.currentTrrMode, 2);
|
||||
equal(dns.currentTrrURI, "https://example.com/provider");
|
||||
dns.setDetectedTrrURI("https://autodetect.example.com/provider");
|
||||
equal(dns.currentTrrURI, "https://example.com/provider");
|
||||
equal(Services.dns.currentTrrMode, 2);
|
||||
equal(Services.dns.currentTrrURI, "https://example.com/provider");
|
||||
Services.dns.setDetectedTrrURI("https://autodetect.example.com/provider");
|
||||
equal(Services.dns.currentTrrURI, "https://example.com/provider");
|
||||
});
|
||||
|
||||
add_task(async function test_enterprise_policy_unlocked() {
|
||||
@ -87,9 +83,9 @@ add_task(async function test_enterprise_policy_unlocked() {
|
||||
"example.com,example.org"
|
||||
);
|
||||
equal(Services.prefs.prefIsLocked("network.trr.excluded-domains"), false);
|
||||
equal(dns.currentTrrMode, 5);
|
||||
equal(dns.currentTrrURI, "https://example.org/provider");
|
||||
dns.setDetectedTrrURI("https://autodetect.example.com/provider");
|
||||
equal(dns.currentTrrMode, 5);
|
||||
equal(dns.currentTrrURI, "https://example.org/provider");
|
||||
equal(Services.dns.currentTrrMode, 5);
|
||||
equal(Services.dns.currentTrrURI, "https://example.org/provider");
|
||||
Services.dns.setDetectedTrrURI("https://autodetect.example.com/provider");
|
||||
equal(Services.dns.currentTrrMode, 5);
|
||||
equal(Services.dns.currentTrrURI, "https://example.org/provider");
|
||||
});
|
||||
|
@ -4,10 +4,6 @@
|
||||
|
||||
"use strict";
|
||||
|
||||
const dns = Cc["@mozilla.org/network/dns-service;1"].getService(
|
||||
Ci.nsIDNSService
|
||||
);
|
||||
|
||||
trr_test_setup();
|
||||
registerCleanupFunction(async () => {
|
||||
trr_clear_prefs();
|
||||
@ -42,7 +38,7 @@ add_task(async function setup() {
|
||||
let [, resp] = await channelOpenPromise(chan);
|
||||
equal(resp, "<h1> 404 Path not found: /test?bla=some</h1>");
|
||||
|
||||
dns.clearCache(true);
|
||||
Services.dns.clearCache(true);
|
||||
Services.prefs.setIntPref("network.trr.mode", 2);
|
||||
Services.prefs.setCharPref(
|
||||
"network.trr.uri",
|
||||
|
@ -14,9 +14,6 @@ let h3Port;
|
||||
let h3NoResponsePort;
|
||||
let trrServer;
|
||||
|
||||
const dns = Cc["@mozilla.org/network/dns-service;1"].getService(
|
||||
Ci.nsIDNSService
|
||||
);
|
||||
const certOverrideService = Cc[
|
||||
"@mozilla.org/security/certoverride;1"
|
||||
].getService(Ci.nsICertOverrideService);
|
||||
@ -60,6 +57,7 @@ add_setup(async function setup() {
|
||||
});
|
||||
|
||||
if (mozinfo.socketprocess_networking) {
|
||||
Services.dns; // Needed to trigger socket process.
|
||||
await TestUtils.waitForCondition(() => Services.io.socketProcessLaunched);
|
||||
}
|
||||
|
||||
@ -396,7 +394,7 @@ add_task(async function testFallbackToTheOrigin2() {
|
||||
// Test when some records have echConfig and some not, we directly fallback to
|
||||
// the origin one.
|
||||
add_task(async function testFallbackToTheOrigin3() {
|
||||
dns.clearCache(true);
|
||||
Services.dns.clearCache(true);
|
||||
|
||||
trrServer = new TRRServer();
|
||||
await trrServer.start();
|
||||
@ -713,7 +711,7 @@ add_task(async function testFastfallbackToH2() {
|
||||
add_task(async function testFailedH3Connection() {
|
||||
trrServer = new TRRServer();
|
||||
await trrServer.start();
|
||||
dns.clearCache(true);
|
||||
Services.dns.clearCache(true);
|
||||
Services.prefs.setIntPref("network.trr.mode", 3);
|
||||
Services.prefs.setCharPref(
|
||||
"network.trr.uri",
|
||||
@ -760,7 +758,7 @@ add_task(async function testFailedH3Connection() {
|
||||
add_task(async function testHttp3ExcludedList() {
|
||||
trrServer = new TRRServer();
|
||||
await trrServer.start();
|
||||
dns.clearCache(true);
|
||||
Services.dns.clearCache(true);
|
||||
Services.prefs.setIntPref("network.trr.mode", 3);
|
||||
Services.prefs.setCharPref(
|
||||
"network.trr.uri",
|
||||
@ -832,7 +830,7 @@ add_task(async function testHttp3ExcludedList() {
|
||||
add_task(async function testAllRecordsInHttp3ExcludedList() {
|
||||
trrServer = new TRRServer();
|
||||
await trrServer.start();
|
||||
dns.clearCache(true);
|
||||
Services.dns.clearCache(true);
|
||||
Services.prefs.setIntPref("network.trr.mode", 3);
|
||||
Services.prefs.setBoolPref("network.dns.http3_echconfig.enabled", true);
|
||||
Services.prefs.setCharPref(
|
||||
@ -924,7 +922,7 @@ add_task(async function testAllRecordsInHttp3ExcludedList() {
|
||||
type: Ci.nsIDNSService.RESOLVE_TYPE_HTTPSSVC,
|
||||
});
|
||||
|
||||
dns.clearCache(true);
|
||||
Services.dns.clearCache(true);
|
||||
Services.prefs.setIntPref("network.http.speculative-parallel-limit", 0);
|
||||
Services.obs.notifyObservers(null, "net:prune-all-connections");
|
||||
|
||||
|
@ -16,10 +16,6 @@ function inChildProcess() {
|
||||
return Services.appinfo.processType != Ci.nsIXULRuntime.PROCESS_TYPE_DEFAULT;
|
||||
}
|
||||
|
||||
const dns = Cc["@mozilla.org/network/dns-service;1"].getService(
|
||||
Ci.nsIDNSService
|
||||
);
|
||||
|
||||
add_setup(async function setup() {
|
||||
if (inChildProcess()) {
|
||||
return;
|
||||
@ -37,6 +33,7 @@ add_setup(async function setup() {
|
||||
});
|
||||
|
||||
if (mozinfo.socketprocess_networking) {
|
||||
Services.dns; // Needed to trigger socket process.
|
||||
await TestUtils.waitForCondition(() => Services.io.socketProcessLaunched);
|
||||
}
|
||||
|
||||
@ -53,7 +50,7 @@ add_task(async function testHTTPSSVC() {
|
||||
}
|
||||
|
||||
let { inRecord } = await new TRRDNSListener("test.httpssvc.com", {
|
||||
type: dns.RESOLVE_TYPE_HTTPSSVC,
|
||||
type: Ci.nsIDNSService.RESOLVE_TYPE_HTTPSSVC,
|
||||
});
|
||||
let answer = inRecord.QueryInterface(Ci.nsIDNSHTTPSSVCRecord).records;
|
||||
Assert.equal(answer[0].priority, 1);
|
||||
@ -230,7 +227,7 @@ add_task(async function test_aliasform() {
|
||||
|
||||
{
|
||||
let { inStatus, inRecord } = await new TRRDNSListener("test.com", {
|
||||
type: dns.RESOLVE_TYPE_HTTPSSVC,
|
||||
type: Ci.nsIDNSService.RESOLVE_TYPE_HTTPSSVC,
|
||||
expectedSuccess: false,
|
||||
});
|
||||
Assert.ok(Components.isSuccessCode(inStatus), `${inStatus} should succeed`);
|
||||
@ -299,7 +296,7 @@ add_task(async function test_aliasform() {
|
||||
});
|
||||
|
||||
let { inStatus, inRecord } = await new TRRDNSListener("x.com", {
|
||||
type: dns.RESOLVE_TYPE_HTTPSSVC,
|
||||
type: Ci.nsIDNSService.RESOLVE_TYPE_HTTPSSVC,
|
||||
expectedSuccess: false,
|
||||
});
|
||||
Assert.ok(Components.isSuccessCode(inStatus), `${inStatus} should succeed`);
|
||||
@ -373,7 +370,7 @@ add_task(async function test_aliasform() {
|
||||
Assert.equal(await trrServer.requestCount("loop2.com", "HTTPS"), 0);
|
||||
|
||||
({ inStatus } = await new TRRDNSListener("loop.com", {
|
||||
type: dns.RESOLVE_TYPE_HTTPSSVC,
|
||||
type: Ci.nsIDNSService.RESOLVE_TYPE_HTTPSSVC,
|
||||
expectedSuccess: false,
|
||||
}));
|
||||
Assert.ok(
|
||||
@ -445,7 +442,7 @@ add_task(async function test_aliasform() {
|
||||
});
|
||||
|
||||
let { inStatus: inStatus2 } = await new TRRDNSListener("multi.com", {
|
||||
type: dns.RESOLVE_TYPE_HTTPSSVC,
|
||||
type: Ci.nsIDNSService.RESOLVE_TYPE_HTTPSSVC,
|
||||
expectedSuccess: false,
|
||||
});
|
||||
Assert.ok(
|
||||
@ -478,7 +475,7 @@ add_task(async function test_aliasform() {
|
||||
});
|
||||
|
||||
({ inStatus: inStatus2 } = await new TRRDNSListener("order.com", {
|
||||
type: dns.RESOLVE_TYPE_HTTPSSVC,
|
||||
type: Ci.nsIDNSService.RESOLVE_TYPE_HTTPSSVC,
|
||||
expectedSuccess: false,
|
||||
}));
|
||||
Assert.ok(
|
||||
@ -507,7 +504,7 @@ add_task(async function test_aliasform() {
|
||||
});
|
||||
|
||||
({ inStatus: inStatus2 } = await new TRRDNSListener("duplicate.com", {
|
||||
type: dns.RESOLVE_TYPE_HTTPSSVC,
|
||||
type: Ci.nsIDNSService.RESOLVE_TYPE_HTTPSSVC,
|
||||
expectedSuccess: false,
|
||||
}));
|
||||
Assert.ok(
|
||||
@ -537,7 +534,7 @@ add_task(async function test_aliasform() {
|
||||
});
|
||||
|
||||
({ inStatus: inStatus2 } = await new TRRDNSListener("mandatory.com", {
|
||||
type: dns.RESOLVE_TYPE_HTTPSSVC,
|
||||
type: Ci.nsIDNSService.RESOLVE_TYPE_HTTPSSVC,
|
||||
expectedSuccess: false,
|
||||
}));
|
||||
Assert.ok(!Components.isSuccessCode(inStatus2), `${inStatus2} should fail`);
|
||||
@ -578,7 +575,7 @@ add_task(async function test_aliasform() {
|
||||
});
|
||||
|
||||
({ inStatus: inStatus2 } = await new TRRDNSListener("mandatory2.com", {
|
||||
type: dns.RESOLVE_TYPE_HTTPSSVC,
|
||||
type: Ci.nsIDNSService.RESOLVE_TYPE_HTTPSSVC,
|
||||
}));
|
||||
|
||||
Assert.ok(Components.isSuccessCode(inStatus2), `${inStatus2} should succeed`);
|
||||
@ -601,7 +598,7 @@ add_task(async function test_aliasform() {
|
||||
});
|
||||
|
||||
({ inStatus: inStatus2 } = await new TRRDNSListener("no-alias.com", {
|
||||
type: dns.RESOLVE_TYPE_HTTPSSVC,
|
||||
type: Ci.nsIDNSService.RESOLVE_TYPE_HTTPSSVC,
|
||||
expectedSuccess: false,
|
||||
}));
|
||||
|
||||
@ -625,7 +622,7 @@ add_task(async function test_aliasform() {
|
||||
});
|
||||
|
||||
({ inRecord, inStatus: inStatus2 } = await new TRRDNSListener("service.com", {
|
||||
type: dns.RESOLVE_TYPE_HTTPSSVC,
|
||||
type: Ci.nsIDNSService.RESOLVE_TYPE_HTTPSSVC,
|
||||
}));
|
||||
Assert.ok(Components.isSuccessCode(inStatus2), `${inStatus2} should work`);
|
||||
answer = inRecord.QueryInterface(Ci.nsIDNSHTTPSSVCRecord).records;
|
||||
@ -635,7 +632,7 @@ add_task(async function test_aliasform() {
|
||||
|
||||
add_task(async function testNegativeResponse() {
|
||||
let { inStatus } = await new TRRDNSListener("negative_test.com", {
|
||||
type: dns.RESOLVE_TYPE_HTTPSSVC,
|
||||
type: Ci.nsIDNSService.RESOLVE_TYPE_HTTPSSVC,
|
||||
expectedSuccess: false,
|
||||
});
|
||||
Assert.ok(
|
||||
@ -661,7 +658,7 @@ add_task(async function testNegativeResponse() {
|
||||
|
||||
// Should still be failed because a negative response is from DNS cache.
|
||||
({ inStatus } = await new TRRDNSListener("negative_test.com", {
|
||||
type: dns.RESOLVE_TYPE_HTTPSSVC,
|
||||
type: Ci.nsIDNSService.RESOLVE_TYPE_HTTPSSVC,
|
||||
expectedSuccess: false,
|
||||
}));
|
||||
Assert.ok(
|
||||
@ -673,12 +670,12 @@ add_task(async function testNegativeResponse() {
|
||||
do_send_remote_message("clearCache");
|
||||
await do_await_remote_message("clearCache-done");
|
||||
} else {
|
||||
dns.clearCache(true);
|
||||
Services.dns.clearCache(true);
|
||||
}
|
||||
|
||||
let inRecord;
|
||||
({ inRecord, inStatus } = await new TRRDNSListener("negative_test.com", {
|
||||
type: dns.RESOLVE_TYPE_HTTPSSVC,
|
||||
type: Ci.nsIDNSService.RESOLVE_TYPE_HTTPSSVC,
|
||||
}));
|
||||
Assert.ok(Components.isSuccessCode(inStatus), `${inStatus} should work`);
|
||||
let answer = inRecord.QueryInterface(Ci.nsIDNSHTTPSSVCRecord).records;
|
||||
@ -720,7 +717,7 @@ add_task(async function testPortPrefixedName() {
|
||||
let { inRecord, inStatus } = await new TRRDNSListener(
|
||||
"port_prefix.test.com",
|
||||
{
|
||||
type: dns.RESOLVE_TYPE_HTTPSSVC,
|
||||
type: Ci.nsIDNSService.RESOLVE_TYPE_HTTPSSVC,
|
||||
port: 4433,
|
||||
}
|
||||
);
|
||||
|
@ -7,9 +7,6 @@
|
||||
const override = Cc["@mozilla.org/network/native-dns-override;1"].getService(
|
||||
Ci.nsINativeDNSResolverOverride
|
||||
);
|
||||
const dns = Cc["@mozilla.org/network/dns-service;1"].getService(
|
||||
Ci.nsIDNSService
|
||||
);
|
||||
|
||||
trr_test_setup();
|
||||
registerCleanupFunction(async () => {
|
||||
@ -64,7 +61,7 @@ add_task(async function test_add_nat64_prefix_to_trr() {
|
||||
let chan = makeChan(`https://localhost:${trrServer.port}/test?bla=some`);
|
||||
let [, resp] = await channelOpenPromise(chan);
|
||||
equal(resp, "<h1> 404 Path not found: /test?bla=some</h1>");
|
||||
dns.clearCache(true);
|
||||
Services.dns.clearCache(true);
|
||||
override.addIPOverride("ipv4only.arpa", "fe80::9b2b:c000:00aa");
|
||||
Services.prefs.setCharPref(
|
||||
"network.connectivity-service.nat64-prefix",
|
||||
|
@ -4,10 +4,6 @@
|
||||
|
||||
"use strict";
|
||||
|
||||
const dns = Cc["@mozilla.org/network/dns-service;1"].getService(
|
||||
Ci.nsIDNSService
|
||||
);
|
||||
|
||||
function setup() {
|
||||
trr_test_setup();
|
||||
}
|
||||
@ -24,7 +20,7 @@ add_task(async function checkBlocklisting() {
|
||||
await trrServer.start();
|
||||
info(`port = ${trrServer.port}\n`);
|
||||
|
||||
dns.clearCache(true);
|
||||
Services.dns.clearCache(true);
|
||||
Services.prefs.setCharPref(
|
||||
"network.trr.uri",
|
||||
`https://foo.example.com:${trrServer.port}/dns-query`
|
||||
@ -44,13 +40,13 @@ add_task(async function checkBlocklisting() {
|
||||
await new TRRDNSListener(`sub${i}.blocklisted.com`, {
|
||||
expectedAnswer: "127.0.0.1",
|
||||
});
|
||||
dns.clearCache(true);
|
||||
Services.dns.clearCache(true);
|
||||
await new TRRDNSListener(`sub${i}.blocklisted.com`, {
|
||||
expectedAnswer: "127.0.0.1",
|
||||
});
|
||||
await new TRRDNSListener(`sub.sub${i}.blocklisted.com`, {
|
||||
expectedAnswer: "127.0.0.1",
|
||||
});
|
||||
dns.clearCache(true);
|
||||
Services.dns.clearCache(true);
|
||||
}
|
||||
});
|
||||
|
@ -71,7 +71,7 @@ class ProxyFilter {
|
||||
|
||||
async function doTest(proxySetup, delay) {
|
||||
info("Verifying a basic A record");
|
||||
dns.clearCache(true);
|
||||
Services.dns.clearCache(true);
|
||||
setModeAndURI(2, "doh?responseIP=2.2.2.2"); // TRR-first
|
||||
|
||||
trrProxy = new TRRProxy();
|
||||
@ -200,12 +200,12 @@ add_task(async function test_trr_proxy() {
|
||||
add_task(async function test_trr_uri_change() {
|
||||
Services.prefs.setIntPref("network.proxy.type", 0);
|
||||
Services.prefs.setBoolPref("network.trr.async_connInfo", true);
|
||||
dns.clearCache(true);
|
||||
Services.dns.clearCache(true);
|
||||
setModeAndURI(2, "doh?responseIP=2.2.2.2", "127.0.0.1");
|
||||
|
||||
await new TRRDNSListener("car.example.com", "127.0.0.1");
|
||||
|
||||
dns.clearCache(true);
|
||||
Services.dns.clearCache(true);
|
||||
setModeAndURI(2, "doh?responseIP=2.2.2.2");
|
||||
await new TRRDNSListener("car.example.net", "2.2.2.2");
|
||||
});
|
||||
|
@ -8,9 +8,6 @@ ChromeUtils.import("resource://gre/modules/NetUtil.jsm");
|
||||
|
||||
let h2Port;
|
||||
|
||||
const dns = Cc["@mozilla.org/network/dns-service;1"].getService(
|
||||
Ci.nsIDNSService
|
||||
);
|
||||
const certOverrideService = Cc[
|
||||
"@mozilla.org/security/certoverride;1"
|
||||
].getService(Ci.nsICertOverrideService);
|
||||
@ -35,6 +32,7 @@ add_setup(async function setup() {
|
||||
});
|
||||
|
||||
if (mozinfo.socketprocess_networking) {
|
||||
Services.dns; // Needed to trigger socket process.
|
||||
await TestUtils.waitForCondition(() => Services.io.socketProcessLaunched);
|
||||
}
|
||||
|
||||
@ -69,7 +67,7 @@ add_task(async function testUseHTTPSSVCForHttpsUpgrade() {
|
||||
"network.trr.uri",
|
||||
"https://foo.example.com:" + h2Port + "/httpssvc_as_altsvc"
|
||||
);
|
||||
dns.clearCache(true);
|
||||
Services.dns.clearCache(true);
|
||||
|
||||
certOverrideService.setDisableAllSecurityChecksAndLetAttackersInterceptMyData(
|
||||
true
|
||||
@ -111,7 +109,7 @@ add_task(async function testUseHTTPSSVCAsHSTS() {
|
||||
"network.trr.uri",
|
||||
"https://foo.example.com:" + h2Port + "/httpssvc_as_altsvc"
|
||||
);
|
||||
dns.clearCache(true);
|
||||
Services.dns.clearCache(true);
|
||||
|
||||
certOverrideService.setDisableAllSecurityChecksAndLetAttackersInterceptMyData(
|
||||
true
|
||||
@ -156,7 +154,7 @@ add_task(async function testUseHTTPSSVC() {
|
||||
// Do DNS resolution before creating the channel, so the HTTPSSVC record will
|
||||
// be resolved from the cache.
|
||||
await new TRRDNSListener("test.httpssvc.com", {
|
||||
type: dns.RESOLVE_TYPE_HTTPSSVC,
|
||||
type: Ci.nsIDNSService.RESOLVE_TYPE_HTTPSSVC,
|
||||
});
|
||||
|
||||
// We need to skip the security check, since our test cert is signed for
|
||||
@ -218,7 +216,7 @@ add_task(async function testFallback() {
|
||||
});
|
||||
|
||||
let { inRecord } = await new TRRDNSListener("test.fallback.com", {
|
||||
type: dns.RESOLVE_TYPE_HTTPSSVC,
|
||||
type: Ci.nsIDNSService.RESOLVE_TYPE_HTTPSSVC,
|
||||
});
|
||||
|
||||
let record = inRecord
|
||||
|
@ -13,10 +13,6 @@ const { TestUtils } = ChromeUtils.importESModule(
|
||||
"resource://testing-common/TestUtils.sys.mjs"
|
||||
);
|
||||
|
||||
const dns = Cc["@mozilla.org/network/dns-service;1"].getService(
|
||||
Ci.nsIDNSService
|
||||
);
|
||||
|
||||
const { HttpServer } = ChromeUtils.import("resource://testing-common/httpd.js");
|
||||
|
||||
const TRR_Domain = "foo.example.com";
|
||||
@ -38,7 +34,7 @@ async function SetParentalControlEnabled(aEnabled) {
|
||||
"@mozilla.org/parental-controls-service;1",
|
||||
parentalControlsService
|
||||
);
|
||||
dns.reloadParentalControlEnabled();
|
||||
Services.dns.reloadParentalControlEnabled();
|
||||
MockRegistrar.unregister(cid);
|
||||
}
|
||||
|
||||
@ -75,12 +71,12 @@ function setModeAndURI(mode, path, domain) {
|
||||
|
||||
async function test_A_record() {
|
||||
info("Verifying a basic A record");
|
||||
dns.clearCache(true);
|
||||
Services.dns.clearCache(true);
|
||||
setModeAndURI(2, "doh?responseIP=2.2.2.2"); // TRR-first
|
||||
await new TRRDNSListener("bar.example.com", "2.2.2.2");
|
||||
|
||||
info("Verifying a basic A record - without bootstrapping");
|
||||
dns.clearCache(true);
|
||||
Services.dns.clearCache(true);
|
||||
setModeAndURI(3, "doh?responseIP=3.3.3.3"); // TRR-only
|
||||
|
||||
// Clear bootstrap address and add DoH endpoint hostname to local domains
|
||||
@ -98,14 +94,14 @@ async function test_A_record() {
|
||||
|
||||
await new TRRDNSListener("bar.example.com", "3.3.3.3");
|
||||
info("verify working credentials in DOH request");
|
||||
dns.clearCache(true);
|
||||
Services.dns.clearCache(true);
|
||||
setModeAndURI(3, "doh?responseIP=4.4.4.4&auth=true");
|
||||
Services.prefs.setCharPref("network.trr.credentials", "user:password");
|
||||
|
||||
await new TRRDNSListener("bar.example.com", "4.4.4.4");
|
||||
|
||||
info("Verify failing credentials in DOH request");
|
||||
dns.clearCache(true);
|
||||
Services.dns.clearCache(true);
|
||||
setModeAndURI(3, "doh?responseIP=4.4.4.4&auth=true");
|
||||
Services.prefs.setCharPref("network.trr.credentials", "evil:person");
|
||||
|
||||
@ -125,17 +121,17 @@ async function test_A_record() {
|
||||
async function test_AAAA_records() {
|
||||
info("Verifying AAAA record");
|
||||
|
||||
dns.clearCache(true);
|
||||
Services.dns.clearCache(true);
|
||||
setModeAndURI(3, "doh?responseIP=2020:2020::2020&delayIPv4=100");
|
||||
|
||||
await new TRRDNSListener("aaaa.example.com", "2020:2020::2020");
|
||||
|
||||
dns.clearCache(true);
|
||||
Services.dns.clearCache(true);
|
||||
setModeAndURI(3, "doh?responseIP=2020:2020::2020&delayIPv6=100");
|
||||
|
||||
await new TRRDNSListener("aaaa.example.com", "2020:2020::2020");
|
||||
|
||||
dns.clearCache(true);
|
||||
Services.dns.clearCache(true);
|
||||
setModeAndURI(3, "doh?responseIP=2020:2020::2020");
|
||||
|
||||
await new TRRDNSListener("aaaa.example.com", "2020:2020::2020");
|
||||
@ -143,7 +139,7 @@ async function test_AAAA_records() {
|
||||
|
||||
async function test_RFC1918() {
|
||||
info("Verifying that RFC1918 address from the server is rejected by default");
|
||||
dns.clearCache(true);
|
||||
Services.dns.clearCache(true);
|
||||
setModeAndURI(3, "doh?responseIP=192.168.0.1");
|
||||
|
||||
let { inStatus } = await new TRRDNSListener(
|
||||
@ -168,7 +164,7 @@ async function test_RFC1918() {
|
||||
);
|
||||
|
||||
info("Verify RFC1918 address from the server is fine when told so");
|
||||
dns.clearCache(true);
|
||||
Services.dns.clearCache(true);
|
||||
setModeAndURI(3, "doh?responseIP=192.168.0.1");
|
||||
Services.prefs.setBoolPref("network.trr.allow-rfc1918", true);
|
||||
await new TRRDNSListener("rfc1918.example.com", "192.168.0.1");
|
||||
@ -181,7 +177,7 @@ async function test_RFC1918() {
|
||||
|
||||
async function test_GET_ECS() {
|
||||
info("Verifying resolution via GET with ECS disabled");
|
||||
dns.clearCache(true);
|
||||
Services.dns.clearCache(true);
|
||||
// The template part should be discarded
|
||||
if (runningODoHTests) {
|
||||
setModeAndURI(3, "odoh");
|
||||
@ -194,7 +190,7 @@ async function test_GET_ECS() {
|
||||
await new TRRDNSListener("ecs.example.com", "5.5.5.5");
|
||||
|
||||
info("Verifying resolution via GET with ECS enabled");
|
||||
dns.clearCache(true);
|
||||
Services.dns.clearCache(true);
|
||||
if (runningODoHTests) {
|
||||
setModeAndURI(3, "odoh");
|
||||
} else {
|
||||
@ -210,7 +206,7 @@ async function test_GET_ECS() {
|
||||
|
||||
async function test_timeout_mode3() {
|
||||
info("Verifying that a short timeout causes failure with a slow server");
|
||||
dns.clearCache(true);
|
||||
Services.dns.clearCache(true);
|
||||
// First, mode 3.
|
||||
setModeAndURI(3, "doh?noResponse=true");
|
||||
Services.prefs.setIntPref("network.trr.request_timeout_ms", 10);
|
||||
@ -227,7 +223,7 @@ async function test_timeout_mode3() {
|
||||
);
|
||||
|
||||
// Now for mode 2
|
||||
dns.clearCache(true);
|
||||
Services.dns.clearCache(true);
|
||||
setModeAndURI(2, "doh?noResponse=true");
|
||||
|
||||
await new TRRDNSListener("timeout.example.com", "127.0.0.1"); // Should fallback
|
||||
@ -237,7 +233,7 @@ async function test_timeout_mode3() {
|
||||
}
|
||||
|
||||
async function test_trr_retry() {
|
||||
dns.clearCache(true);
|
||||
Services.dns.clearCache(true);
|
||||
Services.prefs.setBoolPref("network.trr.strict_native_fallback", false);
|
||||
|
||||
info("Test fallback to native");
|
||||
@ -268,13 +264,13 @@ async function test_trr_retry() {
|
||||
await new TRRDNSListener("retry_ok.example.com", "2.2.2.2");
|
||||
|
||||
info("Test Retry Failed");
|
||||
dns.clearCache(true);
|
||||
Services.dns.clearCache(true);
|
||||
setModeAndURI(2, "doh?responseIP=2.2.2.2&corruptedAnswer=true");
|
||||
await new TRRDNSListener("retry_ng.example.com", "127.0.0.1");
|
||||
}
|
||||
|
||||
async function test_strict_native_fallback() {
|
||||
dns.clearCache(true);
|
||||
Services.dns.clearCache(true);
|
||||
Services.prefs.setBoolPref("network.trr.retry_on_recoverable_errors", true);
|
||||
Services.prefs.setBoolPref("network.trr.strict_native_fallback", true);
|
||||
|
||||
@ -301,10 +297,10 @@ async function test_strict_native_fallback() {
|
||||
!Components.isSuccessCode(inStatus),
|
||||
`${inStatus} should be an error code`
|
||||
);
|
||||
dns.clearCache(true);
|
||||
Services.dns.clearCache(true);
|
||||
await new TRRDNSListener("timeout.example.com", undefined, false);
|
||||
|
||||
dns.clearCache(true);
|
||||
Services.dns.clearCache(true);
|
||||
Services.prefs.setBoolPref(
|
||||
"network.trr.strict_native_fallback_allow_timeouts",
|
||||
true
|
||||
@ -319,7 +315,7 @@ async function test_strict_native_fallback() {
|
||||
);
|
||||
|
||||
info("Now a connection error");
|
||||
dns.clearCache(true);
|
||||
Services.dns.clearCache(true);
|
||||
setModeAndURI(2, "doh?responseIP=2.2.2.2");
|
||||
Services.prefs.clearUserPref("network.trr.request_timeout_ms");
|
||||
Services.prefs.clearUserPref("network.trr.request_timeout_mode_trronly_ms");
|
||||
@ -333,7 +329,7 @@ async function test_strict_native_fallback() {
|
||||
);
|
||||
|
||||
info("Now a decode error");
|
||||
dns.clearCache(true);
|
||||
Services.dns.clearCache(true);
|
||||
setModeAndURI(2, "doh?responseIP=2.2.2.2&corruptedAnswer=true");
|
||||
({ inStatus } = await new TRRDNSListener(
|
||||
"bar.example.com",
|
||||
@ -348,7 +344,7 @@ async function test_strict_native_fallback() {
|
||||
if (!mozinfo.socketprocess_networking) {
|
||||
// Confirmation state isn't passed cross-process.
|
||||
info("Now with confirmation failed - should fallback");
|
||||
dns.clearCache(true);
|
||||
Services.dns.clearCache(true);
|
||||
setModeAndURI(2, "doh?responseIP=2.2.2.2&corruptedAnswer=true");
|
||||
if (runningODoHTests) {
|
||||
Services.prefs.setCharPref(
|
||||
@ -362,9 +358,9 @@ async function test_strict_native_fallback() {
|
||||
await TestUtils.waitForCondition(
|
||||
// 3 => CONFIRM_FAILED, 4 => CONFIRM_TRYING_FAILED
|
||||
() =>
|
||||
dns.currentTrrConfirmationState == 3 ||
|
||||
dns.currentTrrConfirmationState == 4,
|
||||
`Timed out waiting for confirmation failure. Currently ${dns.currentTrrConfirmationState}`,
|
||||
Services.dns.currentTrrConfirmationState == 3 ||
|
||||
Services.dns.currentTrrConfirmationState == 4,
|
||||
`Timed out waiting for confirmation failure. Currently ${Services.dns.currentTrrConfirmationState}`,
|
||||
1,
|
||||
5000
|
||||
);
|
||||
@ -372,7 +368,7 @@ async function test_strict_native_fallback() {
|
||||
}
|
||||
|
||||
info("Now a successful case.");
|
||||
dns.clearCache(true);
|
||||
Services.dns.clearCache(true);
|
||||
setModeAndURI(2, "doh?responseIP=2.2.2.2");
|
||||
if (!mozinfo.socketprocess_networking) {
|
||||
// Only need to reset confirmation state if we messed with it before.
|
||||
@ -385,8 +381,8 @@ async function test_strict_native_fallback() {
|
||||
Services.prefs.setCharPref("network.trr.confirmationNS", "skip");
|
||||
await TestUtils.waitForCondition(
|
||||
// 5 => CONFIRM_DISABLED
|
||||
() => dns.currentTrrConfirmationState == 5,
|
||||
`Timed out waiting for confirmation disabled. Currently ${dns.currentTrrConfirmationState}`,
|
||||
() => Services.dns.currentTrrConfirmationState == 5,
|
||||
`Timed out waiting for confirmation disabled. Currently ${Services.dns.currentTrrConfirmationState}`,
|
||||
1,
|
||||
5000
|
||||
);
|
||||
@ -394,7 +390,7 @@ async function test_strict_native_fallback() {
|
||||
await new TRRDNSListener("bar.example.com", "2.2.2.2");
|
||||
|
||||
info("Now without strict fallback mode, timeout case");
|
||||
dns.clearCache(true);
|
||||
Services.dns.clearCache(true);
|
||||
setModeAndURI(2, "doh?noResponse=true");
|
||||
Services.prefs.setIntPref("network.trr.request_timeout_ms", 10);
|
||||
Services.prefs.setIntPref("network.trr.request_timeout_mode_trronly_ms", 10);
|
||||
@ -407,7 +403,7 @@ async function test_strict_native_fallback() {
|
||||
await new TRRDNSListener("timeout.example.com", "127.0.0.1"); // Should fallback
|
||||
|
||||
info("Now a connection error");
|
||||
dns.clearCache(true);
|
||||
Services.dns.clearCache(true);
|
||||
setModeAndURI(2, "doh?responseIP=2.2.2.2");
|
||||
Services.prefs.clearUserPref("network.trr.request_timeout_ms");
|
||||
Services.prefs.clearUserPref("network.trr.request_timeout_mode_trronly_ms");
|
||||
@ -417,7 +413,7 @@ async function test_strict_native_fallback() {
|
||||
await new TRRDNSListener("closeme.com", "127.0.0.1"); // Should fallback
|
||||
|
||||
info("Now a decode error");
|
||||
dns.clearCache(true);
|
||||
Services.dns.clearCache(true);
|
||||
setModeAndURI(2, "doh?responseIP=2.2.2.2&corruptedAnswer=true");
|
||||
await new TRRDNSListener("bar.example.com", "127.0.0.1"); // Should fallback
|
||||
|
||||
@ -431,28 +427,28 @@ async function test_strict_native_fallback() {
|
||||
|
||||
async function test_no_answers_fallback() {
|
||||
info("Verfiying that we correctly fallback to Do53 when no answers from DoH");
|
||||
dns.clearCache(true);
|
||||
Services.dns.clearCache(true);
|
||||
setModeAndURI(2, "doh?responseIP=none"); // TRR-first
|
||||
|
||||
await new TRRDNSListener("confirm.example.com", "127.0.0.1");
|
||||
|
||||
info("Now in strict mode - no fallback");
|
||||
Services.prefs.setBoolPref("network.trr.strict_native_fallback", true);
|
||||
dns.clearCache(true);
|
||||
Services.dns.clearCache(true);
|
||||
await new TRRDNSListener("confirm.example.com", "127.0.0.1");
|
||||
Services.prefs.setBoolPref("network.trr.strict_native_fallback", false);
|
||||
}
|
||||
|
||||
async function test_404_fallback() {
|
||||
info("Verfiying that we correctly fallback to Do53 when DoH sends 404");
|
||||
dns.clearCache(true);
|
||||
Services.dns.clearCache(true);
|
||||
setModeAndURI(2, "404"); // TRR-first
|
||||
|
||||
await new TRRDNSListener("test404.example.com", "127.0.0.1");
|
||||
|
||||
info("Now in strict mode - no fallback");
|
||||
Services.prefs.setBoolPref("network.trr.strict_native_fallback", true);
|
||||
dns.clearCache(true);
|
||||
Services.dns.clearCache(true);
|
||||
let { inStatus } = await new TRRDNSListener("test404.example.com", {
|
||||
expectedSuccess: false,
|
||||
});
|
||||
@ -466,15 +462,19 @@ async function test_404_fallback() {
|
||||
async function test_mode_1_and_4() {
|
||||
info("Verifying modes 1 and 4 are treated as TRR-off");
|
||||
for (let mode of [1, 4]) {
|
||||
dns.clearCache(true);
|
||||
Services.dns.clearCache(true);
|
||||
setModeAndURI(mode, "doh?responseIP=2.2.2.2");
|
||||
Assert.equal(dns.currentTrrMode, 5, "Effective TRR mode should be 5");
|
||||
Assert.equal(
|
||||
Services.dns.currentTrrMode,
|
||||
5,
|
||||
"Effective TRR mode should be 5"
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
async function test_CNAME() {
|
||||
info("Checking that we follow a CNAME correctly");
|
||||
dns.clearCache(true);
|
||||
Services.dns.clearCache(true);
|
||||
// The dns-cname path alternates between sending us a CNAME pointing to
|
||||
// another domain, and an A record. If we follow the cname correctly, doing
|
||||
// a lookup with this path as the DoH URI should resolve to that A record.
|
||||
@ -487,7 +487,7 @@ async function test_CNAME() {
|
||||
await new TRRDNSListener("cname.example.com", "99.88.77.66");
|
||||
|
||||
info("Verifying that we bail out when we're thrown into a CNAME loop");
|
||||
dns.clearCache(true);
|
||||
Services.dns.clearCache(true);
|
||||
// First mode 3.
|
||||
if (runningODoHTests) {
|
||||
setModeAndURI(3, "odoh?responseIP=none&cnameloop=true");
|
||||
@ -506,7 +506,7 @@ async function test_CNAME() {
|
||||
);
|
||||
|
||||
// Now mode 2.
|
||||
dns.clearCache(true);
|
||||
Services.dns.clearCache(true);
|
||||
if (runningODoHTests) {
|
||||
setModeAndURI(2, "ododoh?responseIP=none&cnameloop=trueoh");
|
||||
} else {
|
||||
@ -516,7 +516,7 @@ async function test_CNAME() {
|
||||
await new TRRDNSListener("test20.example.com", "127.0.0.1"); // Should fallback
|
||||
|
||||
info("Check that we correctly handle CNAME bundled with an A record");
|
||||
dns.clearCache(true);
|
||||
Services.dns.clearCache(true);
|
||||
// "dns-cname-a" path causes server to send a CNAME as well as an A record
|
||||
if (runningODoHTests) {
|
||||
setModeAndURI(3, "odoh?cname=ARecord");
|
||||
@ -529,7 +529,7 @@ async function test_CNAME() {
|
||||
|
||||
async function test_name_mismatch() {
|
||||
info("Verify that records that don't match the requested name are rejected");
|
||||
dns.clearCache(true);
|
||||
Services.dns.clearCache(true);
|
||||
// Setting hostname param tells server to always send record for bar.example.com
|
||||
// regardless of what was requested.
|
||||
setModeAndURI(3, "doh?hostname=mismatch.example.com");
|
||||
@ -547,7 +547,7 @@ async function test_name_mismatch() {
|
||||
|
||||
async function test_mode_2() {
|
||||
info("Checking that TRR result is used in mode 2");
|
||||
dns.clearCache(true);
|
||||
Services.dns.clearCache(true);
|
||||
setModeAndURI(2, "doh?responseIP=192.192.192.192");
|
||||
Services.prefs.setCharPref("network.trr.excluded-domains", "");
|
||||
Services.prefs.setCharPref("network.trr.builtin-excluded-domains", "");
|
||||
@ -556,7 +556,7 @@ async function test_mode_2() {
|
||||
|
||||
info("Now in strict mode");
|
||||
Services.prefs.setBoolPref("network.trr.strict_native_fallback", true);
|
||||
dns.clearCache(true);
|
||||
Services.dns.clearCache(true);
|
||||
await new TRRDNSListener("bar.example.com", "192.192.192.192");
|
||||
Services.prefs.setBoolPref("network.trr.strict_native_fallback", false);
|
||||
}
|
||||
@ -569,7 +569,7 @@ async function test_excluded_domains() {
|
||||
"network.trr.strict_native_fallback",
|
||||
strictMode
|
||||
);
|
||||
dns.clearCache(true);
|
||||
Services.dns.clearCache(true);
|
||||
setModeAndURI(2, "doh?responseIP=192.192.192.192");
|
||||
Services.prefs.setCharPref(
|
||||
"network.trr.excluded-domains",
|
||||
@ -578,19 +578,19 @@ async function test_excluded_domains() {
|
||||
|
||||
await new TRRDNSListener("bar.example.com", "127.0.0.1"); // Do53 result
|
||||
|
||||
dns.clearCache(true);
|
||||
Services.dns.clearCache(true);
|
||||
Services.prefs.setCharPref("network.trr.excluded-domains", "example.com");
|
||||
|
||||
await new TRRDNSListener("bar.example.com", "127.0.0.1");
|
||||
|
||||
dns.clearCache(true);
|
||||
Services.dns.clearCache(true);
|
||||
Services.prefs.setCharPref(
|
||||
"network.trr.excluded-domains",
|
||||
"foo.test.com, bar.example.com"
|
||||
);
|
||||
await new TRRDNSListener("bar.example.com", "127.0.0.1");
|
||||
|
||||
dns.clearCache(true);
|
||||
Services.dns.clearCache(true);
|
||||
Services.prefs.setCharPref(
|
||||
"network.trr.excluded-domains",
|
||||
"bar.example.com, foo.test.com"
|
||||
@ -625,7 +625,7 @@ async function test_captiveportal_canonicalURL() {
|
||||
"network.trr.strict_native_fallback",
|
||||
strictMode
|
||||
);
|
||||
dns.clearCache(true);
|
||||
Services.dns.clearCache(true);
|
||||
setModeAndURI(2, "doh?responseIP=2.2.2.2");
|
||||
|
||||
const cpServer = new HttpServer();
|
||||
@ -668,7 +668,7 @@ async function test_captiveportal_canonicalURL() {
|
||||
|
||||
async function test_parentalcontrols() {
|
||||
info("Check that DoH isn't used when parental controls are enabled");
|
||||
dns.clearCache(true);
|
||||
Services.dns.clearCache(true);
|
||||
setModeAndURI(2, "doh?responseIP=2.2.2.2");
|
||||
await SetParentalControlEnabled(true);
|
||||
await new TRRDNSListener("www.example.com", "127.0.0.1");
|
||||
@ -676,7 +676,7 @@ async function test_parentalcontrols() {
|
||||
|
||||
info("Now in strict mode");
|
||||
Services.prefs.setBoolPref("network.trr.strict_native_fallback", true);
|
||||
dns.clearCache(true);
|
||||
Services.dns.clearCache(true);
|
||||
setModeAndURI(2, "doh?responseIP=2.2.2.2");
|
||||
await SetParentalControlEnabled(true);
|
||||
await new TRRDNSListener("www.example.com", "127.0.0.1");
|
||||
@ -692,7 +692,7 @@ async function test_builtin_excluded_domains() {
|
||||
"network.trr.strict_native_fallback",
|
||||
strictMode
|
||||
);
|
||||
dns.clearCache(true);
|
||||
Services.dns.clearCache(true);
|
||||
setModeAndURI(2, "doh?responseIP=2.2.2.2");
|
||||
|
||||
Services.prefs.setCharPref("network.trr.excluded-domains", "");
|
||||
@ -702,14 +702,14 @@ async function test_builtin_excluded_domains() {
|
||||
);
|
||||
await new TRRDNSListener("bar.example.com", "127.0.0.1");
|
||||
|
||||
dns.clearCache(true);
|
||||
Services.dns.clearCache(true);
|
||||
Services.prefs.setCharPref(
|
||||
"network.trr.builtin-excluded-domains",
|
||||
"example.com"
|
||||
);
|
||||
await new TRRDNSListener("bar.example.com", "127.0.0.1");
|
||||
|
||||
dns.clearCache(true);
|
||||
Services.dns.clearCache(true);
|
||||
Services.prefs.setCharPref(
|
||||
"network.trr.builtin-excluded-domains",
|
||||
"foo.test.com, bar.example.com"
|
||||
@ -721,26 +721,26 @@ async function test_builtin_excluded_domains() {
|
||||
|
||||
async function test_excluded_domains_mode3() {
|
||||
info("Checking Do53 is used for names in excluded-domains list in mode 3");
|
||||
dns.clearCache(true);
|
||||
Services.dns.clearCache(true);
|
||||
setModeAndURI(3, "doh?responseIP=192.192.192.192");
|
||||
Services.prefs.setCharPref("network.trr.excluded-domains", "");
|
||||
Services.prefs.setCharPref("network.trr.builtin-excluded-domains", "");
|
||||
|
||||
await new TRRDNSListener("excluded", "192.192.192.192", true);
|
||||
|
||||
dns.clearCache(true);
|
||||
Services.dns.clearCache(true);
|
||||
Services.prefs.setCharPref("network.trr.excluded-domains", "excluded");
|
||||
|
||||
await new TRRDNSListener("excluded", "127.0.0.1");
|
||||
|
||||
// Test .local
|
||||
dns.clearCache(true);
|
||||
Services.dns.clearCache(true);
|
||||
Services.prefs.setCharPref("network.trr.excluded-domains", "excluded,local");
|
||||
|
||||
await new TRRDNSListener("test.local", "127.0.0.1");
|
||||
|
||||
// Test .other
|
||||
dns.clearCache(true);
|
||||
Services.dns.clearCache(true);
|
||||
Services.prefs.setCharPref(
|
||||
"network.trr.excluded-domains",
|
||||
"excluded,local,other"
|
||||
@ -751,7 +751,7 @@ async function test_excluded_domains_mode3() {
|
||||
|
||||
async function test25e() {
|
||||
info("Check captivedetect.canonicalURL is resolved via native DNS in mode 3");
|
||||
dns.clearCache(true);
|
||||
Services.dns.clearCache(true);
|
||||
setModeAndURI(3, "doh?responseIP=192.192.192.192");
|
||||
|
||||
const cpServer = new HttpServer();
|
||||
@ -793,7 +793,7 @@ async function test25e() {
|
||||
|
||||
async function test_parentalcontrols_mode3() {
|
||||
info("Check DoH isn't used when parental controls are enabled in mode 3");
|
||||
dns.clearCache(true);
|
||||
Services.dns.clearCache(true);
|
||||
setModeAndURI(3, "doh?responseIP=192.192.192.192");
|
||||
await SetParentalControlEnabled(true);
|
||||
await new TRRDNSListener("www.example.com", "127.0.0.1");
|
||||
@ -802,7 +802,7 @@ async function test_parentalcontrols_mode3() {
|
||||
|
||||
async function test_builtin_excluded_domains_mode3() {
|
||||
info("Check Do53 used for domains in builtin-excluded-domians list, mode 3");
|
||||
dns.clearCache(true);
|
||||
Services.dns.clearCache(true);
|
||||
setModeAndURI(3, "doh?responseIP=192.192.192.192");
|
||||
Services.prefs.setCharPref("network.trr.excluded-domains", "");
|
||||
Services.prefs.setCharPref(
|
||||
@ -813,7 +813,7 @@ async function test_builtin_excluded_domains_mode3() {
|
||||
await new TRRDNSListener("excluded", "127.0.0.1");
|
||||
|
||||
// Test .local
|
||||
dns.clearCache(true);
|
||||
Services.dns.clearCache(true);
|
||||
Services.prefs.setCharPref(
|
||||
"network.trr.builtin-excluded-domains",
|
||||
"excluded,local"
|
||||
@ -822,7 +822,7 @@ async function test_builtin_excluded_domains_mode3() {
|
||||
await new TRRDNSListener("test.local", "127.0.0.1");
|
||||
|
||||
// Test .other
|
||||
dns.clearCache(true);
|
||||
Services.dns.clearCache(true);
|
||||
Services.prefs.setCharPref(
|
||||
"network.trr.builtin-excluded-domains",
|
||||
"excluded,local,other"
|
||||
@ -839,7 +839,7 @@ async function count_cookies() {
|
||||
|
||||
async function test_connection_closed() {
|
||||
info("Check we handle it correctly when the connection is closed");
|
||||
dns.clearCache(true);
|
||||
Services.dns.clearCache(true);
|
||||
setModeAndURI(3, "doh?responseIP=2.2.2.2");
|
||||
Services.prefs.setCharPref("network.trr.excluded-domains", "");
|
||||
// We don't need to wait for 30 seconds for the request to fail
|
||||
@ -861,7 +861,7 @@ async function test_connection_closed() {
|
||||
// No bootstrap this time
|
||||
Services.prefs.clearUserPref("network.trr.bootstrapAddr");
|
||||
|
||||
dns.clearCache(true);
|
||||
Services.dns.clearCache(true);
|
||||
Services.prefs.setCharPref("network.trr.excluded-domains", "excluded,local");
|
||||
Services.prefs.setCharPref("network.dns.localDomains", TRR_Domain);
|
||||
|
||||
@ -876,7 +876,7 @@ async function test_connection_closed() {
|
||||
await new TRRDNSListener("bar2.example.com", "2.2.2.2");
|
||||
|
||||
// No local domains either
|
||||
dns.clearCache(true);
|
||||
Services.dns.clearCache(true);
|
||||
Services.prefs.setCharPref("network.trr.excluded-domains", "excluded");
|
||||
Services.prefs.clearUserPref("network.dns.localDomains");
|
||||
Services.prefs.clearUserPref("network.trr.bootstrapAddr");
|
||||
@ -894,7 +894,7 @@ async function test_connection_closed() {
|
||||
// Now make sure that even in mode 3 without a bootstrap address
|
||||
// we are able to restart the TRR connection if it drops - the TRR service
|
||||
// channel will use regular DNS to resolve the TRR address.
|
||||
dns.clearCache(true);
|
||||
Services.dns.clearCache(true);
|
||||
Services.prefs.setCharPref("network.trr.excluded-domains", "");
|
||||
Services.prefs.setCharPref("network.trr.builtin-excluded-domains", "");
|
||||
Services.prefs.clearUserPref("network.dns.localDomains");
|
||||
@ -908,13 +908,13 @@ async function test_connection_closed() {
|
||||
!Components.isSuccessCode(inStatus),
|
||||
`${inStatus} should be an error code`
|
||||
);
|
||||
dns.clearCache(true);
|
||||
Services.dns.clearCache(true);
|
||||
await new TRRDNSListener("bar2.example.com", "2.2.2.2");
|
||||
|
||||
// This test exists to document what happens when we're in TRR only mode
|
||||
// and we don't set a bootstrap address. We use DNS to resolve the
|
||||
// initial URI, but if the connection fails, we don't fallback to DNS
|
||||
dns.clearCache(true);
|
||||
Services.dns.clearCache(true);
|
||||
setModeAndURI(2, "doh?responseIP=9.9.9.9");
|
||||
Services.prefs.setCharPref("network.dns.localDomains", "closeme.com");
|
||||
Services.prefs.clearUserPref("network.trr.bootstrapAddr");
|
||||
@ -929,13 +929,13 @@ async function test_connection_closed() {
|
||||
|
||||
async function test_fetch_time() {
|
||||
info("Verifying timing");
|
||||
dns.clearCache(true);
|
||||
Services.dns.clearCache(true);
|
||||
setModeAndURI(2, "doh?responseIP=2.2.2.2&delayIPv4=20");
|
||||
|
||||
await new TRRDNSListener("bar_time.example.com", "2.2.2.2", true, 20);
|
||||
|
||||
// gets an error from DoH. It will fall back to regular DNS. The TRR timing should be 0.
|
||||
dns.clearCache(true);
|
||||
Services.dns.clearCache(true);
|
||||
setModeAndURI(2, "404&delayIPv4=20");
|
||||
|
||||
await new TRRDNSListener("bar_time1.example.com", "127.0.0.1", true, 0);
|
||||
@ -951,7 +951,7 @@ async function test_fetch_time() {
|
||||
"network.trr.strict_native_fallback",
|
||||
strictMode
|
||||
);
|
||||
dns.clearCache(true);
|
||||
Services.dns.clearCache(true);
|
||||
setModeAndURI(2, "doh?responseIP=2.2.2.2&delayIPv4=20");
|
||||
await new TRRDNSListener("bar_time2.example.com", "127.0.0.1", true, 0);
|
||||
}
|
||||
@ -959,20 +959,20 @@ async function test_fetch_time() {
|
||||
Services.prefs.setCharPref("network.trr.excluded-domains", "");
|
||||
|
||||
// verify RFC1918 address from the server is rejected and the TRR timing will be not set because the response will be from the native resolver.
|
||||
dns.clearCache(true);
|
||||
Services.dns.clearCache(true);
|
||||
setModeAndURI(2, "doh?responseIP=192.168.0.1&delayIPv4=20");
|
||||
await new TRRDNSListener("rfc1918_time.example.com", "127.0.0.1", true, 0);
|
||||
}
|
||||
|
||||
async function test_fqdn() {
|
||||
info("Test that we handle FQDN encoding and decoding properly");
|
||||
dns.clearCache(true);
|
||||
Services.dns.clearCache(true);
|
||||
setModeAndURI(3, "doh?responseIP=9.8.7.6");
|
||||
|
||||
await new TRRDNSListener("fqdn.example.org.", "9.8.7.6");
|
||||
|
||||
// GET
|
||||
dns.clearCache(true);
|
||||
Services.dns.clearCache(true);
|
||||
Services.prefs.setBoolPref("network.trr.useGET", true);
|
||||
await new TRRDNSListener("fqdn_get.example.org.", "9.8.7.6");
|
||||
|
||||
@ -981,7 +981,7 @@ async function test_fqdn() {
|
||||
|
||||
async function test_ipv6_trr_fallback() {
|
||||
info("Testing fallback with ipv6");
|
||||
dns.clearCache(true);
|
||||
Services.dns.clearCache(true);
|
||||
|
||||
setModeAndURI(2, "doh?responseIP=4.4.4.4");
|
||||
const override = Cc["@mozilla.org/network/native-dns-override;1"].getService(
|
||||
@ -998,12 +998,12 @@ async function test_ipv6_trr_fallback() {
|
||||
equal(inStatus, Cr.NS_ERROR_UNKNOWN_HOST);
|
||||
|
||||
// This time both requests fail, so we do fall back
|
||||
dns.clearCache(true);
|
||||
Services.dns.clearCache(true);
|
||||
setModeAndURI(2, "doh?responseIP=none");
|
||||
await new TRRDNSListener("ipv6.host.com", "1:1::2");
|
||||
|
||||
info("In strict mode, the lookup should fail when both reqs fail.");
|
||||
dns.clearCache(true);
|
||||
Services.dns.clearCache(true);
|
||||
Services.prefs.setBoolPref("network.trr.strict_native_fallback", true);
|
||||
setModeAndURI(2, "doh?responseIP=none");
|
||||
await new TRRDNSListener("ipv6.host.com", "1:1::2");
|
||||
@ -1014,7 +1014,7 @@ async function test_ipv6_trr_fallback() {
|
||||
|
||||
async function test_ipv4_trr_fallback() {
|
||||
info("Testing fallback with ipv4");
|
||||
dns.clearCache(true);
|
||||
Services.dns.clearCache(true);
|
||||
|
||||
setModeAndURI(2, "doh?responseIP=1:2::3");
|
||||
const override = Cc["@mozilla.org/network/native-dns-override;1"].getService(
|
||||
@ -1031,12 +1031,12 @@ async function test_ipv4_trr_fallback() {
|
||||
equal(inStatus, Cr.NS_ERROR_UNKNOWN_HOST);
|
||||
|
||||
// This time both requests fail, so we do fall back
|
||||
dns.clearCache(true);
|
||||
Services.dns.clearCache(true);
|
||||
setModeAndURI(2, "doh?responseIP=none");
|
||||
await new TRRDNSListener("ipv4.host.com", "3.4.5.6");
|
||||
|
||||
// No fallback with strict mode.
|
||||
dns.clearCache(true);
|
||||
Services.dns.clearCache(true);
|
||||
Services.prefs.setBoolPref("network.trr.strict_native_fallback", true);
|
||||
setModeAndURI(2, "doh?responseIP=none");
|
||||
await new TRRDNSListener("ipv4.host.com", "3.4.5.6");
|
||||
@ -1097,7 +1097,7 @@ async function test_no_retry_without_doh() {
|
||||
}
|
||||
|
||||
async function test_connection_reuse_and_cycling() {
|
||||
dns.clearCache(true);
|
||||
Services.dns.clearCache(true);
|
||||
Services.prefs.setIntPref("network.trr.request_timeout_ms", 500);
|
||||
Services.prefs.setIntPref(
|
||||
"network.trr.strict_fallback_request_timeout_ms",
|
||||
@ -1110,8 +1110,8 @@ async function test_connection_reuse_and_cycling() {
|
||||
Services.prefs.setCharPref("network.trr.confirmationNS", "example.com");
|
||||
await TestUtils.waitForCondition(
|
||||
// 2 => CONFIRM_OK
|
||||
() => dns.currentTrrConfirmationState == 2,
|
||||
`Timed out waiting for confirmation success. Currently ${dns.currentTrrConfirmationState}`,
|
||||
() => Services.dns.currentTrrConfirmationState == 2,
|
||||
`Timed out waiting for confirmation success. Currently ${Services.dns.currentTrrConfirmationState}`,
|
||||
1,
|
||||
5000
|
||||
);
|
||||
@ -1122,8 +1122,8 @@ async function test_connection_reuse_and_cycling() {
|
||||
setModeAndURI(2, `doh?responseIP=9.8.7.6&conncycle=true`);
|
||||
await TestUtils.waitForCondition(
|
||||
// 2 => CONFIRM_OK
|
||||
() => dns.currentTrrConfirmationState == 2,
|
||||
`Timed out waiting for confirmation success. Currently ${dns.currentTrrConfirmationState}`,
|
||||
() => Services.dns.currentTrrConfirmationState == 2,
|
||||
`Timed out waiting for confirmation success. Currently ${Services.dns.currentTrrConfirmationState}`,
|
||||
1,
|
||||
5000
|
||||
);
|
||||
@ -1138,8 +1138,8 @@ async function test_connection_reuse_and_cycling() {
|
||||
await new TRRDNSListener("newconn.example.org.", "9.8.7.6");
|
||||
await TestUtils.waitForCondition(
|
||||
// 2 => CONFIRM_OK
|
||||
() => dns.currentTrrConfirmationState == 2,
|
||||
`Timed out waiting for confirmation success. Currently ${dns.currentTrrConfirmationState}`,
|
||||
() => Services.dns.currentTrrConfirmationState == 2,
|
||||
`Timed out waiting for confirmation success. Currently ${Services.dns.currentTrrConfirmationState}`,
|
||||
1,
|
||||
5000
|
||||
);
|
||||
@ -1154,8 +1154,8 @@ async function test_connection_reuse_and_cycling() {
|
||||
await new TRRDNSListener("newconn2.example.org.", "9.8.7.6");
|
||||
await TestUtils.waitForCondition(
|
||||
// 2 => CONFIRM_OK
|
||||
() => dns.currentTrrConfirmationState == 2,
|
||||
`Timed out waiting for confirmation success. Currently ${dns.currentTrrConfirmationState}`,
|
||||
() => Services.dns.currentTrrConfirmationState == 2,
|
||||
`Timed out waiting for confirmation success. Currently ${Services.dns.currentTrrConfirmationState}`,
|
||||
1,
|
||||
5000
|
||||
);
|
||||
|
@ -6,17 +6,13 @@
|
||||
|
||||
/* import-globals-from ../unit/head_trr.js */
|
||||
|
||||
const dns = Cc["@mozilla.org/network/dns-service;1"].getService(
|
||||
Ci.nsIDNSService
|
||||
);
|
||||
|
||||
let test_answer = "bXkgdm9pY2UgaXMgbXkgcGFzc3dvcmQ=";
|
||||
let test_answer_addr = "127.0.0.1";
|
||||
|
||||
add_task(async function testTXTResolve() {
|
||||
// use the h2 server as DOH provider
|
||||
let { inRecord, inStatus } = await new TRRDNSListener("_esni.example.com", {
|
||||
type: dns.RESOLVE_TYPE_TXT,
|
||||
type: Ci.nsIDNSService.RESOLVE_TYPE_TXT,
|
||||
});
|
||||
Assert.equal(inStatus, Cr.NS_OK, "status OK");
|
||||
let answer = inRecord
|
||||
|
@ -35,12 +35,6 @@ function setup() {
|
||||
// XXX(valentin): It would be nice to just call trr_test_setup() here, but
|
||||
// the relative path here makes it awkward. Would be nice to fix someday.
|
||||
addCertFromFile(certdb, "../unit/http2-ca.pem", "CTu,u,u");
|
||||
|
||||
if (!gDNS) {
|
||||
gDNS = Cc["@mozilla.org/network/dns-service;1"].getService(
|
||||
Ci.nsIDNSService
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
setup();
|
||||
|
@ -3,10 +3,6 @@
|
||||
let h2Port;
|
||||
let prefs;
|
||||
|
||||
const dns = Cc["@mozilla.org/network/dns-service;1"].getService(
|
||||
Ci.nsIDNSService
|
||||
);
|
||||
|
||||
function setup() {
|
||||
h2Port = Services.env.get("MOZHTTP2_PORT");
|
||||
Assert.notEqual(h2Port, null);
|
||||
@ -79,7 +75,7 @@ function run_test() {
|
||||
});
|
||||
|
||||
do_await_remote_message("clearCache").then(() => {
|
||||
dns.clearCache(true);
|
||||
Services.dns.clearCache(true);
|
||||
do_send_remote_message("clearCache-done");
|
||||
});
|
||||
|
||||
|
@ -17,13 +17,6 @@ XPCOMUtils.defineLazyModuleGetters(lazy, {
|
||||
HttpServer: "chrome://remote/content/server/HTTPD.jsm",
|
||||
});
|
||||
|
||||
XPCOMUtils.defineLazyServiceGetter(
|
||||
lazy,
|
||||
"DNSService",
|
||||
"@mozilla.org/network/dns-service;1",
|
||||
"nsIDNSService"
|
||||
);
|
||||
|
||||
XPCOMUtils.defineLazyGetter(lazy, "logger", () => lazy.Log.get());
|
||||
|
||||
XPCOMUtils.defineLazyGetter(lazy, "activeProtocols", () => {
|
||||
@ -294,7 +287,7 @@ class RemoteAgentParentProcess {
|
||||
};
|
||||
|
||||
try {
|
||||
originalRequest = lazy.DNSService.asyncResolve(
|
||||
originalRequest = Services.dns.asyncResolve(
|
||||
hostname,
|
||||
Ci.nsIDNSService.RESOLVE_TYPE_DEFAULT,
|
||||
Ci.nsIDNSService.RESOLVE_BYPASS_CACHE,
|
||||
|
@ -118,9 +118,7 @@ class FxAccountsDevice {
|
||||
let hostname;
|
||||
try {
|
||||
// hostname of the system, usually assigned by the user or admin
|
||||
hostname = Cc["@mozilla.org/network/dns-service;1"].getService(
|
||||
Ci.nsIDNSService
|
||||
).myHostName;
|
||||
hostname = Services.dns.myHostName;
|
||||
} catch (ex) {
|
||||
console.error(ex);
|
||||
}
|
||||
|
@ -28,10 +28,7 @@ add_test(function test_default_device_name() {
|
||||
// This is obviously tied to the implementation, but we want early warning
|
||||
// if any of these things fail.
|
||||
// We really want one of these 2 to provide a value.
|
||||
let hostname =
|
||||
Services.sysinfo.get("device") ||
|
||||
Cc["@mozilla.org/network/dns-service;1"].getService(Ci.nsIDNSService)
|
||||
.myHostName;
|
||||
let hostname = Services.sysinfo.get("device") || Services.dns.myHostName;
|
||||
_("hostname is " + hostname);
|
||||
ok(!!hostname.length);
|
||||
// the hostname should be in the default.
|
||||
|
@ -26,9 +26,6 @@ function getErrorString(nsresult) {
|
||||
|
||||
this.dns = class extends ExtensionAPI {
|
||||
getAPI(context) {
|
||||
const dnss = Cc["@mozilla.org/network/dns-service;1"].getService(
|
||||
Ci.nsIDNSService
|
||||
);
|
||||
return {
|
||||
dns: {
|
||||
resolve: function(hostname, flags) {
|
||||
@ -69,7 +66,7 @@ this.dns = class extends ExtensionAPI {
|
||||
},
|
||||
};
|
||||
try {
|
||||
request = dnss.asyncResolve(
|
||||
request = Services.dns.asyncResolve(
|
||||
hostname,
|
||||
Ci.nsIDNSService.RESOLVE_TYPE_DEFAULT,
|
||||
dnsFlags,
|
||||
|
@ -18,9 +18,6 @@ const gNetLinkSvc =
|
||||
Cc["@mozilla.org/network/network-link-service;1"].getService(
|
||||
Ci.nsINetworkLinkService
|
||||
);
|
||||
const gDNSService = Cc["@mozilla.org/network/dns-service;1"].getService(
|
||||
Ci.nsIDNSService
|
||||
);
|
||||
|
||||
const gRequestNetworkingData = {
|
||||
http: gDashboard.requestHttpConnections,
|
||||
@ -107,8 +104,8 @@ function displayDns(data) {
|
||||
let trr_url_tbody = document.createElement("tbody");
|
||||
trr_url_tbody.id = "dns_trr_url";
|
||||
let trr_url = document.createElement("tr");
|
||||
trr_url.appendChild(col(gDNSService.currentTrrURI));
|
||||
trr_url.appendChild(col(gDNSService.currentTrrMode));
|
||||
trr_url.appendChild(col(Services.dns.currentTrrURI));
|
||||
trr_url.appendChild(col(Services.dns.currentTrrMode));
|
||||
trr_url_tbody.appendChild(trr_url);
|
||||
let prevURL = document.getElementById("dns_trr_url");
|
||||
prevURL.parentNode.replaceChild(trr_url_tbody, prevURL);
|
||||
@ -282,7 +279,7 @@ function init() {
|
||||
|
||||
let clearDNSCache = document.getElementById("clearDNSCache");
|
||||
clearDNSCache.addEventListener("click", function() {
|
||||
gDNSService.clearCache(true);
|
||||
Services.dns.clearCache(true);
|
||||
});
|
||||
|
||||
if (location.hash) {
|
||||
|
@ -18,6 +18,7 @@
|
||||
"nsIDAPTelemetry": "DAPTelemetry",
|
||||
"nsIDOMRequestService": "DOMRequest",
|
||||
"nsIDOMStorageManager": "domStorageManager",
|
||||
"nsIDNSService": "dns",
|
||||
"nsIDirectoryService": "dirsvc",
|
||||
"nsIDroppedLinkHandler": "droppedLinkHandler",
|
||||
"nsIEffectiveTLDService": "eTLD",
|
||||
|
Loading…
Reference in New Issue
Block a user