зеркало из https://github.com/mozilla/gecko-dev.git
Backed out 9 changesets (bug 1596845
) for causing mochitest failures in browser/base/content/test/about/browser_aboutCertError_telemetry.js
Backed out changeset eb1e34c3041f (bug1596845
) Backed out changeset af6d41439c60 (bug1596845
) Backed out changeset f1447dd8df04 (bug1596845
) Backed out changeset a383f2bbcaae (bug1596845
) Backed out changeset 950c66dd6133 (bug1596845
) Backed out changeset ab300239fd69 (bug1596845
) Backed out changeset 8e1fe024b680 (bug1596845
) Backed out changeset 80e5048d1f35 (bug1596845
) Backed out changeset b14a4910d73b (bug1596845
)
This commit is contained in:
Родитель
ef9dfdf3a6
Коммит
56d5efdcae
|
@ -285,6 +285,7 @@ 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,6 +79,13 @@ XPCOMUtils.defineLazyServiceGetter(
|
|||
"nsICaptivePortalService"
|
||||
);
|
||||
|
||||
XPCOMUtils.defineLazyServiceGetter(
|
||||
lazy,
|
||||
"gDNSService",
|
||||
"@mozilla.org/network/dns-service;1",
|
||||
"nsIDNSService"
|
||||
);
|
||||
|
||||
XPCOMUtils.defineLazyServiceGetter(
|
||||
lazy,
|
||||
"gNetworkLinkService",
|
||||
|
@ -362,7 +369,7 @@ const DoHController = {
|
|||
};
|
||||
|
||||
if (results.steeredProvider) {
|
||||
Services.dns.setDetectedTrrURI(results.steeredProvider.uri);
|
||||
lazy.gDNSService.setDetectedTrrURI(results.steeredProvider.uri);
|
||||
resultsForTelemetry.steeredProvider = results.steeredProvider.id;
|
||||
}
|
||||
|
||||
|
|
|
@ -17,6 +17,13 @@ const { XPCOMUtils } = ChromeUtils.importESModule(
|
|||
|
||||
const lazy = {};
|
||||
|
||||
XPCOMUtils.defineLazyServiceGetter(
|
||||
lazy,
|
||||
"gDNSService",
|
||||
"@mozilla.org/network/dns-service;1",
|
||||
"nsIDNSService"
|
||||
);
|
||||
|
||||
XPCOMUtils.defineLazyServiceGetter(
|
||||
lazy,
|
||||
"gNetworkLinkService",
|
||||
|
@ -132,7 +139,7 @@ async function dnsLookup(hostname, resolveCanonicalName = false) {
|
|||
Ci.nsIDNSService.RESOLVE_BYPASS_CACHE |
|
||||
Ci.nsIDNSService.RESOLVE_CANONICAL_NAME;
|
||||
try {
|
||||
request = Services.dns.asyncResolve(
|
||||
request = lazy.gDNSService.asyncResolve(
|
||||
hostname,
|
||||
Ci.nsIDNSService.RESOLVE_TYPE_DEFAULT,
|
||||
dnsFlags,
|
||||
|
|
|
@ -44,6 +44,13 @@ 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,
|
||||
|
@ -103,11 +110,11 @@ class DNSLookup {
|
|||
this.retryCount++;
|
||||
try {
|
||||
this.usedDomain = this._domain || getRandomSubdomain();
|
||||
Services.dns.asyncResolve(
|
||||
lazy.gDNSService.asyncResolve(
|
||||
this.usedDomain,
|
||||
Ci.nsIDNSService.RESOLVE_TYPE_DEFAULT,
|
||||
Ci.nsIDNSService.RESOLVE_BYPASS_CACHE,
|
||||
Services.dns.newAdditionalInfo(this.trrServer, -1),
|
||||
lazy.gDNSService.newAdditionalInfo(this.trrServer, -1),
|
||||
this,
|
||||
Services.tm.currentThread,
|
||||
{}
|
||||
|
|
|
@ -48,16 +48,12 @@ 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 Services.dns.currentTrrURI == expectedURI;
|
||||
return gDNSService.currentTrrURI == expectedURI;
|
||||
}
|
||||
);
|
||||
simulateNetworkChange();
|
||||
await trrURIChanged;
|
||||
is(
|
||||
Services.dns.currentTrrURI,
|
||||
expectedURI,
|
||||
`TRR URI set to ${expectedURI}`
|
||||
);
|
||||
is(gDNSService.currentTrrURI, expectedURI, `TRR URI set to ${expectedURI}`);
|
||||
await checkHeuristicsTelemetry(
|
||||
heuristicsDecision,
|
||||
"netchange",
|
||||
|
|
|
@ -14,6 +14,13 @@ 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",
|
||||
|
|
|
@ -753,8 +753,7 @@
|
|||
<groupbox id="connectionGroup" data-category="paneGeneral" hidden="true">
|
||||
<label class="search-header" hidden="true"><html:h2 data-l10n-id="network-settings-title"/></label>
|
||||
|
||||
<hbox align="center"
|
||||
data-subcategory="netsettings">
|
||||
<hbox align="center">
|
||||
<description flex="1" control="connectionSettings">
|
||||
<html:span id="connectionSettingsDescription"/>
|
||||
<label id="connectionSettingsLearnMore" class="learnMore" is="text-link" data-l10n-id="network-proxy-connection-learn-more"/>
|
||||
|
|
|
@ -148,7 +148,9 @@ LocalDevice.prototype = {
|
|||
// TODO: Bug 1180997: Find the right way to expose an editable name
|
||||
this.name = Services.sysinfo.get("device");
|
||||
} else {
|
||||
this.name = Services.dns.myHostName;
|
||||
this.name = Cc["@mozilla.org/network/dns-service;1"].getService(
|
||||
Ci.nsIDNSService
|
||||
).myHostName;
|
||||
}
|
||||
},
|
||||
|
||||
|
|
|
@ -16,7 +16,8 @@ ChromeUtils.defineESModuleGetters(lazy, {
|
|||
loader.lazyGetter(this, "hostname", () => {
|
||||
try {
|
||||
// On some platforms (Linux according to try), this service does not exist and fails.
|
||||
return Services.dns.myHostName;
|
||||
return Cc["@mozilla.org/network/dns-service;1"].getService(Ci.nsIDNSService)
|
||||
.myHostName;
|
||||
} catch (e) {
|
||||
return "";
|
||||
}
|
||||
|
|
|
@ -43,6 +43,13 @@ XPCOMUtils.defineLazyServiceGetter(
|
|||
"nsIFileProtocolHandler"
|
||||
);
|
||||
|
||||
XPCOMUtils.defineLazyServiceGetter(
|
||||
lazy,
|
||||
"gDNSService",
|
||||
"@mozilla.org/network/dns-service;1",
|
||||
"nsIDNSService"
|
||||
);
|
||||
|
||||
XPCOMUtils.defineLazyServiceGetter(
|
||||
lazy,
|
||||
"handlerService",
|
||||
|
@ -621,7 +628,7 @@ URIFixup.prototype = {
|
|||
}
|
||||
|
||||
Services.obs.notifyObservers(null, "uri-fixup-check-dns");
|
||||
Services.dns.asyncResolve(
|
||||
lazy.gDNSService.asyncResolve(
|
||||
lookupName,
|
||||
Ci.nsIDNSService.RESOLVE_TYPE_DEFAULT,
|
||||
0,
|
||||
|
|
|
@ -14,6 +14,13 @@ 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");
|
||||
|
@ -88,7 +95,7 @@ add_task(async function test_uri_with_force_fixup() {
|
|||
);
|
||||
|
||||
lazy.gDNSOverride.clearHostOverride(fixedURI.displayHost);
|
||||
Services.dns.clearCache(false);
|
||||
lazy.gDNSService.clearCache(false);
|
||||
});
|
||||
|
||||
add_task(async function test_uri_with_get_fixup() {
|
||||
|
@ -105,7 +112,7 @@ add_task(async function test_uri_with_get_fixup() {
|
|||
);
|
||||
|
||||
lazy.gDNSOverride.clearHostOverride(uri.displayHost);
|
||||
Services.dns.clearCache(false);
|
||||
lazy.gDNSService.clearCache(false);
|
||||
});
|
||||
|
||||
add_task(async function test_intranet_like_uri() {
|
||||
|
@ -125,7 +132,7 @@ add_task(async function test_intranet_like_uri() {
|
|||
|
||||
lazy.gDNSOverride.clearHostOverride(uri.displayHost);
|
||||
lazy.gDNSOverride.clearHostOverride(uri.displayHost + ".");
|
||||
Services.dns.clearCache(false);
|
||||
lazy.gDNSService.clearCache(false);
|
||||
});
|
||||
|
||||
add_task(async function test_intranet_like_uri_without_fixup() {
|
||||
|
@ -149,7 +156,7 @@ add_task(async function test_intranet_like_uri_without_fixup() {
|
|||
|
||||
lazy.gDNSOverride.clearHostOverride(uri.displayHost);
|
||||
lazy.gDNSOverride.clearHostOverride(uri.displayHost + ".");
|
||||
Services.dns.clearCache(false);
|
||||
lazy.gDNSService.clearCache(false);
|
||||
});
|
||||
|
||||
add_task(async function test_ip_address() {
|
||||
|
@ -178,6 +185,6 @@ add_task(async function test_ip_address() {
|
|||
);
|
||||
|
||||
lazy.gDNSOverride.clearHostOverride(uri.displayHost);
|
||||
Services.dns.clearCache(false);
|
||||
lazy.gDNSService.clearCache(false);
|
||||
Services.obs.removeObserver(observer, topic);
|
||||
});
|
||||
|
|
|
@ -2122,7 +2122,7 @@ void Document::AccumulatePageLoadTelemetry(
|
|||
if (resolvedByTRR) {
|
||||
RefPtr<net::ChildDNSService> dnsServiceChild =
|
||||
net::ChildDNSService::GetSingleton();
|
||||
dnsServiceChild->GetTRRDomainKey(dnsKey);
|
||||
dnsServiceChild->GetTRRDomain(dnsKey);
|
||||
aEventTelemetryDataOut.trrDomain = mozilla::Some(dnsKey);
|
||||
}
|
||||
|
||||
|
|
|
@ -96,7 +96,7 @@ class DeferredDNSPrefetches final : public nsIWebProgressListener,
|
|||
DeferredDNSPrefetches();
|
||||
|
||||
void Activate();
|
||||
nsresult Add(nsIDNSService::DNSFlags flags, SupportsDNSPrefetch&, Element&);
|
||||
nsresult Add(uint32_t flags, SupportsDNSPrefetch&, Element&);
|
||||
|
||||
void RemoveUnboundLinks();
|
||||
|
||||
|
@ -105,7 +105,7 @@ class DeferredDNSPrefetches final : public nsIWebProgressListener,
|
|||
void Flush();
|
||||
|
||||
void SubmitQueue();
|
||||
void SubmitQueueEntry(Element&, nsIDNSService::DNSFlags aFlags);
|
||||
void SubmitQueueEntry(Element&, uint32_t aFlags);
|
||||
|
||||
uint16_t mHead;
|
||||
uint16_t mTail;
|
||||
|
@ -119,7 +119,7 @@ class DeferredDNSPrefetches final : public nsIWebProgressListener,
|
|||
static const int sMaxDeferredMask = (sMaxDeferred - 1);
|
||||
|
||||
struct deferred_entry {
|
||||
nsIDNSService::DNSFlags mFlags;
|
||||
uint32_t mFlags;
|
||||
// SupportsDNSPrefetch clears this raw pointer in Destroyed().
|
||||
Element* mElement;
|
||||
} mEntries[sMaxDeferred];
|
||||
|
@ -184,26 +184,25 @@ bool HTMLDNSPrefetch::IsAllowed(Document* aDocument) {
|
|||
return aDocument->IsDNSPrefetchAllowed() && aDocument->GetWindow();
|
||||
}
|
||||
|
||||
static nsIDNSService::DNSFlags GetDNSFlagsFromElement(Element& aElement) {
|
||||
static uint32_t GetDNSFlagsFromElement(Element& aElement) {
|
||||
nsIChannel* channel = aElement.OwnerDoc()->GetChannel();
|
||||
if (!channel) {
|
||||
return nsIDNSService::RESOLVE_DEFAULT_FLAGS;
|
||||
return 0;
|
||||
}
|
||||
return nsIDNSService::GetFlagsFromTRRMode(channel->GetTRRMode());
|
||||
}
|
||||
|
||||
nsIDNSService::DNSFlags HTMLDNSPrefetch::PriorityToDNSServiceFlags(
|
||||
Priority aPriority) {
|
||||
uint32_t HTMLDNSPrefetch::PriorityToDNSServiceFlags(Priority aPriority) {
|
||||
switch (aPriority) {
|
||||
case Priority::Low:
|
||||
return nsIDNSService::RESOLVE_PRIORITY_LOW;
|
||||
return uint32_t(nsIDNSService::RESOLVE_PRIORITY_LOW);
|
||||
case Priority::Medium:
|
||||
return nsIDNSService::RESOLVE_PRIORITY_MEDIUM;
|
||||
return uint32_t(nsIDNSService::RESOLVE_PRIORITY_MEDIUM);
|
||||
case Priority::High:
|
||||
return nsIDNSService::RESOLVE_DEFAULT_FLAGS;
|
||||
return 0u;
|
||||
}
|
||||
MOZ_ASSERT_UNREACHABLE("Unknown priority");
|
||||
return nsIDNSService::RESOLVE_DEFAULT_FLAGS;
|
||||
return 0u;
|
||||
}
|
||||
|
||||
nsresult HTMLDNSPrefetch::Prefetch(SupportsDNSPrefetch& aSupports,
|
||||
|
@ -220,7 +219,7 @@ nsresult HTMLDNSPrefetch::Prefetch(SupportsDNSPrefetch& aSupports,
|
|||
nsresult HTMLDNSPrefetch::Prefetch(
|
||||
const nsAString& hostname, bool isHttps,
|
||||
const OriginAttributes& aPartitionedPrincipalOriginAttributes,
|
||||
nsIDNSService::DNSFlags flags) {
|
||||
uint32_t flags) {
|
||||
if (IsNeckoChild()) {
|
||||
// We need to check IsEmpty() because net_IsValidHostName()
|
||||
// considers empty strings to be valid hostnames
|
||||
|
@ -277,7 +276,7 @@ nsresult HTMLDNSPrefetch::CancelPrefetch(SupportsDNSPrefetch& aSupports,
|
|||
return NS_ERROR_NOT_AVAILABLE;
|
||||
}
|
||||
|
||||
nsIDNSService::DNSFlags flags =
|
||||
uint32_t flags =
|
||||
GetDNSFlagsFromElement(aElement) | PriorityToDNSServiceFlags(aPriority);
|
||||
|
||||
nsIURI* uri = aSupports.GetURIForDNSPrefetch(aElement);
|
||||
|
@ -302,7 +301,7 @@ nsresult HTMLDNSPrefetch::CancelPrefetch(SupportsDNSPrefetch& aSupports,
|
|||
nsresult HTMLDNSPrefetch::CancelPrefetch(
|
||||
const nsAString& hostname, bool isHttps,
|
||||
const OriginAttributes& aPartitionedPrincipalOriginAttributes,
|
||||
nsIDNSService::DNSFlags flags, nsresult aReason) {
|
||||
uint32_t flags, nsresult aReason) {
|
||||
// Forward this request to Necko Parent if we're a child process
|
||||
if (IsNeckoChild()) {
|
||||
// We need to check IsEmpty() because net_IsValidHostName()
|
||||
|
@ -410,7 +409,7 @@ void DeferredDNSPrefetches::Flush() {
|
|||
}
|
||||
}
|
||||
|
||||
nsresult DeferredDNSPrefetches::Add(nsIDNSService::DNSFlags flags,
|
||||
nsresult DeferredDNSPrefetches::Add(uint32_t flags,
|
||||
SupportsDNSPrefetch& aSupports,
|
||||
Element& aElement) {
|
||||
// The FIFO has no lock, so it can only be accessed on main thread
|
||||
|
@ -461,7 +460,7 @@ void DeferredDNSPrefetches::SubmitQueue() {
|
|||
}
|
||||
|
||||
void DeferredDNSPrefetches::SubmitQueueEntry(Element& aElement,
|
||||
nsIDNSService::DNSFlags aFlags) {
|
||||
uint32_t aFlags) {
|
||||
auto& supports = ToSupportsDNSPrefetch(aElement);
|
||||
supports.ClearIsInDNSPrefetch();
|
||||
|
||||
|
|
|
@ -10,7 +10,6 @@
|
|||
#include "nsCOMPtr.h"
|
||||
#include "nsIRequest.h"
|
||||
#include "nsString.h"
|
||||
#include "nsIDNSService.h"
|
||||
|
||||
class nsITimer;
|
||||
class nsIURI;
|
||||
|
@ -69,16 +68,16 @@ class HTMLDNSPrefetch {
|
|||
static void ElementDestroyed(Element&, SupportsDNSPrefetch&);
|
||||
|
||||
private:
|
||||
static nsIDNSService::DNSFlags PriorityToDNSServiceFlags(Priority);
|
||||
static uint32_t PriorityToDNSServiceFlags(Priority);
|
||||
|
||||
static nsresult Prefetch(
|
||||
const nsAString& host, bool isHttps,
|
||||
const OriginAttributes& aPartitionedPrincipalOriginAttributes,
|
||||
nsIDNSService::DNSFlags flags);
|
||||
uint32_t flags);
|
||||
static nsresult CancelPrefetch(
|
||||
const nsAString& hostname, bool isHttps,
|
||||
const OriginAttributes& aPartitionedPrincipalOriginAttributes,
|
||||
nsIDNSService::DNSFlags flags, nsresult aReason);
|
||||
uint32_t flags, nsresult aReason);
|
||||
|
||||
friend class net::NeckoParent;
|
||||
};
|
||||
|
|
|
@ -3114,8 +3114,7 @@ bool ContentParent::InitInternal(ProcessPriority aInitialPriority) {
|
|||
|
||||
xpcomInit.perfStatsMask() = PerfStats::GetCollectionMask();
|
||||
|
||||
nsCOMPtr<nsIDNSService> dns = do_GetService(NS_DNSSERVICE_CONTRACTID);
|
||||
dns->GetTrrDomain(xpcomInit.trrDomain());
|
||||
xpcomInit.trrDomain() = TRRService::ProviderKey();
|
||||
|
||||
Unused << SendSetXPCOMProcessAttributes(
|
||||
xpcomInit, initialData, lnf, fontList, std::move(sharedUASheetHandle),
|
||||
|
|
|
@ -147,7 +147,7 @@ int NrIceResolver::resolve(nr_resolver_resource* resource,
|
|||
MOZ_ASSERT(allocated_resolvers_ > 0);
|
||||
ASSERT_ON_THREAD(sts_thread_);
|
||||
RefPtr<PendingResolution> pr;
|
||||
nsIDNSService::DNSFlags resolve_flags = nsIDNSService::RESOLVE_DEFAULT_FLAGS;
|
||||
uint32_t resolve_flags = 0;
|
||||
OriginAttributes attrs;
|
||||
|
||||
if (resource->transport_protocol != IPPROTO_UDP &&
|
||||
|
@ -162,10 +162,10 @@ int NrIceResolver::resolve(nr_resolver_resource* resource,
|
|||
|
||||
switch (resource->address_family) {
|
||||
case AF_INET:
|
||||
resolve_flags = nsIDNSService::RESOLVE_DISABLE_IPV6;
|
||||
resolve_flags |= nsIDNSService::RESOLVE_DISABLE_IPV6;
|
||||
break;
|
||||
case AF_INET6:
|
||||
resolve_flags = nsIDNSService::RESOLVE_DISABLE_IPV4;
|
||||
resolve_flags |= nsIDNSService::RESOLVE_DISABLE_IPV4;
|
||||
break;
|
||||
default:
|
||||
ABORT(R_BAD_ARGS);
|
||||
|
|
|
@ -11732,12 +11732,6 @@
|
|||
value: false
|
||||
mirror: always
|
||||
|
||||
# The base URL of the `Learn more` button for skip reasons
|
||||
- name: network.trr_ui.skip_reason_learn_more_url
|
||||
type: String
|
||||
value: "https://firefox-source-docs.mozilla.org/networking/dns/trr-skip-reasons.html#"
|
||||
mirror: never
|
||||
|
||||
# Allow the network changed event to get sent when a network topology or setup
|
||||
# change is noticed while running.
|
||||
- name: network.notify.changed
|
||||
|
|
|
@ -943,8 +943,7 @@ Dashboard::RequestDNSLookup(const nsACString& aHost,
|
|||
helper->mEventTarget = GetCurrentEventTarget();
|
||||
OriginAttributes attrs;
|
||||
rv = mDnsService->AsyncResolveNative(
|
||||
aHost, nsIDNSService::RESOLVE_TYPE_DEFAULT,
|
||||
nsIDNSService::RESOLVE_DEFAULT_FLAGS, nullptr, helper.get(),
|
||||
aHost, nsIDNSService::RESOLVE_TYPE_DEFAULT, 0, nullptr, helper.get(),
|
||||
NS_GetCurrentThread(), attrs, getter_AddRefs(helper->mCancel));
|
||||
return rv;
|
||||
}
|
||||
|
@ -967,8 +966,7 @@ Dashboard::RequestDNSHTTPSRRLookup(const nsACString& aHost,
|
|||
helper->mEventTarget = GetCurrentEventTarget();
|
||||
OriginAttributes attrs;
|
||||
rv = mDnsService->AsyncResolveNative(
|
||||
aHost, nsIDNSService::RESOLVE_TYPE_HTTPSSVC,
|
||||
nsIDNSService::RESOLVE_DEFAULT_FLAGS, nullptr, helper.get(),
|
||||
aHost, nsIDNSService::RESOLVE_TYPE_HTTPSSVC, 0, nullptr, helper.get(),
|
||||
NS_GetCurrentThread(), attrs, getter_AddRefs(helper->mCancel));
|
||||
return rv;
|
||||
}
|
||||
|
|
|
@ -269,7 +269,7 @@ NS_IMETHODIMP
|
|||
NetworkConnectivityService::OnLookupComplete(nsICancelable* aRequest,
|
||||
nsIDNSRecord* aRecord,
|
||||
nsresult aStatus) {
|
||||
ConnectivityState state = NS_SUCCEEDED(aStatus) ? OK : NOT_AVAILABLE;
|
||||
ConnectivityState state = aRecord ? OK : NOT_AVAILABLE;
|
||||
|
||||
if (aRequest == mDNSv4Request) {
|
||||
mDNSv4 = state;
|
||||
|
|
|
@ -239,7 +239,7 @@ bool ProxyAutoConfig::ResolveAddress(const nsACString& aHostName,
|
|||
// When the PAC script attempts to resolve a domain, we must make sure we
|
||||
// don't use TRR, otherwise the TRR channel might also attempt to resolve
|
||||
// a name and we'll have a deadlock.
|
||||
nsIDNSService::DNSFlags flags =
|
||||
uint32_t flags =
|
||||
nsIDNSService::RESOLVE_PRIORITY_MEDIUM |
|
||||
nsIDNSService::GetFlagsFromTRRMode(nsIRequest::TRR_DISABLED_MODE);
|
||||
|
||||
|
|
|
@ -53,7 +53,7 @@ nsDNSPrefetch::nsDNSPrefetch(nsIURI* aURI,
|
|||
aURI->GetAsciiHost(mHostname);
|
||||
}
|
||||
|
||||
nsresult nsDNSPrefetch::Prefetch(nsIDNSService::DNSFlags flags) {
|
||||
nsresult nsDNSPrefetch::Prefetch(uint32_t flags) {
|
||||
if (mHostname.IsEmpty()) return NS_ERROR_NOT_AVAILABLE;
|
||||
|
||||
if (!sDNSService) return NS_ERROR_NOT_AVAILABLE;
|
||||
|
@ -75,16 +75,18 @@ nsresult nsDNSPrefetch::Prefetch(nsIDNSService::DNSFlags flags) {
|
|||
mOriginAttributes, getter_AddRefs(tmpOutstanding));
|
||||
}
|
||||
|
||||
nsresult nsDNSPrefetch::PrefetchLow(nsIDNSService::DNSFlags aFlags) {
|
||||
return Prefetch(nsIDNSService::RESOLVE_PRIORITY_LOW | aFlags);
|
||||
nsresult nsDNSPrefetch::PrefetchLow(bool refreshDNS) {
|
||||
return Prefetch(nsIDNSService::RESOLVE_PRIORITY_LOW |
|
||||
(refreshDNS ? nsIDNSService::RESOLVE_BYPASS_CACHE : 0));
|
||||
}
|
||||
|
||||
nsresult nsDNSPrefetch::PrefetchMedium(nsIDNSService::DNSFlags aFlags) {
|
||||
return Prefetch(nsIDNSService::RESOLVE_PRIORITY_MEDIUM | aFlags);
|
||||
nsresult nsDNSPrefetch::PrefetchMedium(bool refreshDNS) {
|
||||
return Prefetch(nsIDNSService::RESOLVE_PRIORITY_MEDIUM |
|
||||
(refreshDNS ? nsIDNSService::RESOLVE_BYPASS_CACHE : 0));
|
||||
}
|
||||
|
||||
nsresult nsDNSPrefetch::PrefetchHigh(nsIDNSService::DNSFlags aFlags) {
|
||||
return Prefetch(aFlags);
|
||||
nsresult nsDNSPrefetch::PrefetchHigh(bool refreshDNS) {
|
||||
return Prefetch(refreshDNS ? nsIDNSService::RESOLVE_BYPASS_CACHE : 0);
|
||||
}
|
||||
|
||||
namespace {
|
||||
|
@ -128,7 +130,7 @@ nsresult nsDNSPrefetch::FetchHTTPSSVC(
|
|||
}
|
||||
|
||||
nsCOMPtr<nsIEventTarget> target = mozilla::GetCurrentEventTarget();
|
||||
nsIDNSService::DNSFlags flags = nsIDNSService::GetFlagsFromTRRMode(mTRRMode);
|
||||
uint32_t flags = nsIDNSService::GetFlagsFromTRRMode(mTRRMode);
|
||||
if (aRefreshDNS) {
|
||||
flags |= nsIDNSService::RESOLVE_BYPASS_CACHE;
|
||||
}
|
||||
|
|
|
@ -16,9 +16,9 @@
|
|||
|
||||
#include "nsIDNSListener.h"
|
||||
#include "nsIRequest.h"
|
||||
#include "nsIDNSService.h"
|
||||
|
||||
class nsIURI;
|
||||
class nsIDNSService;
|
||||
class nsIDNSHTTPSSVCRecord;
|
||||
|
||||
class nsDNSPrefetch final : public nsIDNSListener {
|
||||
|
@ -45,12 +45,9 @@ class nsDNSPrefetch final : public nsIDNSListener {
|
|||
static nsresult Shutdown();
|
||||
|
||||
// Call one of the following methods to start the Prefetch.
|
||||
nsresult PrefetchHigh(
|
||||
nsIDNSService::DNSFlags = nsIDNSService::RESOLVE_DEFAULT_FLAGS);
|
||||
nsresult PrefetchMedium(
|
||||
nsIDNSService::DNSFlags = nsIDNSService::RESOLVE_DEFAULT_FLAGS);
|
||||
nsresult PrefetchLow(
|
||||
nsIDNSService::DNSFlags = nsIDNSService::RESOLVE_DEFAULT_FLAGS);
|
||||
nsresult PrefetchHigh(bool refreshDNS = false);
|
||||
nsresult PrefetchMedium(bool refreshDNS = false);
|
||||
nsresult PrefetchLow(bool refreshDNS = false);
|
||||
|
||||
nsresult FetchHTTPSSVC(
|
||||
bool aRefreshDNS, bool aPrefetch,
|
||||
|
@ -66,7 +63,7 @@ class nsDNSPrefetch final : public nsIDNSListener {
|
|||
mozilla::TimeStamp mEndTimestamp;
|
||||
nsWeakPtr mListener;
|
||||
|
||||
nsresult Prefetch(nsIDNSService::DNSFlags flags);
|
||||
nsresult Prefetch(uint32_t flags);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -141,7 +141,7 @@ interface nsIRequest : nsISupports
|
|||
*/
|
||||
const unsigned long LOAD_DOCUMENT_NEEDS_COOKIE = 1 << 2;
|
||||
|
||||
cenum TRRMode : 32 {
|
||||
cenum TRRMode : 8 {
|
||||
TRR_DEFAULT_MODE = 0,
|
||||
TRR_DISABLED_MODE = 1,
|
||||
TRR_FIRST_MODE = 2,
|
||||
|
|
|
@ -987,7 +987,7 @@ nsresult nsSocketTransport::ResolveHost() {
|
|||
|
||||
mResolving = true;
|
||||
|
||||
nsIDNSService::DNSFlags dnsFlags = nsIDNSService::RESOLVE_DEFAULT_FLAGS;
|
||||
uint32_t dnsFlags = 0;
|
||||
if (mConnectionFlags & nsSocketTransport::BYPASS_CACHE) {
|
||||
dnsFlags = nsIDNSService::RESOLVE_BYPASS_CACHE;
|
||||
}
|
||||
|
@ -1723,10 +1723,10 @@ bool nsSocketTransport::RecoverFromError() {
|
|||
mNetAddr.inet6.ip.u64[1] == 0))) {
|
||||
SOCKET_LOG((" TRR returned 0.0.0.0 and there are no other IPs"));
|
||||
} else if (trrEnabled) {
|
||||
nsIRequest::TRRMode trrMode = nsIRequest::TRR_DEFAULT_MODE;
|
||||
uint32_t trrMode = 0;
|
||||
mDNSRecord->GetEffectiveTRRMode(&trrMode);
|
||||
// If current trr mode is trr only, we should not retry.
|
||||
if (trrMode != nsIRequest::TRR_ONLY_MODE) {
|
||||
if (trrMode != 3) {
|
||||
// Drop state to closed. This will trigger a new round of
|
||||
// DNS resolving. Bypass the cache this time since the
|
||||
// cached data came from TRR and failed already!
|
||||
|
|
|
@ -67,9 +67,8 @@ static nsresult ResolveHost(const nsACString& host,
|
|||
}
|
||||
|
||||
nsCOMPtr<nsICancelable> tmpOutstanding;
|
||||
return dns->AsyncResolveNative(host, nsIDNSService::RESOLVE_TYPE_DEFAULT,
|
||||
nsIDNSService::RESOLVE_DEFAULT_FLAGS, nullptr,
|
||||
listener, nullptr, aOriginAttributes,
|
||||
return dns->AsyncResolveNative(host, nsIDNSService::RESOLVE_TYPE_DEFAULT, 0,
|
||||
nullptr, listener, nullptr, aOriginAttributes,
|
||||
getter_AddRefs(tmpOutstanding));
|
||||
}
|
||||
|
||||
|
|
|
@ -114,11 +114,8 @@ 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',
|
||||
|
|
|
@ -22,7 +22,6 @@
|
|||
#include "nsServiceManagerUtils.h"
|
||||
#include "prsystem.h"
|
||||
#include "DNSAdditionalInfo.h"
|
||||
#include "TRRService.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace net {
|
||||
|
@ -68,9 +67,8 @@ ChildDNSService::ChildDNSService() {
|
|||
|
||||
void ChildDNSService::GetDNSRecordHashKey(
|
||||
const nsACString& aHost, const nsACString& aTrrServer, int32_t aPort,
|
||||
uint16_t aType, const OriginAttributes& aOriginAttributes,
|
||||
nsIDNSService::DNSFlags aFlags, uintptr_t aListenerAddr,
|
||||
nsACString& aHashKey) {
|
||||
uint16_t aType, const OriginAttributes& aOriginAttributes, uint32_t aFlags,
|
||||
uintptr_t aListenerAddr, nsACString& aHashKey) {
|
||||
aHashKey.Assign(aHost);
|
||||
aHashKey.Assign(aTrrServer);
|
||||
aHashKey.AppendInt(aPort);
|
||||
|
@ -85,7 +83,7 @@ void ChildDNSService::GetDNSRecordHashKey(
|
|||
}
|
||||
|
||||
nsresult ChildDNSService::AsyncResolveInternal(
|
||||
const nsACString& hostname, uint16_t type, nsIDNSService::DNSFlags flags,
|
||||
const nsACString& hostname, uint16_t type, uint32_t flags,
|
||||
nsIDNSAdditionalInfo* aInfo, nsIDNSListener* listener,
|
||||
nsIEventTarget* target_, const OriginAttributes& aOriginAttributes,
|
||||
nsICancelable** result) {
|
||||
|
@ -158,7 +156,7 @@ nsresult ChildDNSService::AsyncResolveInternal(
|
|||
}
|
||||
|
||||
nsresult ChildDNSService::CancelAsyncResolveInternal(
|
||||
const nsACString& aHostname, uint16_t aType, nsIDNSService::DNSFlags aFlags,
|
||||
const nsACString& aHostname, uint16_t aType, uint32_t aFlags,
|
||||
nsIDNSAdditionalInfo* aInfo, nsIDNSListener* aListener, nsresult aReason,
|
||||
const OriginAttributes& aOriginAttributes) {
|
||||
if (mDisablePrefetch && (aFlags & RESOLVE_SPECULATE)) {
|
||||
|
@ -186,8 +184,7 @@ nsresult ChildDNSService::CancelAsyncResolveInternal(
|
|||
|
||||
NS_IMETHODIMP
|
||||
ChildDNSService::AsyncResolve(const nsACString& hostname,
|
||||
nsIDNSService::ResolveType aType,
|
||||
nsIDNSService::DNSFlags flags,
|
||||
nsIDNSService::ResolveType aType, uint32_t flags,
|
||||
nsIDNSAdditionalInfo* aInfo,
|
||||
nsIDNSListener* listener, nsIEventTarget* target_,
|
||||
JS::Handle<JS::Value> aOriginAttributes,
|
||||
|
@ -206,11 +203,13 @@ ChildDNSService::AsyncResolve(const nsACString& hostname,
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
ChildDNSService::AsyncResolveNative(
|
||||
const nsACString& hostname, nsIDNSService::ResolveType aType,
|
||||
nsIDNSService::DNSFlags flags, nsIDNSAdditionalInfo* aInfo,
|
||||
nsIDNSListener* listener, nsIEventTarget* target_,
|
||||
const OriginAttributes& aOriginAttributes, nsICancelable** result) {
|
||||
ChildDNSService::AsyncResolveNative(const nsACString& hostname,
|
||||
nsIDNSService::ResolveType aType,
|
||||
uint32_t flags, nsIDNSAdditionalInfo* aInfo,
|
||||
nsIDNSListener* listener,
|
||||
nsIEventTarget* target_,
|
||||
const OriginAttributes& aOriginAttributes,
|
||||
nsICancelable** result) {
|
||||
return AsyncResolveInternal(hostname, aType, flags, aInfo, listener, target_,
|
||||
aOriginAttributes, result);
|
||||
}
|
||||
|
@ -226,7 +225,7 @@ ChildDNSService::NewAdditionalInfo(const nsACString& aTrrURL, int32_t aPort,
|
|||
NS_IMETHODIMP
|
||||
ChildDNSService::CancelAsyncResolve(const nsACString& aHostname,
|
||||
nsIDNSService::ResolveType aType,
|
||||
nsIDNSService::DNSFlags aFlags,
|
||||
uint32_t aFlags,
|
||||
nsIDNSAdditionalInfo* aInfo,
|
||||
nsIDNSListener* aListener, nsresult aReason,
|
||||
JS::Handle<JS::Value> aOriginAttributes,
|
||||
|
@ -246,16 +245,14 @@ ChildDNSService::CancelAsyncResolve(const nsACString& aHostname,
|
|||
NS_IMETHODIMP
|
||||
ChildDNSService::CancelAsyncResolveNative(
|
||||
const nsACString& aHostname, nsIDNSService::ResolveType aType,
|
||||
nsIDNSService::DNSFlags aFlags, nsIDNSAdditionalInfo* aInfo,
|
||||
nsIDNSListener* aListener, nsresult aReason,
|
||||
const OriginAttributes& aOriginAttributes) {
|
||||
uint32_t aFlags, nsIDNSAdditionalInfo* aInfo, nsIDNSListener* aListener,
|
||||
nsresult aReason, const OriginAttributes& aOriginAttributes) {
|
||||
return CancelAsyncResolveInternal(aHostname, aType, aFlags, aInfo, aListener,
|
||||
aReason, aOriginAttributes);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
ChildDNSService::Resolve(const nsACString& hostname,
|
||||
nsIDNSService::DNSFlags flags,
|
||||
ChildDNSService::Resolve(const nsACString& hostname, uint32_t flags,
|
||||
JS::Handle<JS::Value> aOriginAttributes,
|
||||
JSContext* aCx, uint8_t aArgc, nsIDNSRecord** result) {
|
||||
// not planning to ever support this, since sync IPDL is evil.
|
||||
|
@ -263,8 +260,7 @@ ChildDNSService::Resolve(const nsACString& hostname,
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
ChildDNSService::ResolveNative(const nsACString& hostname,
|
||||
nsIDNSService::DNSFlags flags,
|
||||
ChildDNSService::ResolveNative(const nsACString& hostname, uint32_t flags,
|
||||
const OriginAttributes& aOriginAttributes,
|
||||
nsIDNSRecord** result) {
|
||||
// not planning to ever support this, since sync IPDL is evil.
|
||||
|
@ -310,12 +306,6 @@ ChildDNSService::SetDetectedTrrURI(const nsACString& aURI) {
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
ChildDNSService::GetTRRSkipReasonName(nsITRRSkipReason::value aValue,
|
||||
nsACString& aName) {
|
||||
return mozilla::net::GetTRRSkipReasonName(aValue, aName);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
ChildDNSService::GetCurrentTrrURI(nsACString& aURI) {
|
||||
if (!mTRRServiceParent) {
|
||||
|
@ -371,8 +361,7 @@ ChildDNSService::GetODoHActivated(bool* aResult) {
|
|||
|
||||
void ChildDNSService::NotifyRequestDone(DNSRequestSender* aDnsRequest) {
|
||||
// We need the original flags and listener for the pending requests hash.
|
||||
nsIDNSService::DNSFlags originalFlags =
|
||||
aDnsRequest->mFlags & ~RESOLVE_OFFLINE;
|
||||
uint32_t originalFlags = aDnsRequest->mFlags & ~RESOLVE_OFFLINE;
|
||||
uintptr_t originalListenerAddr =
|
||||
reinterpret_cast<uintptr_t>(aDnsRequest->mListener.get());
|
||||
RefPtr<DNSListenerProxy> wrapper = do_QueryObject(aDnsRequest->mListener);
|
||||
|
@ -473,17 +462,10 @@ ChildDNSService::Observe(nsISupports* subject, const char* topic,
|
|||
|
||||
void ChildDNSService::SetTRRDomain(const nsACString& aTRRDomain) {
|
||||
mTRRDomain = aTRRDomain;
|
||||
TRRService::SetProviderDomain(aTRRDomain);
|
||||
}
|
||||
|
||||
void ChildDNSService::GetTRRDomainKey(nsACString& aTRRDomain) {
|
||||
aTRRDomain = TRRService::ProviderKey();
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
ChildDNSService::GetTrrDomain(nsACString& aTRRDomain) {
|
||||
void ChildDNSService::GetTRRDomain(nsACString& aTRRDomain) {
|
||||
aTRRDomain = mTRRDomain;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
} // namespace net
|
||||
|
|
|
@ -36,7 +36,7 @@ class ChildDNSService final : public DNSServiceBase, public nsPIDNSService {
|
|||
void NotifyRequestDone(DNSRequestSender* aDnsRequest);
|
||||
|
||||
void SetTRRDomain(const nsACString& aTRRDomain);
|
||||
void GetTRRDomainKey(nsACString& aTRRDomain);
|
||||
void GetTRRDomain(nsACString& aTRRDomain);
|
||||
|
||||
private:
|
||||
virtual ~ChildDNSService() = default;
|
||||
|
@ -44,19 +44,16 @@ class ChildDNSService final : public DNSServiceBase, public nsPIDNSService {
|
|||
void MOZ_ALWAYS_INLINE GetDNSRecordHashKey(
|
||||
const nsACString& aHost, const nsACString& aTrrServer, int32_t aPort,
|
||||
uint16_t aType, const OriginAttributes& aOriginAttributes,
|
||||
nsIDNSService::DNSFlags aFlags, uintptr_t aListenerAddr,
|
||||
nsACString& aHashKey);
|
||||
uint32_t aFlags, uintptr_t aListenerAddr, nsACString& aHashKey);
|
||||
nsresult AsyncResolveInternal(const nsACString& hostname, uint16_t type,
|
||||
nsIDNSService::DNSFlags flags,
|
||||
nsIDNSAdditionalInfo* aInfo,
|
||||
uint32_t flags, nsIDNSAdditionalInfo* aInfo,
|
||||
nsIDNSListener* listener,
|
||||
nsIEventTarget* target_,
|
||||
const OriginAttributes& aOriginAttributes,
|
||||
nsICancelable** result);
|
||||
nsresult CancelAsyncResolveInternal(
|
||||
const nsACString& aHostname, uint16_t aType,
|
||||
nsIDNSService::DNSFlags aFlags, nsIDNSAdditionalInfo* aInfo,
|
||||
nsIDNSListener* aListener, nsresult aReason,
|
||||
const nsACString& aHostname, uint16_t aType, uint32_t aFlags,
|
||||
nsIDNSAdditionalInfo* aInfo, nsIDNSListener* aListener, nsresult aReason,
|
||||
const OriginAttributes& aOriginAttributes);
|
||||
|
||||
bool mODoHActivated = false;
|
||||
|
|
|
@ -35,7 +35,7 @@ class DNSRequestBase : public nsISupports {
|
|||
const nsCString& trrServer,
|
||||
const int32_t& port, const uint16_t& type,
|
||||
const OriginAttributes& originAttributes,
|
||||
const nsIDNSService::DNSFlags& flags,
|
||||
const uint32_t& flags,
|
||||
const nsresult& reason) = 0;
|
||||
virtual bool OnRecvLookupCompleted(const DNSRequestResponse& reply) = 0;
|
||||
virtual void OnIPCActorDestroy() = 0;
|
||||
|
@ -60,14 +60,14 @@ class DNSRequestSender final : public DNSRequestBase, public nsICancelable {
|
|||
DNSRequestSender(const nsACString& aHost, const nsACString& aTrrServer,
|
||||
int32_t aPort, const uint16_t& aType,
|
||||
const OriginAttributes& aOriginAttributes,
|
||||
const nsIDNSService::DNSFlags& aFlags,
|
||||
nsIDNSListener* aListener, nsIEventTarget* target);
|
||||
const uint32_t& aFlags, nsIDNSListener* aListener,
|
||||
nsIEventTarget* target);
|
||||
|
||||
void OnRecvCancelDNSRequest(const nsCString& hostName,
|
||||
const nsCString& trrServer, const int32_t& port,
|
||||
const uint16_t& type,
|
||||
const OriginAttributes& originAttributes,
|
||||
const nsIDNSService::DNSFlags& flags,
|
||||
const uint32_t& flags,
|
||||
const nsresult& reason) override;
|
||||
bool OnRecvLookupCompleted(const DNSRequestResponse& reply) override;
|
||||
void OnIPCActorDestroy() override;
|
||||
|
@ -92,7 +92,7 @@ class DNSRequestSender final : public DNSRequestBase, public nsICancelable {
|
|||
int32_t mPort;
|
||||
uint16_t mType = 0;
|
||||
const OriginAttributes mOriginAttributes;
|
||||
nsIDNSService::DNSFlags mFlags = nsIDNSService::RESOLVE_DEFAULT_FLAGS;
|
||||
uint16_t mFlags = 0;
|
||||
};
|
||||
|
||||
// DNSRequestHandler handles the dns request and sends the result back via IPC.
|
||||
|
@ -106,14 +106,13 @@ class DNSRequestHandler final : public DNSRequestBase, public nsIDNSListener {
|
|||
|
||||
void DoAsyncResolve(const nsACString& hostname, const nsACString& trrServer,
|
||||
int32_t port, uint16_t type,
|
||||
const OriginAttributes& originAttributes,
|
||||
nsIDNSService::DNSFlags flags);
|
||||
const OriginAttributes& originAttributes, uint32_t flags);
|
||||
|
||||
void OnRecvCancelDNSRequest(const nsCString& hostName,
|
||||
const nsCString& trrServer, const int32_t& port,
|
||||
const uint16_t& type,
|
||||
const OriginAttributes& originAttributes,
|
||||
const nsIDNSService::DNSFlags& flags,
|
||||
const uint32_t& flags,
|
||||
const nsresult& reason) override;
|
||||
bool OnRecvLookupCompleted(const DNSRequestResponse& reply) override;
|
||||
void OnIPCActorDestroy() override;
|
||||
|
@ -124,7 +123,7 @@ class DNSRequestHandler final : public DNSRequestBase, public nsIDNSListener {
|
|||
private:
|
||||
virtual ~DNSRequestHandler() = default;
|
||||
|
||||
nsIDNSService::DNSFlags mFlags = nsIDNSService::RESOLVE_DEFAULT_FLAGS;
|
||||
uint32_t mFlags = 0;
|
||||
};
|
||||
|
||||
// Provides some common methods for DNSRequestChild and DNSRequestParent.
|
||||
|
|
|
@ -42,7 +42,7 @@ class ChildDNSRecord : public nsIDNSAddrRecord {
|
|||
NS_DECL_NSIDNSRECORD
|
||||
NS_DECL_NSIDNSADDRRECORD
|
||||
|
||||
ChildDNSRecord(const DNSRecord& reply, nsIDNSService::DNSFlags flags);
|
||||
ChildDNSRecord(const DNSRecord& reply, uint16_t flags);
|
||||
|
||||
private:
|
||||
virtual ~ChildDNSRecord() = default;
|
||||
|
@ -50,20 +50,18 @@ class ChildDNSRecord : public nsIDNSAddrRecord {
|
|||
nsCString mCanonicalName;
|
||||
nsTArray<NetAddr> mAddresses;
|
||||
uint32_t mCurrent = 0; // addr iterator
|
||||
nsIDNSService::DNSFlags mFlags = nsIDNSService::RESOLVE_DEFAULT_FLAGS;
|
||||
uint16_t mFlags = 0;
|
||||
double mTrrFetchDuration = 0;
|
||||
double mTrrFetchDurationNetworkOnly = 0;
|
||||
bool mIsTRR = false;
|
||||
bool mResolvedInSocketProcess = false;
|
||||
nsIRequest::TRRMode mEffectiveTRRMode = nsIRequest::TRR_DEFAULT_MODE;
|
||||
nsITRRSkipReason::value mTRRSkipReason = nsITRRSkipReason::TRR_UNSET;
|
||||
uint32_t mEffectiveTRRMode = 0;
|
||||
uint32_t mTTL = 0;
|
||||
};
|
||||
|
||||
NS_IMPL_ISUPPORTS(ChildDNSRecord, nsIDNSRecord, nsIDNSAddrRecord)
|
||||
|
||||
ChildDNSRecord::ChildDNSRecord(const DNSRecord& reply,
|
||||
nsIDNSService::DNSFlags flags)
|
||||
ChildDNSRecord::ChildDNSRecord(const DNSRecord& reply, uint16_t flags)
|
||||
: mFlags(flags) {
|
||||
mCanonicalName = reply.canonicalName();
|
||||
mTrrFetchDuration = reply.trrFetchDuration();
|
||||
|
@ -191,17 +189,11 @@ ChildDNSRecord::ReportUnusable(uint16_t aPort) {
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
ChildDNSRecord::GetEffectiveTRRMode(nsIRequest::TRRMode* aMode) {
|
||||
ChildDNSRecord::GetEffectiveTRRMode(uint32_t* aMode) {
|
||||
*aMode = mEffectiveTRRMode;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP ChildDNSRecord::GetTrrSkipReason(
|
||||
nsITRRSkipReason::value* aTrrSkipReason) {
|
||||
*aTrrSkipReason = mTRRSkipReason;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
ChildDNSRecord::GetTtl(uint32_t* aTtl) {
|
||||
*aTtl = mTTL;
|
||||
|
@ -363,13 +355,10 @@ ChildDNSByTypeRecord::GetTtl(uint32_t* aResult) {
|
|||
|
||||
NS_IMPL_ISUPPORTS(DNSRequestSender, nsICancelable)
|
||||
|
||||
DNSRequestSender::DNSRequestSender(const nsACString& aHost,
|
||||
const nsACString& aTrrServer, int32_t aPort,
|
||||
const uint16_t& aType,
|
||||
const OriginAttributes& aOriginAttributes,
|
||||
const nsIDNSService::DNSFlags& aFlags,
|
||||
nsIDNSListener* aListener,
|
||||
nsIEventTarget* target)
|
||||
DNSRequestSender::DNSRequestSender(
|
||||
const nsACString& aHost, const nsACString& aTrrServer, int32_t aPort,
|
||||
const uint16_t& aType, const OriginAttributes& aOriginAttributes,
|
||||
const uint32_t& aFlags, nsIDNSListener* aListener, nsIEventTarget* target)
|
||||
: mListener(aListener),
|
||||
mTarget(target),
|
||||
mResultStatus(NS_OK),
|
||||
|
@ -383,7 +372,7 @@ DNSRequestSender::DNSRequestSender(const nsACString& aHost,
|
|||
void DNSRequestSender::OnRecvCancelDNSRequest(
|
||||
const nsCString& hostName, const nsCString& trrServer, const int32_t& port,
|
||||
const uint16_t& type, const OriginAttributes& originAttributes,
|
||||
const nsIDNSService::DNSFlags& flags, const nsresult& reason) {}
|
||||
const uint32_t& flags, const nsresult& reason) {}
|
||||
|
||||
NS_IMETHODIMP
|
||||
DNSRequestSender::Cancel(nsresult reason) {
|
||||
|
@ -550,7 +539,7 @@ DNSRequestChild::DNSRequestChild(DNSRequestBase* aRequest)
|
|||
mozilla::ipc::IPCResult DNSRequestChild::RecvCancelDNSRequest(
|
||||
const nsCString& hostName, const nsCString& trrServer, const int32_t& port,
|
||||
const uint16_t& type, const OriginAttributes& originAttributes,
|
||||
const nsIDNSService::DNSFlags& flags, const nsresult& reason) {
|
||||
const uint32_t& flags, const nsresult& reason) {
|
||||
mDNSRequest->OnRecvCancelDNSRequest(hostName, trrServer, port, type,
|
||||
originAttributes, flags, reason);
|
||||
return IPC_OK();
|
||||
|
|
|
@ -30,8 +30,8 @@ class DNSRequestChild final : public DNSRequestActor, public PDNSRequestChild {
|
|||
mozilla::ipc::IPCResult RecvCancelDNSRequest(
|
||||
const nsCString& hostName, const nsCString& trrServer,
|
||||
const int32_t& port, const uint16_t& type,
|
||||
const OriginAttributes& originAttributes,
|
||||
const nsIDNSService::DNSFlags& flags, const nsresult& reason);
|
||||
const OriginAttributes& originAttributes, const uint32_t& flags,
|
||||
const nsresult& reason);
|
||||
mozilla::ipc::IPCResult RecvLookupCompleted(const DNSRequestResponse& reply);
|
||||
virtual void ActorDestroy(ActorDestroyReason why) override;
|
||||
};
|
||||
|
|
|
@ -40,7 +40,7 @@ void DNSRequestHandler::DoAsyncResolve(const nsACString& hostname,
|
|||
const nsACString& trrServer,
|
||||
int32_t port, uint16_t type,
|
||||
const OriginAttributes& originAttributes,
|
||||
nsIDNSService::DNSFlags flags) {
|
||||
uint32_t flags) {
|
||||
nsresult rv;
|
||||
mFlags = flags;
|
||||
nsCOMPtr<nsIDNSService> dns = do_GetService(NS_DNSSERVICE_CONTRACTID, &rv);
|
||||
|
@ -64,7 +64,7 @@ void DNSRequestHandler::DoAsyncResolve(const nsACString& hostname,
|
|||
void DNSRequestHandler::OnRecvCancelDNSRequest(
|
||||
const nsCString& hostName, const nsCString& aTrrServer, const int32_t& port,
|
||||
const uint16_t& type, const OriginAttributes& originAttributes,
|
||||
const nsIDNSService::DNSFlags& flags, const nsresult& reason) {
|
||||
const uint32_t& flags, const nsresult& reason) {
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsIDNSService> dns = do_GetService(NS_DNSSERVICE_CONTRACTID, &rv);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
|
@ -128,7 +128,7 @@ DNSRequestHandler::OnLookupComplete(nsICancelable* request,
|
|||
bool isTRR = false;
|
||||
rec->IsTRR(&isTRR);
|
||||
|
||||
nsIRequest::TRRMode effectiveTRRMode = nsIRequest::TRR_DEFAULT_MODE;
|
||||
uint32_t effectiveTRRMode = 0;
|
||||
rec->GetEffectiveTRRMode(&effectiveTRRMode);
|
||||
|
||||
uint32_t ttl = 0;
|
||||
|
@ -159,7 +159,7 @@ DNSRequestParent::DNSRequestParent(DNSRequestBase* aRequest)
|
|||
mozilla::ipc::IPCResult DNSRequestParent::RecvCancelDNSRequest(
|
||||
const nsCString& hostName, const nsCString& trrServer, const int32_t& port,
|
||||
const uint16_t& type, const OriginAttributes& originAttributes,
|
||||
const nsIDNSService::DNSFlags& flags, const nsresult& reason) {
|
||||
const uint32_t& flags, const nsresult& reason) {
|
||||
mDNSRequest->OnRecvCancelDNSRequest(hostName, trrServer, port, type,
|
||||
originAttributes, flags, reason);
|
||||
return IPC_OK();
|
||||
|
|
|
@ -33,8 +33,8 @@ class DNSRequestParent : public DNSRequestActor, public PDNSRequestParent {
|
|||
mozilla::ipc::IPCResult RecvCancelDNSRequest(
|
||||
const nsCString& hostName, const nsCString& trrServer,
|
||||
const int32_t& port, const uint16_t& type,
|
||||
const OriginAttributes& originAttributes,
|
||||
const nsIDNSService::DNSFlags& flags, const nsresult& reason);
|
||||
const OriginAttributes& originAttributes, const uint32_t& flags,
|
||||
const nsresult& reason);
|
||||
mozilla::ipc::IPCResult RecvLookupCompleted(const DNSRequestResponse& reply);
|
||||
void ActorDestroy(ActorDestroyReason) override;
|
||||
};
|
||||
|
|
|
@ -10,8 +10,7 @@
|
|||
namespace mozilla {
|
||||
namespace net {
|
||||
|
||||
void HostRecordQueue::InsertRecord(nsHostRecord* aRec,
|
||||
nsIDNSService::DNSFlags aFlags,
|
||||
void HostRecordQueue::InsertRecord(nsHostRecord* aRec, uint16_t aFlags,
|
||||
const MutexAutoLock& aProofOfLock) {
|
||||
if (aRec->isInList()) {
|
||||
MOZ_DIAGNOSTIC_ASSERT(!mEvictionQ.contains(aRec),
|
||||
|
@ -156,8 +155,7 @@ void HostRecordQueue::MaybeRemoveFromQ(nsHostRecord* aRec,
|
|||
aRec->remove();
|
||||
}
|
||||
|
||||
void HostRecordQueue::MoveToAnotherPendingQ(nsHostRecord* aRec,
|
||||
nsIDNSService::DNSFlags aFlags,
|
||||
void HostRecordQueue::MoveToAnotherPendingQ(nsHostRecord* aRec, uint16_t aFlags,
|
||||
const MutexAutoLock& aProofOfLock) {
|
||||
if (!(mHighQ.contains(aRec) || mMediumQ.contains(aRec) ||
|
||||
mLowQ.contains(aRec))) {
|
||||
|
|
|
@ -26,7 +26,7 @@ class HostRecordQueue final {
|
|||
|
||||
// Insert the record to mHighQ or mMediumQ or mLowQ based on the record's
|
||||
// priority.
|
||||
void InsertRecord(nsHostRecord* aRec, nsIDNSService::DNSFlags aFlags,
|
||||
void InsertRecord(nsHostRecord* aRec, uint16_t aFlags,
|
||||
const MutexAutoLock& aProofOfLock);
|
||||
// Insert the record to mEvictionQ. In theory, this function should be called
|
||||
// when the record is not in any queue.
|
||||
|
@ -45,7 +45,7 @@ class HostRecordQueue final {
|
|||
// Remove the record from the queue that contains it.
|
||||
void MaybeRemoveFromQ(nsHostRecord* aRec, const MutexAutoLock& aProofOfLock);
|
||||
// When the record's priority changes, move the record between pending queues.
|
||||
void MoveToAnotherPendingQ(nsHostRecord* aRec, nsIDNSService::DNSFlags aFlags,
|
||||
void MoveToAnotherPendingQ(nsHostRecord* aRec, uint16_t aFlags,
|
||||
const MutexAutoLock& aProofOfLock);
|
||||
// Returning the first record from one of the pending queue. When |aHighQOnly|
|
||||
// is true, returning the record from mHighQ only. When false, return the
|
||||
|
|
|
@ -331,7 +331,7 @@ nsresult ODoHService::UpdateODoHConfigFromHTTPSRR() {
|
|||
nsCOMPtr<nsIEventTarget> target = TRRService::Get()->MainThreadOrTRRThread();
|
||||
// We'd like to bypass the DNS cache, since ODoHConfigs will be updated
|
||||
// manually by ODoHService.
|
||||
nsIDNSService::DNSFlags flags =
|
||||
uint32_t flags =
|
||||
nsIDNSService::RESOLVE_DISABLE_ODOH | nsIDNSService::RESOLVE_BYPASS_CACHE;
|
||||
nsCOMPtr<nsIDNSAdditionalInfo> info;
|
||||
if (port != -1) {
|
||||
|
|
|
@ -13,7 +13,6 @@ include PDNSRequestParams;
|
|||
include "mozilla/net/NeckoMessageUtils.h";
|
||||
|
||||
using mozilla::OriginAttributes from "mozilla/ipc/BackgroundUtils.h";
|
||||
using nsIDNSService::DNSFlags from "nsIDNSService.h";
|
||||
|
||||
namespace mozilla {
|
||||
namespace net {
|
||||
|
@ -29,7 +28,7 @@ both:
|
|||
// needed if the request is to be canceled.
|
||||
async CancelDNSRequest(nsCString hostName, nsCString trrServer, int32_t port,
|
||||
uint16_t type, OriginAttributes originAttributes,
|
||||
DNSFlags flags, nsresult reason);
|
||||
uint32_t flags, nsresult reason);
|
||||
async __delete__();
|
||||
|
||||
async LookupCompleted(DNSRequestResponse reply);
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
|
||||
using NetAddr from "mozilla/net/DNS.h";
|
||||
using mozilla::net::IPCTypeRecord from "mozilla/net/DNSByTypeRecord.h";
|
||||
using nsIRequest::TRRMode from "nsIRequest.h";
|
||||
|
||||
|
||||
namespace mozilla {
|
||||
namespace net {
|
||||
|
@ -23,7 +23,7 @@ struct DNSRecord
|
|||
double trrFetchDuration;
|
||||
double trrFetchDurationNetworkOnly;
|
||||
bool isTRR;
|
||||
TRRMode effectiveTRRMode;
|
||||
uint32_t effectiveTRRMode;
|
||||
uint32_t ttl;
|
||||
};
|
||||
|
||||
|
|
|
@ -559,8 +559,7 @@ nsresult TRR::ReceivePush(nsIHttpChannel* pushed, nsHostRecord* pushedRec) {
|
|||
// Since we don't ever call nsHostResolver::NameLookup for this record,
|
||||
// we need to copy the trr mode from the previous record
|
||||
if (hostRecord->mEffectiveTRRMode == nsIRequest::TRR_DEFAULT_MODE) {
|
||||
hostRecord->mEffectiveTRRMode =
|
||||
static_cast<nsIRequest::TRRMode>(pushedRec->mEffectiveTRRMode);
|
||||
hostRecord->mEffectiveTRRMode = pushedRec->mEffectiveTRRMode;
|
||||
}
|
||||
|
||||
rv = mHostResolver->TrrLookup_unlocked(hostRecord, this);
|
||||
|
@ -670,8 +669,7 @@ void TRR::SaveAdditionalRecords(
|
|||
// This is quite hacky, and should be fixed.
|
||||
hostRecord->Reset();
|
||||
hostRecord->mResolving++;
|
||||
hostRecord->mEffectiveTRRMode =
|
||||
static_cast<nsIRequest::TRRMode>(mRec->mEffectiveTRRMode);
|
||||
hostRecord->mEffectiveTRRMode = mRec->mEffectiveTRRMode;
|
||||
LOG(("Completing lookup for additional: %s",
|
||||
nsCString(recordEntry.GetKey()).get()));
|
||||
(void)mHostResolver->CompleteLookup(hostRecord, NS_OK, ai, mPB,
|
||||
|
@ -710,8 +708,7 @@ void TRR::StoreIPHintAsDNSRecord(const struct SVCB& aSVCBRecord) {
|
|||
// to set these fields to avoid assertions in CompleteLookup.
|
||||
// This is quite hacky, and should be fixed.
|
||||
hostRecord->mResolving++;
|
||||
hostRecord->mEffectiveTRRMode =
|
||||
static_cast<nsIRequest::TRRMode>(mRec->mEffectiveTRRMode);
|
||||
hostRecord->mEffectiveTRRMode = mRec->mEffectiveTRRMode;
|
||||
(void)mHostResolver->CompleteLookup(hostRecord, NS_OK, ai, mPB, mOriginSuffix,
|
||||
TRRSkippedReason::TRR_OK, this);
|
||||
}
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
#include "nsThreadUtils.h"
|
||||
#include "nsXULAppAPI.h"
|
||||
#include "DNSPacket.h"
|
||||
#include "nsITRRSkipReason.h"
|
||||
#include "TRRSkippedReason.h"
|
||||
|
||||
class AHostResolver;
|
||||
class nsHostRecord;
|
||||
|
|
|
@ -43,8 +43,8 @@ class TRRQuery : public AHostResolver {
|
|||
uint32_t aTtl, bool pb) override;
|
||||
virtual nsresult GetHostRecord(const nsACString& host,
|
||||
const nsACString& aTrrServer, uint16_t type,
|
||||
nsIDNSService::DNSFlags flags, uint16_t af,
|
||||
bool pb, const nsCString& originSuffix,
|
||||
uint16_t flags, uint16_t af, bool pb,
|
||||
const nsCString& originSuffix,
|
||||
nsHostRecord** result) override {
|
||||
if (!mHostResolver) {
|
||||
return NS_ERROR_FAILURE;
|
||||
|
|
|
@ -54,16 +54,6 @@ constexpr nsLiteralCString kTRRDomains[] = {
|
|||
"dns.shaw.ca"_ns, // Steered clients
|
||||
// clang-format on
|
||||
};
|
||||
// static
|
||||
void TRRService::SetProviderDomain(const nsACString& aTRRDomain) {
|
||||
sDomainIndex = 0;
|
||||
for (size_t i = 1; i < std::size(kTRRDomains); i++) {
|
||||
if (aTRRDomain.Equals(kTRRDomains[i])) {
|
||||
sDomainIndex = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// static
|
||||
const nsCString& TRRService::ProviderKey() { return kTRRDomains[sDomainIndex]; }
|
||||
|
@ -302,7 +292,13 @@ bool TRRService::MaybeSetPrivateURI(const nsACString& aURI) {
|
|||
nsAutoCString host;
|
||||
url->GetHost(host);
|
||||
|
||||
SetProviderDomain(host);
|
||||
sDomainIndex = 0;
|
||||
for (size_t i = 1; i < std::size(kTRRDomains); i++) {
|
||||
if (host.Equals(kTRRDomains[i])) {
|
||||
sDomainIndex = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
mPrivateURI = newURI;
|
||||
|
||||
|
@ -314,7 +310,7 @@ bool TRRService::MaybeSetPrivateURI(const nsACString& aURI) {
|
|||
if (!neckoParent) {
|
||||
continue;
|
||||
}
|
||||
Unused << neckoParent->SendSetTRRDomain(host);
|
||||
Unused << neckoParent->SendSetTRRDomain(ProviderKey());
|
||||
}
|
||||
|
||||
AsyncCreateTRRConnectionInfo(mPrivateURI);
|
||||
|
|
|
@ -82,7 +82,6 @@ class TRRService : public TRRServiceBase,
|
|||
// Returns a reference to a static string identifying the current DoH server
|
||||
// If the DoH server is not one of the built-in ones it will return "(other)"
|
||||
static const nsCString& ProviderKey();
|
||||
static void SetProviderDomain(const nsACString& aTRRDomain);
|
||||
|
||||
void InitTRRConnectionInfo() override;
|
||||
|
||||
|
|
|
@ -0,0 +1,103 @@
|
|||
/* vim:set ts=4 sw=2 sts=2 et cin: */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#ifndef mozilla_net_TRRSkippedReason_h__
|
||||
#define mozilla_net_TRRSkippedReason_h__
|
||||
|
||||
namespace mozilla {
|
||||
namespace net {
|
||||
|
||||
// IMPORTANT: when adding new values, always add them to the end, otherwise
|
||||
// it will mess up telemetry.
|
||||
// When adding a reason here, make sure it is documented in
|
||||
// netwerk/docs/dns/trr-skip-reasons.md
|
||||
enum class TRRSkippedReason : uint32_t {
|
||||
TRR_UNSET = 0,
|
||||
TRR_OK = 1, // Only set when we actually got a positive TRR result
|
||||
TRR_NO_GSERVICE = 2, // no gService
|
||||
TRR_PARENTAL_CONTROL = 3, // parental control is on
|
||||
TRR_OFF_EXPLICIT = 4, // user has set mode5
|
||||
TRR_REQ_MODE_DISABLED = 5, // request has disabled flags set
|
||||
TRR_MODE_NOT_ENABLED = 6, // mode0
|
||||
TRR_FAILED = 7, // unknown failure
|
||||
TRR_MODE_UNHANDLED_DEFAULT = 8, // Unhandled case in ComputeEffectiveMode
|
||||
TRR_MODE_UNHANDLED_DISABLED = 9, // Unhandled case in ComputeEffectiveMode
|
||||
TRR_DISABLED_FLAG = 10, // the DISABLE_TRR flag was set
|
||||
TRR_TIMEOUT = 11, // the TRR channel timed out
|
||||
TRR_CHANNEL_DNS_FAIL = 12, // DoH server name failed to resolve
|
||||
TRR_IS_OFFLINE = 13, // The browser is offline/no interfaces up
|
||||
TRR_NOT_CONFIRMED = 14, // TRR confirmation is not done yet
|
||||
TRR_DID_NOT_MAKE_QUERY = 15, // TrrLookup exited without doing a TRR query
|
||||
TRR_UNKNOWN_CHANNEL_FAILURE = 16, // unknown channel failure reason
|
||||
TRR_HOST_BLOCKED_TEMPORARY = 17, // host blocklisted
|
||||
TRR_SEND_FAILED = 18, // The call to TRR::SendHTTPRequest failed
|
||||
TRR_NET_RESET = 19, // NS_ERROR_NET_RESET
|
||||
TRR_NET_TIMEOUT = 20, // NS_ERROR_NET_TIMEOUT
|
||||
TRR_NET_REFUSED = 21, // NS_ERROR_CONNECTION_REFUSED
|
||||
TRR_NET_INTERRUPT = 22, // NS_ERROR_NET_INTERRUPT
|
||||
TRR_NET_INADEQ_SEQURITY = 23, // NS_ERROR_NET_INADEQUATE_SECURITY
|
||||
TRR_NO_ANSWERS = 24, // TRR returned no answers
|
||||
TRR_DECODE_FAILED = 25, // DohDecode failed
|
||||
TRR_EXCLUDED = 26, // ExcludedFromTRR
|
||||
TRR_SERVER_RESPONSE_ERR = 27, // Server responded with non-200 code
|
||||
TRR_RCODE_FAIL = 28, // DNS response contains a non-NOERROR rcode
|
||||
TRR_NO_CONNECTIVITY = 29, // Not confirmed because of no connectivity
|
||||
TRR_NXDOMAIN = 30, // DNS response contains NXDOMAIN rcode (0x03)
|
||||
TRR_REQ_CANCELLED = 31, // The request has been cancelled
|
||||
ODOH_KEY_NOT_USABLE = 32, // We don't have a valid ODoHConfig to use.
|
||||
ODOH_UPDATE_KEY_FAILED = 33, // Failed to update the ODoHConfigs.
|
||||
ODOH_KEY_NOT_AVAILABLE = 34, // ODoH requests timeout because of no key.
|
||||
ODOH_ENCRYPTION_FAILED = 35, // Failed to encrypt DNS packets.
|
||||
ODOH_DECRYPTION_FAILED = 36, // Failed to decrypt DNS packets.
|
||||
};
|
||||
|
||||
inline bool IsRelevantTRRSkipReason(TRRSkippedReason aReason) {
|
||||
// - TRR_REQ_MODE_DISABLED - these requests are intentionally skipping TRR.
|
||||
// These include DNS queries used to bootstrap the TRR connection,
|
||||
// captive portal checks, connectivity checks, etc.
|
||||
// Since we don't want to use TRR for these connections, we don't need
|
||||
// to include them with other relevant skip reasons.
|
||||
// - TRR_DISABLED_FLAG - This reason is used when retrying failed connections,
|
||||
// sync DNS resolves on the main thread, or requests coming from
|
||||
// webextensions that choose to skip TRR
|
||||
// - TRR_EXCLUDED - This reason is used when a certain domain is excluded
|
||||
// from TRR because it is explicitly set by the user, or because it
|
||||
// is part of the user's DNS suffix list, indicating a host that is likely
|
||||
// to be on the local network.
|
||||
if (aReason == TRRSkippedReason::TRR_REQ_MODE_DISABLED ||
|
||||
aReason == TRRSkippedReason::TRR_DISABLED_FLAG ||
|
||||
aReason == TRRSkippedReason::TRR_EXCLUDED) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
inline bool IsBlockedTRRRequest(TRRSkippedReason aReason) {
|
||||
// See TRR::MaybeBlockRequest. These are the reasons that could block sending
|
||||
// TRR requests.
|
||||
return (aReason == TRRSkippedReason::TRR_EXCLUDED ||
|
||||
aReason == TRRSkippedReason::TRR_MODE_NOT_ENABLED ||
|
||||
aReason == TRRSkippedReason::TRR_HOST_BLOCKED_TEMPORARY);
|
||||
}
|
||||
|
||||
inline bool IsNonRecoverableTRRSkipReason(TRRSkippedReason aReason) {
|
||||
// These are non-recoverable reasons and we'll fallback to native without
|
||||
// retrying.
|
||||
return (aReason == TRRSkippedReason::TRR_NXDOMAIN ||
|
||||
aReason == TRRSkippedReason::TRR_NO_ANSWERS ||
|
||||
aReason == TRRSkippedReason::TRR_DISABLED_FLAG ||
|
||||
aReason == TRRSkippedReason::TRR_RCODE_FAIL);
|
||||
}
|
||||
|
||||
inline bool IsFailedConfirmationOrNoConnectivity(TRRSkippedReason aReason) {
|
||||
// TRR is in non-confirmed state now, so we don't try to use TRR at all.
|
||||
return (aReason == TRRSkippedReason::TRR_NOT_CONFIRMED ||
|
||||
aReason == TRRSkippedReason::TRR_NO_CONNECTIVITY);
|
||||
}
|
||||
|
||||
} // namespace net
|
||||
} // namespace mozilla
|
||||
|
||||
#endif // mozilla_net_TRRSkippedReason_h__
|
|
@ -18,7 +18,6 @@ XPIDL_SOURCES += [
|
|||
"nsIEffectiveTLDService.idl",
|
||||
"nsIIDNService.idl",
|
||||
"nsINativeDNSResolverOverride.idl",
|
||||
"nsITRRSkipReason.idl",
|
||||
"nsPIDNSService.idl",
|
||||
]
|
||||
|
||||
|
|
|
@ -352,17 +352,11 @@ nsDNSRecord::ReportUnusable(uint16_t aPort) {
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDNSRecord::GetEffectiveTRRMode(nsIRequest::TRRMode* aMode) {
|
||||
nsDNSRecord::GetEffectiveTRRMode(uint32_t* aMode) {
|
||||
*aMode = mHostRecord->EffectiveTRRMode();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsDNSRecord::GetTrrSkipReason(
|
||||
nsITRRSkipReason::value* aTrrSkipReason) {
|
||||
*aTrrSkipReason = mHostRecord->TrrSkipReason();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDNSRecord::GetTtl(uint32_t* aTtl) { return mHostRecord->GetTtl(aTtl); }
|
||||
|
||||
|
@ -457,7 +451,7 @@ class nsDNSAsyncRequest final : public nsResolveHostCallback,
|
|||
nsDNSAsyncRequest(nsHostResolver* res, const nsACString& host,
|
||||
const nsACString& trrServer, uint16_t type,
|
||||
const OriginAttributes& attrs, nsIDNSListener* listener,
|
||||
nsIDNSService::DNSFlags flags, uint16_t af)
|
||||
uint16_t flags, uint16_t af)
|
||||
: mResolver(res),
|
||||
mHost(host),
|
||||
mTrrServer(trrServer),
|
||||
|
@ -482,7 +476,7 @@ class nsDNSAsyncRequest final : public nsResolveHostCallback,
|
|||
const OriginAttributes
|
||||
mOriginAttributes; // The originAttributes for this resolving
|
||||
nsCOMPtr<nsIDNSListener> mListener;
|
||||
nsIDNSService::DNSFlags mFlags = nsIDNSService::RESOLVE_DEFAULT_FLAGS;
|
||||
uint16_t mFlags = 0;
|
||||
uint16_t mAF = 0;
|
||||
|
||||
private:
|
||||
|
@ -498,8 +492,7 @@ void nsDNSAsyncRequest::OnResolveHostComplete(nsHostResolver* resolver,
|
|||
// the caller to be able to addref/release multiple times without
|
||||
// destroying the record prematurely.
|
||||
nsCOMPtr<nsIDNSRecord> rec;
|
||||
if (NS_SUCCEEDED(status) ||
|
||||
mFlags & nsIDNSService::RESOLVE_WANT_RECORD_ON_ERROR) {
|
||||
if (NS_SUCCEEDED(status)) {
|
||||
MOZ_ASSERT(hostRecord, "no host record");
|
||||
if (hostRecord->type != nsDNSService::RESOLVE_TYPE_DEFAULT) {
|
||||
rec = new nsDNSByTypeRecord(hostRecord);
|
||||
|
@ -982,7 +975,7 @@ nsresult nsDNSService::PreprocessHostname(bool aLocalDomain,
|
|||
}
|
||||
|
||||
nsresult nsDNSService::AsyncResolveInternal(
|
||||
const nsACString& aHostname, uint16_t type, nsIDNSService::DNSFlags flags,
|
||||
const nsACString& aHostname, uint16_t type, uint32_t flags,
|
||||
nsIDNSAdditionalInfo* aInfo, nsIDNSListener* aListener,
|
||||
nsIEventTarget* target_, const OriginAttributes& aOriginAttributes,
|
||||
nsICancelable** result) {
|
||||
|
@ -1065,7 +1058,7 @@ nsresult nsDNSService::AsyncResolveInternal(
|
|||
}
|
||||
|
||||
nsresult nsDNSService::CancelAsyncResolveInternal(
|
||||
const nsACString& aHostname, uint16_t aType, nsIDNSService::DNSFlags aFlags,
|
||||
const nsACString& aHostname, uint16_t aType, uint32_t aFlags,
|
||||
nsIDNSAdditionalInfo* aInfo, nsIDNSListener* aListener, nsresult aReason,
|
||||
const OriginAttributes& aOriginAttributes) {
|
||||
// grab reference to global host resolver and IDN service. beware
|
||||
|
@ -1104,8 +1097,7 @@ nsresult nsDNSService::CancelAsyncResolveInternal(
|
|||
|
||||
NS_IMETHODIMP
|
||||
nsDNSService::AsyncResolve(const nsACString& aHostname,
|
||||
nsIDNSService::ResolveType aType,
|
||||
nsIDNSService::DNSFlags flags,
|
||||
nsIDNSService::ResolveType aType, uint32_t flags,
|
||||
nsIDNSAdditionalInfo* aInfo,
|
||||
nsIDNSListener* listener, nsIEventTarget* target_,
|
||||
JS::Handle<JS::Value> aOriginAttributes,
|
||||
|
@ -1124,11 +1116,13 @@ nsDNSService::AsyncResolve(const nsACString& aHostname,
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDNSService::AsyncResolveNative(
|
||||
const nsACString& aHostname, nsIDNSService::ResolveType aType,
|
||||
nsIDNSService::DNSFlags flags, nsIDNSAdditionalInfo* aInfo,
|
||||
nsIDNSListener* aListener, nsIEventTarget* target_,
|
||||
const OriginAttributes& aOriginAttributes, nsICancelable** result) {
|
||||
nsDNSService::AsyncResolveNative(const nsACString& aHostname,
|
||||
nsIDNSService::ResolveType aType,
|
||||
uint32_t flags, nsIDNSAdditionalInfo* aInfo,
|
||||
nsIDNSListener* aListener,
|
||||
nsIEventTarget* target_,
|
||||
const OriginAttributes& aOriginAttributes,
|
||||
nsICancelable** result) {
|
||||
return AsyncResolveInternal(aHostname, aType, flags, aInfo, aListener,
|
||||
target_, aOriginAttributes, result);
|
||||
}
|
||||
|
@ -1144,8 +1138,7 @@ nsDNSService::NewAdditionalInfo(const nsACString& aTrrURL, int32_t aPort,
|
|||
NS_IMETHODIMP
|
||||
nsDNSService::CancelAsyncResolve(const nsACString& aHostname,
|
||||
nsIDNSService::ResolveType aType,
|
||||
nsIDNSService::DNSFlags aFlags,
|
||||
nsIDNSAdditionalInfo* aInfo,
|
||||
uint32_t aFlags, nsIDNSAdditionalInfo* aInfo,
|
||||
nsIDNSListener* aListener, nsresult aReason,
|
||||
JS::Handle<JS::Value> aOriginAttributes,
|
||||
JSContext* aCx, uint8_t aArgc) {
|
||||
|
@ -1164,16 +1157,14 @@ nsDNSService::CancelAsyncResolve(const nsACString& aHostname,
|
|||
NS_IMETHODIMP
|
||||
nsDNSService::CancelAsyncResolveNative(
|
||||
const nsACString& aHostname, nsIDNSService::ResolveType aType,
|
||||
nsIDNSService::DNSFlags aFlags, nsIDNSAdditionalInfo* aInfo,
|
||||
nsIDNSListener* aListener, nsresult aReason,
|
||||
const OriginAttributes& aOriginAttributes) {
|
||||
uint32_t aFlags, nsIDNSAdditionalInfo* aInfo, nsIDNSListener* aListener,
|
||||
nsresult aReason, const OriginAttributes& aOriginAttributes) {
|
||||
return CancelAsyncResolveInternal(aHostname, aType, aFlags, aInfo, aListener,
|
||||
aReason, aOriginAttributes);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDNSService::Resolve(const nsACString& aHostname,
|
||||
nsIDNSService::DNSFlags flags,
|
||||
nsDNSService::Resolve(const nsACString& aHostname, uint32_t flags,
|
||||
JS::Handle<JS::Value> aOriginAttributes, JSContext* aCx,
|
||||
uint8_t aArgc, nsIDNSRecord** result) {
|
||||
OriginAttributes attrs;
|
||||
|
@ -1188,8 +1179,7 @@ nsDNSService::Resolve(const nsACString& aHostname,
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDNSService::ResolveNative(const nsACString& aHostname,
|
||||
nsIDNSService::DNSFlags flags,
|
||||
nsDNSService::ResolveNative(const nsACString& aHostname, uint32_t flags,
|
||||
const OriginAttributes& aOriginAttributes,
|
||||
nsIDNSRecord** result) {
|
||||
// Synchronous resolution is not available on the main thread.
|
||||
|
@ -1201,13 +1191,13 @@ nsDNSService::ResolveNative(const nsACString& aHostname,
|
|||
}
|
||||
|
||||
nsresult nsDNSService::DeprecatedSyncResolve(
|
||||
const nsACString& aHostname, nsIDNSService::DNSFlags flags,
|
||||
const nsACString& aHostname, uint32_t flags,
|
||||
const OriginAttributes& aOriginAttributes, nsIDNSRecord** result) {
|
||||
return ResolveInternal(aHostname, flags, aOriginAttributes, result);
|
||||
}
|
||||
|
||||
nsresult nsDNSService::ResolveInternal(
|
||||
const nsACString& aHostname, nsIDNSService::DNSFlags flags,
|
||||
const nsACString& aHostname, uint32_t flags,
|
||||
const OriginAttributes& aOriginAttributes, nsIDNSRecord** result) {
|
||||
// grab reference to global host resolver and IDN service. beware
|
||||
// simultaneous shutdown!!
|
||||
|
@ -1342,8 +1332,7 @@ nsDNSService::Observe(nsISupports* subject, const char* topic,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
uint16_t nsDNSService::GetAFForLookup(const nsACString& host,
|
||||
nsIDNSService::DNSFlags flags) {
|
||||
uint16_t nsDNSService::GetAFForLookup(const nsACString& host, uint32_t flags) {
|
||||
if (mDisableIPv6 || (flags & RESOLVE_DISABLE_IPV6)) {
|
||||
return PR_AF_INET;
|
||||
}
|
||||
|
@ -1437,12 +1426,6 @@ nsDNSService::SetDetectedTrrURI(const nsACString& aURI) {
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDNSService::GetTRRSkipReasonName(nsITRRSkipReason::value aValue,
|
||||
nsACString& aName) {
|
||||
return mozilla::net::GetTRRSkipReasonName(aValue, aName);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDNSService::GetCurrentTrrURI(nsACString& aURI) {
|
||||
if (mTrrService) {
|
||||
|
@ -1469,20 +1452,6 @@ nsDNSService::GetCurrentTrrConfirmationState(uint32_t* aConfirmationState) {
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDNSService::GetTrrDomain(nsACString& aTRRDomain) {
|
||||
nsAutoCString url;
|
||||
if (mTrrService) {
|
||||
mTrrService->GetURI(url);
|
||||
}
|
||||
nsCOMPtr<nsIURI> uri;
|
||||
nsresult rv = NS_NewURI(getter_AddRefs(uri), url);
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
}
|
||||
return uri->GetHost(aTRRDomain);
|
||||
}
|
||||
|
||||
size_t nsDNSService::SizeOfIncludingThis(
|
||||
mozilla::MallocSizeOf mallocSizeOf) const {
|
||||
// Measurement of the following members may be added later if DMD finds it
|
||||
|
@ -1549,163 +1518,3 @@ nsDNSService::ResetExcludedSVCDomainName(const nsACString& aOwnerName) {
|
|||
mFailedSVCDomainNames.Remove(aOwnerName);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
namespace mozilla::net {
|
||||
nsresult GetTRRSkipReasonName(TRRSkippedReason aReason, nsACString& aName) {
|
||||
static_assert(TRRSkippedReason::TRR_UNSET == 0);
|
||||
static_assert(TRRSkippedReason::TRR_OK == 1);
|
||||
static_assert(TRRSkippedReason::TRR_NO_GSERVICE == 2);
|
||||
static_assert(TRRSkippedReason::TRR_PARENTAL_CONTROL == 3);
|
||||
static_assert(TRRSkippedReason::TRR_OFF_EXPLICIT == 4);
|
||||
static_assert(TRRSkippedReason::TRR_REQ_MODE_DISABLED == 5);
|
||||
static_assert(TRRSkippedReason::TRR_MODE_NOT_ENABLED == 6);
|
||||
static_assert(TRRSkippedReason::TRR_FAILED == 7);
|
||||
static_assert(TRRSkippedReason::TRR_MODE_UNHANDLED_DEFAULT == 8);
|
||||
static_assert(TRRSkippedReason::TRR_MODE_UNHANDLED_DISABLED == 9);
|
||||
static_assert(TRRSkippedReason::TRR_DISABLED_FLAG == 10);
|
||||
static_assert(TRRSkippedReason::TRR_TIMEOUT == 11);
|
||||
static_assert(TRRSkippedReason::TRR_CHANNEL_DNS_FAIL == 12);
|
||||
static_assert(TRRSkippedReason::TRR_IS_OFFLINE == 13);
|
||||
static_assert(TRRSkippedReason::TRR_NOT_CONFIRMED == 14);
|
||||
static_assert(TRRSkippedReason::TRR_DID_NOT_MAKE_QUERY == 15);
|
||||
static_assert(TRRSkippedReason::TRR_UNKNOWN_CHANNEL_FAILURE == 16);
|
||||
static_assert(TRRSkippedReason::TRR_HOST_BLOCKED_TEMPORARY == 17);
|
||||
static_assert(TRRSkippedReason::TRR_SEND_FAILED == 18);
|
||||
static_assert(TRRSkippedReason::TRR_NET_RESET == 19);
|
||||
static_assert(TRRSkippedReason::TRR_NET_TIMEOUT == 20);
|
||||
static_assert(TRRSkippedReason::TRR_NET_REFUSED == 21);
|
||||
static_assert(TRRSkippedReason::TRR_NET_INTERRUPT == 22);
|
||||
static_assert(TRRSkippedReason::TRR_NET_INADEQ_SEQURITY == 23);
|
||||
static_assert(TRRSkippedReason::TRR_NO_ANSWERS == 24);
|
||||
static_assert(TRRSkippedReason::TRR_DECODE_FAILED == 25);
|
||||
static_assert(TRRSkippedReason::TRR_EXCLUDED == 26);
|
||||
static_assert(TRRSkippedReason::TRR_SERVER_RESPONSE_ERR == 27);
|
||||
static_assert(TRRSkippedReason::TRR_RCODE_FAIL == 28);
|
||||
static_assert(TRRSkippedReason::TRR_NO_CONNECTIVITY == 29);
|
||||
static_assert(TRRSkippedReason::TRR_NXDOMAIN == 30);
|
||||
static_assert(TRRSkippedReason::TRR_REQ_CANCELLED == 31);
|
||||
static_assert(TRRSkippedReason::ODOH_KEY_NOT_USABLE == 32);
|
||||
static_assert(TRRSkippedReason::ODOH_UPDATE_KEY_FAILED == 33);
|
||||
static_assert(TRRSkippedReason::ODOH_KEY_NOT_AVAILABLE == 34);
|
||||
static_assert(TRRSkippedReason::ODOH_ENCRYPTION_FAILED == 35);
|
||||
static_assert(TRRSkippedReason::ODOH_DECRYPTION_FAILED == 36);
|
||||
|
||||
switch (aReason) {
|
||||
case TRRSkippedReason::TRR_UNSET:
|
||||
aName = "TRR_UNSET"_ns;
|
||||
break;
|
||||
case TRRSkippedReason::TRR_OK:
|
||||
aName = "TRR_OK"_ns;
|
||||
break;
|
||||
case TRRSkippedReason::TRR_NO_GSERVICE:
|
||||
aName = "TRR_NO_GSERVICE"_ns;
|
||||
break;
|
||||
case TRRSkippedReason::TRR_PARENTAL_CONTROL:
|
||||
aName = "TRR_PARENTAL_CONTROL"_ns;
|
||||
break;
|
||||
case TRRSkippedReason::TRR_OFF_EXPLICIT:
|
||||
aName = "TRR_OFF_EXPLICIT"_ns;
|
||||
break;
|
||||
case TRRSkippedReason::TRR_REQ_MODE_DISABLED:
|
||||
aName = "TRR_REQ_MODE_DISABLED"_ns;
|
||||
break;
|
||||
case TRRSkippedReason::TRR_MODE_NOT_ENABLED:
|
||||
aName = "TRR_MODE_NOT_ENABLED"_ns;
|
||||
break;
|
||||
case TRRSkippedReason::TRR_FAILED:
|
||||
aName = "TRR_FAILED"_ns;
|
||||
break;
|
||||
case TRRSkippedReason::TRR_MODE_UNHANDLED_DEFAULT:
|
||||
aName = "TRR_MODE_UNHANDLED_DEFAULT"_ns;
|
||||
break;
|
||||
case TRRSkippedReason::TRR_MODE_UNHANDLED_DISABLED:
|
||||
aName = "TRR_MODE_UNHANDLED_DISABLED"_ns;
|
||||
break;
|
||||
case TRRSkippedReason::TRR_DISABLED_FLAG:
|
||||
aName = "TRR_DISABLED_FLAG"_ns;
|
||||
break;
|
||||
case TRRSkippedReason::TRR_TIMEOUT:
|
||||
aName = "TRR_TIMEOUT"_ns;
|
||||
break;
|
||||
case TRRSkippedReason::TRR_CHANNEL_DNS_FAIL:
|
||||
aName = "TRR_CHANNEL_DNS_FAIL"_ns;
|
||||
break;
|
||||
case TRRSkippedReason::TRR_IS_OFFLINE:
|
||||
aName = "TRR_IS_OFFLINE"_ns;
|
||||
break;
|
||||
case TRRSkippedReason::TRR_NOT_CONFIRMED:
|
||||
aName = "TRR_NOT_CONFIRMED"_ns;
|
||||
break;
|
||||
case TRRSkippedReason::TRR_DID_NOT_MAKE_QUERY:
|
||||
aName = "TRR_DID_NOT_MAKE_QUERY"_ns;
|
||||
break;
|
||||
case TRRSkippedReason::TRR_UNKNOWN_CHANNEL_FAILURE:
|
||||
aName = "TRR_UNKNOWN_CHANNEL_FAILURE"_ns;
|
||||
break;
|
||||
case TRRSkippedReason::TRR_HOST_BLOCKED_TEMPORARY:
|
||||
aName = "TRR_HOST_BLOCKED_TEMPORARY"_ns;
|
||||
break;
|
||||
case TRRSkippedReason::TRR_SEND_FAILED:
|
||||
aName = "TRR_SEND_FAILED"_ns;
|
||||
break;
|
||||
case TRRSkippedReason::TRR_NET_RESET:
|
||||
aName = "TRR_NET_RESET"_ns;
|
||||
break;
|
||||
case TRRSkippedReason::TRR_NET_TIMEOUT:
|
||||
aName = "TRR_NET_TIMEOUT"_ns;
|
||||
break;
|
||||
case TRRSkippedReason::TRR_NET_REFUSED:
|
||||
aName = "TRR_NET_REFUSED"_ns;
|
||||
break;
|
||||
case TRRSkippedReason::TRR_NET_INTERRUPT:
|
||||
aName = "TRR_NET_INTERRUPT"_ns;
|
||||
break;
|
||||
case TRRSkippedReason::TRR_NET_INADEQ_SEQURITY:
|
||||
aName = "TRR_NET_INADEQ_SEQURITY"_ns;
|
||||
break;
|
||||
case TRRSkippedReason::TRR_NO_ANSWERS:
|
||||
aName = "TRR_NO_ANSWERS"_ns;
|
||||
break;
|
||||
case TRRSkippedReason::TRR_DECODE_FAILED:
|
||||
aName = "TRR_DECODE_FAILED"_ns;
|
||||
break;
|
||||
case TRRSkippedReason::TRR_EXCLUDED:
|
||||
aName = "TRR_EXCLUDED"_ns;
|
||||
break;
|
||||
case TRRSkippedReason::TRR_SERVER_RESPONSE_ERR:
|
||||
aName = "TRR_SERVER_RESPONSE_ERR"_ns;
|
||||
break;
|
||||
case TRRSkippedReason::TRR_RCODE_FAIL:
|
||||
aName = "TRR_RCODE_FAIL"_ns;
|
||||
break;
|
||||
case TRRSkippedReason::TRR_NO_CONNECTIVITY:
|
||||
aName = "TRR_NO_CONNECTIVITY"_ns;
|
||||
break;
|
||||
case TRRSkippedReason::TRR_NXDOMAIN:
|
||||
aName = "TRR_NXDOMAIN"_ns;
|
||||
break;
|
||||
case TRRSkippedReason::TRR_REQ_CANCELLED:
|
||||
aName = "TRR_REQ_CANCELLED"_ns;
|
||||
break;
|
||||
case TRRSkippedReason::ODOH_KEY_NOT_USABLE:
|
||||
aName = "ODOH_KEY_NOT_USABLE"_ns;
|
||||
break;
|
||||
case TRRSkippedReason::ODOH_UPDATE_KEY_FAILED:
|
||||
aName = "ODOH_UPDATE_KEY_FAILED"_ns;
|
||||
break;
|
||||
case TRRSkippedReason::ODOH_KEY_NOT_AVAILABLE:
|
||||
aName = "ODOH_KEY_NOT_AVAILABLE"_ns;
|
||||
break;
|
||||
case TRRSkippedReason::ODOH_ENCRYPTION_FAILED:
|
||||
aName = "ODOH_ENCRYPTION_FAILED"_ns;
|
||||
break;
|
||||
case TRRSkippedReason::ODOH_DECRYPTION_FAILED:
|
||||
aName = "ODOH_DECRYPTION_FAILED"_ns;
|
||||
break;
|
||||
default:
|
||||
MOZ_ASSERT(false, "Unknown value");
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
} // namespace mozilla::net
|
||||
|
|
|
@ -67,7 +67,7 @@ class nsDNSService final : public mozilla::net::DNSServiceBase,
|
|||
friend class DNSServiceWrapper;
|
||||
|
||||
nsresult DeprecatedSyncResolve(
|
||||
const nsACString& aHostname, nsIDNSService::DNSFlags flags,
|
||||
const nsACString& aHostname, uint32_t flags,
|
||||
const mozilla::OriginAttributes& aOriginAttributes,
|
||||
nsIDNSRecord** result);
|
||||
|
||||
|
@ -77,27 +77,24 @@ class nsDNSService final : public mozilla::net::DNSServiceBase,
|
|||
void ReadPrefs(const char* name) override;
|
||||
static already_AddRefed<nsDNSService> GetSingleton();
|
||||
|
||||
uint16_t GetAFForLookup(const nsACString& host,
|
||||
nsIDNSService::DNSFlags flags);
|
||||
uint16_t GetAFForLookup(const nsACString& host, uint32_t flags);
|
||||
|
||||
nsresult PreprocessHostname(bool aLocalDomain, const nsACString& aInput,
|
||||
nsIIDNService* aIDN, nsACString& aACE);
|
||||
|
||||
nsresult AsyncResolveInternal(
|
||||
const nsACString& aHostname, uint16_t type, nsIDNSService::DNSFlags flags,
|
||||
const nsACString& aHostname, uint16_t type, uint32_t flags,
|
||||
nsIDNSAdditionalInfo* aInfo, nsIDNSListener* aListener,
|
||||
nsIEventTarget* target_,
|
||||
const mozilla::OriginAttributes& aOriginAttributes,
|
||||
nsICancelable** result);
|
||||
|
||||
nsresult CancelAsyncResolveInternal(
|
||||
const nsACString& aHostname, uint16_t aType,
|
||||
nsIDNSService::DNSFlags aFlags, nsIDNSAdditionalInfo* aInfo,
|
||||
nsIDNSListener* aListener, nsresult aReason,
|
||||
const nsACString& aHostname, uint16_t aType, uint32_t aFlags,
|
||||
nsIDNSAdditionalInfo* aInfo, nsIDNSListener* aListener, nsresult aReason,
|
||||
const mozilla::OriginAttributes& aOriginAttributes);
|
||||
|
||||
nsresult ResolveInternal(const nsACString& aHostname,
|
||||
nsIDNSService::DNSFlags flags,
|
||||
nsresult ResolveInternal(const nsACString& aHostname, uint32_t flags,
|
||||
const mozilla::OriginAttributes& aOriginAttributes,
|
||||
nsIDNSRecord** result);
|
||||
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
#include "TRRQuery.h"
|
||||
// Put DNSLogging.h at the end to avoid LOG being overwritten by other headers.
|
||||
#include "DNSLogging.h"
|
||||
#include "TRRSkippedReason.h"
|
||||
#include "mozilla/StaticPrefs_network.h"
|
||||
#include "mozilla/Telemetry.h"
|
||||
#include "TRRService.h"
|
||||
|
@ -29,8 +30,8 @@ using namespace mozilla;
|
|||
using namespace mozilla::net;
|
||||
|
||||
nsHostKey::nsHostKey(const nsACString& aHost, const nsACString& aTrrServer,
|
||||
uint16_t aType, nsIDNSService::DNSFlags aFlags,
|
||||
uint16_t aAf, bool aPb, const nsACString& aOriginsuffix)
|
||||
uint16_t aType, uint16_t aFlags, uint16_t aAf, bool aPb,
|
||||
const nsACString& aOriginsuffix)
|
||||
: host(aHost),
|
||||
mTrrServer(aTrrServer),
|
||||
type(aType),
|
||||
|
@ -119,7 +120,7 @@ void nsHostRecord::CopyExpirationTimesAndFlagsFrom(
|
|||
}
|
||||
|
||||
bool nsHostRecord::HasUsableResult(const mozilla::TimeStamp& now,
|
||||
nsIDNSService::DNSFlags queryFlags) const {
|
||||
uint16_t queryFlags) const {
|
||||
if (mDoomed) {
|
||||
return false;
|
||||
}
|
||||
|
@ -221,8 +222,8 @@ size_t AddrHostRecord::SizeOfIncludingThis(MallocSizeOf mallocSizeOf) const {
|
|||
return n;
|
||||
}
|
||||
|
||||
bool AddrHostRecord::HasUsableResultInternal(
|
||||
const mozilla::TimeStamp& now, nsIDNSService::DNSFlags queryFlags) const {
|
||||
bool AddrHostRecord::HasUsableResultInternal(const mozilla::TimeStamp& now,
|
||||
uint16_t queryFlags) const {
|
||||
// don't use cached negative results for high priority queries.
|
||||
if (negative && IsHighPriority(queryFlags)) {
|
||||
return false;
|
||||
|
@ -411,8 +412,7 @@ void AddrHostRecord::ResolveComplete() {
|
|||
}
|
||||
}
|
||||
|
||||
AddrHostRecord::DnsPriority AddrHostRecord::GetPriority(
|
||||
nsIDNSService::DNSFlags aFlags) {
|
||||
AddrHostRecord::DnsPriority AddrHostRecord::GetPriority(uint16_t aFlags) {
|
||||
if (IsHighPriority(aFlags)) {
|
||||
return AddrHostRecord::DNS_PRIORITY_HIGH;
|
||||
}
|
||||
|
@ -441,8 +441,8 @@ TypeHostRecord::TypeHostRecord(const nsHostKey& key)
|
|||
|
||||
TypeHostRecord::~TypeHostRecord() { mCallbacks.clear(); }
|
||||
|
||||
bool TypeHostRecord::HasUsableResultInternal(
|
||||
const mozilla::TimeStamp& now, nsIDNSService::DNSFlags queryFlags) const {
|
||||
bool TypeHostRecord::HasUsableResultInternal(const mozilla::TimeStamp& now,
|
||||
uint16_t queryFlags) const {
|
||||
if (CheckExpiration(now) == EXP_EXPIRED) {
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
#include "nsIDNSService.h"
|
||||
#include "nsIDNSByTypeRecord.h"
|
||||
#include "PLDHashTable.h"
|
||||
#include "nsITRRSkipReason.h"
|
||||
#include "TRRSkippedReason.h"
|
||||
|
||||
class nsHostRecord;
|
||||
class nsHostResolver;
|
||||
|
@ -79,13 +79,13 @@ struct nsHostKey {
|
|||
const nsCString host;
|
||||
const nsCString mTrrServer;
|
||||
uint16_t type = 0;
|
||||
nsIDNSService::DNSFlags flags = nsIDNSService::RESOLVE_DEFAULT_FLAGS;
|
||||
uint16_t flags = 0;
|
||||
uint16_t af = 0;
|
||||
bool pb = false;
|
||||
const nsCString originSuffix;
|
||||
explicit nsHostKey(const nsACString& host, const nsACString& aTrrServer,
|
||||
uint16_t type, nsIDNSService::DNSFlags flags, uint16_t af,
|
||||
bool pb, const nsACString& originSuffix);
|
||||
uint16_t type, uint16_t flags, uint16_t af, bool pb,
|
||||
const nsACString& originSuffix);
|
||||
bool operator==(const nsHostKey& other) const;
|
||||
size_t SizeOfExcludingThis(mozilla::MallocSizeOf mallocSizeOf) const;
|
||||
PLDHashNumber Hash() const;
|
||||
|
@ -150,15 +150,13 @@ class nsHostRecord : public mozilla::LinkedListElement<RefPtr<nsHostRecord>>,
|
|||
|
||||
// Checks if the record is usable (not expired and has a value)
|
||||
bool HasUsableResult(const mozilla::TimeStamp& now,
|
||||
nsIDNSService::DNSFlags queryFlags =
|
||||
nsIDNSService::RESOLVE_DEFAULT_FLAGS) const;
|
||||
uint16_t queryFlags = 0) const;
|
||||
|
||||
static DnsPriority GetPriority(nsIDNSService::DNSFlags aFlags);
|
||||
static DnsPriority GetPriority(uint16_t aFlags);
|
||||
|
||||
virtual void Cancel();
|
||||
virtual bool HasUsableResultInternal(
|
||||
const mozilla::TimeStamp& now,
|
||||
nsIDNSService::DNSFlags queryFlags) const = 0;
|
||||
virtual bool HasUsableResultInternal(const mozilla::TimeStamp& now,
|
||||
uint16_t queryFlags) const = 0;
|
||||
virtual bool RefreshForNegativeResponse() const { return true; }
|
||||
|
||||
mozilla::LinkedList<RefPtr<nsResolveHostCallback>> mCallbacks;
|
||||
|
@ -195,11 +193,9 @@ class nsHostRecord : public mozilla::LinkedListElement<RefPtr<nsHostRecord>>,
|
|||
// default resolver and the TRRMode encoded in the flags.
|
||||
// The mode into account if the TRR service is disabled,
|
||||
// parental controls are on, domain matches exclusion list, etc.
|
||||
mozilla::Atomic<nsIRequest::TRRMode> mEffectiveTRRMode{
|
||||
nsIRequest::TRR_DEFAULT_MODE};
|
||||
nsIRequest::TRRMode mEffectiveTRRMode = nsIRequest::TRR_DEFAULT_MODE;
|
||||
|
||||
mozilla::Atomic<TRRSkippedReason> mTRRSkippedReason{
|
||||
TRRSkippedReason::TRR_UNSET};
|
||||
TRRSkippedReason mTRRSkippedReason = TRRSkippedReason::TRR_UNSET;
|
||||
TRRSkippedReason mFirstTRRSkippedReason = TRRSkippedReason::TRR_UNSET;
|
||||
|
||||
mozilla::DataMutex<RefPtr<mozilla::net::TRRQuery>> mTRRQuery;
|
||||
|
@ -273,7 +269,6 @@ class AddrHostRecord final : public nsHostRecord {
|
|||
size_t SizeOfIncludingThis(mozilla::MallocSizeOf mallocSizeOf) const override;
|
||||
|
||||
nsIRequest::TRRMode EffectiveTRRMode() const { return mEffectiveTRRMode; }
|
||||
nsITRRSkipReason::value TrrSkipReason() const { return mTRRSkippedReason; }
|
||||
|
||||
nsresult GetTtl(uint32_t* aResult);
|
||||
|
||||
|
@ -287,9 +282,8 @@ class AddrHostRecord final : public nsHostRecord {
|
|||
~AddrHostRecord();
|
||||
|
||||
// Checks if the record is usable (not expired and has a value)
|
||||
bool HasUsableResultInternal(
|
||||
const mozilla::TimeStamp& now,
|
||||
nsIDNSService::DNSFlags queryFlags) const override;
|
||||
bool HasUsableResultInternal(const mozilla::TimeStamp& now,
|
||||
uint16_t queryFlags) const override;
|
||||
|
||||
bool RemoveOrRefresh(bool aTrrToo); // Mark records currently being resolved
|
||||
// as needed to resolve again.
|
||||
|
@ -299,7 +293,7 @@ class AddrHostRecord final : public nsHostRecord {
|
|||
void NotifyRetryingTrr();
|
||||
void ResolveComplete();
|
||||
|
||||
static DnsPriority GetPriority(nsIDNSService::DNSFlags aFlags);
|
||||
static DnsPriority GetPriority(uint16_t aFlags);
|
||||
|
||||
// true if pending and on the queue (not yet given to getaddrinfo())
|
||||
bool onQueue() { return LoadNative() && isInList(); }
|
||||
|
@ -380,9 +374,8 @@ class TypeHostRecord final : public nsHostRecord,
|
|||
~TypeHostRecord();
|
||||
|
||||
// Checks if the record is usable (not expired and has a value)
|
||||
bool HasUsableResultInternal(
|
||||
const mozilla::TimeStamp& now,
|
||||
nsIDNSService::DNSFlags queryFlags) const override;
|
||||
bool HasUsableResultInternal(const mozilla::TimeStamp& now,
|
||||
uint16_t queryFlags) const override;
|
||||
bool RefreshForNegativeResponse() const override;
|
||||
|
||||
mozilla::net::TypeRecordResultType mResults = AsVariant(mozilla::Nothing());
|
||||
|
@ -397,16 +390,16 @@ class TypeHostRecord final : public nsHostRecord,
|
|||
|
||||
NS_DEFINE_STATIC_IID_ACCESSOR(TypeHostRecord, TYPEHOSTRECORD_IID)
|
||||
|
||||
static inline bool IsHighPriority(nsIDNSService::DNSFlags flags) {
|
||||
static inline bool IsHighPriority(uint16_t flags) {
|
||||
return !(flags & (nsHostRecord::DNS_PRIORITY_LOW |
|
||||
nsHostRecord::DNS_PRIORITY_MEDIUM));
|
||||
}
|
||||
|
||||
static inline bool IsMediumPriority(nsIDNSService::DNSFlags flags) {
|
||||
static inline bool IsMediumPriority(uint16_t flags) {
|
||||
return flags & nsHostRecord::DNS_PRIORITY_MEDIUM;
|
||||
}
|
||||
|
||||
static inline bool IsLowPriority(nsIDNSService::DNSFlags flags) {
|
||||
static inline bool IsLowPriority(uint16_t flags) {
|
||||
return flags & nsHostRecord::DNS_PRIORITY_LOW;
|
||||
}
|
||||
|
||||
|
|
|
@ -350,10 +350,12 @@ void nsHostResolver::Shutdown() {
|
|||
}
|
||||
}
|
||||
|
||||
nsresult nsHostResolver::GetHostRecord(
|
||||
const nsACString& host, const nsACString& aTrrServer, uint16_t type,
|
||||
nsIDNSService::DNSFlags flags, uint16_t af, bool pb,
|
||||
const nsCString& originSuffix, nsHostRecord** result) {
|
||||
nsresult nsHostResolver::GetHostRecord(const nsACString& host,
|
||||
const nsACString& aTrrServer,
|
||||
uint16_t type, uint16_t flags,
|
||||
uint16_t af, bool pb,
|
||||
const nsCString& originSuffix,
|
||||
nsHostRecord** result) {
|
||||
MutexAutoLock lock(mLock);
|
||||
nsHostKey key(host, aTrrServer, type, flags, af, pb, originSuffix);
|
||||
|
||||
|
@ -418,7 +420,7 @@ nsresult nsHostResolver::ResolveHost(const nsACString& aHost,
|
|||
const nsACString& aTrrServer,
|
||||
int32_t aPort, uint16_t type,
|
||||
const OriginAttributes& aOriginAttributes,
|
||||
nsIDNSService::DNSFlags flags, uint16_t af,
|
||||
uint16_t flags, uint16_t af,
|
||||
nsResolveHostCallback* aCallback) {
|
||||
nsAutoCString host(aHost);
|
||||
NS_ENSURE_TRUE(!host.IsEmpty(), NS_ERROR_UNEXPECTED);
|
||||
|
@ -478,7 +480,7 @@ nsresult nsHostResolver::ResolveHost(const nsACString& aHost,
|
|||
|
||||
bool excludedFromTRR = false;
|
||||
if (TRRService::Get() && TRRService::Get()->IsExcludedFromTRR(host)) {
|
||||
flags |= nsIDNSService::RESOLVE_DISABLE_TRR;
|
||||
flags |= RES_DISABLE_TRR;
|
||||
excludedFromTRR = true;
|
||||
|
||||
if (!aTrrServer.IsEmpty()) {
|
||||
|
@ -679,8 +681,8 @@ already_AddRefed<nsHostRecord> nsHostResolver::FromIPLiteral(
|
|||
|
||||
already_AddRefed<nsHostRecord> nsHostResolver::FromUnspecEntry(
|
||||
nsHostRecord* aRec, const nsACString& aHost, const nsACString& aTrrServer,
|
||||
const nsACString& aOriginSuffix, uint16_t aType,
|
||||
nsIDNSService::DNSFlags aFlags, uint16_t af, bool aPb, nsresult& aStatus) {
|
||||
const nsACString& aOriginSuffix, uint16_t aType, uint16_t aFlags,
|
||||
uint16_t af, bool aPb, nsresult& aStatus) {
|
||||
RefPtr<nsHostRecord> result = nullptr;
|
||||
// If this is an IPV4 or IPV6 specific request, check if there is
|
||||
// an AF_UNSPEC entry we can use. Otherwise, hit the resolver...
|
||||
|
@ -771,8 +773,8 @@ already_AddRefed<nsHostRecord> nsHostResolver::FromUnspecEntry(
|
|||
|
||||
void nsHostResolver::DetachCallback(
|
||||
const nsACString& host, const nsACString& aTrrServer, uint16_t aType,
|
||||
const OriginAttributes& aOriginAttributes, nsIDNSService::DNSFlags flags,
|
||||
uint16_t af, nsResolveHostCallback* aCallback, nsresult status) {
|
||||
const OriginAttributes& aOriginAttributes, uint16_t flags, uint16_t af,
|
||||
nsResolveHostCallback* aCallback, nsresult status) {
|
||||
RefPtr<nsHostRecord> rec;
|
||||
RefPtr<nsResolveHostCallback> callback(aCallback);
|
||||
|
||||
|
@ -1106,7 +1108,7 @@ nsresult nsHostResolver::NameLookup(nsHostRecord* rec,
|
|||
return NS_ERROR_UNKNOWN_HOST;
|
||||
}
|
||||
|
||||
if (rec->flags & nsIDNSService::RESOLVE_DISABLE_TRR) {
|
||||
if (rec->flags & RES_DISABLE_TRR) {
|
||||
LOG(("TRR with server and DISABLE_TRR flag. Returning error."));
|
||||
return NS_ERROR_UNKNOWN_HOST;
|
||||
}
|
||||
|
@ -1114,24 +1116,22 @@ nsresult nsHostResolver::NameLookup(nsHostRecord* rec,
|
|||
}
|
||||
|
||||
LOG(("NameLookup: %s effectiveTRRmode: %d flags: %X", rec->host.get(),
|
||||
static_cast<nsIRequest::TRRMode>(rec->mEffectiveTRRMode), rec->flags));
|
||||
rec->mEffectiveTRRMode, rec->flags));
|
||||
|
||||
if (rec->flags & nsIDNSService::RESOLVE_DISABLE_TRR) {
|
||||
if (rec->flags & RES_DISABLE_TRR) {
|
||||
rec->RecordReason(TRRSkippedReason::TRR_DISABLED_FLAG);
|
||||
}
|
||||
|
||||
bool serviceNotReady = !TRRServiceEnabledForRecord(rec);
|
||||
|
||||
if (rec->mEffectiveTRRMode != nsIRequest::TRR_DISABLED_MODE &&
|
||||
!((rec->flags & nsIDNSService::RESOLVE_DISABLE_TRR)) &&
|
||||
!serviceNotReady) {
|
||||
!((rec->flags & RES_DISABLE_TRR)) && !serviceNotReady) {
|
||||
rv = TrrLookup(rec, aLock);
|
||||
}
|
||||
|
||||
if (rec->mEffectiveTRRMode == nsIRequest::TRR_DISABLED_MODE ||
|
||||
(rec->mEffectiveTRRMode == nsIRequest::TRR_FIRST_MODE &&
|
||||
(rec->flags & nsIDNSService::RESOLVE_DISABLE_TRR || serviceNotReady ||
|
||||
NS_FAILED(rv)))) {
|
||||
(rec->flags & RES_DISABLE_TRR || serviceNotReady || NS_FAILED(rv)))) {
|
||||
if (!rec->IsAddrRecord()) {
|
||||
return rv;
|
||||
}
|
||||
|
@ -1558,9 +1558,7 @@ nsHostResolver::LookupStatus nsHostResolver::CompleteLookupLocked(
|
|||
!rec->mResolving && sGetTtlEnabled) {
|
||||
LOG(("Issuing second async lookup for TTL for host [%s].",
|
||||
addrRec->host.get()));
|
||||
addrRec->flags =
|
||||
(addrRec->flags & ~nsIDNSService::RESOLVE_PRIORITY_MEDIUM) |
|
||||
nsIDNSService::RESOLVE_PRIORITY_LOW;
|
||||
addrRec->flags = (addrRec->flags & ~RES_PRIORITY_MEDIUM) | RES_PRIORITY_LOW;
|
||||
DebugOnly<nsresult> rv = NativeLookup(rec, aLock);
|
||||
NS_WARNING_ASSERTION(NS_SUCCEEDED(rv),
|
||||
"Could not issue second async lookup for TTL.");
|
||||
|
@ -1646,8 +1644,8 @@ nsHostResolver::LookupStatus nsHostResolver::CompleteLookupByTypeLocked(
|
|||
|
||||
void nsHostResolver::CancelAsyncRequest(
|
||||
const nsACString& host, const nsACString& aTrrServer, uint16_t aType,
|
||||
const OriginAttributes& aOriginAttributes, nsIDNSService::DNSFlags flags,
|
||||
uint16_t af, nsIDNSListener* aListener, nsresult status)
|
||||
const OriginAttributes& aOriginAttributes, uint16_t flags, uint16_t af,
|
||||
nsIDNSListener* aListener, nsresult status)
|
||||
|
||||
{
|
||||
MutexAutoLock lock(mLock);
|
||||
|
|
|
@ -70,8 +70,8 @@ class AHostResolver {
|
|||
uint32_t aTtl, bool pb) = 0;
|
||||
virtual nsresult GetHostRecord(const nsACString& host,
|
||||
const nsACString& aTrrServer, uint16_t type,
|
||||
nsIDNSService::DNSFlags flags, uint16_t af,
|
||||
bool pb, const nsCString& originSuffix,
|
||||
uint16_t flags, uint16_t af, bool pb,
|
||||
const nsCString& originSuffix,
|
||||
nsHostRecord** result) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
@ -123,7 +123,7 @@ class nsHostResolver : public nsISupports, public AHostResolver {
|
|||
nsresult ResolveHost(const nsACString& aHost, const nsACString& trrServer,
|
||||
int32_t aPort, uint16_t type,
|
||||
const mozilla::OriginAttributes& aOriginAttributes,
|
||||
nsIDNSService::DNSFlags flags, uint16_t af,
|
||||
uint16_t flags, uint16_t af,
|
||||
nsResolveHostCallback* callback);
|
||||
|
||||
nsHostRecord* InitRecord(const nsHostKey& key);
|
||||
|
@ -147,7 +147,7 @@ class nsHostResolver : public nsISupports, public AHostResolver {
|
|||
void DetachCallback(const nsACString& hostname, const nsACString& trrServer,
|
||||
uint16_t type,
|
||||
const mozilla::OriginAttributes& aOriginAttributes,
|
||||
nsIDNSService::DNSFlags flags, uint16_t af,
|
||||
uint16_t flags, uint16_t af,
|
||||
nsResolveHostCallback* callback, nsresult status);
|
||||
|
||||
/**
|
||||
|
@ -160,7 +160,7 @@ class nsHostResolver : public nsISupports, public AHostResolver {
|
|||
void CancelAsyncRequest(const nsACString& host, const nsACString& trrServer,
|
||||
uint16_t type,
|
||||
const mozilla::OriginAttributes& aOriginAttributes,
|
||||
nsIDNSService::DNSFlags flags, uint16_t af,
|
||||
uint16_t flags, uint16_t af,
|
||||
nsIDNSListener* aListener, nsresult status);
|
||||
/**
|
||||
* values for the flags parameter passed to ResolveHost and DetachCallback
|
||||
|
@ -199,8 +199,8 @@ class nsHostResolver : public nsISupports, public AHostResolver {
|
|||
mozilla::net::TypeRecordResultType& aResult,
|
||||
uint32_t aTtl, bool pb) override;
|
||||
nsresult GetHostRecord(const nsACString& host, const nsACString& trrServer,
|
||||
uint16_t type, nsIDNSService::DNSFlags flags,
|
||||
uint16_t af, bool pb, const nsCString& originSuffix,
|
||||
uint16_t type, uint16_t flags, uint16_t af, bool pb,
|
||||
const nsCString& originSuffix,
|
||||
nsHostRecord** result) override;
|
||||
nsresult TrrLookup_unlocked(nsHostRecord*,
|
||||
mozilla::net::TRR* pushedTRR = nullptr) override;
|
||||
|
@ -281,9 +281,8 @@ class nsHostResolver : public nsISupports, public AHostResolver {
|
|||
// Called to check if we have an AF_UNSPEC entry in the cache.
|
||||
already_AddRefed<nsHostRecord> FromUnspecEntry(
|
||||
nsHostRecord* aRec, const nsACString& aHost, const nsACString& aTrrServer,
|
||||
const nsACString& aOriginSuffix, uint16_t aType,
|
||||
nsIDNSService::DNSFlags aFlags, uint16_t af, bool aPb, nsresult& aStatus)
|
||||
MOZ_REQUIRES(mLock);
|
||||
const nsACString& aOriginSuffix, uint16_t aType, uint16_t aFlags,
|
||||
uint16_t af, bool aPb, nsresult& aStatus) MOZ_REQUIRES(mLock);
|
||||
|
||||
enum {
|
||||
METHOD_HIT = 1,
|
||||
|
|
|
@ -3,8 +3,6 @@
|
|||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "nsISupports.idl"
|
||||
#include "nsIRequest.idl"
|
||||
#include "nsITRRSkipReason.idl"
|
||||
|
||||
%{ C++
|
||||
namespace mozilla {
|
||||
|
@ -139,13 +137,7 @@ interface nsIDNSAddrRecord : nsIDNSRecord
|
|||
/**
|
||||
* The TRR mode this record is used.
|
||||
*/
|
||||
readonly attribute nsIRequest_TRRMode effectiveTRRMode;
|
||||
|
||||
/**
|
||||
* If the DNS request didn't use TRR, this value
|
||||
* contains the reason why that was skipped.
|
||||
*/
|
||||
readonly attribute nsITRRSkipReason_value trrSkipReason;
|
||||
readonly attribute unsigned long effectiveTRRMode;
|
||||
|
||||
/**
|
||||
* Returns the ttl of this record.
|
||||
|
|
|
@ -4,11 +4,9 @@
|
|||
|
||||
#include "nsISupports.idl"
|
||||
#include "nsIRequest.idl"
|
||||
#include "nsITRRSkipReason.idl"
|
||||
|
||||
%{ C++
|
||||
#include "mozilla/BasePrincipal.h"
|
||||
#include "mozilla/TypedEnumBits.h"
|
||||
%}
|
||||
|
||||
interface nsICancelable;
|
||||
|
@ -52,52 +50,6 @@ interface nsIDNSService : nsISupports
|
|||
MODE_TRROFF = 5 // identical to MODE_NATIVEONLY but explicitly selected
|
||||
};
|
||||
|
||||
cenum DNSFlags : 32 {
|
||||
RESOLVE_DEFAULT_FLAGS = 0,
|
||||
// if set, this flag suppresses the internal DNS lookup cache.
|
||||
RESOLVE_BYPASS_CACHE = (1 << 0),
|
||||
// if set, the canonical name of the specified host will be queried.
|
||||
RESOLVE_CANONICAL_NAME = (1 << 1),
|
||||
// If PRIORITY flags are set, the query is given lower priority.
|
||||
// Medium takes precedence if both MEDIUM and LOW are used.
|
||||
RESOLVE_PRIORITY_MEDIUM = (1 << 2),
|
||||
RESOLVE_PRIORITY_LOW = (1 << 3),
|
||||
// if set, indicates request is speculative. Speculative requests
|
||||
// return errors if prefetching is disabled by configuration.
|
||||
RESOLVE_SPECULATE = (1 << 4),
|
||||
// If set, only IPv4 addresses will be returned from resolve/asyncResolve.
|
||||
RESOLVE_DISABLE_IPV6 = (1 << 5),
|
||||
// If set, only literals and cached entries will be returned from resolve/asyncResolve.
|
||||
RESOLVE_OFFLINE = (1 << 6),
|
||||
// If set, only IPv6 addresses will be returned from resolve/asyncResolve.
|
||||
RESOLVE_DISABLE_IPV4 = (1 << 7),
|
||||
// If set, allow name collision results (127.0.53.53) which are normally filtered.
|
||||
RESOLVE_ALLOW_NAME_COLLISION = (1 << 8),
|
||||
// If set, do not use TRR for resolving the host name.
|
||||
RESOLVE_DISABLE_TRR = (1 << 9),
|
||||
// if set (together with RESOLVE_BYPASS_CACHE), invalidate the DNS
|
||||
// existing cache entry first (if existing) then make a new resolve.
|
||||
RESOLVE_REFRESH_CACHE = (1 << 10),
|
||||
// These two bits encode the TRR mode of the request.
|
||||
// Use the static helper methods GetFlagsFromTRRMode and
|
||||
// GetTRRModeFromFlags to convert between the TRR mode and flags.
|
||||
RESOLVE_TRR_MODE_MASK = (1 << 11) | (1 << 12),
|
||||
RESOLVE_TRR_DISABLED_MODE = (1 << 11),
|
||||
// Force resolution even when SOCKS proxy with DNS forwarding is configured.
|
||||
// Only to be used for the proxy host resolution.
|
||||
RESOLVE_IGNORE_SOCKS_DNS = (1 << 13),
|
||||
// If set, only cached IP hint addresses will be returned from resolve/asyncResolve.
|
||||
RESOLVE_IP_HINT = (1 << 14),
|
||||
// If set, do not use ODoH for resolving the host name.
|
||||
RESOLVE_DISABLE_ODOH = (1 << 15),
|
||||
// If set, the DNS service will pass a DNS record to
|
||||
// OnLookupComplete even when there was a resolution error.
|
||||
RESOLVE_WANT_RECORD_ON_ERROR = (1 << 16),
|
||||
|
||||
// Bitflag containing all possible flags.
|
||||
ALL_DNSFLAGS_BITS = ((1 << 17) - 1),
|
||||
};
|
||||
|
||||
/**
|
||||
* kicks off an asynchronous host lookup.
|
||||
*
|
||||
|
@ -131,7 +83,7 @@ interface nsIDNSService : nsISupports
|
|||
[implicit_jscontext, optional_argc]
|
||||
nsICancelable asyncResolve(in AUTF8String aHostName,
|
||||
in nsIDNSService_ResolveType aType,
|
||||
in nsIDNSService_DNSFlags aFlags,
|
||||
in unsigned long aFlags,
|
||||
in nsIDNSAdditionalInfo aInfo,
|
||||
in nsIDNSListener aListener,
|
||||
in nsIEventTarget aListenerTarget,
|
||||
|
@ -140,7 +92,7 @@ interface nsIDNSService : nsISupports
|
|||
[notxpcom]
|
||||
nsresult asyncResolveNative(in AUTF8String aHostName,
|
||||
in nsIDNSService_ResolveType aType,
|
||||
in nsIDNSService_DNSFlags aFlags,
|
||||
in unsigned long aFlags,
|
||||
in nsIDNSAdditionalInfo aInfo,
|
||||
in nsIDNSListener aListener,
|
||||
in nsIEventTarget aListenerTarget,
|
||||
|
@ -180,7 +132,7 @@ interface nsIDNSService : nsISupports
|
|||
[implicit_jscontext, optional_argc]
|
||||
void cancelAsyncResolve(in AUTF8String aHostName,
|
||||
in nsIDNSService_ResolveType aType,
|
||||
in nsIDNSService_DNSFlags aFlags,
|
||||
in unsigned long aFlags,
|
||||
in nsIDNSAdditionalInfo aResolver,
|
||||
in nsIDNSListener aListener,
|
||||
in nsresult aReason,
|
||||
|
@ -189,7 +141,7 @@ interface nsIDNSService : nsISupports
|
|||
[notxpcom]
|
||||
nsresult cancelAsyncResolveNative(in AUTF8String aHostName,
|
||||
in nsIDNSService_ResolveType aType,
|
||||
in nsIDNSService_DNSFlags aFlags,
|
||||
in unsigned long aFlags,
|
||||
in nsIDNSAdditionalInfo aResolver,
|
||||
in nsIDNSListener aListener,
|
||||
in nsresult aReason,
|
||||
|
@ -216,12 +168,12 @@ interface nsIDNSService : nsISupports
|
|||
*/
|
||||
[implicit_jscontext, optional_argc]
|
||||
nsIDNSRecord resolve(in AUTF8String aHostName,
|
||||
in nsIDNSService_DNSFlags aFlags,
|
||||
in unsigned long aFlags,
|
||||
[optional] in jsval aOriginAttributes);
|
||||
|
||||
[notxpcom]
|
||||
nsresult resolveNative(in AUTF8String aHostName,
|
||||
in nsIDNSService_DNSFlags aFlags,
|
||||
in unsigned long aFlags,
|
||||
in OriginAttributes aOriginAttributes,
|
||||
out nsIDNSRecord aResult);
|
||||
|
||||
|
@ -255,8 +207,6 @@ interface nsIDNSService : nsISupports
|
|||
*/
|
||||
void setDetectedTrrURI(in AUTF8String aURI);
|
||||
|
||||
ACString getTRRSkipReasonName(in nsITRRSkipReason_value value);
|
||||
|
||||
/**
|
||||
* Notifies the DNS service that we failed to connect to this alternative
|
||||
* endpoint.
|
||||
|
@ -306,11 +256,6 @@ interface nsIDNSService : nsISupports
|
|||
*/
|
||||
readonly attribute AUTF8String myHostName;
|
||||
|
||||
/**
|
||||
* returns the current TRR domain.
|
||||
*/
|
||||
readonly attribute ACString trrDomain;
|
||||
|
||||
/**
|
||||
* Returns true when we have valid ODoHConfigs to encrypt/decrypt oblivious
|
||||
* DNS packets.
|
||||
|
@ -322,16 +267,93 @@ interface nsIDNSService : nsISupports
|
|||
* the aFlags parameter passed to asyncResolve() and resolve().
|
||||
*/
|
||||
|
||||
/**
|
||||
* if set, this flag suppresses the internal DNS lookup cache.
|
||||
*/
|
||||
const unsigned long RESOLVE_BYPASS_CACHE = (1 << 0);
|
||||
|
||||
/**
|
||||
* if set, the canonical name of the specified host will be queried.
|
||||
*/
|
||||
const unsigned long RESOLVE_CANONICAL_NAME = (1 << 1);
|
||||
|
||||
/**
|
||||
* if set, the query is given lower priority. Medium takes precedence
|
||||
* if both are used.
|
||||
*/
|
||||
const unsigned long RESOLVE_PRIORITY_MEDIUM = (1 << 2);
|
||||
const unsigned long RESOLVE_PRIORITY_LOW = (1 << 3);
|
||||
|
||||
/**
|
||||
* if set, indicates request is speculative. Speculative requests
|
||||
* return errors if prefetching is disabled by configuration.
|
||||
*/
|
||||
const unsigned long RESOLVE_SPECULATE = (1 << 4);
|
||||
|
||||
/**
|
||||
* If set, only IPv4 addresses will be returned from resolve/asyncResolve.
|
||||
*/
|
||||
const unsigned long RESOLVE_DISABLE_IPV6 = (1 << 5);
|
||||
|
||||
/**
|
||||
* If set, only literals and cached entries will be returned from resolve/
|
||||
* asyncResolve.
|
||||
*/
|
||||
const unsigned long RESOLVE_OFFLINE = (1 << 6);
|
||||
|
||||
/**
|
||||
* If set, only IPv6 addresses will be returned from resolve/asyncResolve.
|
||||
*/
|
||||
const unsigned long RESOLVE_DISABLE_IPV4 = (1 << 7);
|
||||
|
||||
/**
|
||||
* If set, allow name collision results (127.0.53.53) which are normally filtered.
|
||||
*/
|
||||
const unsigned long RESOLVE_ALLOW_NAME_COLLISION = (1 << 8);
|
||||
|
||||
/**
|
||||
* If set, do not use TRR for resolving the host name.
|
||||
*/
|
||||
const unsigned long RESOLVE_DISABLE_TRR = (1 << 9);
|
||||
|
||||
/**
|
||||
* if set (together with RESOLVE_BYPASS_CACHE), invalidate the DNS
|
||||
* existing cache entry first (if existing) then make a new resolve.
|
||||
*/
|
||||
const unsigned long RESOLVE_REFRESH_CACHE = (1 << 10);
|
||||
|
||||
/**
|
||||
* These two bits encode the TRR mode of the request.
|
||||
* Use the static helper methods convert between the TRR mode and flags.
|
||||
*/
|
||||
const unsigned long RESOLVE_TRR_MODE_MASK = (1 << 11) | (1 << 12);
|
||||
const unsigned long RESOLVE_TRR_DISABLED_MODE = (1 << 11);
|
||||
%{C++
|
||||
static nsIDNSService::DNSFlags GetFlagsFromTRRMode(nsIRequest::TRRMode aMode) {
|
||||
return static_cast<nsIDNSService::DNSFlags>(static_cast<uint32_t>(aMode) << 11);
|
||||
static uint32_t GetFlagsFromTRRMode(nsIRequest::TRRMode aMode) {
|
||||
return static_cast<uint32_t>(aMode) << 11;
|
||||
}
|
||||
|
||||
static nsIRequest::TRRMode GetTRRModeFromFlags(nsIDNSService::DNSFlags aFlags) {
|
||||
static nsIRequest::TRRMode GetTRRModeFromFlags(uint32_t aFlags) {
|
||||
return static_cast<nsIRequest::TRRMode>((aFlags & RESOLVE_TRR_MODE_MASK) >> 11);
|
||||
}
|
||||
%}
|
||||
|
||||
/**
|
||||
* Force resolution even when SOCKS proxy with DNS forwarding is configured.
|
||||
* Only to be used for the proxy host resolution.
|
||||
*/
|
||||
const unsigned long RESOLVE_IGNORE_SOCKS_DNS = 1 << 13;
|
||||
|
||||
/**
|
||||
* If set, only cached IP hint addresses will be returned from
|
||||
* resolve/asyncResolve.
|
||||
*/
|
||||
const unsigned long RESOLVE_IP_HINT = 1 << 14;
|
||||
|
||||
/**
|
||||
* If set, do not use ODoH for resolving the host name.
|
||||
*/
|
||||
const unsigned long RESOLVE_DISABLE_ODOH = 1 << 15;
|
||||
};
|
||||
|
||||
%{C++
|
||||
|
@ -348,7 +370,5 @@ interface nsIDNSService : nsISupports
|
|||
*/
|
||||
#define NS_NETWORK_TRR_MODE_CHANGED_TOPIC "network:trr-mode-changed"
|
||||
|
||||
MOZ_MAKE_ENUM_CLASS_BITWISE_OPERATORS(nsIDNSService::DNSFlags)
|
||||
|
||||
%}
|
||||
|
||||
|
|
|
@ -1,109 +0,0 @@
|
|||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "nsISupports.idl"
|
||||
|
||||
[scriptable, uuid(e61b5d39-f6d6-4ed3-aead-1213b24c6f27)]
|
||||
interface nsITRRSkipReason: nsISupports
|
||||
{
|
||||
// IMPORTANT: when adding new values, always add them to the end, otherwise
|
||||
// it will mess up telemetry.
|
||||
// When adding a reason here, make sure it is documented in
|
||||
// netwerk/docs/dns/trr-skip-reasons.md
|
||||
cenum value: 32 {
|
||||
TRR_UNSET = 0,
|
||||
TRR_OK = 1, // Only set when we actually got a positive TRR result
|
||||
TRR_NO_GSERVICE = 2, // no gService
|
||||
TRR_PARENTAL_CONTROL = 3, // parental control is on
|
||||
TRR_OFF_EXPLICIT = 4, // user has set mode5
|
||||
TRR_REQ_MODE_DISABLED = 5, // request has disabled flags set
|
||||
TRR_MODE_NOT_ENABLED = 6, // mode0
|
||||
TRR_FAILED = 7, // unknown failure
|
||||
TRR_MODE_UNHANDLED_DEFAULT = 8, // Unhandled case in ComputeEffectiveMode
|
||||
TRR_MODE_UNHANDLED_DISABLED = 9, // Unhandled case in ComputeEffectiveMode
|
||||
TRR_DISABLED_FLAG = 10, // the DISABLE_TRR flag was set
|
||||
TRR_TIMEOUT = 11, // the TRR channel timed out
|
||||
TRR_CHANNEL_DNS_FAIL = 12, // DoH server name failed to resolve
|
||||
TRR_IS_OFFLINE = 13, // The browser is offline/no interfaces up
|
||||
TRR_NOT_CONFIRMED = 14, // TRR confirmation is not done yet
|
||||
TRR_DID_NOT_MAKE_QUERY = 15, // TrrLookup exited without doing a TRR query
|
||||
TRR_UNKNOWN_CHANNEL_FAILURE = 16, // unknown channel failure reason
|
||||
TRR_HOST_BLOCKED_TEMPORARY = 17, // host blocklisted
|
||||
TRR_SEND_FAILED = 18, // The call to TRR::SendHTTPRequest failed
|
||||
TRR_NET_RESET = 19, // NS_ERROR_NET_RESET
|
||||
TRR_NET_TIMEOUT = 20, // NS_ERROR_NET_TIMEOUT
|
||||
TRR_NET_REFUSED = 21, // NS_ERROR_CONNECTION_REFUSED
|
||||
TRR_NET_INTERRUPT = 22, // NS_ERROR_NET_INTERRUPT
|
||||
TRR_NET_INADEQ_SEQURITY = 23, // NS_ERROR_NET_INADEQUATE_SECURITY
|
||||
TRR_NO_ANSWERS = 24, // TRR returned no answers
|
||||
TRR_DECODE_FAILED = 25, // DohDecode failed
|
||||
TRR_EXCLUDED = 26, // ExcludedFromTRR
|
||||
TRR_SERVER_RESPONSE_ERR = 27, // Server responded with non-200 code
|
||||
TRR_RCODE_FAIL = 28, // DNS response contains a non-NOERROR rcode
|
||||
TRR_NO_CONNECTIVITY = 29, // Not confirmed because of no connectivity
|
||||
TRR_NXDOMAIN = 30, // DNS response contains NXDOMAIN rcode (0x03)
|
||||
TRR_REQ_CANCELLED = 31, // The request has been cancelled
|
||||
ODOH_KEY_NOT_USABLE = 32, // We don't have a valid ODoHConfig to use.
|
||||
ODOH_UPDATE_KEY_FAILED = 33, // Failed to update the ODoHConfigs.
|
||||
ODOH_KEY_NOT_AVAILABLE = 34, // ODoH requests timeout because of no key.
|
||||
ODOH_ENCRYPTION_FAILED = 35, // Failed to encrypt DNS packets.
|
||||
ODOH_DECRYPTION_FAILED = 36, // Failed to decrypt DNS packets.
|
||||
};
|
||||
};
|
||||
|
||||
%{ C++
|
||||
namespace mozilla {
|
||||
namespace net {
|
||||
|
||||
using TRRSkippedReason = nsITRRSkipReason::value;
|
||||
|
||||
inline bool IsRelevantTRRSkipReason(TRRSkippedReason aReason) {
|
||||
// - TRR_REQ_MODE_DISABLED - these requests are intentionally skipping TRR.
|
||||
// These include DNS queries used to bootstrap the TRR connection,
|
||||
// captive portal checks, connectivity checks, etc.
|
||||
// Since we don't want to use TRR for these connections, we don't need
|
||||
// to include them with other relevant skip reasons.
|
||||
// - TRR_DISABLED_FLAG - This reason is used when retrying failed connections,
|
||||
// sync DNS resolves on the main thread, or requests coming from
|
||||
// webextensions that choose to skip TRR
|
||||
// - TRR_EXCLUDED - This reason is used when a certain domain is excluded
|
||||
// from TRR because it is explicitly set by the user, or because it
|
||||
// is part of the user's DNS suffix list, indicating a host that is likely
|
||||
// to be on the local network.
|
||||
if (aReason == TRRSkippedReason::TRR_REQ_MODE_DISABLED ||
|
||||
aReason == TRRSkippedReason::TRR_DISABLED_FLAG ||
|
||||
aReason == TRRSkippedReason::TRR_EXCLUDED) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
inline bool IsBlockedTRRRequest(TRRSkippedReason aReason) {
|
||||
// See TRR::MaybeBlockRequest. These are the reasons that could block sending
|
||||
// TRR requests.
|
||||
return (aReason == TRRSkippedReason::TRR_EXCLUDED ||
|
||||
aReason == TRRSkippedReason::TRR_MODE_NOT_ENABLED ||
|
||||
aReason == TRRSkippedReason::TRR_HOST_BLOCKED_TEMPORARY);
|
||||
}
|
||||
|
||||
inline bool IsNonRecoverableTRRSkipReason(TRRSkippedReason aReason) {
|
||||
// These are non-recoverable reasons and we'll fallback to native without
|
||||
// retrying.
|
||||
return (aReason == TRRSkippedReason::TRR_NXDOMAIN ||
|
||||
aReason == TRRSkippedReason::TRR_NO_ANSWERS ||
|
||||
aReason == TRRSkippedReason::TRR_DISABLED_FLAG ||
|
||||
aReason == TRRSkippedReason::TRR_RCODE_FAIL);
|
||||
}
|
||||
|
||||
inline bool IsFailedConfirmationOrNoConnectivity(TRRSkippedReason aReason) {
|
||||
// TRR is in non-confirmed state now, so we don't try to use TRR at all.
|
||||
return (aReason == TRRSkippedReason::TRR_NOT_CONFIRMED ||
|
||||
aReason == TRRSkippedReason::TRR_NO_CONNECTIVITY);
|
||||
}
|
||||
|
||||
extern nsresult GetTRRSkipReasonName(TRRSkippedReason aReason, nsACString& aName);
|
||||
|
||||
} // net
|
||||
} // mozilla
|
||||
%}
|
|
@ -1,6 +1,6 @@
|
|||
# TRRSkippedReasons
|
||||
|
||||
These values are defined in [TRRSkippedReason.h](https://searchfox.org/mozilla-central/source/netwerk/dns/nsITRRSkipReason.idl) and are recorded on _nsHostRecord_ for each resolution.
|
||||
These values are defined in [TRRSkippedReason.h](https://searchfox.org/mozilla-central/source/netwerk/dns/TRRSkippedReason.h) and are recorded on _nsHostRecord_ for each resolution.
|
||||
We normally use them for telemetry or to determine the cause of a TRR failure.
|
||||
|
||||
|
||||
|
|
|
@ -17,8 +17,6 @@
|
|||
#include "prio.h"
|
||||
#include "mozilla/net/DNS.h"
|
||||
#include "ipc/IPCMessageUtilsSpecializations.h"
|
||||
#include "nsITRRSkipReason.h"
|
||||
#include "nsIDNSService.h"
|
||||
|
||||
namespace IPC {
|
||||
|
||||
|
@ -128,45 +126,6 @@ struct ParamTraits<mozilla::net::NetAddr> {
|
|||
}
|
||||
};
|
||||
|
||||
template <>
|
||||
struct ParamTraits<nsIRequest::TRRMode> {
|
||||
static void Write(MessageWriter* aWriter, const nsIRequest::TRRMode& aParam) {
|
||||
WriteParam(aWriter, (uint8_t)aParam);
|
||||
}
|
||||
static bool Read(MessageReader* aReader, nsIRequest::TRRMode* aResult) {
|
||||
uint8_t mode;
|
||||
if (!ReadParam(aReader, &mode)) {
|
||||
return false;
|
||||
}
|
||||
// TODO: sanity check
|
||||
*aResult = static_cast<nsIRequest::TRRMode>(mode);
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
template <>
|
||||
struct ParamTraits<nsITRRSkipReason::value> {
|
||||
static void Write(MessageWriter* aWriter,
|
||||
const nsITRRSkipReason::value& aParam) {
|
||||
WriteParam(aWriter, (uint8_t)aParam);
|
||||
}
|
||||
static bool Read(MessageReader* aReader, nsITRRSkipReason::value* aResult) {
|
||||
uint8_t reason;
|
||||
if (!ReadParam(aReader, &reason)) {
|
||||
return false;
|
||||
}
|
||||
// TODO: sanity check
|
||||
*aResult = static_cast<nsITRRSkipReason::value>(reason);
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
template <>
|
||||
struct ParamTraits<nsIDNSService::DNSFlags>
|
||||
: public BitFlagsEnumSerializer<
|
||||
nsIDNSService::DNSFlags, nsIDNSService::DNSFlags::ALL_DNSFLAGS_BITS> {
|
||||
};
|
||||
|
||||
} // namespace IPC
|
||||
|
||||
#endif // mozilla_net_NeckoMessageUtils_h
|
||||
|
|
|
@ -504,7 +504,7 @@ bool NeckoParent::DeallocPUDPSocketParent(PUDPSocketParent* actor) {
|
|||
already_AddRefed<PDNSRequestParent> NeckoParent::AllocPDNSRequestParent(
|
||||
const nsACString& aHost, const nsACString& aTrrServer, const int32_t& aPort,
|
||||
const uint16_t& aType, const OriginAttributes& aOriginAttributes,
|
||||
const nsIDNSService::DNSFlags& aFlags) {
|
||||
const uint32_t& aFlags) {
|
||||
RefPtr<DNSRequestHandler> handler = new DNSRequestHandler();
|
||||
RefPtr<DNSRequestParent> actor = new DNSRequestParent(handler);
|
||||
return actor.forget();
|
||||
|
@ -513,8 +513,7 @@ already_AddRefed<PDNSRequestParent> NeckoParent::AllocPDNSRequestParent(
|
|||
mozilla::ipc::IPCResult NeckoParent::RecvPDNSRequestConstructor(
|
||||
PDNSRequestParent* aActor, const nsACString& aHost,
|
||||
const nsACString& aTrrServer, const int32_t& aPort, const uint16_t& aType,
|
||||
const OriginAttributes& aOriginAttributes,
|
||||
const nsIDNSService::DNSFlags& aFlags) {
|
||||
const OriginAttributes& aOriginAttributes, const uint32_t& aFlags) {
|
||||
RefPtr<DNSRequestParent> actor = static_cast<DNSRequestParent*>(aActor);
|
||||
RefPtr<DNSRequestHandler> handler =
|
||||
actor->GetDNSRequest()->AsDNSRequestHandler();
|
||||
|
@ -542,16 +541,15 @@ mozilla::ipc::IPCResult NeckoParent::RecvSpeculativeConnect(
|
|||
|
||||
mozilla::ipc::IPCResult NeckoParent::RecvHTMLDNSPrefetch(
|
||||
const nsAString& hostname, const bool& isHttps,
|
||||
const OriginAttributes& aOriginAttributes,
|
||||
const nsIDNSService::DNSFlags& flags) {
|
||||
const OriginAttributes& aOriginAttributes, const uint32_t& flags) {
|
||||
dom::HTMLDNSPrefetch::Prefetch(hostname, isHttps, aOriginAttributes, flags);
|
||||
return IPC_OK();
|
||||
}
|
||||
|
||||
mozilla::ipc::IPCResult NeckoParent::RecvCancelHTMLDNSPrefetch(
|
||||
const nsAString& hostname, const bool& isHttps,
|
||||
const OriginAttributes& aOriginAttributes,
|
||||
const nsIDNSService::DNSFlags& flags, const nsresult& reason) {
|
||||
const OriginAttributes& aOriginAttributes, const uint32_t& flags,
|
||||
const nsresult& reason) {
|
||||
dom::HTMLDNSPrefetch::CancelPrefetch(hostname, isHttps, aOriginAttributes,
|
||||
flags, reason);
|
||||
return IPC_OK();
|
||||
|
|
|
@ -116,24 +116,22 @@ class NeckoParent : public PNeckoParent {
|
|||
already_AddRefed<PDNSRequestParent> AllocPDNSRequestParent(
|
||||
const nsACString& aHost, const nsACString& aTrrServer,
|
||||
const int32_t& aPort, const uint16_t& aType,
|
||||
const OriginAttributes& aOriginAttributes,
|
||||
const nsIDNSService::DNSFlags& aFlags);
|
||||
const OriginAttributes& aOriginAttributes, const uint32_t& aFlags);
|
||||
virtual mozilla::ipc::IPCResult RecvPDNSRequestConstructor(
|
||||
PDNSRequestParent* actor, const nsACString& aHost,
|
||||
const nsACString& trrServer, const int32_t& aPort, const uint16_t& type,
|
||||
const OriginAttributes& aOriginAttributes,
|
||||
const nsIDNSService::DNSFlags& flags) override;
|
||||
const uint32_t& flags) override;
|
||||
mozilla::ipc::IPCResult RecvSpeculativeConnect(nsIURI* aURI,
|
||||
nsIPrincipal* aPrincipal,
|
||||
const bool& aAnonymous);
|
||||
mozilla::ipc::IPCResult RecvHTMLDNSPrefetch(
|
||||
const nsAString& hostname, const bool& isHttps,
|
||||
const OriginAttributes& aOriginAttributes,
|
||||
const nsIDNSService::DNSFlags& flags);
|
||||
const OriginAttributes& aOriginAttributes, const uint32_t& flags);
|
||||
mozilla::ipc::IPCResult RecvCancelHTMLDNSPrefetch(
|
||||
const nsAString& hostname, const bool& isHttps,
|
||||
const OriginAttributes& aOriginAttributes,
|
||||
const nsIDNSService::DNSFlags& flags, const nsresult& reason);
|
||||
const OriginAttributes& aOriginAttributes, const uint32_t& flags,
|
||||
const nsresult& reason);
|
||||
PWebSocketEventListenerParent* AllocPWebSocketEventListenerParent(
|
||||
const uint64_t& aInnerWindowID);
|
||||
bool DeallocPWebSocketEventListenerParent(PWebSocketEventListenerParent*);
|
||||
|
|
|
@ -36,7 +36,6 @@ include "mozilla/dom/PermissionMessageUtils.h";
|
|||
using mozilla::dom::MaybeDiscardedBrowsingContext from "mozilla/dom/BrowsingContext.h";
|
||||
using class IPC::SerializedLoadContext from "SerializedLoadContext.h";
|
||||
using mozilla::dom::TabId from "mozilla/dom/ipc/IdType.h";
|
||||
using nsIDNSService::DNSFlags from "nsIDNSService.h";
|
||||
[RefCounted] using class nsIInputStream from "mozilla/ipc/IPCStreamUtils.h";
|
||||
[RefCounted] using class nsIURI from "mozilla/ipc/URIUtils.h";
|
||||
[RefCounted] using class nsIPrincipal from "nsIPrincipal.h";
|
||||
|
@ -84,7 +83,7 @@ parent:
|
|||
|
||||
async PDNSRequest(nsCString hostName, nsCString trrServer, int32_t port,
|
||||
uint16_t type, OriginAttributes originAttributes,
|
||||
DNSFlags flags);
|
||||
uint32_t flags);
|
||||
|
||||
async PDocumentChannel(MaybeDiscardedBrowsingContext browsingContext,
|
||||
DocumentChannelCreationArgs args);
|
||||
|
@ -101,10 +100,10 @@ parent:
|
|||
|
||||
async SpeculativeConnect(nsIURI uri, nsIPrincipal principal, bool anonymous);
|
||||
async HTMLDNSPrefetch(nsString hostname, bool isHttps,
|
||||
OriginAttributes originAttributes, DNSFlags flags);
|
||||
OriginAttributes originAttributes, uint32_t flags);
|
||||
async CancelHTMLDNSPrefetch(nsString hostname, bool isHttps,
|
||||
OriginAttributes originAttributes,
|
||||
DNSFlags flags, nsresult reason);
|
||||
uint32_t flags, nsresult reason);
|
||||
|
||||
/**
|
||||
* channelId is used to establish a connection between redirect channels in
|
||||
|
|
|
@ -45,7 +45,6 @@ using struct nsID from "nsID.h";
|
|||
using mozilla::net::SocketInfo from "mozilla/net/DashboardTypes.h";
|
||||
using mozilla::net::DNSCacheEntries from "mozilla/net/DashboardTypes.h";
|
||||
using mozilla::net::HttpRetParams from "mozilla/net/DashboardTypes.h";
|
||||
using nsIDNSService::DNSFlags from "nsIDNSService.h";
|
||||
|
||||
#if defined(XP_WIN)
|
||||
[MoveOnly] using mozilla::UntrustedModulesData from "mozilla/UntrustedModulesData.h";
|
||||
|
@ -217,7 +216,7 @@ child:
|
|||
both:
|
||||
async PDNSRequest(nsCString hostName, nsCString trrServer, int32_t port,
|
||||
uint16_t type, OriginAttributes originAttributes,
|
||||
DNSFlags flags);
|
||||
uint32_t flags);
|
||||
};
|
||||
|
||||
} // namespace net
|
||||
|
|
|
@ -429,7 +429,7 @@ SocketProcessChild::AllocPAltSvcTransactionChild(
|
|||
already_AddRefed<PDNSRequestChild> SocketProcessChild::AllocPDNSRequestChild(
|
||||
const nsACString& aHost, const nsACString& aTrrServer, const int32_t& aPort,
|
||||
const uint16_t& aType, const OriginAttributes& aOriginAttributes,
|
||||
const nsIDNSService::DNSFlags& aFlags) {
|
||||
const uint32_t& aFlags) {
|
||||
RefPtr<DNSRequestHandler> handler = new DNSRequestHandler();
|
||||
RefPtr<DNSRequestChild> actor = new DNSRequestChild(handler);
|
||||
return actor.forget();
|
||||
|
@ -438,8 +438,7 @@ already_AddRefed<PDNSRequestChild> SocketProcessChild::AllocPDNSRequestChild(
|
|||
mozilla::ipc::IPCResult SocketProcessChild::RecvPDNSRequestConstructor(
|
||||
PDNSRequestChild* aActor, const nsACString& aHost,
|
||||
const nsACString& aTrrServer, const int32_t& aPort, const uint16_t& aType,
|
||||
const OriginAttributes& aOriginAttributes,
|
||||
const nsIDNSService::DNSFlags& aFlags) {
|
||||
const OriginAttributes& aOriginAttributes, const uint32_t& aFlags) {
|
||||
RefPtr<DNSRequestChild> actor = static_cast<DNSRequestChild*>(aActor);
|
||||
RefPtr<DNSRequestHandler> handler =
|
||||
actor->GetDNSRequest()->AsDNSRequestHandler();
|
||||
|
|
|
@ -91,13 +91,12 @@ class SocketProcessChild final : public PSocketProcessChild {
|
|||
already_AddRefed<PDNSRequestChild> AllocPDNSRequestChild(
|
||||
const nsACString& aHost, const nsACString& aTrrServer,
|
||||
const int32_t& aPort, const uint16_t& aType,
|
||||
const OriginAttributes& aOriginAttributes,
|
||||
const nsIDNSService::DNSFlags& aFlags);
|
||||
const OriginAttributes& aOriginAttributes, const uint32_t& aFlags);
|
||||
mozilla::ipc::IPCResult RecvPDNSRequestConstructor(
|
||||
PDNSRequestChild* aActor, const nsACString& aHost,
|
||||
const nsACString& aTrrServer, const int32_t& aPort, const uint16_t& aType,
|
||||
const OriginAttributes& aOriginAttributes,
|
||||
const nsIDNSService::DNSFlags& aFlags) override;
|
||||
const uint32_t& aFlags) override;
|
||||
|
||||
void AddDataBridgeToMap(uint64_t aChannelId,
|
||||
BackgroundDataBridgeParent* aActor);
|
||||
|
|
|
@ -214,7 +214,7 @@ bool SocketProcessParent::DeallocPWebrtcTCPSocketParent(
|
|||
already_AddRefed<PDNSRequestParent> SocketProcessParent::AllocPDNSRequestParent(
|
||||
const nsACString& aHost, const nsACString& aTrrServer, const int32_t& port,
|
||||
const uint16_t& aType, const OriginAttributes& aOriginAttributes,
|
||||
const nsIDNSService::DNSFlags& aFlags) {
|
||||
const uint32_t& aFlags) {
|
||||
RefPtr<DNSRequestHandler> handler = new DNSRequestHandler();
|
||||
RefPtr<DNSRequestParent> actor = new DNSRequestParent(handler);
|
||||
return actor.forget();
|
||||
|
@ -223,8 +223,7 @@ already_AddRefed<PDNSRequestParent> SocketProcessParent::AllocPDNSRequestParent(
|
|||
mozilla::ipc::IPCResult SocketProcessParent::RecvPDNSRequestConstructor(
|
||||
PDNSRequestParent* aActor, const nsACString& aHost,
|
||||
const nsACString& aTrrServer, const int32_t& port, const uint16_t& aType,
|
||||
const OriginAttributes& aOriginAttributes,
|
||||
const nsIDNSService::DNSFlags& aFlags) {
|
||||
const OriginAttributes& aOriginAttributes, const uint32_t& aFlags) {
|
||||
RefPtr<DNSRequestParent> actor = static_cast<DNSRequestParent*>(aActor);
|
||||
RefPtr<DNSRequestHandler> handler =
|
||||
actor->GetDNSRequest()->AsDNSRequestHandler();
|
||||
|
|
|
@ -56,13 +56,12 @@ class SocketProcessParent final
|
|||
already_AddRefed<PDNSRequestParent> AllocPDNSRequestParent(
|
||||
const nsACString& aHost, const nsACString& aTrrServer,
|
||||
const int32_t& port, const uint16_t& aType,
|
||||
const OriginAttributes& aOriginAttributes,
|
||||
const nsIDNSService::DNSFlags& aFlags);
|
||||
const OriginAttributes& aOriginAttributes, const uint32_t& aFlags);
|
||||
virtual mozilla::ipc::IPCResult RecvPDNSRequestConstructor(
|
||||
PDNSRequestParent* actor, const nsACString& aHost,
|
||||
const nsACString& trrServer, const int32_t& port, const uint16_t& type,
|
||||
const OriginAttributes& aOriginAttributes,
|
||||
const nsIDNSService::DNSFlags& flags) override;
|
||||
const uint32_t& flags) override;
|
||||
|
||||
void ActorDestroy(ActorDestroyReason aWhy) override;
|
||||
bool SendRequestMemoryReport(const uint32_t& aGeneration,
|
||||
|
|
|
@ -181,7 +181,7 @@ void DnsAndConnectSocket::CheckProxyConfig() {
|
|||
nsresult DnsAndConnectSocket::SetupDnsFlags(ConnectionEntry* ent) {
|
||||
LOG(("DnsAndConnectSocket::SetupDnsFlags [this=%p] ", this));
|
||||
|
||||
nsIDNSService::DNSFlags dnsFlags = nsIDNSService::RESOLVE_DEFAULT_FLAGS;
|
||||
uint32_t dnsFlags = 0;
|
||||
bool disableIpv6ForBackup = false;
|
||||
if (mCaps & NS_HTTP_REFRESH_DNS) {
|
||||
dnsFlags = nsIDNSService::RESOLVE_BYPASS_CACHE;
|
||||
|
@ -965,10 +965,10 @@ nsresult DnsAndConnectSocket::TransportSetup::CheckConnectedResult(
|
|||
bool trrEnabled;
|
||||
mDNSRecord->IsTRR(&trrEnabled);
|
||||
if (trrEnabled) {
|
||||
nsIRequest::TRRMode trrMode = nsIRequest::TRR_DEFAULT_MODE;
|
||||
uint32_t trrMode = 0;
|
||||
mDNSRecord->GetEffectiveTRRMode(&trrMode);
|
||||
// If current trr mode is trr only, we should not retry.
|
||||
if (trrMode != nsIRequest::TRR_ONLY_MODE) {
|
||||
if (trrMode != 3) {
|
||||
// Drop state to closed. This will trigger a new round of
|
||||
// DNS resolving. Bypass the cache this time since the
|
||||
// cached data came from TRR and failed already!
|
||||
|
|
|
@ -15,7 +15,6 @@
|
|||
#include "nsICancelable.h"
|
||||
#include "nsIDNSListener.h"
|
||||
#include "nsIDNSRecord.h"
|
||||
#include "nsIDNSService.h"
|
||||
#include "nsINamed.h"
|
||||
#include "nsITransport.h"
|
||||
#include "nsWeakReference.h"
|
||||
|
@ -154,7 +153,7 @@ class DnsAndConnectSocket final : public nsIOutputStreamCallback,
|
|||
nsCString mHost;
|
||||
nsCOMPtr<nsICancelable> mDNSRequest;
|
||||
nsCOMPtr<nsIDNSAddrRecord> mDNSRecord;
|
||||
nsIDNSService::DNSFlags mDnsFlags = nsIDNSService::RESOLVE_DEFAULT_FLAGS;
|
||||
uint32_t mDnsFlags = 0;
|
||||
bool mRetryWithDifferentIPFamily = false;
|
||||
bool mResetFamilyPreference = false;
|
||||
bool mSkipDnsResolution = false;
|
||||
|
|
|
@ -41,8 +41,7 @@ nsresult HTTPSRecordResolver::FetchHTTPSRRInternal(
|
|||
return NS_ERROR_NOT_AVAILABLE;
|
||||
}
|
||||
|
||||
nsIDNSService::DNSFlags flags =
|
||||
nsIDNSService::GetFlagsFromTRRMode(mConnInfo->GetTRRMode());
|
||||
uint32_t flags = nsIDNSService::GetFlagsFromTRRMode(mConnInfo->GetTRRMode());
|
||||
if (mCaps & NS_HTTP_REFRESH_DNS) {
|
||||
flags |= nsIDNSService::RESOLVE_BYPASS_CACHE;
|
||||
}
|
||||
|
@ -95,7 +94,7 @@ void HTTPSRecordResolver::PrefetchAddrRecord(const nsACString& aTargetName,
|
|||
return;
|
||||
}
|
||||
|
||||
nsIDNSService::DNSFlags flags = nsIDNSService::GetFlagsFromTRRMode(
|
||||
uint32_t flags = nsIDNSService::GetFlagsFromTRRMode(
|
||||
mTransaction->ConnectionInfo()->GetTRRMode());
|
||||
if (aRefreshDNS) {
|
||||
flags |= nsIDNSService::RESOLVE_BYPASS_CACHE;
|
||||
|
|
|
@ -3600,18 +3600,6 @@ HttpBaseChannel::GetIsResolvedByTRR(bool* aResolvedByTRR) {
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
HttpBaseChannel::GetEffectiveTRRMode(nsIRequest::TRRMode* aEffectiveTRRMode) {
|
||||
*aEffectiveTRRMode = mEffectiveTRRMode;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
HttpBaseChannel::GetTrrSkipReason(nsITRRSkipReason::value* aTrrSkipReason) {
|
||||
*aTrrSkipReason = mTRRSkipReason;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
HttpBaseChannel::GetIsLoadedBySocketProcess(bool* aResult) {
|
||||
NS_ENSURE_ARG_POINTER(aResult);
|
||||
|
|
|
@ -281,9 +281,6 @@ class HttpBaseChannel : public nsHashPropertyBag,
|
|||
NS_IMETHOD GetIsTRRServiceChannel(bool* aTRR) override;
|
||||
NS_IMETHOD SetIsTRRServiceChannel(bool aTRR) override;
|
||||
NS_IMETHOD GetIsResolvedByTRR(bool* aResolvedByTRR) override;
|
||||
NS_IMETHOD GetEffectiveTRRMode(
|
||||
nsIRequest::TRRMode* aEffectiveTRRMode) override;
|
||||
NS_IMETHOD GetTrrSkipReason(nsITRRSkipReason::value* aTrrSkipReason) override;
|
||||
NS_IMETHOD GetIsLoadedBySocketProcess(bool* aResult) override;
|
||||
NS_IMETHOD GetIsOCSP(bool* value) override;
|
||||
NS_IMETHOD SetIsOCSP(bool value) override;
|
||||
|
@ -791,11 +788,6 @@ class HttpBaseChannel : public nsHashPropertyBag,
|
|||
uint32_t mCaps;
|
||||
|
||||
ClassOfService mClassOfService;
|
||||
// This should be set the the actual TRR mode used to resolve the request.
|
||||
// Is initially set to TRR_DEFAULT_MODE, but should be updated to the actual
|
||||
// mode used by the request
|
||||
nsIRequest::TRRMode mEffectiveTRRMode = nsIRequest::TRR_DEFAULT_MODE;
|
||||
TRRSkippedReason mTRRSkipReason = TRRSkippedReason::TRR_UNSET;
|
||||
|
||||
public:
|
||||
void SetEarlyHints(
|
||||
|
|
|
@ -432,8 +432,6 @@ void HttpChannelChild::OnStartRequest(
|
|||
StoreDeliveringAltData(aArgs.deliveringAltData());
|
||||
mAltDataLength = aArgs.altDataLength();
|
||||
StoreResolvedByTRR(aArgs.isResolvedByTRR());
|
||||
mEffectiveTRRMode = aArgs.effectiveTRRMode();
|
||||
mTRRSkipReason = aArgs.trrSkipReason();
|
||||
|
||||
SetApplyConversion(aArgs.applyConversion());
|
||||
|
||||
|
|
|
@ -19,8 +19,6 @@ using mozilla::net::NetAddr from "mozilla/net/DNS.h";
|
|||
using nsILoadInfo::CrossOriginOpenerPolicy from "nsILoadInfo.h";
|
||||
[RefCounted] using class nsIReferrerInfo from "nsIReferrerInfo.h";
|
||||
[RefCounted] using class nsITransportSecurityInfo from "nsITransportSecurityInfo.h";
|
||||
using nsIRequest::TRRMode from "nsIRequest.h";
|
||||
using TRRSkippedReason from "nsITRRSkipReason.h";
|
||||
|
||||
namespace mozilla {
|
||||
namespace net {
|
||||
|
@ -57,8 +55,6 @@ struct HttpChannelOnStartRequestArgs
|
|||
bool dataFromSocketProcess;
|
||||
bool hasHTTPSRR;
|
||||
bool isProxyUsed;
|
||||
TRRMode effectiveTRRMode;
|
||||
TRRSkippedReason trrSkipReason;
|
||||
};
|
||||
|
||||
struct HttpChannelAltDataStream
|
||||
|
|
|
@ -1259,14 +1259,6 @@ HttpChannelParent::OnStartRequest(nsIRequest* aRequest) {
|
|||
}
|
||||
}
|
||||
|
||||
nsIRequest::TRRMode effectiveMode = nsIRequest::TRR_DEFAULT_MODE;
|
||||
mChannel->GetEffectiveTRRMode(&effectiveMode);
|
||||
args.effectiveTRRMode() = effectiveMode;
|
||||
|
||||
TRRSkippedReason reason = TRRSkippedReason::TRR_UNSET;
|
||||
mChannel->GetTrrSkipReason(&reason);
|
||||
args.trrSkipReason() = reason;
|
||||
|
||||
if (mIPCClosed ||
|
||||
!mBgParent->OnStartRequest(
|
||||
*responseHead, useResponseHead,
|
||||
|
|
|
@ -779,12 +779,7 @@ void TRRServiceChannel::MaybeStartDNSPrefetch() {
|
|||
mDNSPrefetch =
|
||||
new nsDNSPrefetch(mURI, originAttributes, nsIRequest::GetTRRMode(), this,
|
||||
LoadTimingEnabled());
|
||||
nsIDNSService::DNSFlags dnsFlags = nsIDNSService::RESOLVE_DEFAULT_FLAGS;
|
||||
if (mCaps & NS_HTTP_REFRESH_DNS) {
|
||||
dnsFlags |= nsIDNSService::RESOLVE_BYPASS_CACHE;
|
||||
}
|
||||
nsresult rv = mDNSPrefetch->PrefetchHigh(dnsFlags);
|
||||
NS_ENSURE_SUCCESS_VOID(rv);
|
||||
mDNSPrefetch->PrefetchHigh(mCaps & NS_HTTP_REFRESH_DNS);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
|
|
@ -6413,12 +6413,7 @@ nsresult nsHttpChannel::MaybeStartDNSPrefetch() {
|
|||
mDNSPrefetch =
|
||||
new nsDNSPrefetch(mURI, originAttributes, nsIRequest::GetTRRMode(),
|
||||
this, LoadTimingEnabled());
|
||||
nsIDNSService::DNSFlags dnsFlags =
|
||||
nsIDNSService::RESOLVE_WANT_RECORD_ON_ERROR;
|
||||
if (mCaps & NS_HTTP_REFRESH_DNS) {
|
||||
dnsFlags |= nsIDNSService::RESOLVE_BYPASS_CACHE;
|
||||
}
|
||||
nsresult rv = mDNSPrefetch->PrefetchHigh(dnsFlags);
|
||||
nsresult rv = mDNSPrefetch->PrefetchHigh(mCaps & NS_HTTP_REFRESH_DNS);
|
||||
|
||||
if (dnsStrategy & DNS_BLOCK_ON_ORIGIN_RESOLVE) {
|
||||
LOG((" blocking on prefetching origin"));
|
||||
|
@ -8534,11 +8529,6 @@ nsHttpChannel::OnLookupComplete(nsICancelable* request, nsIDNSRecord* rec,
|
|||
nsresult status) {
|
||||
MOZ_ASSERT(NS_IsMainThread(), "Expecting DNS callback on main thread.");
|
||||
|
||||
if (nsCOMPtr<nsIDNSAddrRecord> r = do_QueryInterface(rec)) {
|
||||
r->GetEffectiveTRRMode(&mEffectiveTRRMode);
|
||||
r->GetTrrSkipReason(&mTRRSkipReason);
|
||||
}
|
||||
|
||||
LOG(
|
||||
("nsHttpChannel::OnLookupComplete [this=%p] prefetch complete%s: "
|
||||
"%s status[0x%" PRIx32 "]\n",
|
||||
|
|
|
@ -5,8 +5,6 @@
|
|||
|
||||
#include "nsISupports.idl"
|
||||
#include "nsILoadInfo.idl"
|
||||
#include "nsIRequest.idl"
|
||||
#include "nsITRRSkipReason.idl"
|
||||
|
||||
%{C++
|
||||
#include "nsStringFwd.h"
|
||||
|
@ -284,22 +282,6 @@ interface nsIHttpChannelInternal : nsISupports
|
|||
*/
|
||||
[must_use] readonly attribute boolean isResolvedByTRR;
|
||||
|
||||
|
||||
/**
|
||||
* The effective TRR mode used to resolve this channel.
|
||||
* This is computed by taking the value returned by nsIRequest.getTRRMode()
|
||||
* and the state of the TRRService. If the domain is excluded from TRR
|
||||
* or the TRRService is disabled, the effective mode would be TRR_DISABLED_MODE
|
||||
* even if the initial mode set on the request was TRR_ONLY_MODE.
|
||||
*/
|
||||
[must_use] readonly attribute nsIRequest_TRRMode effectiveTRRMode;
|
||||
|
||||
/**
|
||||
* If the DNS request triggered by this channel didn't use TRR, this value
|
||||
* contains the reason why that was skipped.
|
||||
*/
|
||||
[must_use] readonly attribute nsITRRSkipReason_value trrSkipReason;
|
||||
|
||||
/**
|
||||
* True if channel is loaded by socket process.
|
||||
*/
|
||||
|
|
|
@ -2855,10 +2855,9 @@ nsresult WebSocketChannel::DoAdmissionDNS() {
|
|||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
nsCOMPtr<nsIEventTarget> main = GetMainThreadEventTarget();
|
||||
nsCOMPtr<nsICancelable> cancelable;
|
||||
rv = dns->AsyncResolveNative(hostName, nsIDNSService::RESOLVE_TYPE_DEFAULT,
|
||||
nsIDNSService::RESOLVE_DEFAULT_FLAGS, nullptr,
|
||||
this, main, mLoadInfo->GetOriginAttributes(),
|
||||
getter_AddRefs(cancelable));
|
||||
rv = dns->AsyncResolveNative(
|
||||
hostName, nsIDNSService::RESOLVE_TYPE_DEFAULT, 0, nullptr, this, main,
|
||||
mLoadInfo->GetOriginAttributes(), getter_AddRefs(cancelable));
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
}
|
||||
|
|
|
@ -14,6 +14,7 @@ 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.
|
||||
|
@ -138,12 +139,18 @@ 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
|
||||
: Services.dns.newAdditionalInfo(trrServer, port);
|
||||
: gDNS.newAdditionalInfo(trrServer, port);
|
||||
try {
|
||||
this.request = Services.dns.asyncResolve(
|
||||
this.request = gDNS.asyncResolve(
|
||||
this.name,
|
||||
this.type,
|
||||
this.options.flags || 0,
|
||||
|
@ -233,7 +240,7 @@ class TRRDNSListener {
|
|||
}
|
||||
|
||||
cancel(aStatus = Cr.NS_ERROR_ABORT) {
|
||||
Services.dns.cancelAsyncResolve(
|
||||
gDNS.cancelAsyncResolve(
|
||||
this.name,
|
||||
this.type,
|
||||
this.options.flags || 0,
|
||||
|
|
|
@ -8,6 +8,10 @@ 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"
|
||||
);
|
||||
|
@ -23,7 +27,6 @@ add_setup(async function setup() {
|
|||
});
|
||||
|
||||
if (mozinfo.socketprocess_networking) {
|
||||
Services.dns; // Needed to trigger socket process.
|
||||
await TestUtils.waitForCondition(() => Services.io.socketProcessLaunched);
|
||||
}
|
||||
|
||||
|
@ -41,7 +44,7 @@ add_task(async function testTXTResolve() {
|
|||
);
|
||||
|
||||
let { inRecord } = await new TRRDNSListener("_esni.example.com", {
|
||||
type: Ci.nsIDNSService.RESOLVE_TYPE_TXT,
|
||||
type: dns.RESOLVE_TYPE_TXT,
|
||||
});
|
||||
|
||||
let answer = inRecord
|
||||
|
@ -57,7 +60,7 @@ add_task(async function testTXTRecordPushPart1() {
|
|||
"https://foo.example.com:" + h2Port + "/txt-dns-push"
|
||||
);
|
||||
let { inRecord } = await new TRRDNSListener("_esni_push.example.com", {
|
||||
type: Ci.nsIDNSService.RESOLVE_TYPE_DEFAULT,
|
||||
type: dns.RESOLVE_TYPE_DEFAULT,
|
||||
expectedAnswer: "127.0.0.1",
|
||||
});
|
||||
|
||||
|
@ -75,7 +78,7 @@ add_task(async function testTXTRecordPushPart2() {
|
|||
"https://foo.example.com:" + h2Port + "/404"
|
||||
);
|
||||
let { inRecord } = await new TRRDNSListener("_esni_push.example.com", {
|
||||
type: Ci.nsIDNSService.RESOLVE_TYPE_TXT,
|
||||
type: dns.RESOLVE_TYPE_TXT,
|
||||
});
|
||||
|
||||
let answer = inRecord
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
"use strict";
|
||||
|
||||
var dns = Cc["@mozilla.org/network/dns-service;1"].getService(Ci.nsIDNSService);
|
||||
|
||||
var hostname1 = "";
|
||||
var hostname2 = "";
|
||||
var possible = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
|
||||
|
@ -49,7 +51,7 @@ function run_test() {
|
|||
var flags = Ci.nsIDNSService.RESOLVE_BYPASS_CACHE;
|
||||
|
||||
// This one will be canceled with cancelAsyncResolve.
|
||||
Services.dns.asyncResolve(
|
||||
dns.asyncResolve(
|
||||
hostname2,
|
||||
Ci.nsIDNSService.RESOLVE_TYPE_DEFAULT,
|
||||
flags,
|
||||
|
@ -58,7 +60,7 @@ function run_test() {
|
|||
mainThread,
|
||||
defaultOriginAttributes
|
||||
);
|
||||
Services.dns.cancelAsyncResolve(
|
||||
dns.cancelAsyncResolve(
|
||||
hostname2,
|
||||
Ci.nsIDNSService.RESOLVE_TYPE_DEFAULT,
|
||||
flags,
|
||||
|
@ -69,7 +71,7 @@ function run_test() {
|
|||
);
|
||||
|
||||
// This one will not be canceled.
|
||||
requestList1NotCanceled = Services.dns.asyncResolve(
|
||||
requestList1NotCanceled = dns.asyncResolve(
|
||||
hostname1,
|
||||
Ci.nsIDNSService.RESOLVE_TYPE_DEFAULT,
|
||||
flags,
|
||||
|
@ -80,7 +82,7 @@ function run_test() {
|
|||
);
|
||||
|
||||
// This one will be canceled with cancel(Cr.NS_ERROR_ABORT).
|
||||
requestList1Canceled2 = Services.dns.asyncResolve(
|
||||
requestList1Canceled2 = dns.asyncResolve(
|
||||
hostname1,
|
||||
Ci.nsIDNSService.RESOLVE_TYPE_DEFAULT,
|
||||
flags,
|
||||
|
@ -92,7 +94,7 @@ function run_test() {
|
|||
requestList1Canceled2.cancel(Cr.NS_ERROR_ABORT);
|
||||
|
||||
// This one will not be canceled.
|
||||
requestList2NotCanceled = Services.dns.asyncResolve(
|
||||
requestList2NotCanceled = dns.asyncResolve(
|
||||
hostname1,
|
||||
Ci.nsIDNSService.RESOLVE_TYPE_DEFAULT,
|
||||
flags,
|
||||
|
@ -103,7 +105,7 @@ function run_test() {
|
|||
);
|
||||
|
||||
// This one will be canceled with cancel(Cr.NS_ERROR_ABORT).
|
||||
requestList2Canceled = Services.dns.asyncResolve(
|
||||
requestList2Canceled = dns.asyncResolve(
|
||||
hostname2,
|
||||
Ci.nsIDNSService.RESOLVE_TYPE_DEFAULT,
|
||||
flags,
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
|
||||
"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
|
||||
);
|
||||
|
@ -20,7 +21,7 @@ add_task(async function test_none() {
|
|||
QueryInterface: ChromeUtils.generateQI(["nsIDNSListener"]),
|
||||
};
|
||||
|
||||
Services.dns.asyncResolve(
|
||||
dns.asyncResolve(
|
||||
"example.org",
|
||||
Ci.nsIDNSService.RESOLVE_TYPE_DEFAULT,
|
||||
Ci.nsIDNSService.RESOLVE_DISABLE_IPV4,
|
||||
|
@ -40,7 +41,7 @@ add_task(async function test_none() {
|
|||
});
|
||||
|
||||
add_task(async function test_some() {
|
||||
Services.dns.clearCache(true);
|
||||
dns.clearCache(true);
|
||||
gOverride.addIPOverride("example.com", "1.1.1.1");
|
||||
gOverride.addIPOverride("example.org", "::1:2:3");
|
||||
let [, inRecord] = await new Promise(resolve => {
|
||||
|
@ -51,7 +52,7 @@ add_task(async function test_some() {
|
|||
QueryInterface: ChromeUtils.generateQI(["nsIDNSListener"]),
|
||||
};
|
||||
|
||||
Services.dns.asyncResolve(
|
||||
dns.asyncResolve(
|
||||
"example.org",
|
||||
Ci.nsIDNSService.RESOLVE_TYPE_DEFAULT,
|
||||
Ci.nsIDNSService.RESOLVE_DISABLE_IPV4,
|
||||
|
|
|
@ -5,6 +5,8 @@
|
|||
|
||||
"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) {
|
||||
|
@ -34,7 +36,7 @@ const defaultOriginAttributes = {};
|
|||
function run_test() {
|
||||
do_test_pending();
|
||||
try {
|
||||
Services.dns.asyncResolve(
|
||||
dns.asyncResolve(
|
||||
"example.com",
|
||||
Ci.nsIDNSService.RESOLVE_TYPE_DEFAULT,
|
||||
Ci.nsIDNSService.RESOLVE_DISABLE_IPV6,
|
||||
|
|
|
@ -1,5 +1,8 @@
|
|||
"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
|
||||
);
|
||||
|
@ -34,7 +37,7 @@ function do_test({ dnsDisabled, mustBlock, testDomain, expectedAnswer }) {
|
|||
return new Promise(resolve => {
|
||||
Services.prefs.setBoolPref("network.dns.disabled", dnsDisabled);
|
||||
try {
|
||||
Services.dns.asyncResolve(
|
||||
dns.asyncResolve(
|
||||
testDomain,
|
||||
Ci.nsIDNSService.RESOLVE_TYPE_DEFAULT,
|
||||
0,
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
"use strict";
|
||||
|
||||
var dns = Cc["@mozilla.org/network/dns-service;1"].getService(Ci.nsIDNSService);
|
||||
var prefs = Services.prefs;
|
||||
|
||||
var nextTest;
|
||||
|
@ -23,7 +24,7 @@ function run_test() {
|
|||
|
||||
var mainThread = Services.tm.currentThread;
|
||||
nextTest = do_test_2;
|
||||
Services.dns.asyncResolve(
|
||||
dns.asyncResolve(
|
||||
"local.vingtetun.org",
|
||||
Ci.nsIDNSService.RESOLVE_TYPE_DEFAULT,
|
||||
0,
|
||||
|
@ -40,7 +41,7 @@ function do_test_2() {
|
|||
var mainThread = Services.tm.currentThread;
|
||||
nextTest = testsDone;
|
||||
prefs.setCharPref("network.dns.forceResolve", "localhost");
|
||||
Services.dns.asyncResolve(
|
||||
dns.asyncResolve(
|
||||
"www.example.com",
|
||||
Ci.nsIDNSService.RESOLVE_TYPE_DEFAULT,
|
||||
0,
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
"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;
|
||||
|
@ -43,7 +44,7 @@ function run_test() {
|
|||
prefs.setBoolPref("network.proxy.allow_hijacking_localhost", true);
|
||||
ioService.offline = true;
|
||||
try {
|
||||
Services.dns.asyncResolve(
|
||||
dns.asyncResolve(
|
||||
"localhost",
|
||||
Ci.nsIDNSService.RESOLVE_TYPE_DEFAULT,
|
||||
0,
|
||||
|
@ -69,7 +70,7 @@ function test2() {
|
|||
}
|
||||
|
||||
function test2Continued() {
|
||||
Services.dns.asyncResolve(
|
||||
dns.asyncResolve(
|
||||
"localhost",
|
||||
Ci.nsIDNSService.RESOLVE_TYPE_DEFAULT,
|
||||
0,
|
||||
|
@ -88,7 +89,7 @@ function test3() {
|
|||
}
|
||||
|
||||
function test3Continued() {
|
||||
Services.dns.asyncResolve(
|
||||
dns.asyncResolve(
|
||||
"localhost",
|
||||
Ci.nsIDNSService.RESOLVE_TYPE_DEFAULT,
|
||||
0,
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
"use strict";
|
||||
|
||||
var dns = Cc["@mozilla.org/network/dns-service;1"].getService(Ci.nsIDNSService);
|
||||
var mainThread = Services.tm.currentThread;
|
||||
|
||||
var onionPref;
|
||||
|
@ -30,7 +31,7 @@ const defaultOriginAttributes = {};
|
|||
|
||||
function do_test_dontBlock() {
|
||||
prefs.setBoolPref("network.dns.blockDotOnion", false);
|
||||
Services.dns.asyncResolve(
|
||||
dns.asyncResolve(
|
||||
"private.onion",
|
||||
Ci.nsIDNSService.RESOLVE_TYPE_DEFAULT,
|
||||
0,
|
||||
|
@ -44,7 +45,7 @@ function do_test_dontBlock() {
|
|||
function do_test_block() {
|
||||
prefs.setBoolPref("network.dns.blockDotOnion", true);
|
||||
try {
|
||||
Services.dns.asyncResolve(
|
||||
dns.asyncResolve(
|
||||
"private.onion",
|
||||
Ci.nsIDNSService.RESOLVE_TYPE_DEFAULT,
|
||||
0,
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
"use strict";
|
||||
|
||||
var dns = Cc["@mozilla.org/network/dns-service;1"].getService(Ci.nsIDNSService);
|
||||
var prefs = Services.prefs;
|
||||
var mainThread = Services.tm.currentThread;
|
||||
|
||||
|
@ -40,7 +41,7 @@ const secondOriginAttributes = { userContextId: 2 };
|
|||
function run_test() {
|
||||
do_test_pending();
|
||||
prefs.setBoolPref("network.proxy.allow_hijacking_localhost", true);
|
||||
Services.dns.asyncResolve(
|
||||
dns.asyncResolve(
|
||||
"localhost",
|
||||
Ci.nsIDNSService.RESOLVE_TYPE_DEFAULT,
|
||||
0,
|
||||
|
@ -55,7 +56,7 @@ function run_test() {
|
|||
// correctly.
|
||||
function test2() {
|
||||
do_test_pending();
|
||||
Services.dns.asyncResolve(
|
||||
dns.asyncResolve(
|
||||
"localhost",
|
||||
Ci.nsIDNSService.RESOLVE_TYPE_DEFAULT,
|
||||
Ci.nsIDNSService.RESOLVE_OFFLINE,
|
||||
|
@ -72,7 +73,7 @@ function test2() {
|
|||
function test3() {
|
||||
do_test_pending();
|
||||
try {
|
||||
Services.dns.asyncResolve(
|
||||
dns.asyncResolve(
|
||||
"localhost",
|
||||
Ci.nsIDNSService.RESOLVE_TYPE_DEFAULT,
|
||||
Ci.nsIDNSService.RESOLVE_OFFLINE,
|
||||
|
|
|
@ -1,5 +1,8 @@
|
|||
"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
|
||||
);
|
||||
|
@ -74,7 +77,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");
|
||||
Services.dns.asyncResolve(
|
||||
dns.asyncResolve(
|
||||
DOMAIN,
|
||||
Ci.nsIDNSService.RESOLVE_TYPE_DEFAULT,
|
||||
0,
|
||||
|
@ -85,14 +88,14 @@ add_task(async function test_ipv4() {
|
|||
);
|
||||
Assert.equal(await listener.firstAddress(), "1.2.3.4");
|
||||
|
||||
Services.dns.clearCache(false);
|
||||
dns.clearCache(false);
|
||||
override.clearOverrides();
|
||||
});
|
||||
|
||||
add_task(async function test_ipv6() {
|
||||
let listener = new Listener();
|
||||
override.addIPOverride(DOMAIN, "fe80::6a99:9b2b:6ccc:6e1b");
|
||||
Services.dns.asyncResolve(
|
||||
dns.asyncResolve(
|
||||
DOMAIN,
|
||||
Ci.nsIDNSService.RESOLVE_TYPE_DEFAULT,
|
||||
0,
|
||||
|
@ -103,14 +106,14 @@ add_task(async function test_ipv6() {
|
|||
);
|
||||
Assert.equal(await listener.firstAddress(), "fe80::6a99:9b2b:6ccc:6e1b");
|
||||
|
||||
Services.dns.clearCache(false);
|
||||
dns.clearCache(false);
|
||||
override.clearOverrides();
|
||||
});
|
||||
|
||||
add_task(async function test_clearOverrides() {
|
||||
let listener = new Listener();
|
||||
override.addIPOverride(DOMAIN, "1.2.3.4");
|
||||
Services.dns.asyncResolve(
|
||||
dns.asyncResolve(
|
||||
DOMAIN,
|
||||
Ci.nsIDNSService.RESOLVE_TYPE_DEFAULT,
|
||||
0,
|
||||
|
@ -121,11 +124,11 @@ add_task(async function test_clearOverrides() {
|
|||
);
|
||||
Assert.equal(await listener.firstAddress(), "1.2.3.4");
|
||||
|
||||
Services.dns.clearCache(false);
|
||||
dns.clearCache(false);
|
||||
override.clearOverrides();
|
||||
|
||||
listener = new Listener();
|
||||
Services.dns.asyncResolve(
|
||||
dns.asyncResolve(
|
||||
DOMAIN,
|
||||
Ci.nsIDNSService.RESOLVE_TYPE_DEFAULT,
|
||||
0,
|
||||
|
@ -137,7 +140,7 @@ add_task(async function test_clearOverrides() {
|
|||
Assert.notEqual(await listener.firstAddress(), "1.2.3.4");
|
||||
|
||||
await new Promise(resolve => do_timeout(1000, resolve));
|
||||
Services.dns.clearCache(false);
|
||||
dns.clearCache(false);
|
||||
override.clearOverrides();
|
||||
});
|
||||
|
||||
|
@ -146,7 +149,7 @@ add_task(async function test_clearHostOverride() {
|
|||
override.addIPOverride(OTHER, "2.2.2.2");
|
||||
override.clearHostOverride(DOMAIN);
|
||||
let listener = new Listener();
|
||||
Services.dns.asyncResolve(
|
||||
dns.asyncResolve(
|
||||
DOMAIN,
|
||||
Ci.nsIDNSService.RESOLVE_TYPE_DEFAULT,
|
||||
0,
|
||||
|
@ -159,7 +162,7 @@ add_task(async function test_clearHostOverride() {
|
|||
Assert.notEqual(await listener.firstAddress(), "2.2.2.2");
|
||||
|
||||
listener = new Listener();
|
||||
Services.dns.asyncResolve(
|
||||
dns.asyncResolve(
|
||||
OTHER,
|
||||
Ci.nsIDNSService.RESOLVE_TYPE_DEFAULT,
|
||||
0,
|
||||
|
@ -178,7 +181,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));
|
||||
Services.dns.clearCache(false);
|
||||
dns.clearCache(false);
|
||||
override.clearOverrides();
|
||||
});
|
||||
|
||||
|
@ -188,7 +191,7 @@ add_task(async function test_multiple_IPs() {
|
|||
override.addIPOverride(DOMAIN, "::1");
|
||||
override.addIPOverride(DOMAIN, "fe80::6a99:9b2b:6ccc:6e1b");
|
||||
let listener = new Listener();
|
||||
Services.dns.asyncResolve(
|
||||
dns.asyncResolve(
|
||||
DOMAIN,
|
||||
Ci.nsIDNSService.RESOLVE_TYPE_DEFAULT,
|
||||
0,
|
||||
|
@ -204,7 +207,7 @@ add_task(async function test_multiple_IPs() {
|
|||
"fe80::6a99:9b2b:6ccc:6e1b",
|
||||
]);
|
||||
|
||||
Services.dns.clearCache(false);
|
||||
dns.clearCache(false);
|
||||
override.clearOverrides();
|
||||
});
|
||||
|
||||
|
@ -214,7 +217,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();
|
||||
Services.dns.asyncResolve(
|
||||
dns.asyncResolve(
|
||||
DOMAIN,
|
||||
Ci.nsIDNSService.RESOLVE_TYPE_DEFAULT,
|
||||
Ci.nsIDNSService.RESOLVE_DISABLE_IPV4,
|
||||
|
@ -229,7 +232,7 @@ add_task(async function test_address_family_flags() {
|
|||
]);
|
||||
|
||||
listener = new Listener();
|
||||
Services.dns.asyncResolve(
|
||||
dns.asyncResolve(
|
||||
DOMAIN,
|
||||
Ci.nsIDNSService.RESOLVE_TYPE_DEFAULT,
|
||||
Ci.nsIDNSService.RESOLVE_DISABLE_IPV6,
|
||||
|
@ -240,14 +243,14 @@ add_task(async function test_address_family_flags() {
|
|||
);
|
||||
Assert.deepEqual(await listener.addresses(), ["2.2.2.2", "1.1.1.1"]);
|
||||
|
||||
Services.dns.clearCache(false);
|
||||
dns.clearCache(false);
|
||||
override.clearOverrides();
|
||||
});
|
||||
|
||||
add_task(async function test_cname_flag() {
|
||||
override.addIPOverride(DOMAIN, "2.2.2.2");
|
||||
let listener = new Listener();
|
||||
Services.dns.asyncResolve(
|
||||
dns.asyncResolve(
|
||||
DOMAIN,
|
||||
Ci.nsIDNSService.RESOLVE_TYPE_DEFAULT,
|
||||
0,
|
||||
|
@ -266,7 +269,7 @@ add_task(async function test_cname_flag() {
|
|||
Assert.equal(inRecord.getNextAddrAsString(), "2.2.2.2");
|
||||
|
||||
listener = new Listener();
|
||||
Services.dns.asyncResolve(
|
||||
dns.asyncResolve(
|
||||
DOMAIN,
|
||||
Ci.nsIDNSService.RESOLVE_TYPE_DEFAULT,
|
||||
Ci.nsIDNSService.RESOLVE_CANONICAL_NAME,
|
||||
|
@ -280,13 +283,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");
|
||||
|
||||
Services.dns.clearCache(false);
|
||||
dns.clearCache(false);
|
||||
override.clearOverrides();
|
||||
|
||||
override.addIPOverride(DOMAIN, "2.2.2.2");
|
||||
override.setCnameOverride(DOMAIN, OTHER);
|
||||
listener = new Listener();
|
||||
Services.dns.asyncResolve(
|
||||
dns.asyncResolve(
|
||||
DOMAIN,
|
||||
Ci.nsIDNSService.RESOLVE_TYPE_DEFAULT,
|
||||
Ci.nsIDNSService.RESOLVE_CANONICAL_NAME,
|
||||
|
@ -300,14 +303,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");
|
||||
|
||||
Services.dns.clearCache(false);
|
||||
dns.clearCache(false);
|
||||
override.clearOverrides();
|
||||
});
|
||||
|
||||
add_task(async function test_nxdomain() {
|
||||
override.addIPOverride(DOMAIN, "N/A");
|
||||
let listener = new Listener();
|
||||
Services.dns.asyncResolve(
|
||||
dns.asyncResolve(
|
||||
DOMAIN,
|
||||
Ci.nsIDNSService.RESOLVE_TYPE_DEFAULT,
|
||||
Ci.nsIDNSService.RESOLVE_CANONICAL_NAME,
|
||||
|
|
|
@ -1,5 +1,8 @@
|
|||
"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
|
||||
);
|
||||
|
@ -51,7 +54,7 @@ DOMAINS.forEach(domain => {
|
|||
});
|
||||
|
||||
// Verify that loopback host names are not overridden.
|
||||
Services.dns.asyncResolve(
|
||||
dns.asyncResolve(
|
||||
domain,
|
||||
Ci.nsIDNSService.RESOLVE_TYPE_DEFAULT,
|
||||
0,
|
||||
|
@ -70,7 +73,7 @@ DOMAINS.forEach(domain => {
|
|||
// registered above are taken into account.
|
||||
Services.prefs.setBoolPref("network.proxy.allow_hijacking_localhost", true);
|
||||
let listener2 = new Listener();
|
||||
Services.dns.asyncResolve(
|
||||
dns.asyncResolve(
|
||||
domain,
|
||||
Ci.nsIDNSService.RESOLVE_TYPE_DEFAULT,
|
||||
0,
|
||||
|
@ -86,7 +89,7 @@ DOMAINS.forEach(domain => {
|
|||
);
|
||||
Services.prefs.clearUserPref("network.proxy.allow_hijacking_localhost");
|
||||
|
||||
Services.dns.clearCache(false);
|
||||
dns.clearCache(false);
|
||||
override.clearOverrides();
|
||||
});
|
||||
});
|
||||
|
|
|
@ -24,6 +24,9 @@ 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);
|
||||
|
@ -74,7 +77,6 @@ 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);
|
||||
}
|
||||
|
||||
|
@ -124,7 +126,7 @@ async function registerDoHAnswers(ipv4, ipv6) {
|
|||
});
|
||||
}
|
||||
|
||||
Services.dns.clearCache(true);
|
||||
dns.clearCache(true);
|
||||
}
|
||||
|
||||
let StatusCounter = function() {
|
||||
|
@ -271,7 +273,7 @@ add_task(async function test_prefer_address_version_fail_trr3_1() {
|
|||
// Make IPv6 connectivity check fail
|
||||
await setup_connectivity(false, true);
|
||||
|
||||
Services.dns.clearCache(true);
|
||||
dns.clearCache(true);
|
||||
|
||||
// This will succeed as we query both DNS records
|
||||
await make_request(URL6a, true, true);
|
||||
|
@ -303,7 +305,7 @@ add_task(async function test_prefer_address_version_fail_trr3_2() {
|
|||
// Make IPv6 connectivity check fail
|
||||
await setup_connectivity(false, true);
|
||||
|
||||
Services.dns.clearCache(true);
|
||||
dns.clearCache(true);
|
||||
|
||||
// This will succeed as we query both DNS records
|
||||
await make_request(URL6b, false, true);
|
||||
|
|
|
@ -1,5 +1,8 @@
|
|||
"use strict";
|
||||
|
||||
const dns = Cc["@mozilla.org/network/dns-service;1"].getService(
|
||||
Ci.nsIDNSService
|
||||
);
|
||||
const defaultOriginAttributes = {};
|
||||
const mainThread = Services.tm.currentThread;
|
||||
|
||||
|
@ -33,7 +36,7 @@ const ADDR2 = "::1";
|
|||
|
||||
add_task(async function test_dns_localhost() {
|
||||
let listener = new Listener();
|
||||
Services.dns.asyncResolve(
|
||||
dns.asyncResolve(
|
||||
"localhost",
|
||||
Ci.nsIDNSService.RESOLVE_TYPE_DEFAULT,
|
||||
0,
|
||||
|
@ -50,7 +53,7 @@ add_task(async function test_dns_localhost() {
|
|||
|
||||
add_task(async function test_idn_cname() {
|
||||
let listener = new Listener();
|
||||
Services.dns.asyncResolve(
|
||||
dns.asyncResolve(
|
||||
DOMAIN_IDN,
|
||||
Ci.nsIDNSService.RESOLVE_TYPE_DEFAULT,
|
||||
Ci.nsIDNSService.RESOLVE_CANONICAL_NAME,
|
||||
|
@ -73,7 +76,7 @@ add_task(
|
|||
let listener = new Listener();
|
||||
let domain = "a".repeat(253);
|
||||
overrideService.addIPOverride(domain, "1.2.3.4");
|
||||
Services.dns.asyncResolve(
|
||||
dns.asyncResolve(
|
||||
domain,
|
||||
Ci.nsIDNSService.RESOLVE_TYPE_DEFAULT,
|
||||
Ci.nsIDNSService.RESOLVE_CANONICAL_NAME,
|
||||
|
@ -93,7 +96,7 @@ add_task(
|
|||
|
||||
if (mozinfo.socketprocess_networking) {
|
||||
// When using the socket process, the call fails asynchronously.
|
||||
Services.dns.asyncResolve(
|
||||
dns.asyncResolve(
|
||||
domain,
|
||||
Ci.nsIDNSService.RESOLVE_TYPE_DEFAULT,
|
||||
Ci.nsIDNSService.RESOLVE_CANONICAL_NAME,
|
||||
|
@ -107,7 +110,7 @@ add_task(
|
|||
} else {
|
||||
Assert.throws(
|
||||
() => {
|
||||
Services.dns.asyncResolve(
|
||||
dns.asyncResolve(
|
||||
domain,
|
||||
Ci.nsIDNSService.RESOLVE_TYPE_DEFAULT,
|
||||
Ci.nsIDNSService.RESOLVE_CANONICAL_NAME,
|
||||
|
@ -125,7 +128,7 @@ add_task(
|
|||
listener = new Listener();
|
||||
domain = "a".repeat(254);
|
||||
Services.prefs.setBoolPref("network.dns.limit_253_chars", false);
|
||||
Services.dns.asyncResolve(
|
||||
dns.asyncResolve(
|
||||
domain,
|
||||
Ci.nsIDNSService.RESOLVE_TYPE_DEFAULT,
|
||||
Ci.nsIDNSService.RESOLVE_CANONICAL_NAME,
|
||||
|
|
|
@ -13,6 +13,9 @@ 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"
|
||||
);
|
||||
|
@ -32,7 +35,6 @@ 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);
|
||||
}
|
||||
|
||||
|
@ -770,7 +772,7 @@ add_task(async function testTwoFastFallbackTimers() {
|
|||
|
||||
Services.obs.notifyObservers(null, "net:prune-all-connections");
|
||||
Services.obs.notifyObservers(null, "network:reset-http3-excluded-list");
|
||||
Services.dns.clearCache(true);
|
||||
dns.clearCache(true);
|
||||
|
||||
// Do the same test again, but with a different configuration.
|
||||
Services.prefs.setIntPref(
|
||||
|
|
|
@ -8,6 +8,10 @@ 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();
|
||||
|
||||
|
@ -97,7 +101,7 @@ add_task(async function testEchConfigEnabled() {
|
|||
});
|
||||
|
||||
let { inRecord } = await new TRRDNSListener("test.bar.com", {
|
||||
type: Ci.nsIDNSService.RESOLVE_TYPE_HTTPSSVC,
|
||||
type: dns.RESOLVE_TYPE_HTTPSSVC,
|
||||
});
|
||||
|
||||
checkResult(inRecord, false, false, {
|
||||
|
@ -118,10 +122,10 @@ add_task(async function testEchConfigEnabled() {
|
|||
checkResult(inRecord, true, true);
|
||||
|
||||
Services.prefs.setBoolPref("network.dns.echconfig.enabled", true);
|
||||
Services.dns.clearCache(true);
|
||||
dns.clearCache(true);
|
||||
|
||||
({ inRecord } = await new TRRDNSListener("test.bar.com", {
|
||||
type: Ci.nsIDNSService.RESOLVE_TYPE_HTTPSSVC,
|
||||
type: dns.RESOLVE_TYPE_HTTPSSVC,
|
||||
}));
|
||||
|
||||
checkResult(inRecord, false, false, {
|
||||
|
@ -152,7 +156,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() {
|
||||
Services.dns.clearCache(true);
|
||||
dns.clearCache(true);
|
||||
|
||||
let trrServer = new TRRServer();
|
||||
await trrServer.start();
|
||||
|
@ -199,7 +203,7 @@ add_task(async function testTwoRecordsHaveEchConfig() {
|
|||
});
|
||||
|
||||
let { inRecord } = await new TRRDNSListener("test.foo.com", {
|
||||
type: Ci.nsIDNSService.RESOLVE_TYPE_HTTPSSVC,
|
||||
type: dns.RESOLVE_TYPE_HTTPSSVC,
|
||||
});
|
||||
|
||||
checkResult(inRecord, false, false, {
|
||||
|
@ -220,9 +224,9 @@ add_task(async function testTwoRecordsHaveEchConfig() {
|
|||
checkResult(inRecord, true, true);
|
||||
|
||||
Services.prefs.setBoolPref("network.dns.http3_echconfig.enabled", true);
|
||||
Services.dns.clearCache(true);
|
||||
dns.clearCache(true);
|
||||
({ inRecord } = await new TRRDNSListener("test.foo.com", {
|
||||
type: Ci.nsIDNSService.RESOLVE_TYPE_HTTPSSVC,
|
||||
type: dns.RESOLVE_TYPE_HTTPSSVC,
|
||||
}));
|
||||
|
||||
checkResult(inRecord, false, false, {
|
||||
|
@ -251,7 +255,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() {
|
||||
Services.dns.clearCache(true);
|
||||
dns.clearCache(true);
|
||||
|
||||
let trrServer = new TRRServer();
|
||||
await trrServer.start();
|
||||
|
@ -298,7 +302,7 @@ add_task(async function testTwoRecordsHaveEchConfig1() {
|
|||
});
|
||||
|
||||
let { inRecord } = await new TRRDNSListener("test.foo.com", {
|
||||
type: Ci.nsIDNSService.RESOLVE_TYPE_HTTPSSVC,
|
||||
type: dns.RESOLVE_TYPE_HTTPSSVC,
|
||||
});
|
||||
|
||||
checkResult(inRecord, false, false, {
|
||||
|
@ -323,9 +327,9 @@ add_task(async function testTwoRecordsHaveEchConfig1() {
|
|||
});
|
||||
|
||||
Services.prefs.setBoolPref("network.dns.http3_echconfig.enabled", true);
|
||||
Services.dns.clearCache(true);
|
||||
dns.clearCache(true);
|
||||
({ inRecord } = await new TRRDNSListener("test.foo.com", {
|
||||
type: Ci.nsIDNSService.RESOLVE_TYPE_HTTPSSVC,
|
||||
type: dns.RESOLVE_TYPE_HTTPSSVC,
|
||||
}));
|
||||
|
||||
checkResult(inRecord, false, false, {
|
||||
|
@ -357,7 +361,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() {
|
||||
Services.dns.clearCache(true);
|
||||
dns.clearCache(true);
|
||||
|
||||
let trrServer = new TRRServer();
|
||||
await trrServer.start();
|
||||
|
@ -401,7 +405,7 @@ add_task(async function testOneRecordsHasEchConfig() {
|
|||
});
|
||||
|
||||
let { inRecord } = await new TRRDNSListener("test.foo.com", {
|
||||
type: Ci.nsIDNSService.RESOLVE_TYPE_HTTPSSVC,
|
||||
type: dns.RESOLVE_TYPE_HTTPSSVC,
|
||||
});
|
||||
|
||||
checkResult(inRecord, false, false, {
|
||||
|
@ -422,9 +426,9 @@ add_task(async function testOneRecordsHasEchConfig() {
|
|||
checkResult(inRecord, true, true);
|
||||
|
||||
Services.prefs.setBoolPref("network.dns.http3_echconfig.enabled", true);
|
||||
Services.dns.clearCache(true);
|
||||
dns.clearCache(true);
|
||||
({ inRecord } = await new TRRDNSListener("test.foo.com", {
|
||||
type: Ci.nsIDNSService.RESOLVE_TYPE_HTTPSSVC,
|
||||
type: dns.RESOLVE_TYPE_HTTPSSVC,
|
||||
}));
|
||||
|
||||
checkResult(inRecord, false, false, {
|
||||
|
@ -451,7 +455,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() {
|
||||
Services.dns.clearCache(true);
|
||||
dns.clearCache(true);
|
||||
|
||||
let trrServer = new TRRServer();
|
||||
await trrServer.start();
|
||||
|
@ -499,7 +503,7 @@ add_task(async function testHttp3AndHttp2Pref() {
|
|||
});
|
||||
|
||||
let { inRecord } = await new TRRDNSListener("test.foo.com", {
|
||||
type: Ci.nsIDNSService.RESOLVE_TYPE_HTTPSSVC,
|
||||
type: dns.RESOLVE_TYPE_HTTPSSVC,
|
||||
});
|
||||
|
||||
checkResult(inRecord, false, false, {
|
||||
|
|
|
@ -8,6 +8,10 @@ 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"
|
||||
);
|
||||
|
@ -24,7 +28,6 @@ add_setup(async function setup() {
|
|||
});
|
||||
|
||||
if (mozinfo.socketprocess_networking) {
|
||||
Services.dns; // Needed to trigger socket process.
|
||||
await TestUtils.waitForCondition(() => Services.io.socketProcessLaunched);
|
||||
}
|
||||
});
|
||||
|
@ -52,7 +55,7 @@ function checkResult(inRecord, noHttp2, noHttp3, result) {
|
|||
}
|
||||
|
||||
add_task(async function testSortedAlpnH3() {
|
||||
Services.dns.clearCache(true);
|
||||
dns.clearCache(true);
|
||||
|
||||
trrServer = new TRRServer();
|
||||
await trrServer.start();
|
||||
|
@ -80,7 +83,7 @@ add_task(async function testSortedAlpnH3() {
|
|||
});
|
||||
|
||||
let { inRecord } = await new TRRDNSListener("test.alpn.com", {
|
||||
type: Ci.nsIDNSService.RESOLVE_TYPE_HTTPSSVC,
|
||||
type: dns.RESOLVE_TYPE_HTTPSSVC,
|
||||
});
|
||||
|
||||
checkResult(inRecord, false, false, {
|
||||
|
@ -175,7 +178,7 @@ add_task(async function testSortedAlpnH3() {
|
|||
});
|
||||
|
||||
add_task(async function testSortedAlpnH2() {
|
||||
Services.dns.clearCache(true);
|
||||
dns.clearCache(true);
|
||||
|
||||
Services.prefs.setIntPref("network.trr.mode", 3);
|
||||
Services.prefs.setCharPref(
|
||||
|
@ -199,7 +202,7 @@ add_task(async function testSortedAlpnH2() {
|
|||
});
|
||||
|
||||
let { inRecord } = await new TRRDNSListener("test.alpn_2.com", {
|
||||
type: Ci.nsIDNSService.RESOLVE_TYPE_HTTPSSVC,
|
||||
type: dns.RESOLVE_TYPE_HTTPSSVC,
|
||||
});
|
||||
|
||||
checkResult(inRecord, false, false, {
|
||||
|
|
|
@ -6,6 +6,10 @@
|
|||
|
||||
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);
|
||||
|
@ -52,7 +56,6 @@ add_setup(async function setup() {
|
|||
});
|
||||
|
||||
if (mozinfo.socketprocess_networking) {
|
||||
Services.dns; // Needed to trigger socket process.
|
||||
await TestUtils.waitForCondition(() => Services.io.socketProcessLaunched);
|
||||
}
|
||||
|
||||
|
@ -112,7 +115,7 @@ EventSinkListener.prototype.QueryInterface = ChromeUtils.generateQI([
|
|||
|
||||
// Test if the request is upgraded to https with a HTTPSSVC record.
|
||||
add_task(async function testUseHTTPSSVCAsHSTS() {
|
||||
Services.dns.clearCache(true);
|
||||
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", {
|
||||
|
@ -144,7 +147,7 @@ add_task(async function testUseHTTPSSVCAsHSTS() {
|
|||
// nsHttpChannel::OnHTTPSRRAvailable is called after
|
||||
// nsHttpChannel::MaybeUseHTTPSRRForUpgrade.
|
||||
add_task(async function testInvalidDNSResult() {
|
||||
Services.dns.clearCache(true);
|
||||
dns.clearCache(true);
|
||||
|
||||
let httpserv = new HttpServer();
|
||||
let content = "ok";
|
||||
|
@ -170,7 +173,7 @@ add_task(async function testInvalidDNSResult() {
|
|||
// The same test as above, but nsHttpChannel::MaybeUseHTTPSRRForUpgrade is
|
||||
// called after nsHttpChannel::OnHTTPSRRAvailable.
|
||||
add_task(async function testInvalidDNSResult1() {
|
||||
Services.dns.clearCache(true);
|
||||
dns.clearCache(true);
|
||||
|
||||
let httpserv = new HttpServer();
|
||||
let content = "ok";
|
||||
|
@ -199,7 +202,7 @@ add_task(async function testInvalidDNSResult1() {
|
|||
channel.suspend();
|
||||
|
||||
new TRRDNSListener("foo.notexisted.com", {
|
||||
type: Ci.nsIDNSService.RESOLVE_TYPE_HTTPSSVC,
|
||||
type: dns.RESOLVE_TYPE_HTTPSSVC,
|
||||
expectedSuccess: false,
|
||||
}).then(() => channel.resume());
|
||||
}
|
||||
|
@ -229,7 +232,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() {
|
||||
Services.dns.clearCache(true);
|
||||
dns.clearCache(true);
|
||||
|
||||
let httpserv = new HttpServer();
|
||||
let content = "okok";
|
||||
|
@ -254,7 +257,7 @@ add_task(async function testEndlessUpgradeDowngrade() {
|
|||
});
|
||||
|
||||
add_task(async function testHttpRequestBlocked() {
|
||||
Services.dns.clearCache(true);
|
||||
dns.clearCache(true);
|
||||
|
||||
let dnsRequestObserver = {
|
||||
register() {
|
||||
|
@ -321,7 +324,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() {
|
||||
Services.dns.clearCache(true);
|
||||
dns.clearCache(true);
|
||||
|
||||
const url = "http://test.httpssvc.com:80/origin_header";
|
||||
const originURL = "http://example.com";
|
||||
|
|
|
@ -9,6 +9,9 @@ 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);
|
||||
|
@ -35,7 +38,6 @@ add_setup(async function setup() {
|
|||
});
|
||||
|
||||
if (mozinfo.socketprocess_networking) {
|
||||
Services.dns; // Needed to trigger socket process.
|
||||
await TestUtils.waitForCondition(() => Services.io.socketProcessLaunched);
|
||||
}
|
||||
});
|
||||
|
@ -173,7 +175,7 @@ function channelOpenPromise(chan, flags) {
|
|||
|
||||
// Test if we can connect to the server with the IP hint address.
|
||||
add_task(async function testConnectionWithIPHint() {
|
||||
Services.dns.clearCache(true);
|
||||
dns.clearCache(true);
|
||||
Services.prefs.setIntPref("network.trr.mode", 3);
|
||||
Services.prefs.setCharPref(
|
||||
"network.trr.uri",
|
||||
|
@ -261,7 +263,7 @@ add_task(async function testIPHintWithFreshDNS() {
|
|||
});
|
||||
|
||||
let { inRecord } = await new TRRDNSListener("test.iphint.org", {
|
||||
type: Ci.nsIDNSService.RESOLVE_TYPE_HTTPSSVC,
|
||||
type: dns.RESOLVE_TYPE_HTTPSSVC,
|
||||
});
|
||||
|
||||
let answer = inRecord.QueryInterface(Ci.nsIDNSHTTPSSVCRecord).records;
|
||||
|
|
|
@ -12,6 +12,10 @@ 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 () => {
|
||||
|
@ -95,7 +99,7 @@ add_task(async function testPriorityAndECHConfig() {
|
|||
Assert.equal(answer[3].name, "test.p4.com");
|
||||
|
||||
Services.prefs.setBoolPref("network.dns.echconfig.enabled", true);
|
||||
Services.dns.clearCache(true);
|
||||
dns.clearCache(true);
|
||||
({ inRecord } = await new TRRDNSListener("test.priority.com", {
|
||||
type: Ci.nsIDNSService.RESOLVE_TYPE_HTTPSSVC,
|
||||
}));
|
||||
|
|
|
@ -13,6 +13,9 @@ 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);
|
||||
|
@ -247,7 +250,7 @@ add_task(async function testEchRetry() {
|
|||
// eslint-disable-next-line mozilla/no-arbitrary-setTimeout
|
||||
await new Promise(resolve => setTimeout(resolve, 1000));
|
||||
|
||||
Services.dns.clearCache(true);
|
||||
dns.clearCache(true);
|
||||
|
||||
const ECH_CONFIG_TRUSTED_RETRY =
|
||||
"AEn+DQBFTQAgACCKB1Y5SfrGIyk27W82xPpzWTDs3q72c04xSurDWlb9CgAEAAMAA2QWZWNoLXB1YmxpYy5leGFtcGxlLmNvbQAA";
|
||||
|
@ -408,7 +411,7 @@ add_task(async function testH3ConnectWithECH() {
|
|||
});
|
||||
|
||||
add_task(async function testH3ConnectWithECHRetry() {
|
||||
Services.dns.clearCache(true);
|
||||
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,7 +145,6 @@ 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,7 +52,6 @@ add_setup(async function setup() {
|
|||
});
|
||||
|
||||
if (mozinfo.socketprocess_networking) {
|
||||
Services.dns; // Needed to trigger socket process.
|
||||
await TestUtils.waitForCondition(() => Services.io.socketProcessLaunched);
|
||||
}
|
||||
|
||||
|
@ -98,7 +97,7 @@ async function ODoHConfigTest(query, ODoHHost, expectedResult = false) {
|
|||
}
|
||||
|
||||
await topicObserved("odoh-service-activated");
|
||||
Assert.equal(Services.dns.ODoHActivated, expectedResult);
|
||||
Assert.equal(dns.ODoHActivated, expectedResult);
|
||||
}
|
||||
|
||||
add_task(async function testODoHConfig1() {
|
||||
|
@ -128,12 +127,12 @@ add_task(async function testODoHConfig6() {
|
|||
|
||||
// This is triggered by the expiration of the TTL.
|
||||
await topicObserved("odoh-service-activated");
|
||||
Assert.ok(!Services.dns.ODoHActivated);
|
||||
Assert.ok(!dns.ODoHActivated);
|
||||
Services.prefs.clearUserPref("network.trr.odoh.min_ttl");
|
||||
});
|
||||
|
||||
add_task(async function testODoHConfig7() {
|
||||
Services.dns.clearCache(true);
|
||||
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
|
||||
|
@ -148,11 +147,11 @@ async function ODoHConfigTestHTTP(configUri, expectedResult) {
|
|||
Services.prefs.setCharPref("network.trr.odoh.configs_uri", configUri);
|
||||
|
||||
await topicObserved("odoh-service-activated");
|
||||
Assert.equal(Services.dns.ODoHActivated, expectedResult);
|
||||
Assert.equal(dns.ODoHActivated, expectedResult);
|
||||
}
|
||||
|
||||
add_task(async function testODoHConfig8() {
|
||||
Services.dns.clearCache(true);
|
||||
dns.clearCache(true);
|
||||
Services.prefs.setCharPref("network.trr.uri", "");
|
||||
|
||||
await ODoHConfigTestHTTP(
|
||||
|
@ -179,7 +178,7 @@ add_task(async function testODoHConfig9() {
|
|||
Services.prefs.clearUserPref("network.trr.odoh.configs_uri");
|
||||
|
||||
await topicObserved("odoh-service-activated");
|
||||
Assert.ok(Services.dns.ODoHActivated);
|
||||
Assert.ok(dns.ODoHActivated);
|
||||
|
||||
await ODoHConfigTestHTTP(
|
||||
`https://foo.example.com:${h2Port}/odohconfig?downloadFrom=http`,
|
||||
|
@ -188,7 +187,7 @@ add_task(async function testODoHConfig9() {
|
|||
|
||||
// This is triggered by the expiration of the TTL.
|
||||
await topicObserved("odoh-service-activated");
|
||||
Assert.ok(Services.dns.ODoHActivated);
|
||||
Assert.ok(dns.ODoHActivated);
|
||||
Services.prefs.clearUserPref("network.trr.odoh.min_ttl");
|
||||
});
|
||||
|
||||
|
@ -270,7 +269,7 @@ add_task(test_no_retry_without_doh);
|
|||
add_task(test_connection_reuse_and_cycling).skip(); // Bug 1742743
|
||||
|
||||
add_task(async function testODoHConfigNotAvailableInMode3() {
|
||||
Services.dns.clearCache(true);
|
||||
dns.clearCache(true);
|
||||
Services.prefs.setIntPref("network.trr.mode", 3);
|
||||
Services.prefs.setCharPref("network.trr.uri", "");
|
||||
|
||||
|
@ -285,7 +284,7 @@ add_task(async function testODoHConfigNotAvailableInMode3() {
|
|||
});
|
||||
|
||||
add_task(async function testODoHConfigNotAvailableInMode2() {
|
||||
Services.dns.clearCache(true);
|
||||
dns.clearCache(true);
|
||||
Services.prefs.setIntPref("network.trr.mode", 2);
|
||||
Services.prefs.setCharPref("network.trr.uri", "");
|
||||
|
||||
|
|
|
@ -10,6 +10,9 @@ 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 = [];
|
||||
|
@ -108,7 +111,7 @@ add_task(async function test_bug1724345() {
|
|||
override.clearOverrides();
|
||||
override.addIPOverride("example.org", "N/A");
|
||||
override.addIPOverride("null", "127.0.0.1");
|
||||
Services.dns.clearCache(true);
|
||||
dns.clearCache(true);
|
||||
|
||||
let chan = NetUtil.newChannel({
|
||||
uri: `http://example.org:1234/`,
|
||||
|
|
Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше
Загрузка…
Ссылка в новой задаче