Backed out 6 changesets (bug 1552176) for bustages complaining about ServiceWorkerManager.cpp CLOSED TREE

Backed out changeset bff9110e434e (bug 1552176)
Backed out changeset ac8f8a6dbd98 (bug 1552176)
Backed out changeset 8dd630e7534a (bug 1552176)
Backed out changeset 7ce9e220cdb9 (bug 1552176)
Backed out changeset ee9911acfcd4 (bug 1552176)
Backed out changeset 652b3bd6848d (bug 1552176)
This commit is contained in:
Bogdan Tara 2019-11-08 22:18:05 +02:00
parent fd3b69986c
commit 8f38f4a3fb
51 changed files with 168 additions and 770 deletions

View File

@ -697,16 +697,6 @@ OnloadBlocker::GetLoadFlags(nsLoadFlags* aLoadFlags) {
return NS_OK;
}
NS_IMETHODIMP
OnloadBlocker::GetTRRMode(nsIRequest::TRRMode* aTRRMode) {
return GetTRRModeImpl(aTRRMode);
}
NS_IMETHODIMP
OnloadBlocker::SetTRRMode(nsIRequest::TRRMode aTRRMode) {
return SetTRRModeImpl(aTRRMode);
}
NS_IMETHODIMP
OnloadBlocker::SetLoadFlags(nsLoadFlags aLoadFlags) { return NS_OK; }

View File

@ -860,8 +860,7 @@ void nsContentSink::PrefetchDNS(const nsAString& aHref) {
if (!hostname.IsEmpty() && nsHTMLDNSPrefetch::IsAllowed(mDocument)) {
nsHTMLDNSPrefetch::PrefetchLow(
hostname, isHttps, mDocument->NodePrincipal()->OriginAttributesRef(),
mDocument->GetChannel()->GetTRRMode());
hostname, isHttps, mDocument->NodePrincipal()->OriginAttributesRef());
}
}

View File

@ -91,21 +91,10 @@ bool nsHTMLDNSPrefetch::IsAllowed(Document* aDocument) {
return aDocument->IsDNSPrefetchAllowed() && aDocument->GetWindow();
}
static uint32_t GetDNSFlagsFromLink(Link* aElement) {
if (!aElement || !aElement->GetElement() ||
!aElement->GetElement()->OwnerDoc()->GetChannel()) {
return 0;
}
nsIRequest::TRRMode mode =
aElement->GetElement()->OwnerDoc()->GetChannel()->GetTRRMode();
return nsIDNSService::GetFlagsFromTRRMode(mode);
}
nsresult nsHTMLDNSPrefetch::Prefetch(Link* aElement, uint32_t flags) {
nsresult nsHTMLDNSPrefetch::Prefetch(Link* aElement, uint16_t flags) {
if (!(sInitialized && sPrefetches && sDNSService && sDNSListener))
return NS_ERROR_NOT_AVAILABLE;
flags |= GetDNSFlagsFromLink(aElement);
return sPrefetches->Add(flags, aElement);
}
@ -123,7 +112,7 @@ nsresult nsHTMLDNSPrefetch::PrefetchHigh(Link* aElement) {
nsresult nsHTMLDNSPrefetch::Prefetch(const nsAString& hostname, bool isHttps,
const OriginAttributes& aOriginAttributes,
uint32_t flags) {
uint16_t flags) {
if (IsNeckoChild()) {
// We need to check IsEmpty() because net_IsValidHostName()
// considers empty strings to be valid hostnames
@ -165,28 +154,25 @@ nsresult nsHTMLDNSPrefetch::Prefetch(const nsAString& hostname, bool isHttps,
nsresult nsHTMLDNSPrefetch::PrefetchLow(
const nsAString& hostname, bool isHttps,
const OriginAttributes& aOriginAttributes, nsIRequest::TRRMode aMode) {
const OriginAttributes& aOriginAttributes) {
return Prefetch(hostname, isHttps, aOriginAttributes,
nsIDNSService::GetFlagsFromTRRMode(aMode) |
nsIDNSService::RESOLVE_PRIORITY_LOW);
nsIDNSService::RESOLVE_PRIORITY_LOW);
}
nsresult nsHTMLDNSPrefetch::PrefetchMedium(
const nsAString& hostname, bool isHttps,
const OriginAttributes& aOriginAttributes, nsIRequest::TRRMode aMode) {
const OriginAttributes& aOriginAttributes) {
return Prefetch(hostname, isHttps, aOriginAttributes,
nsIDNSService::GetFlagsFromTRRMode(aMode) |
nsIDNSService::RESOLVE_PRIORITY_MEDIUM);
nsIDNSService::RESOLVE_PRIORITY_MEDIUM);
}
nsresult nsHTMLDNSPrefetch::PrefetchHigh(
const nsAString& hostname, bool isHttps,
const OriginAttributes& aOriginAttributes, nsIRequest::TRRMode aMode) {
return Prefetch(hostname, isHttps, aOriginAttributes,
nsIDNSService::GetFlagsFromTRRMode(aMode));
const OriginAttributes& aOriginAttributes) {
return Prefetch(hostname, isHttps, aOriginAttributes, 0);
}
nsresult nsHTMLDNSPrefetch::CancelPrefetch(Link* aElement, uint32_t flags,
nsresult nsHTMLDNSPrefetch::CancelPrefetch(Link* aElement, uint16_t flags,
nsresult aReason) {
if (!(sInitialized && sPrefetches && sDNSService && sDNSListener))
return NS_ERROR_NOT_AVAILABLE;
@ -210,7 +196,7 @@ nsresult nsHTMLDNSPrefetch::CancelPrefetch(Link* aElement, uint32_t flags,
nsresult nsHTMLDNSPrefetch::CancelPrefetch(
const nsAString& hostname, bool isHttps,
const OriginAttributes& aOriginAttributes, uint32_t flags,
const OriginAttributes& aOriginAttributes, uint16_t flags,
nsresult aReason) {
// Forward this request to Necko Parent if we're a child process
if (IsNeckoChild()) {
@ -249,20 +235,14 @@ nsresult nsHTMLDNSPrefetch::CancelPrefetch(
nsresult nsHTMLDNSPrefetch::CancelPrefetchLow(Link* aElement,
nsresult aReason) {
return CancelPrefetch(
aElement,
GetDNSFlagsFromLink(aElement) | nsIDNSService::RESOLVE_PRIORITY_LOW,
aReason);
return CancelPrefetch(aElement, nsIDNSService::RESOLVE_PRIORITY_LOW, aReason);
}
nsresult nsHTMLDNSPrefetch::CancelPrefetchLow(
const nsAString& hostname, bool isHttps,
const OriginAttributes& aOriginAttributes, nsIRequest::TRRMode aTRRMode,
nsresult aReason) {
const OriginAttributes& aOriginAttributes, nsresult aReason) {
return CancelPrefetch(hostname, isHttps, aOriginAttributes,
nsIDNSService::GetFlagsFromTRRMode(aTRRMode) |
nsIDNSService::RESOLVE_PRIORITY_LOW,
aReason);
nsIDNSService::RESOLVE_PRIORITY_LOW, aReason);
}
void nsHTMLDNSPrefetch::LinkDestroyed(Link* aLink) {
@ -321,7 +301,7 @@ void nsHTMLDNSPrefetch::nsDeferrals::Flush() {
}
}
nsresult nsHTMLDNSPrefetch::nsDeferrals::Add(uint32_t flags, Link* aElement) {
nsresult nsHTMLDNSPrefetch::nsDeferrals::Add(uint16_t flags, Link* aElement) {
// The FIFO has no lock, so it can only be accessed on main thread
NS_ASSERTION(NS_IsMainThread(), "nsDeferrals::Add must be on main thread");

View File

@ -52,20 +52,16 @@ class nsHTMLDNSPrefetch {
static nsresult PrefetchLow(mozilla::dom::Link* aElement);
static nsresult PrefetchHigh(
const nsAString& host, bool isHttps,
const mozilla::OriginAttributes& aOriginAttributes,
nsIRequest::TRRMode aTRRMode);
const mozilla::OriginAttributes& aOriginAttributes);
static nsresult PrefetchMedium(
const nsAString& host, bool isHttps,
const mozilla::OriginAttributes& aOriginAttributes,
nsIRequest::TRRMode aTRRMode);
const mozilla::OriginAttributes& aOriginAttributes);
static nsresult PrefetchLow(
const nsAString& host, bool isHttps,
const mozilla::OriginAttributes& aOriginAttributes,
nsIRequest::TRRMode aTRRMode);
const mozilla::OriginAttributes& aOriginAttributes);
static nsresult CancelPrefetchLow(
const nsAString& host, bool isHttps,
const mozilla::OriginAttributes& aOriginAttributes,
nsIRequest::TRRMode aTRRMode, nsresult aReason);
const mozilla::OriginAttributes& aOriginAttributes, nsresult aReason);
static nsresult CancelPrefetchLow(mozilla::dom::Link* aElement,
nsresult aReason);
@ -74,13 +70,13 @@ class nsHTMLDNSPrefetch {
private:
static nsresult Prefetch(const nsAString& host, bool isHttps,
const mozilla::OriginAttributes& aOriginAttributes,
uint32_t flags);
static nsresult Prefetch(mozilla::dom::Link* aElement, uint32_t flags);
uint16_t flags);
static nsresult Prefetch(mozilla::dom::Link* aElement, uint16_t flags);
static nsresult CancelPrefetch(
const nsAString& hostname, bool isHttps,
const mozilla::OriginAttributes& aOriginAttributes, uint32_t flags,
const mozilla::OriginAttributes& aOriginAttributes, uint16_t flags,
nsresult aReason);
static nsresult CancelPrefetch(mozilla::dom::Link* aElement, uint32_t flags,
static nsresult CancelPrefetch(mozilla::dom::Link* aElement, uint16_t flags,
nsresult aReason);
public:
@ -107,7 +103,7 @@ class nsHTMLDNSPrefetch {
nsDeferrals();
void Activate();
nsresult Add(uint32_t flags, mozilla::dom::Link* aElement);
nsresult Add(uint16_t flags, mozilla::dom::Link* aElement);
void RemoveUnboundLinks();
@ -129,7 +125,7 @@ class nsHTMLDNSPrefetch {
static const int sMaxDeferredMask = (sMaxDeferred - 1);
struct deferred_entry {
uint32_t mFlags;
uint16_t mFlags;
// Link implementation clears this raw pointer in its destructor.
mozilla::dom::Link* mElement;
} mEntries[sMaxDeferred];

View File

@ -3585,8 +3585,6 @@ class FakeChannel final : public nsIChannel,
NS_IMETHOD SetLoadGroup(nsILoadGroup*) NO_IMPL;
NS_IMETHOD SetLoadFlags(nsLoadFlags) NO_IMPL;
NS_IMETHOD GetLoadFlags(nsLoadFlags*) NO_IMPL;
NS_IMETHOD GetTRRMode(nsIRequest::TRRMode* aTRRMode) NO_IMPL;
NS_IMETHOD SetTRRMode(nsIRequest::TRRMode aMode) NO_IMPL;
NS_IMETHOD GetIsDocument(bool*) NO_IMPL;
NS_IMETHOD GetOriginalURI(nsIURI**) NO_IMPL;
NS_IMETHOD SetOriginalURI(nsIURI*) NO_IMPL;

View File

@ -223,16 +223,6 @@ NS_IMETHODIMP RemoteWebProgressRequest::GetLoadFlags(nsLoadFlags* aLoadFlags) {
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP RemoteWebProgressRequest::GetTRRMode(
nsIRequest::TRRMode* aTRRMode) {
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP RemoteWebProgressRequest::SetTRRMode(
nsIRequest::TRRMode aTRRMode) {
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP RemoteWebProgressRequest::SetLoadFlags(nsLoadFlags aLoadFlags) {
return NS_ERROR_NOT_IMPLEMENTED;
}

View File

@ -833,16 +833,6 @@ nsJSChannel::SetLoadFlags(nsLoadFlags aLoadFlags) {
return mStreamChannel->SetLoadFlags(aLoadFlags);
}
NS_IMETHODIMP
nsJSChannel::GetTRRMode(nsIRequest::TRRMode* aTRRMode) {
return GetTRRModeImpl(aTRRMode);
}
NS_IMETHODIMP
nsJSChannel::SetTRRMode(nsIRequest::TRRMode aTRRMode) {
return SetTRRModeImpl(aTRRMode);
}
NS_IMETHODIMP
nsJSChannel::GetLoadGroup(nsILoadGroup** aLoadGroup) {
return mStreamChannel->GetLoadGroup(aLoadGroup);

View File

@ -676,16 +676,6 @@ PresentationConnection::GetLoadFlags(nsLoadFlags* aLoadFlags) {
NS_IMETHODIMP
PresentationConnection::SetLoadFlags(nsLoadFlags aLoadFlags) { return NS_OK; }
NS_IMETHODIMP
PresentationConnection::GetTRRMode(nsIRequest::TRRMode* aTRRMode) {
return GetTRRModeImpl(aTRRMode);
}
NS_IMETHODIMP
PresentationConnection::SetTRRMode(nsIRequest::TRRMode aTRRMode) {
return SetTRRModeImpl(aTRRMode);
}
nsresult PresentationConnection::AddIntoLoadGroup() {
// Avoid adding to loadgroup multiple times
if (mWeakLoadGroup) {

View File

@ -2546,16 +2546,6 @@ WebSocketImpl::SetLoadFlags(nsLoadFlags aLoadFlags) {
return NS_OK;
}
NS_IMETHODIMP
WebSocketImpl::GetTRRMode(nsIRequest::TRRMode* aTRRMode) {
return GetTRRModeImpl(aTRRMode);
}
NS_IMETHODIMP
WebSocketImpl::SetTRRMode(nsIRequest::TRRMode aTRRMode) {
return SetTRRModeImpl(aTRRMode);
}
namespace {
class WorkerRunnableDispatcher final : public WorkerRunnable {

View File

@ -346,12 +346,6 @@ nsIconChannel::SetLoadFlags(uint32_t aLoadAttributes) {
return mPump->SetLoadFlags(aLoadAttributes);
}
NS_IMETHODIMP
nsIconChannel::GetTRRMode(nsIRequest::TRRMode* aTRRMode) { return GetTRRModeImpl(aTRRMode); }
NS_IMETHODIMP
nsIconChannel::SetTRRMode(nsIRequest::TRRMode aTRRMode) { return SetTRRModeImpl(aTRRMode); }
NS_IMETHODIMP
nsIconChannel::GetIsDocument(bool* aIsDocument) {
return NS_GetIsDocumentChannel(this, aIsDocument);

View File

@ -231,16 +231,6 @@ nsIconChannel::SetLoadFlags(uint32_t aLoadAttributes) {
return mPump->SetLoadFlags(aLoadAttributes);
}
NS_IMETHODIMP
nsIconChannel::GetTRRMode(nsIRequest::TRRMode* aTRRMode) {
return GetTRRModeImpl(aTRRMode);
}
NS_IMETHODIMP
nsIconChannel::SetTRRMode(nsIRequest::TRRMode aTRRMode) {
return SetTRRModeImpl(aTRRMode);
}
NS_IMETHODIMP
nsIconChannel::GetIsDocument(bool* aIsDocument) {
return NS_GetIsDocumentChannel(this, aIsDocument);

View File

@ -661,16 +661,6 @@ imgRequestProxy::SetLoadFlags(nsLoadFlags flags) {
return NS_OK;
}
NS_IMETHODIMP
imgRequestProxy::GetTRRMode(nsIRequest::TRRMode* aTRRMode) {
return GetTRRModeImpl(aTRRMode);
}
NS_IMETHODIMP
imgRequestProxy::SetTRRMode(nsIRequest::TRRMode aTRRMode) {
return SetTRRModeImpl(aTRRMode);
}
/** imgIRequest methods **/
NS_IMETHODIMP

View File

@ -614,16 +614,6 @@ nsJARChannel::SetLoadFlags(nsLoadFlags aLoadFlags) {
return NS_OK;
}
NS_IMETHODIMP
nsJARChannel::GetTRRMode(nsIRequest::TRRMode* aTRRMode) {
return GetTRRModeImpl(aTRRMode);
}
NS_IMETHODIMP
nsJARChannel::SetTRRMode(nsIRequest::TRRMode aTRRMode) {
return SetTRRModeImpl(aTRRMode);
}
NS_IMETHODIMP
nsJARChannel::GetIsDocument(bool* aIsDocument) {
return NS_GetIsDocumentChannel(this, aIsDocument);

View File

@ -201,11 +201,10 @@ static inline already_AddRefed<nsIChannel> SetupIPCheckChannel(bool ipv4) {
nullptr, // aPerformanceStorage
nullptr, // aLoadGroup
nullptr,
nsIRequest::LOAD_BYPASS_CACHE | // don't read from the cache
nsIRequest::INHIBIT_CACHING | // don't write the response to cache
nsIRequest::LOAD_ANONYMOUS); // prevent privacy leaks
channel->SetTRRMode(nsIRequest::TRR_DISABLED_MODE);
nsIRequest::LOAD_BYPASS_CACHE | // don't read from the cache
nsIRequest::INHIBIT_CACHING | // don't write the response to cache
nsIRequest::LOAD_DISABLE_TRR | // check network capabilities not TRR
nsIRequest::LOAD_ANONYMOUS); // prevent privacy leaks
NS_ENSURE_SUCCESS(rv, nullptr);

View File

@ -202,16 +202,6 @@ nsAsyncStreamCopier::GetLoadFlags(nsLoadFlags* aLoadFlags) {
NS_IMETHODIMP
nsAsyncStreamCopier::SetLoadFlags(nsLoadFlags aLoadFlags) { return NS_OK; }
NS_IMETHODIMP
nsAsyncStreamCopier::GetTRRMode(nsIRequest::TRRMode* aTRRMode) {
return nsIAsyncStreamCopier::GetTRRModeImpl(aTRRMode);
}
NS_IMETHODIMP
nsAsyncStreamCopier::SetTRRMode(nsIRequest::TRRMode aTRRMode) {
return nsIAsyncStreamCopier::SetTRRModeImpl(aTRRMode);
}
NS_IMETHODIMP
nsAsyncStreamCopier::GetLoadGroup(nsILoadGroup** aLoadGroup) {
*aLoadGroup = nullptr;

View File

@ -430,16 +430,6 @@ nsBaseChannel::SetLoadFlags(nsLoadFlags aLoadFlags) {
return NS_OK;
}
NS_IMETHODIMP
nsBaseChannel::GetTRRMode(nsIRequest::TRRMode* aTRRMode) {
return GetTRRModeImpl(aTRRMode);
}
NS_IMETHODIMP
nsBaseChannel::SetTRRMode(nsIRequest::TRRMode aTRRMode) {
return SetTRRModeImpl(aTRRMode);
}
NS_IMETHODIMP
nsBaseChannel::GetLoadGroup(nsILoadGroup** aLoadGroup) {
NS_IF_ADDREF(*aLoadGroup = mLoadGroup);

View File

@ -33,17 +33,15 @@ nsresult nsDNSPrefetch::Shutdown() {
nsDNSPrefetch::nsDNSPrefetch(nsIURI* aURI,
mozilla::OriginAttributes& aOriginAttributes,
nsIRequest::TRRMode aTRRMode,
nsIDNSListener* aListener, bool storeTiming)
: mOriginAttributes(aOriginAttributes),
mStoreTiming(storeTiming),
mTRRMode(aTRRMode),
mListener(do_GetWeakReference(aListener)) {
aURI->GetAsciiHost(mHostname);
mIsHttps = aURI->SchemeIs("https");
}
nsresult nsDNSPrefetch::Prefetch(uint32_t flags) {
nsresult nsDNSPrefetch::Prefetch(uint16_t flags) {
// This can work properly only if this call is on the main thread.
// Curenlty we use nsDNSPrefetch only in nsHttpChannel which will call
// PrefetchHigh() from the main thread. Let's add assertion to catch
@ -63,8 +61,6 @@ nsresult nsDNSPrefetch::Prefetch(uint32_t flags) {
// TimingsValid() before using the timing.
nsCOMPtr<nsIEventTarget> main = mozilla::GetMainThreadEventTarget();
flags |= nsIDNSService::GetFlagsFromTRRMode(mTRRMode);
nsresult rv = sDNSService->AsyncResolveNative(
mHostname, flags | nsIDNSService::RESOLVE_SPECULATE, this, main,
mOriginAttributes, getter_AddRefs(tmpOutstanding));

View File

@ -25,8 +25,7 @@ class nsDNSPrefetch final : public nsIDNSListener {
NS_DECL_NSIDNSLISTENER
nsDNSPrefetch(nsIURI* aURI, mozilla::OriginAttributes& aOriginAttributes,
nsIRequest::TRRMode aTRRMode, nsIDNSListener* aListener,
bool storeTiming);
nsIDNSListener* aListener, bool storeTiming);
bool TimingsValid() const {
return !mStartTimestamp.IsNull() && !mEndTimestamp.IsNull();
}
@ -47,12 +46,11 @@ class nsDNSPrefetch final : public nsIDNSListener {
bool mIsHttps;
mozilla::OriginAttributes mOriginAttributes;
bool mStoreTiming;
nsIRequest::TRRMode mTRRMode;
mozilla::TimeStamp mStartTimestamp;
mozilla::TimeStamp mEndTimestamp;
nsWeakPtr mListener;
nsresult Prefetch(uint32_t flags);
nsresult Prefetch(uint16_t flags);
};
#endif

View File

@ -137,68 +137,11 @@ interface nsIRequest : nsISupports
*/
const unsigned long LOAD_DOCUMENT_NEEDS_COOKIE = 1 << 2;
cenum TRRMode : 8 {
TRR_DEFAULT_MODE = 0,
TRR_DISABLED_MODE = 1,
TRR_FIRST_MODE = 2,
TRR_ONLY_MODE = 3
};
/**
* These methods encode/decode the TRR mode to/from the loadFlags.
* Helper methods Get/SetTRRModeImpl are provided so implementations don't
* need to duplicate code.
*
* Requests with TRR_DEFAULT_MODE will use the mode indicated by the pref
* - see network.trr.mode in all.js
* Requests with TRR_DISABLED_MODE will always use native DNS, even if the
* pref is set to mode3 (TRR-only).
* Requests with TRR_DISABLED_MODE will first use TRR then fallback to
* regular DNS, unless TRR is disabled by setting the pref to mode5,
* parental control being enabled, or the domain being in the exclusion
* list.
* Requests with TRR_ONLY_MODE will only use TRR, unless not allowed by
* the same conditions mentioned above.
* Set this flag to disable TRR for this request.
*/
nsIRequest_TRRMode getTRRMode();
void setTRRMode(in nsIRequest_TRRMode mode);
%{C++
TRRMode GetTRRMode() {
TRRMode mode = TRR_DEFAULT_MODE;
GetTRRMode(&mode);
return mode;
}
nsresult GetTRRModeImpl(nsIRequest::TRRMode* aTRRMode) {
NS_ENSURE_ARG_POINTER(aTRRMode);
nsLoadFlags flags = nsIRequest::LOAD_NORMAL;
nsresult rv = GetLoadFlags(&flags);
if (NS_FAILED(rv)) {
return rv;
}
*aTRRMode = static_cast<nsIRequest::TRRMode>(
(flags & nsIRequest::LOAD_TRR_MASK) >> 3);
return NS_OK;
}
nsresult SetTRRModeImpl(nsIRequest::TRRMode aTRRMode) {
MOZ_ASSERT(aTRRMode <= 3, "invalid value");
nsLoadFlags flags = nsIRequest::LOAD_NORMAL;
nsresult rv = GetLoadFlags(&flags);
if (NS_FAILED(rv)) {
return rv;
}
flags = (flags & ~nsIRequest::LOAD_TRR_MASK) | (aTRRMode << 3);
return SetLoadFlags(flags);
}
%}
/**
* These two bits encode the TRR mode.
* Do not get/set manually, rather use the getTRRMode/setTRRMode methods.
*/
const unsigned long LOAD_TRR_MASK = (1 << 3) | (1 << 4);
const unsigned long LOAD_DISABLE_TRR = 1 << 3;
/**************************************************************************
* The following flags control the flow of data into the cache.

View File

@ -4,7 +4,6 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "nsITransport.idl"
#include "nsIRequest.idl"
interface nsIInterfaceRequestor;
interface nsINetAddr;
@ -259,23 +258,6 @@ interface nsISocketTransport : nsITransport
*/
const unsigned long DONT_TRY_ESNI = (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 TRR_MODE_FLAGS = (1 << 11) | (1 << 12);
%{C++
static uint32_t GetFlagsFromTRRMode(nsIRequest::TRRMode aMode) {
return static_cast<uint32_t>(aMode) << 11;
}
static nsIRequest::TRRMode GetTRRModeFromFlags(uint32_t aFlags) {
return static_cast<nsIRequest::TRRMode>((aFlags & TRR_MODE_FLAGS) >> 11);
}
%}
/**
* An opaque flags for non-standard behavior of the TLS system.
* It is unlikely this will need to be set outside of telemetry studies

View File

@ -371,16 +371,6 @@ nsIncrementalDownload::SetLoadFlags(nsLoadFlags loadFlags) {
return NS_OK;
}
NS_IMETHODIMP
nsIncrementalDownload::GetTRRMode(nsIRequest::TRRMode* aTRRMode) {
return GetTRRModeImpl(aTRRMode);
}
NS_IMETHODIMP
nsIncrementalDownload::SetTRRMode(nsIRequest::TRRMode aTRRMode) {
return SetTRRModeImpl(aTRRMode);
}
NS_IMETHODIMP
nsIncrementalDownload::GetLoadGroup(nsILoadGroup** loadGroup) {
return NS_ERROR_NOT_IMPLEMENTED;

View File

@ -244,16 +244,6 @@ nsInputStreamPump::SetLoadFlags(nsLoadFlags aLoadFlags) {
return NS_OK;
}
NS_IMETHODIMP
nsInputStreamPump::GetTRRMode(nsIRequest::TRRMode* aTRRMode) {
return GetTRRModeImpl(aTRRMode);
}
NS_IMETHODIMP
nsInputStreamPump::SetTRRMode(nsIRequest::TRRMode aTRRMode) {
return SetTRRModeImpl(aTRRMode);
}
NS_IMETHODIMP
nsInputStreamPump::GetLoadGroup(nsILoadGroup** aLoadGroup) {
RecursiveMutexAutoLock lock(mMutex);

View File

@ -344,16 +344,6 @@ nsLoadGroup::SetLoadFlags(uint32_t aLoadFlags) {
return NS_OK;
}
NS_IMETHODIMP
nsLoadGroup::GetTRRMode(nsIRequest::TRRMode* aTRRMode) {
return GetTRRModeImpl(aTRRMode);
}
NS_IMETHODIMP
nsLoadGroup::SetTRRMode(nsIRequest::TRRMode aTRRMode) {
return SetTRRModeImpl(aTRRMode);
}
NS_IMETHODIMP
nsLoadGroup::GetLoadGroup(nsILoadGroup** loadGroup) {
nsCOMPtr<nsILoadGroup> result = mLoadGroup;

View File

@ -1039,9 +1039,6 @@ nsresult nsSocketTransport::ResolveHost() {
if (mConnectionFlags & nsSocketTransport::DISABLE_TRR)
dnsFlags |= nsIDNSService::RESOLVE_DISABLE_TRR;
dnsFlags |= nsIDNSService::GetFlagsFromTRRMode(
nsISocketTransport::GetTRRModeFromFlags(mConnectionFlags));
NS_ASSERTION(!(dnsFlags & nsIDNSService::RESOLVE_DISABLE_IPV6) ||
!(dnsFlags & nsIDNSService::RESOLVE_DISABLE_IPV4),
"Setting both RESOLVE_DISABLE_IPV6 and RESOLVE_DISABLE_IPV4");

View File

@ -173,10 +173,8 @@ nsresult TRR::SendHTTPRequest() {
return NS_ERROR_FAILURE;
}
if (((mType == TRRTYPE_A) || (mType == TRRTYPE_AAAA)) &&
mRec->EffectiveTRRMode() != nsIRequest::TRR_ONLY_MODE) {
if ((mType == TRRTYPE_A) || (mType == TRRTYPE_AAAA)) {
// let NS resolves skip the blacklist check
// we also don't check the blacklist for TRR only requests
MOZ_ASSERT(mRec);
if (gTRRService->IsTRRBlacklisted(mHost, mOriginSuffix, mPB, true)) {
@ -256,10 +254,6 @@ nsresult TRR::SendHTTPRequest() {
return NS_ERROR_UNEXPECTED;
}
// This connection should not use TRR
rv = httpChannel->SetTRRMode(nsIRequest::TRR_DISABLED_MODE);
NS_ENSURE_SUCCESS(rv, rv);
rv = httpChannel->SetRequestHeader(
NS_LITERAL_CSTRING("Accept"),
NS_LITERAL_CSTRING("application/dns-message"), false);

View File

@ -21,8 +21,7 @@ static const char kOpenCaptivePortalLoginEvent[] = "captive-portal-login";
static const char kClearPrivateData[] = "clear-private-data";
static const char kPurge[] = "browser:purge-session-history";
static const char kDisableIpv6Pref[] = "network.dns.disableIPv6";
static const char kPrefSkipTRRParentalControl[] =
"network.dns.skipTRR-when-parental-control-enabled";
static const char kCaptivedetectCanonicalURL[] = "captivedetect.canonicalURL";
#define TRR_PREF_PREFIX "network.trr."
#define TRR_PREF(x) TRR_PREF_PREFIX x
@ -49,7 +48,6 @@ TRRService::TRRService()
mCaptiveIsPassed(false),
mUseGET(false),
mDisableECS(true),
mSkipTRRWhenParentalControlEnabled(true),
mDisableAfterFails(5),
mClearTRRBLStorage(false),
mConfirmationState(CONFIRM_INIT),
@ -80,7 +78,7 @@ nsresult TRRService::Init() {
if (prefBranch) {
prefBranch->AddObserver(TRR_PREF_PREFIX, this, true);
prefBranch->AddObserver(kDisableIpv6Pref, this, true);
prefBranch->AddObserver(kPrefSkipTRRParentalControl, this, true);
prefBranch->AddObserver(kCaptivedetectCanonicalURL, this, true);
}
nsCOMPtr<nsICaptivePortalService> captivePortalService =
do_GetService(NS_CAPTIVEPORTAL_CID);
@ -116,13 +114,9 @@ void TRRService::GetParentalControlEnabledInternal() {
}
}
bool TRRService::Enabled(nsIRequest::TRRMode aMode) {
if (mMode == MODE_TRROFF) {
return false;
}
bool TRRService::Enabled() {
if (mConfirmationState == CONFIRM_INIT &&
(!mWaitForCaptive || mCaptiveIsPassed ||
(mMode == MODE_TRRONLY || aMode == nsIRequest::TRR_ONLY_MODE))) {
(!mWaitForCaptive || mCaptiveIsPassed || (mMode == MODE_TRRONLY))) {
LOG(("TRRService::Enabled => CONFIRM_TRYING\n"));
mConfirmationState = CONFIRM_TRYING;
}
@ -310,7 +304,8 @@ nsresult TRRService::ReadPrefs(const char* name) {
}
}
if (!name || !strcmp(name, TRR_PREF("excluded-domains")) ||
!strcmp(name, TRR_PREF("builtin-excluded-domains"))) {
!strcmp(name, TRR_PREF("builtin-excluded-domains")) ||
!strcmp(name, kCaptivedetectCanonicalURL)) {
mExcludedDomains.Clear();
auto parseExcludedDomains = [this](const char* aPrefName) {
@ -332,12 +327,18 @@ nsresult TRRService::ReadPrefs(const char* name) {
parseExcludedDomains(TRR_PREF("excluded-domains"));
parseExcludedDomains(TRR_PREF("builtin-excluded-domains"));
clearEntireCache = true;
}
if (!name || !strcmp(name, kPrefSkipTRRParentalControl)) {
bool tmp;
if (NS_SUCCEEDED(Preferences::GetBool(kPrefSkipTRRParentalControl, &tmp))) {
mSkipTRRWhenParentalControlEnabled = tmp;
nsAutoCString canonicalSiteURL;
Preferences::GetCString(kCaptivedetectCanonicalURL, canonicalSiteURL);
nsCOMPtr<nsIURI> uri;
nsresult rv = NS_NewURI(getter_AddRefs(uri), canonicalSiteURL,
UTF_8_ENCODING, nullptr);
if (NS_SUCCEEDED(rv)) {
nsAutoCString host;
uri->GetHost(host);
LOG(("TRRService::ReadPrefs captive portal URL:[%s]\n", host.get()));
mExcludedDomains.PutEntry(host);
}
}
@ -433,20 +434,17 @@ TRRService::Observe(nsISupports* aSubject, const char* aTopic,
}
}
// We should avoid doing calling MaybeConfirm in response to a pref change
// unless the service is in a TRR=enabled mode.
if (mMode == MODE_TRRFIRST || mMode == MODE_TRRONLY) {
if (!mCaptiveIsPassed) {
if (mConfirmationState != CONFIRM_OK) {
mConfirmationState = CONFIRM_TRYING;
MaybeConfirm();
}
} else {
LOG(("TRRservice CP clear when already up!\n"));
if (!mCaptiveIsPassed) {
if (mConfirmationState != CONFIRM_OK) {
mConfirmationState = CONFIRM_TRYING;
MaybeConfirm();
}
mCaptiveIsPassed = true;
} else {
LOG(("TRRservice CP clear when already up!\n"));
}
mCaptiveIsPassed = true;
} else if (!strcmp(aTopic, kClearPrivateData) || !strcmp(aTopic, kPurge)) {
// flush the TRR blacklist, both in-memory and on-disk
if (mTRRBLStorage) {
@ -478,7 +476,7 @@ void TRRService::MaybeConfirm() {
void TRRService::MaybeConfirm_locked() {
mLock.AssertCurrentThreadOwns();
if (mMode == MODE_TRROFF || mConfirmer ||
if (TRR_DISABLED(mMode) || mConfirmer ||
mConfirmationState != CONFIRM_TRYING) {
LOG(
("TRRService:MaybeConfirm mode=%d, mConfirmer=%p "
@ -503,7 +501,7 @@ void TRRService::MaybeConfirm_locked() {
bool TRRService::MaybeBootstrap(const nsACString& aPossible,
nsACString& aResult) {
MutexAutoLock lock(mLock);
if (mMode == MODE_TRROFF || mBootstrapAddr.IsEmpty()) {
if (TRR_DISABLED(mMode) || mBootstrapAddr.IsEmpty()) {
return false;
}
@ -560,7 +558,7 @@ bool TRRService::IsTRRBlacklisted(const nsACString& aHost,
return true;
}
if (!Enabled(nsIRequest::TRR_DEFAULT_MODE)) {
if (!Enabled()) {
return true;
}

View File

@ -30,7 +30,7 @@ class TRRService : public nsIObserver,
TRRService();
nsresult Init();
nsresult Start();
bool Enabled(nsIRequest::TRRMode aMode);
bool Enabled();
uint32_t Mode() { return mMode; }
bool AllowRFC1918() { return mRfc1918; }
@ -40,9 +40,6 @@ class TRRService : public nsIObserver,
bool WaitForAllResponses() { return mWaitForAllResponses; }
bool DisableIPv6() { return mDisableIPv6; }
bool DisableECS() { return mDisableECS; }
bool SkipTRRWhenParentalControlEnabled() {
return mSkipTRRWhenParentalControlEnabled;
}
nsresult GetURI(nsCString& result);
nsresult GetCredentials(nsCString& result);
uint32_t GetRequestTimeout();
@ -97,7 +94,6 @@ class TRRService : public nsIObserver,
Atomic<bool, Relaxed> mWaitForAllResponses; // Don't notify until all are in
Atomic<bool, Relaxed> mDisableIPv6; // don't even try
Atomic<bool, Relaxed> mDisableECS; // disable EDNS Client Subnet in requests
Atomic<bool, Relaxed> mSkipTRRWhenParentalControlEnabled;
Atomic<uint32_t, Relaxed>
mDisableAfterFails; // this many fails in a row means failed TRR service

View File

@ -152,9 +152,8 @@ static inline bool IsLowPriority(uint16_t flags) {
// this macro filters out any flags that are not used when constructing the
// host key. the significant flags are those that would affect the resulting
// host record (i.e., the flags that are passed down to PR_GetAddrInfoByName).
#define RES_KEY_FLAGS(_f) \
((_f) & (nsHostResolver::RES_CANON_NAME | nsHostResolver::RES_DISABLE_TRR | \
nsIDNSService::RESOLVE_TRR_MODE_MASK))
#define RES_KEY_FLAGS(_f) \
((_f) & (nsHostResolver::RES_CANON_NAME | nsHostResolver::RES_DISABLE_TRR))
#define IS_ADDR_TYPE(_type) ((_type) == nsIDNSService::RESOLVE_TYPE_DEFAULT)
#define IS_OTHER_TYPE(_type) ((_type) != nsIDNSService::RESOLVE_TYPE_DEFAULT)
@ -166,7 +165,12 @@ nsHostKey::nsHostKey(const nsACString& aHost, uint16_t aType, uint16_t aFlags,
flags(aFlags),
af(aAf),
pb(aPb),
originSuffix(aOriginsuffix) {}
originSuffix(aOriginsuffix) {
if (TRR_DISABLED(gTRRService->Mode())) {
// When not using TRR, lookup all answers as TRR-disabled
flags |= nsHostResolver::RES_DISABLE_TRR;
}
}
bool nsHostKey::operator==(const nsHostKey& other) const {
return host == other.host && type == other.type &&
@ -543,6 +547,8 @@ static const char kPrefGetTtl[] = "network.dns.get-ttl";
static const char kPrefNativeIsLocalhost[] = "network.dns.native-is-localhost";
static const char kPrefThreadIdleTime[] =
"network.dns.resolver-thread-extra-idle-time-seconds";
static const char kPrefSkipTRRParentalControl[] =
"network.dns.skipTRR-when-parental-control-enabled";
static bool sGetTtlEnabled = false;
mozilla::Atomic<bool, mozilla::Relaxed> gNativeIsLocalhost;
@ -572,6 +578,7 @@ nsHostResolver::nsHostResolver(uint32_t maxCacheEntries,
mLock("nsHostResolver.mLock"),
mIdleTaskCV(mLock, "nsHostResolver.mIdleTaskCV"),
mEvictionQSize(0),
mSkipTRRWhenParentalControlEnabled(true),
mShutdown(true),
mNumIdleTasks(0),
mActiveTaskCount(0),
@ -595,6 +602,8 @@ nsresult nsHostResolver::Init() {
mShutdown = false;
mNCS = NetworkConnectivityService::GetSingleton();
mSkipTRRWhenParentalControlEnabled =
Preferences::GetBool(kPrefSkipTRRParentalControl, true);
// The preferences probably haven't been loaded from the disk yet, so we
// need to register a callback that will set up the experiment once they
@ -820,7 +829,7 @@ nsresult nsHostResolver::ResolveHost(const nsACString& aHost, uint16_t type,
// By-Type requests use only TRR. If TRR is disabled we can return
// immediately.
if (IS_OTHER_TYPE(type) && Mode() == MODE_TRROFF) {
if (IS_OTHER_TYPE(type) && TRR_DISABLED(Mode())) {
return NS_ERROR_UNKNOWN_HOST;
}
@ -1186,10 +1195,6 @@ nsresult nsHostResolver::TrrLookup_unlocked(nsHostRecord* rec, TRR* pushedTRR) {
// returns error if no TRR resolve is issued
// it is impt this is not called while a native lookup is going on
nsresult nsHostResolver::TrrLookup(nsHostRecord* aRec, TRR* pushedTRR) {
if (Mode() == MODE_TRROFF) {
return NS_ERROR_UNKNOWN_HOST;
}
RefPtr<nsHostRecord> rec(aRec);
mLock.AssertCurrentThreadOwns();
@ -1212,8 +1217,7 @@ nsresult nsHostResolver::TrrLookup(nsHostRecord* aRec, TRR* pushedTRR) {
#endif
MOZ_ASSERT(!rec->mResolving);
nsIRequest::TRRMode reqMode = rec->EffectiveTRRMode();
if (!gTRRService || !gTRRService->Enabled(reqMode)) {
if (!gTRRService || !gTRRService->Enabled()) {
LOG(("TrrLookup:: %s service not enabled\n", rec->host.get()));
return NS_ERROR_UNKNOWN_HOST;
}
@ -1374,49 +1378,6 @@ ResolverMode nsHostResolver::Mode() {
return MODE_NATIVEONLY;
}
nsIRequest::TRRMode nsHostRecord::TRRMode() {
return nsIDNSService::GetTRRModeFromFlags(flags);
}
nsIRequest::TRRMode nsHostRecord::EffectiveTRRMode() {
// For domains that are excluded from TRR or when parental control is enabled,
// we fallback to NativeLookup. This happens even in MODE_TRRONLY. By default
// localhost and local are excluded (so we cover *.local hosts) See the
// network.trr.excluded-domains pref.
bool skipTRR = true;
if (gTRRService) {
skipTRR = gTRRService->IsExcludedFromTRR(host) ||
(gTRRService->SkipTRRWhenParentalControlEnabled() &&
gTRRService->ParentalControlEnabled());
}
nsIRequest::TRRMode aRequestMode = TRRMode();
if (!gTRRService) {
return aRequestMode;
}
ResolverMode aResolverMode = static_cast<ResolverMode>(gTRRService->Mode());
if (skipTRR || aResolverMode == MODE_TRROFF ||
aRequestMode == nsIRequest::TRR_DISABLED_MODE ||
(aRequestMode == nsIRequest::TRR_DEFAULT_MODE &&
aResolverMode == MODE_NATIVEONLY)) {
return nsIRequest::TRR_DISABLED_MODE;
}
if (aRequestMode == nsIRequest::TRR_DEFAULT_MODE &&
aResolverMode == MODE_TRRFIRST) {
return nsIRequest::TRR_FIRST_MODE;
}
if (aRequestMode == nsIRequest::TRR_DEFAULT_MODE &&
aResolverMode == MODE_TRRONLY) {
return nsIRequest::TRR_ONLY_MODE;
}
return aRequestMode;
}
// Kick-off a name resolve operation, using native resolver and/or TRR
nsresult nsHostResolver::NameLookup(nsHostRecord* rec) {
nsresult rv = NS_ERROR_UNKNOWN_HOST;
@ -1425,8 +1386,8 @@ nsresult nsHostResolver::NameLookup(nsHostRecord* rec) {
return NS_OK;
}
rec->mResolverMode = Mode();
MOZ_ASSERT(rec->mResolverMode != MODE_RESERVED1);
ResolverMode mode = rec->mResolverMode = Mode();
MOZ_ASSERT(mode != MODE_RESERVED1);
if (rec->IsAddrRecord()) {
RefPtr<AddrHostRecord> addrRec = do_QueryObject(rec);
@ -1441,19 +1402,30 @@ nsresult nsHostResolver::NameLookup(nsHostRecord* rec) {
addrRec->mTrrAAAAUsed = AddrHostRecord::INIT;
}
nsIRequest::TRRMode effectiveRequestMode = rec->EffectiveTRRMode();
// For domains that are excluded from TRR or when parental control is enabled,
// we fallback to NativeLookup. This happens even in MODE_TRRONLY. By default
// localhost and local are excluded (so we cover *.local hosts) See the
// network.trr.excluded-domains pref.
bool skipTRR = true;
if (gTRRService) {
skipTRR = gTRRService->IsExcludedFromTRR(rec->host) ||
(mSkipTRRWhenParentalControlEnabled &&
gTRRService->ParentalControlEnabled());
}
LOG(("NameLookup: %s effectiveTRRmode: %d", rec->host.get(),
effectiveRequestMode));
if (rec->flags & RES_DISABLE_TRR) {
if (mode == MODE_TRRONLY && !skipTRR) {
return rv;
}
mode = MODE_NATIVEONLY;
}
if (effectiveRequestMode != nsIRequest::TRR_DISABLED_MODE &&
!((rec->flags & RES_DISABLE_TRR))) {
if (!TRR_DISABLED(mode) && !skipTRR) {
rv = TrrLookup(rec);
}
if (effectiveRequestMode == nsIRequest::TRR_DISABLED_MODE ||
(effectiveRequestMode == nsIRequest::TRR_FIRST_MODE &&
(rec->flags & RES_DISABLE_TRR) && NS_FAILED(rv))) {
if (TRR_DISABLED(mode) || ((mode == MODE_TRRFIRST) && NS_FAILED(rv)) ||
(mode == MODE_TRRONLY && skipTRR)) {
if (!rec->IsAddrRecord()) {
return rv;
}

View File

@ -81,12 +81,6 @@ class nsHostRecord : public mozilla::LinkedListElement<RefPtr<nsHostRecord>>,
return 0;
}
// Returns the TRR mode encoded by the flags
nsIRequest::TRRMode TRRMode();
// Returns a TRR mode that takes into account if the TRR service is disabled,
// parental controls are on, domain matches exclusion list, etc.
nsIRequest::TRRMode EffectiveTRRMode();
protected:
friend class nsHostResolver;
@ -557,6 +551,7 @@ class nsHostResolver : public nsISupports, public AHostResolver {
PRTime mCreationTime;
mozilla::TimeDuration mLongIdleTimeout;
mozilla::TimeDuration mShortIdleTimeout;
bool mSkipTRRWhenParentalControlEnabled;
RefPtr<nsIThreadPool> mResolverThreads;
RefPtr<mozilla::net::NetworkConnectivityService> mNCS;

View File

@ -3,7 +3,6 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "nsISupports.idl"
#include "nsIRequest.idl"
%{ C++
#include "mozilla/BasePrincipal.h"
@ -295,22 +294,6 @@ interface nsIDNSService : nsISupports
*/
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);
%{C++
static uint32_t GetFlagsFromTRRMode(nsIRequest::TRRMode aMode) {
return static_cast<uint32_t>(aMode) << 11;
}
static nsIRequest::TRRMode GetTRRModeFromFlags(uint32_t aFlags) {
return static_cast<nsIRequest::TRRMode>((aFlags & RESOLVE_TRR_MODE_MASK) >> 11);
}
%}
/**
* This ure dns request types that are currently supported.
* RESOLVE_TYPE_DEFAULT is standard A/AAAA lookup

View File

@ -637,14 +637,14 @@ mozilla::ipc::IPCResult NeckoParent::RecvSpeculativeConnect(
mozilla::ipc::IPCResult NeckoParent::RecvHTMLDNSPrefetch(
const nsString& hostname, const bool& isHttps,
const OriginAttributes& aOriginAttributes, const uint32_t& flags) {
const OriginAttributes& aOriginAttributes, const uint16_t& flags) {
nsHTMLDNSPrefetch::Prefetch(hostname, isHttps, aOriginAttributes, flags);
return IPC_OK();
}
mozilla::ipc::IPCResult NeckoParent::RecvCancelHTMLDNSPrefetch(
const nsString& hostname, const bool& isHttps,
const OriginAttributes& aOriginAttributes, const uint32_t& flags,
const OriginAttributes& aOriginAttributes, const uint16_t& flags,
const nsresult& reason) {
nsHTMLDNSPrefetch::CancelPrefetch(hostname, isHttps, aOriginAttributes, flags,
reason);

View File

@ -163,10 +163,10 @@ class NeckoParent : public PNeckoParent {
const bool& aAnonymous);
mozilla::ipc::IPCResult RecvHTMLDNSPrefetch(
const nsString& hostname, const bool& isHttps,
const OriginAttributes& aOriginAttributes, const uint32_t& flags);
const OriginAttributes& aOriginAttributes, const uint16_t& flags);
mozilla::ipc::IPCResult RecvCancelHTMLDNSPrefetch(
const nsString& hostname, const bool& isHttps,
const OriginAttributes& aOriginAttributes, const uint32_t& flags,
const OriginAttributes& aOriginAttributes, const uint16_t& flags,
const nsresult& reason);
PWebSocketEventListenerParent* AllocPWebSocketEventListenerParent(
const uint64_t& aInnerWindowID);

View File

@ -104,10 +104,10 @@ parent:
async SpeculativeConnect(URIParams uri, nsIPrincipal principal, bool anonymous);
async HTMLDNSPrefetch(nsString hostname, bool isHttps,
OriginAttributes originAttributes, uint32_t flags);
OriginAttributes originAttributes, uint16_t flags);
async CancelHTMLDNSPrefetch(nsString hostname, bool isHttps,
OriginAttributes originAttributes,
uint32_t flags, nsresult reason);
uint16_t flags, nsresult reason);
/**
* channelId is used to establish a connection between redirect channels in

View File

@ -296,16 +296,6 @@ ClassifierDummyChannel::GetLoadFlags(nsLoadFlags* aLoadFlags) {
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
ClassifierDummyChannel::GetTRRMode(nsIRequest::TRRMode* aTRRMode) {
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
ClassifierDummyChannel::SetTRRMode(nsIRequest::TRRMode aTRRMode) {
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
ClassifierDummyChannel::SetLoadFlags(nsLoadFlags aLoadFlags) {
return NS_ERROR_NOT_IMPLEMENTED;

View File

@ -484,16 +484,6 @@ HttpBaseChannel::SetLoadFlags(nsLoadFlags aLoadFlags) {
return NS_OK;
}
NS_IMETHODIMP
HttpBaseChannel::GetTRRMode(nsIRequest::TRRMode* aTRRMode) {
return GetTRRModeImpl(aTRRMode);
}
NS_IMETHODIMP
HttpBaseChannel::SetTRRMode(nsIRequest::TRRMode aTRRMode) {
return SetTRRModeImpl(aTRRMode);
}
NS_IMETHODIMP
HttpBaseChannel::SetDocshellUserAgentOverride() {
// This sets the docshell specific user agent override

View File

@ -141,8 +141,6 @@ class HttpBaseChannel : public nsHashPropertyBag,
NS_IMETHOD SetLoadGroup(nsILoadGroup* aLoadGroup) override;
NS_IMETHOD GetLoadFlags(nsLoadFlags* aLoadFlags) override;
NS_IMETHOD SetLoadFlags(nsLoadFlags aLoadFlags) override;
NS_IMETHOD GetTRRMode(nsIRequest::TRRMode* aTRRMode) override;
NS_IMETHOD SetTRRMode(nsIRequest::TRRMode aTRRMode) override;
NS_IMETHOD SetDocshellUserAgentOverride();
// nsIChannel

View File

@ -449,16 +449,6 @@ NullHttpChannel::GetLoadFlags(nsLoadFlags* aLoadFlags) {
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
NullHttpChannel::GetTRRMode(nsIRequest::TRRMode* aTRRMode) {
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
NullHttpChannel::SetTRRMode(nsIRequest::TRRMode aTRRMode) {
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
NullHttpChannel::SetLoadFlags(nsLoadFlags aLoadFlags) {
return NS_ERROR_NOT_IMPLEMENTED;

View File

@ -111,6 +111,10 @@ const char kHttp3VersionHEX[] = "ff00000017"; // this is draft 23.
// on ERROR_NET_RESET.
#define NS_HTTP_CONNECTION_RESTARTABLE (1 << 13)
// Disallow name resolutions for this transaction to use TRR - primarily
// for use with TRR implementations themselves
#define NS_HTTP_DISABLE_TRR (1 << 14)
// Allow re-using a spdy/http2 connection with NS_HTTP_ALLOW_KEEPALIVE not set.
// This is primarily used to allow connection sharing for websockets over http/2
// without accidentally allowing it for websockets not over http/2
@ -127,14 +131,6 @@ const char kHttp3VersionHEX[] = "ff00000017"; // this is draft 23.
// The connection should not use IPv6
#define NS_HTTP_DISABLE_IPV6 (1 << 18)
// Encodes the TRR mode.
#define NS_HTTP_TRR_MODE_MASK ((1 << 19) | (1 << 20))
#define NS_HTTP_TRR_FLAGS_FROM_MODE(x) ((static_cast<uint32_t>(x) & 3) << 19)
#define NS_HTTP_TRR_MODE_FROM_FLAGS(x) \
(static_cast<nsIRequest::TRRMode>((((x)&NS_HTTP_TRR_MODE_MASK) >> 19) & 3))
//-----------------------------------------------------------------------------
// some default values
//-----------------------------------------------------------------------------

View File

@ -620,10 +620,12 @@ nsresult nsHttpChannel::ContinueOnBeforeConnect(bool aShouldUpgrade,
}
if (mIsTRRServiceChannel) {
mCaps |= NS_HTTP_LARGE_KEEPALIVE;
mCaps |= NS_HTTP_LARGE_KEEPALIVE | NS_HTTP_DISABLE_TRR;
}
mCaps |= NS_HTTP_TRR_FLAGS_FROM_MODE(nsIRequest::GetTRRMode());
if (mLoadFlags & LOAD_DISABLE_TRR) {
mCaps |= NS_HTTP_DISABLE_TRR;
}
// Finalize ConnectionInfo flags before SpeculativeConnect
mConnectionInfo->SetAnonymous((mLoadFlags & LOAD_ANONYMOUS) != 0);
@ -634,7 +636,7 @@ nsresult nsHttpChannel::ContinueOnBeforeConnect(bool aShouldUpgrade,
mBeConservative);
mConnectionInfo->SetTlsFlags(mTlsFlags);
mConnectionInfo->SetIsTrrServiceChannel(mIsTRRServiceChannel);
mConnectionInfo->SetTRRMode(nsIRequest::GetTRRMode());
mConnectionInfo->SetTrrDisabled(mCaps & NS_HTTP_DISABLE_TRR);
mConnectionInfo->SetIPv4Disabled(mCaps & NS_HTTP_DISABLE_IPV4);
mConnectionInfo->SetIPv6Disabled(mCaps & NS_HTTP_DISABLE_IPV6);
@ -907,7 +909,7 @@ void nsHttpChannel::SpeculativeConnect() {
Unused << gHttpHandler->SpeculativeConnect(
mConnectionInfo, callbacks,
mCaps & (NS_HTTP_DISALLOW_SPDY | NS_HTTP_TRR_MODE_MASK |
mCaps & (NS_HTTP_DISALLOW_SPDY | NS_HTTP_DISABLE_TRR |
NS_HTTP_DISABLE_IPV4 | NS_HTTP_DISABLE_IPV6));
}
@ -6839,8 +6841,8 @@ void nsHttpChannel::MaybeStartDNSPrefetch() {
mCaps & NS_HTTP_REFRESH_DNS ? ", refresh requested" : ""));
OriginAttributes originAttributes;
NS_GetOriginAttributes(this, originAttributes);
mDNSPrefetch = new nsDNSPrefetch(
mURI, originAttributes, nsIRequest::GetTRRMode(), this, mTimingEnabled);
mDNSPrefetch =
new nsDNSPrefetch(mURI, originAttributes, this, mTimingEnabled);
mDNSPrefetch->PrefetchHigh(mCaps & NS_HTTP_REFRESH_DNS);
}
}

View File

@ -106,7 +106,7 @@ void nsHttpConnectionInfo::Init(const nsACString& host, int32_t port,
mOriginAttributes = originAttributes;
mTlsFlags = 0x0;
mIsTrrServiceChannel = false;
mTRRMode = nsIRequest::TRR_DEFAULT_MODE;
mTrrDisabled = false;
mIPv4Disabled = false;
mIPv6Disabled = false;
@ -234,13 +234,11 @@ void nsHttpConnectionInfo::BuildHashKey() {
mHashKey.AppendLiteral("}");
}
if (GetTRRMode() != nsIRequest::TRR_DEFAULT_MODE) {
// When connecting with another TRR mode, we enforce a separate connection
if (GetTrrDisabled()) {
// When connecting with TRR disabled, we enforce a separate connection
// hashkey so that we also can trigger a fresh DNS resolver that then
// doesn't use TRR as the previous connection might have.
mHashKey.AppendLiteral("[TRR:");
mHashKey.AppendInt(GetTRRMode());
mHashKey.AppendLiteral("]");
mHashKey.AppendLiteral("[NOTRR]");
}
if (GetIPv4Disabled()) {
@ -327,7 +325,7 @@ already_AddRefed<nsHttpConnectionInfo> nsHttpConnectionInfo::Clone() const {
clone->SetBeConservative(GetBeConservative());
clone->SetTlsFlags(GetTlsFlags());
clone->SetIsTrrServiceChannel(GetIsTrrServiceChannel());
clone->SetTRRMode(GetTRRMode());
clone->SetTrrDisabled(GetTrrDisabled());
clone->SetIPv4Disabled(GetIPv4Disabled());
clone->SetIPv6Disabled(GetIPv6Disabled());
MOZ_ASSERT(clone->Equals(this));
@ -353,7 +351,7 @@ void nsHttpConnectionInfo::CloneAsDirectRoute(nsHttpConnectionInfo** outCI) {
clone->SetBeConservative(GetBeConservative());
clone->SetTlsFlags(GetTlsFlags());
clone->SetIsTrrServiceChannel(GetIsTrrServiceChannel());
clone->SetTRRMode(GetTRRMode());
clone->SetTrrDisabled(GetTrrDisabled());
clone->SetIPv4Disabled(GetIPv4Disabled());
clone->SetIPv6Disabled(GetIPv6Disabled());
@ -380,9 +378,9 @@ nsresult nsHttpConnectionInfo::CreateWildCard(nsHttpConnectionInfo** outParam) {
return NS_OK;
}
void nsHttpConnectionInfo::SetTRRMode(nsIRequest::TRRMode aTRRMode) {
if (mTRRMode != aTRRMode) {
mTRRMode = aTRRMode;
void nsHttpConnectionInfo::SetTrrDisabled(bool aNoTrr) {
if (mTrrDisabled != aNoTrr) {
mTrrDisabled = aNoTrr;
RebuildHashKey();
}
}

View File

@ -149,8 +149,10 @@ class nsHttpConnectionInfo final : public ARefBase {
}
bool GetIsTrrServiceChannel() const { return mIsTrrServiceChannel; }
void SetTRRMode(nsIRequest::TRRMode aTRRMode);
nsIRequest::TRRMode GetTRRMode() const { return mTRRMode; }
// SetTrrDisabled means don't use TRR to resolve host names for this
// connection
void SetTrrDisabled(bool aNoTrr);
bool GetTrrDisabled() const { return mTrrDisabled; }
void SetIPv4Disabled(bool aNoIPv4);
bool GetIPv4Disabled() const { return mIPv4Disabled; }
@ -231,11 +233,11 @@ class nsHttpConnectionInfo final : public ARefBase {
bool mUsingConnect; // if will use CONNECT with http proxy
nsCString mNPNToken;
OriginAttributes mOriginAttributes;
nsIRequest::TRRMode mTRRMode;
uint32_t mTlsFlags;
uint16_t mIsolated : 1;
uint16_t mIsTrrServiceChannel : 1;
uint16_t mTrrDisabled : 1;
uint16_t mIPv4Disabled : 1;
uint16_t mIPv6Disabled : 1;

View File

@ -4099,8 +4099,9 @@ nsresult nsHttpConnectionMgr::nsHalfOpenSocket::SetupStreams(
uint32_t tmpFlags = 0;
if (mCaps & NS_HTTP_REFRESH_DNS) tmpFlags = nsISocketTransport::BYPASS_CACHE;
tmpFlags |= nsISocketTransport::GetFlagsFromTRRMode(
NS_HTTP_TRR_MODE_FROM_FLAGS(mCaps));
if (mCaps & NS_HTTP_DISABLE_TRR) {
tmpFlags = nsISocketTransport::DISABLE_TRR;
}
if (mCaps & NS_HTTP_LOAD_ANONYMOUS)
tmpFlags |= nsISocketTransport::ANONYMOUS_CONNECT;

View File

@ -377,16 +377,6 @@ nsViewSourceChannel::SetLoadFlags(uint32_t aLoadFlags) {
return NS_OK;
}
NS_IMETHODIMP
nsViewSourceChannel::GetTRRMode(nsIRequest::TRRMode* aTRRMode) {
return nsIViewSourceChannel::GetTRRModeImpl(aTRRMode);
}
NS_IMETHODIMP
nsViewSourceChannel::SetTRRMode(nsIRequest::TRRMode aTRRMode) {
return nsIViewSourceChannel::SetTRRModeImpl(aTRRMode);
}
NS_IMETHODIMP
nsViewSourceChannel::GetContentType(nsACString& aContentType) {
NS_ENSURE_TRUE(mChannel, NS_ERROR_FAILURE);

View File

@ -198,16 +198,6 @@ nsPartChannel::SetLoadFlags(nsLoadFlags aLoadFlags) {
return NS_OK;
}
NS_IMETHODIMP
nsPartChannel::GetTRRMode(nsIRequest::TRRMode* aTRRMode) {
return GetTRRModeImpl(aTRRMode);
}
NS_IMETHODIMP
nsPartChannel::SetTRRMode(nsIRequest::TRRMode aTRRMode) {
return SetTRRModeImpl(aTRRMode);
}
NS_IMETHODIMP
nsPartChannel::GetIsDocument(bool* aIsDocument) {
return NS_GetIsDocumentChannel(this, aIsDocument);

View File

@ -1,8 +1,6 @@
"use strict";
const { NodeServer, HttpServer } = ChromeUtils.import(
"resource://testing-common/httpd.js"
);
const { NodeServer } = ChromeUtils.import("resource://testing-common/httpd.js");
const dns = Cc["@mozilla.org/network/dns-service;1"].getService(
Ci.nsIDNSService
);
@ -101,15 +99,6 @@ registerCleanupFunction(() => {
Services.prefs.clearUserPref("network.dns.native-is-localhost");
});
// This is an IP that is local, so we don't crash when connecting to it,
// but also connecting to it fails, so we attempt to retry with regular DNS.
const BAD_IP = (() => {
if (mozinfo.os == "linux") {
return "127.9.9.9";
}
return "0.0.0.0";
})();
class DNSListener {
constructor(name, expectedAnswer, expectedSuccess = true) {
this.name = name;
@ -155,139 +144,26 @@ class DNSListener {
return this.promise.then.apply(this.promise, arguments);
}
}
Cu.importGlobalProperties(["fetch"]);
add_task(async function test0_nodeExecute() {
// This test checks that moz-http2.js running in node is working.
// This should always be the first test in this file (except for setup)
// otherwise we may encounter random failures when the http2 server is down.
equal(
await NodeServer.execute(`"hello"`),
"hello",
"Check that moz-http2.js is running"
let env = Cc["@mozilla.org/process/environment;1"].getService(
Ci.nsIEnvironment
);
});
function makeChan(url, mode) {
let chan = NetUtil.newChannel({
uri: url,
loadUsingSystemPrincipal: true,
}).QueryInterface(Ci.nsIHttpChannel);
chan.setTRRMode(mode);
return chan;
}
add_task(
{ skip_if: () => mozinfo.os == "mac" },
async function test_trr_flags() {
let httpserv = new HttpServer();
httpserv.registerPathHandler("/", function handler(metadata, response) {
let content = "ok";
response.setHeader("Content-Length", `${content.length}`);
response.bodyOutputStream.write(content, content.length);
let execPort = env.get("MOZNODE_EXEC_PORT");
await fetch(`http://127.0.0.1:${execPort}/test`)
.then(response => {
ok(true, "NodeServer is working");
})
.catch(e => {
ok(false, `There was an error ${e}`);
});
httpserv.start(-1);
const URL = `http://example.com:${httpserv.identity.primaryPort}/`;
dns.clearCache(true);
Services.prefs.setCharPref(
"network.trr.uri",
`https://localhost:${h2Port}/doh?responseIP=${BAD_IP}`
);
Services.prefs.setIntPref("network.trr.mode", 0);
dns.clearCache(true);
let chan = makeChan(URL, Ci.nsIRequest.TRR_DEFAULT_MODE);
await new Promise(resolve => chan.asyncOpen(new ChannelListener(resolve)));
equal(chan.getTRRMode(), Ci.nsIRequest.TRR_DEFAULT_MODE);
dns.clearCache(true);
chan = makeChan(URL, Ci.nsIRequest.TRR_DISABLED_MODE);
await new Promise(resolve => chan.asyncOpen(new ChannelListener(resolve)));
equal(chan.getTRRMode(), Ci.nsIRequest.TRR_DISABLED_MODE);
dns.clearCache(true);
chan = makeChan(URL, Ci.nsIRequest.TRR_FIRST_MODE);
await new Promise(resolve => chan.asyncOpen(new ChannelListener(resolve)));
equal(chan.getTRRMode(), Ci.nsIRequest.TRR_FIRST_MODE);
dns.clearCache(true);
chan = makeChan(
`http://example.com:${httpserv.identity.primaryPort}/`,
Ci.nsIRequest.TRR_ONLY_MODE
);
// Should fail as it tries to connect to local but unavailable IP
await new Promise(resolve =>
chan.asyncOpen(new ChannelListener(resolve, null, CL_EXPECT_FAILURE))
);
equal(chan.getTRRMode(), Ci.nsIRequest.TRR_ONLY_MODE);
dns.clearCache(true);
Services.prefs.setCharPref(
"network.trr.uri",
`https://localhost:${h2Port}/doh?responseIP=${BAD_IP}`
);
Services.prefs.setIntPref("network.trr.mode", 2);
dns.clearCache(true);
chan = makeChan(URL, Ci.nsIRequest.TRR_DEFAULT_MODE);
// Does get the IP from TRR, but failure means it falls back to DNS.
await new Promise(resolve => chan.asyncOpen(new ChannelListener(resolve)));
dns.clearCache(true);
chan = makeChan(URL, Ci.nsIRequest.TRR_DISABLED_MODE);
await new Promise(resolve => chan.asyncOpen(new ChannelListener(resolve)));
dns.clearCache(true);
// Does get the IP from TRR, but failure means it falls back to DNS.
chan = makeChan(URL, Ci.nsIRequest.TRR_FIRST_MODE);
await new Promise(resolve => chan.asyncOpen(new ChannelListener(resolve)));
dns.clearCache(true);
chan = makeChan(URL, Ci.nsIRequest.TRR_ONLY_MODE);
await new Promise(resolve =>
chan.asyncOpen(new ChannelListener(resolve, null, CL_EXPECT_FAILURE))
);
dns.clearCache(true);
Services.prefs.setCharPref(
"network.trr.uri",
`https://localhost:${h2Port}/doh?responseIP=${BAD_IP}`
);
Services.prefs.setIntPref("network.trr.mode", 3);
dns.clearCache(true);
chan = makeChan(URL, Ci.nsIRequest.TRR_DEFAULT_MODE);
await new Promise(resolve =>
chan.asyncOpen(new ChannelListener(resolve, null, CL_EXPECT_FAILURE))
);
dns.clearCache(true);
chan = makeChan(URL, Ci.nsIRequest.TRR_DISABLED_MODE);
await new Promise(resolve => chan.asyncOpen(new ChannelListener(resolve)));
dns.clearCache(true);
chan = makeChan(URL, Ci.nsIRequest.TRR_FIRST_MODE);
await new Promise(resolve => chan.asyncOpen(new ChannelListener(resolve)));
dns.clearCache(true);
chan = makeChan(URL, Ci.nsIRequest.TRR_ONLY_MODE);
await new Promise(resolve =>
chan.asyncOpen(new ChannelListener(resolve, null, CL_EXPECT_FAILURE))
);
dns.clearCache(true);
Services.prefs.setIntPref("network.trr.mode", 5);
Services.prefs.setCharPref(
"network.trr.uri",
`https://localhost:${h2Port}/doh?responseIP=1.1.1.1`
);
dns.clearCache(true);
chan = makeChan(URL, Ci.nsIRequest.TRR_DEFAULT_MODE);
await new Promise(resolve => chan.asyncOpen(new ChannelListener(resolve)));
dns.clearCache(true);
chan = makeChan(URL, Ci.nsIRequest.TRR_DISABLED_MODE);
await new Promise(resolve => chan.asyncOpen(new ChannelListener(resolve)));
dns.clearCache(true);
chan = makeChan(URL, Ci.nsIRequest.TRR_FIRST_MODE);
await new Promise(resolve => chan.asyncOpen(new ChannelListener(resolve)));
dns.clearCache(true);
chan = makeChan(URL, Ci.nsIRequest.TRR_ONLY_MODE);
await new Promise(resolve => chan.asyncOpen(new ChannelListener(resolve)));
await new Promise(resolve => httpserv.stop(resolve));
}
);
});
// verify basic A record
add_task(async function test1() {
@ -874,61 +750,15 @@ add_task(async function test24e() {
await new DNSListener("bar.example.com", "127.0.0.1");
});
function observerPromise(topic) {
return new Promise(resolve => {
let observer = {
QueryInterface: ChromeUtils.generateQI([Ci.nsIObserver]),
observe(aSubject, aTopic, aData) {
dump(`observe: ${aSubject}, ${aTopic}, ${aData} \n`);
if (aTopic == topic) {
Services.obs.removeObserver(observer, topic);
resolve(aData);
}
},
};
Services.obs.addObserver(observer, topic);
});
}
// TRR-first check that captivedetect.canonicalURL is resolved via native DNS
add_task(async function test24f() {
dns.clearCache(true);
const cpServer = new HttpServer();
cpServer.registerPathHandler("/cp", function handleRawData(
request,
response
) {
response.setHeader("Content-Type", "text/plain", false);
response.setHeader("Cache-Control", "no-cache", false);
response.bodyOutputStream.write("data", 4);
});
cpServer.start(-1);
cpServer.identity.setPrimary(
"http",
"detectportal.firefox.com",
cpServer.identity.primaryPort
);
let cpPromise = observerPromise("captive-portal-login");
Services.prefs.setCharPref(
"captivedetect.canonicalURL",
`http://detectportal.firefox.com:${cpServer.identity.primaryPort}/cp`
"http://test.detectportal.com/success.txt"
);
Services.prefs.setBoolPref("network.captive-portal-service.testMode", true);
Services.prefs.setBoolPref("network.captive-portal-service.enabled", true);
// The captive portal has to have used native DNS, otherwise creating
// a socket to a non-local IP would trigger a crash.
await cpPromise;
// Simply resolving the captive portal domain should still use TRR
await new DNSListener("detectportal.firefox.com", "192.192.192.192");
Services.prefs.clearUserPref("network.captive-portal-service.enabled");
Services.prefs.clearUserPref("network.captive-portal-service.testMode");
Services.prefs.clearUserPref("captivedetect.canonicalURL");
await new Promise(resolve => cpServer.stop(resolve));
await new DNSListener("test.detectportal.com", "127.0.0.1");
});
// TRR-first check that a domain is resolved via native DNS when parental control is enabled.
@ -1041,46 +871,16 @@ add_task(async function test25d() {
add_task(async function test25e() {
dns.clearCache(true);
Services.prefs.setIntPref("network.trr.mode", 3); // TRR-only
Services.prefs.setCharPref(
"captivedetect.canonicalURL",
"http://test.detectportal.com/success.txt"
);
Services.prefs.setCharPref(
"network.trr.uri",
`https://foo.example.com:${h2Port}/doh?responseIP=192.192.192.192`
);
const cpServer = new HttpServer();
cpServer.registerPathHandler("/cp", function handleRawData(
request,
response
) {
response.setHeader("Content-Type", "text/plain", false);
response.setHeader("Cache-Control", "no-cache", false);
response.bodyOutputStream.write("data", 4);
});
cpServer.start(-1);
cpServer.identity.setPrimary(
"http",
"detectportal.firefox.com",
cpServer.identity.primaryPort
);
let cpPromise = observerPromise("captive-portal-login");
Services.prefs.setCharPref(
"captivedetect.canonicalURL",
`http://detectportal.firefox.com:${cpServer.identity.primaryPort}/cp`
);
Services.prefs.setBoolPref("network.captive-portal-service.testMode", true);
Services.prefs.setBoolPref("network.captive-portal-service.enabled", true);
// The captive portal has to have used native DNS, otherwise creating
// a socket to a non-local IP would trigger a crash.
await cpPromise;
// // Simply resolving the captive portal domain should still use TRR
await new DNSListener("detectportal.firefox.com", "192.192.192.192");
Services.prefs.clearUserPref("network.captive-portal-service.enabled");
Services.prefs.clearUserPref("network.captive-portal-service.testMode");
Services.prefs.clearUserPref("captivedetect.canonicalURL");
await new Promise(resolve => cpServer.stop(resolve));
await new DNSListener("test.detectportal.com", "127.0.0.1");
});
// TRR-only check that a domain is resolved via native DNS when parental control is enabled.
@ -1218,9 +1018,9 @@ add_task(async function test_connection_closed_no_bootstrap_localhost() {
});
add_task(async function test_connection_closed_no_bootstrap_no_excluded() {
// This test makes sure that even in mode 3 without a bootstrap address
// we are able to restart the TRR connection if it drops - the TRR service
// channel will use regular DNS to resolve the TRR address.
// This test exists to document what happens when we're in TRR only mode
// and we don't set a bootstrap address. We use DNS to resolve the
// initial URI, but if the connection fails, we don't fallback to DNS
dns.clearCache(true);
Services.prefs.setIntPref("network.trr.mode", 3); // TRR-only
Services.prefs.setCharPref("network.trr.excluded-domains", "");
@ -1240,8 +1040,11 @@ add_task(async function test_connection_closed_no_bootstrap_no_excluded() {
!Components.isSuccessCode(inStatus),
`${inStatus} should be an error code`
);
dns.clearCache(true);
await new DNSListener("bar2.example.com", "3.3.3.3");
[, , inStatus] = await new DNSListener("bar2.example.com", undefined, false);
Assert.ok(
!Components.isSuccessCode(inStatus),
`${inStatus} should be an error code`
);
});
add_task(async function test_connection_closed_trr_first() {

View File

@ -720,20 +720,6 @@ impl BitsRequest {
fn set_load_flags(&self, _load_flags: nsLoadFlags) -> Result<(), nsresult> {
Err(NS_ERROR_NOT_IMPLEMENTED)
}
xpcom_method!(
get_trr_mode => GetTRRMode() -> u8
);
fn get_trr_mode(&self) -> Result<u8, nsresult> {
Err(NS_ERROR_NOT_IMPLEMENTED)
}
xpcom_method!(
set_trr_mode => SetTRRMode(_trr_mode: u8)
);
fn set_trr_mode(&self, _trr_mode: u8) -> Result<(), nsresult> {
Err(NS_ERROR_NOT_IMPLEMENTED)
}
}
impl Drop for BitsRequest {

View File

@ -34,7 +34,7 @@ function URLFetcher(url, timeout) {
// Prevent privacy leaks
xhr.channel.loadFlags |= Ci.nsIRequest.LOAD_ANONYMOUS;
// Use the system's resolver for this check
xhr.channel.setTRRMode(Ci.nsIRequest.TRR_DISABLED_MODE);
xhr.channel.loadFlags |= Ci.nsIRequest.LOAD_DISABLE_TRR;
// We except this from being classified
xhr.channel.loadFlags |= Ci.nsIChannel.LOAD_BYPASS_URL_CLASSIFIER;

View File

@ -447,16 +447,6 @@ StreamFilterParent::SetLoadFlags(nsLoadFlags aLoadFlags) {
return mChannel->SetLoadFlags(aLoadFlags);
}
NS_IMETHODIMP
StreamFilterParent::GetTRRMode(nsIRequest::TRRMode* aTRRMode) {
return GetTRRModeImpl(aTRRMode);
}
NS_IMETHODIMP
StreamFilterParent::SetTRRMode(nsIRequest::TRRMode aTRRMode) {
return SetTRRModeImpl(aTRRMode);
}
/*****************************************************************************
* nsIStreamListener
*****************************************************************************/

View File

@ -293,16 +293,6 @@ ExternalHelperAppParent::SetLoadFlags(nsLoadFlags aLoadFlags) {
return NS_OK;
}
NS_IMETHODIMP
ExternalHelperAppParent::GetTRRMode(nsIRequest::TRRMode* aTRRMode) {
return GetTRRModeImpl(aTRRMode);
}
NS_IMETHODIMP
ExternalHelperAppParent::SetTRRMode(nsIRequest::TRRMode aTRRMode) {
return SetTRRModeImpl(aTRRMode);
}
NS_IMETHODIMP
ExternalHelperAppParent::GetIsDocument(bool* aIsDocument) {
return NS_GetIsDocumentChannel(this, aIsDocument);

View File

@ -238,14 +238,6 @@ NS_IMETHODIMP nsExtProtocolChannel::SetLoadFlags(nsLoadFlags aLoadFlags) {
return NS_OK;
}
NS_IMETHODIMP nsExtProtocolChannel::GetTRRMode(nsIRequest::TRRMode* aTRRMode) {
return GetTRRModeImpl(aTRRMode);
}
NS_IMETHODIMP nsExtProtocolChannel::SetTRRMode(nsIRequest::TRRMode aTRRMode) {
return SetTRRModeImpl(aTRRMode);
}
NS_IMETHODIMP nsExtProtocolChannel::GetIsDocument(bool* aIsDocument) {
return NS_GetIsDocumentChannel(this, aIsDocument);
}

View File

@ -943,7 +943,7 @@ class CEnum(object):
return "%s::%s " % (self.iface.name, self.basename)
def rustType(self, calltype):
return "%s u%d" % ('*mut' if 'out' in calltype else '', self.width)
raise RustNoncompat('cenums unimplemented')
def __str__(self):
body = ', '.join('%s = %s' % v for v in self.variants)