mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-03-01 22:07:41 +00:00
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:
parent
fd3b69986c
commit
8f38f4a3fb
@ -697,16 +697,6 @@ OnloadBlocker::GetLoadFlags(nsLoadFlags* aLoadFlags) {
|
|||||||
return NS_OK;
|
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
|
NS_IMETHODIMP
|
||||||
OnloadBlocker::SetLoadFlags(nsLoadFlags aLoadFlags) { return NS_OK; }
|
OnloadBlocker::SetLoadFlags(nsLoadFlags aLoadFlags) { return NS_OK; }
|
||||||
|
|
||||||
|
@ -860,8 +860,7 @@ void nsContentSink::PrefetchDNS(const nsAString& aHref) {
|
|||||||
|
|
||||||
if (!hostname.IsEmpty() && nsHTMLDNSPrefetch::IsAllowed(mDocument)) {
|
if (!hostname.IsEmpty() && nsHTMLDNSPrefetch::IsAllowed(mDocument)) {
|
||||||
nsHTMLDNSPrefetch::PrefetchLow(
|
nsHTMLDNSPrefetch::PrefetchLow(
|
||||||
hostname, isHttps, mDocument->NodePrincipal()->OriginAttributesRef(),
|
hostname, isHttps, mDocument->NodePrincipal()->OriginAttributesRef());
|
||||||
mDocument->GetChannel()->GetTRRMode());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -91,21 +91,10 @@ bool nsHTMLDNSPrefetch::IsAllowed(Document* aDocument) {
|
|||||||
return aDocument->IsDNSPrefetchAllowed() && aDocument->GetWindow();
|
return aDocument->IsDNSPrefetchAllowed() && aDocument->GetWindow();
|
||||||
}
|
}
|
||||||
|
|
||||||
static uint32_t GetDNSFlagsFromLink(Link* aElement) {
|
nsresult nsHTMLDNSPrefetch::Prefetch(Link* aElement, uint16_t flags) {
|
||||||
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) {
|
|
||||||
if (!(sInitialized && sPrefetches && sDNSService && sDNSListener))
|
if (!(sInitialized && sPrefetches && sDNSService && sDNSListener))
|
||||||
return NS_ERROR_NOT_AVAILABLE;
|
return NS_ERROR_NOT_AVAILABLE;
|
||||||
|
|
||||||
flags |= GetDNSFlagsFromLink(aElement);
|
|
||||||
return sPrefetches->Add(flags, aElement);
|
return sPrefetches->Add(flags, aElement);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -123,7 +112,7 @@ nsresult nsHTMLDNSPrefetch::PrefetchHigh(Link* aElement) {
|
|||||||
|
|
||||||
nsresult nsHTMLDNSPrefetch::Prefetch(const nsAString& hostname, bool isHttps,
|
nsresult nsHTMLDNSPrefetch::Prefetch(const nsAString& hostname, bool isHttps,
|
||||||
const OriginAttributes& aOriginAttributes,
|
const OriginAttributes& aOriginAttributes,
|
||||||
uint32_t flags) {
|
uint16_t flags) {
|
||||||
if (IsNeckoChild()) {
|
if (IsNeckoChild()) {
|
||||||
// We need to check IsEmpty() because net_IsValidHostName()
|
// We need to check IsEmpty() because net_IsValidHostName()
|
||||||
// considers empty strings to be valid hostnames
|
// considers empty strings to be valid hostnames
|
||||||
@ -165,28 +154,25 @@ nsresult nsHTMLDNSPrefetch::Prefetch(const nsAString& hostname, bool isHttps,
|
|||||||
|
|
||||||
nsresult nsHTMLDNSPrefetch::PrefetchLow(
|
nsresult nsHTMLDNSPrefetch::PrefetchLow(
|
||||||
const nsAString& hostname, bool isHttps,
|
const nsAString& hostname, bool isHttps,
|
||||||
const OriginAttributes& aOriginAttributes, nsIRequest::TRRMode aMode) {
|
const OriginAttributes& aOriginAttributes) {
|
||||||
return Prefetch(hostname, isHttps, aOriginAttributes,
|
return Prefetch(hostname, isHttps, aOriginAttributes,
|
||||||
nsIDNSService::GetFlagsFromTRRMode(aMode) |
|
nsIDNSService::RESOLVE_PRIORITY_LOW);
|
||||||
nsIDNSService::RESOLVE_PRIORITY_LOW);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
nsresult nsHTMLDNSPrefetch::PrefetchMedium(
|
nsresult nsHTMLDNSPrefetch::PrefetchMedium(
|
||||||
const nsAString& hostname, bool isHttps,
|
const nsAString& hostname, bool isHttps,
|
||||||
const OriginAttributes& aOriginAttributes, nsIRequest::TRRMode aMode) {
|
const OriginAttributes& aOriginAttributes) {
|
||||||
return Prefetch(hostname, isHttps, aOriginAttributes,
|
return Prefetch(hostname, isHttps, aOriginAttributes,
|
||||||
nsIDNSService::GetFlagsFromTRRMode(aMode) |
|
nsIDNSService::RESOLVE_PRIORITY_MEDIUM);
|
||||||
nsIDNSService::RESOLVE_PRIORITY_MEDIUM);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
nsresult nsHTMLDNSPrefetch::PrefetchHigh(
|
nsresult nsHTMLDNSPrefetch::PrefetchHigh(
|
||||||
const nsAString& hostname, bool isHttps,
|
const nsAString& hostname, bool isHttps,
|
||||||
const OriginAttributes& aOriginAttributes, nsIRequest::TRRMode aMode) {
|
const OriginAttributes& aOriginAttributes) {
|
||||||
return Prefetch(hostname, isHttps, aOriginAttributes,
|
return Prefetch(hostname, isHttps, aOriginAttributes, 0);
|
||||||
nsIDNSService::GetFlagsFromTRRMode(aMode));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
nsresult nsHTMLDNSPrefetch::CancelPrefetch(Link* aElement, uint32_t flags,
|
nsresult nsHTMLDNSPrefetch::CancelPrefetch(Link* aElement, uint16_t flags,
|
||||||
nsresult aReason) {
|
nsresult aReason) {
|
||||||
if (!(sInitialized && sPrefetches && sDNSService && sDNSListener))
|
if (!(sInitialized && sPrefetches && sDNSService && sDNSListener))
|
||||||
return NS_ERROR_NOT_AVAILABLE;
|
return NS_ERROR_NOT_AVAILABLE;
|
||||||
@ -210,7 +196,7 @@ nsresult nsHTMLDNSPrefetch::CancelPrefetch(Link* aElement, uint32_t flags,
|
|||||||
|
|
||||||
nsresult nsHTMLDNSPrefetch::CancelPrefetch(
|
nsresult nsHTMLDNSPrefetch::CancelPrefetch(
|
||||||
const nsAString& hostname, bool isHttps,
|
const nsAString& hostname, bool isHttps,
|
||||||
const OriginAttributes& aOriginAttributes, uint32_t flags,
|
const OriginAttributes& aOriginAttributes, uint16_t flags,
|
||||||
nsresult aReason) {
|
nsresult aReason) {
|
||||||
// Forward this request to Necko Parent if we're a child process
|
// Forward this request to Necko Parent if we're a child process
|
||||||
if (IsNeckoChild()) {
|
if (IsNeckoChild()) {
|
||||||
@ -249,20 +235,14 @@ nsresult nsHTMLDNSPrefetch::CancelPrefetch(
|
|||||||
|
|
||||||
nsresult nsHTMLDNSPrefetch::CancelPrefetchLow(Link* aElement,
|
nsresult nsHTMLDNSPrefetch::CancelPrefetchLow(Link* aElement,
|
||||||
nsresult aReason) {
|
nsresult aReason) {
|
||||||
return CancelPrefetch(
|
return CancelPrefetch(aElement, nsIDNSService::RESOLVE_PRIORITY_LOW, aReason);
|
||||||
aElement,
|
|
||||||
GetDNSFlagsFromLink(aElement) | nsIDNSService::RESOLVE_PRIORITY_LOW,
|
|
||||||
aReason);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
nsresult nsHTMLDNSPrefetch::CancelPrefetchLow(
|
nsresult nsHTMLDNSPrefetch::CancelPrefetchLow(
|
||||||
const nsAString& hostname, bool isHttps,
|
const nsAString& hostname, bool isHttps,
|
||||||
const OriginAttributes& aOriginAttributes, nsIRequest::TRRMode aTRRMode,
|
const OriginAttributes& aOriginAttributes, nsresult aReason) {
|
||||||
nsresult aReason) {
|
|
||||||
return CancelPrefetch(hostname, isHttps, aOriginAttributes,
|
return CancelPrefetch(hostname, isHttps, aOriginAttributes,
|
||||||
nsIDNSService::GetFlagsFromTRRMode(aTRRMode) |
|
nsIDNSService::RESOLVE_PRIORITY_LOW, aReason);
|
||||||
nsIDNSService::RESOLVE_PRIORITY_LOW,
|
|
||||||
aReason);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void nsHTMLDNSPrefetch::LinkDestroyed(Link* aLink) {
|
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
|
// 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");
|
NS_ASSERTION(NS_IsMainThread(), "nsDeferrals::Add must be on main thread");
|
||||||
|
|
||||||
|
@ -52,20 +52,16 @@ class nsHTMLDNSPrefetch {
|
|||||||
static nsresult PrefetchLow(mozilla::dom::Link* aElement);
|
static nsresult PrefetchLow(mozilla::dom::Link* aElement);
|
||||||
static nsresult PrefetchHigh(
|
static nsresult PrefetchHigh(
|
||||||
const nsAString& host, bool isHttps,
|
const nsAString& host, bool isHttps,
|
||||||
const mozilla::OriginAttributes& aOriginAttributes,
|
const mozilla::OriginAttributes& aOriginAttributes);
|
||||||
nsIRequest::TRRMode aTRRMode);
|
|
||||||
static nsresult PrefetchMedium(
|
static nsresult PrefetchMedium(
|
||||||
const nsAString& host, bool isHttps,
|
const nsAString& host, bool isHttps,
|
||||||
const mozilla::OriginAttributes& aOriginAttributes,
|
const mozilla::OriginAttributes& aOriginAttributes);
|
||||||
nsIRequest::TRRMode aTRRMode);
|
|
||||||
static nsresult PrefetchLow(
|
static nsresult PrefetchLow(
|
||||||
const nsAString& host, bool isHttps,
|
const nsAString& host, bool isHttps,
|
||||||
const mozilla::OriginAttributes& aOriginAttributes,
|
const mozilla::OriginAttributes& aOriginAttributes);
|
||||||
nsIRequest::TRRMode aTRRMode);
|
|
||||||
static nsresult CancelPrefetchLow(
|
static nsresult CancelPrefetchLow(
|
||||||
const nsAString& host, bool isHttps,
|
const nsAString& host, bool isHttps,
|
||||||
const mozilla::OriginAttributes& aOriginAttributes,
|
const mozilla::OriginAttributes& aOriginAttributes, nsresult aReason);
|
||||||
nsIRequest::TRRMode aTRRMode, nsresult aReason);
|
|
||||||
static nsresult CancelPrefetchLow(mozilla::dom::Link* aElement,
|
static nsresult CancelPrefetchLow(mozilla::dom::Link* aElement,
|
||||||
nsresult aReason);
|
nsresult aReason);
|
||||||
|
|
||||||
@ -74,13 +70,13 @@ class nsHTMLDNSPrefetch {
|
|||||||
private:
|
private:
|
||||||
static nsresult Prefetch(const nsAString& host, bool isHttps,
|
static nsresult Prefetch(const nsAString& host, bool isHttps,
|
||||||
const mozilla::OriginAttributes& aOriginAttributes,
|
const mozilla::OriginAttributes& aOriginAttributes,
|
||||||
uint32_t flags);
|
uint16_t flags);
|
||||||
static nsresult Prefetch(mozilla::dom::Link* aElement, uint32_t flags);
|
static nsresult Prefetch(mozilla::dom::Link* aElement, uint16_t flags);
|
||||||
static nsresult CancelPrefetch(
|
static nsresult CancelPrefetch(
|
||||||
const nsAString& hostname, bool isHttps,
|
const nsAString& hostname, bool isHttps,
|
||||||
const mozilla::OriginAttributes& aOriginAttributes, uint32_t flags,
|
const mozilla::OriginAttributes& aOriginAttributes, uint16_t flags,
|
||||||
nsresult aReason);
|
nsresult aReason);
|
||||||
static nsresult CancelPrefetch(mozilla::dom::Link* aElement, uint32_t flags,
|
static nsresult CancelPrefetch(mozilla::dom::Link* aElement, uint16_t flags,
|
||||||
nsresult aReason);
|
nsresult aReason);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
@ -107,7 +103,7 @@ class nsHTMLDNSPrefetch {
|
|||||||
nsDeferrals();
|
nsDeferrals();
|
||||||
|
|
||||||
void Activate();
|
void Activate();
|
||||||
nsresult Add(uint32_t flags, mozilla::dom::Link* aElement);
|
nsresult Add(uint16_t flags, mozilla::dom::Link* aElement);
|
||||||
|
|
||||||
void RemoveUnboundLinks();
|
void RemoveUnboundLinks();
|
||||||
|
|
||||||
@ -129,7 +125,7 @@ class nsHTMLDNSPrefetch {
|
|||||||
static const int sMaxDeferredMask = (sMaxDeferred - 1);
|
static const int sMaxDeferredMask = (sMaxDeferred - 1);
|
||||||
|
|
||||||
struct deferred_entry {
|
struct deferred_entry {
|
||||||
uint32_t mFlags;
|
uint16_t mFlags;
|
||||||
// Link implementation clears this raw pointer in its destructor.
|
// Link implementation clears this raw pointer in its destructor.
|
||||||
mozilla::dom::Link* mElement;
|
mozilla::dom::Link* mElement;
|
||||||
} mEntries[sMaxDeferred];
|
} mEntries[sMaxDeferred];
|
||||||
|
@ -3585,8 +3585,6 @@ class FakeChannel final : public nsIChannel,
|
|||||||
NS_IMETHOD SetLoadGroup(nsILoadGroup*) NO_IMPL;
|
NS_IMETHOD SetLoadGroup(nsILoadGroup*) NO_IMPL;
|
||||||
NS_IMETHOD SetLoadFlags(nsLoadFlags) NO_IMPL;
|
NS_IMETHOD SetLoadFlags(nsLoadFlags) NO_IMPL;
|
||||||
NS_IMETHOD GetLoadFlags(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 GetIsDocument(bool*) NO_IMPL;
|
||||||
NS_IMETHOD GetOriginalURI(nsIURI**) NO_IMPL;
|
NS_IMETHOD GetOriginalURI(nsIURI**) NO_IMPL;
|
||||||
NS_IMETHOD SetOriginalURI(nsIURI*) NO_IMPL;
|
NS_IMETHOD SetOriginalURI(nsIURI*) NO_IMPL;
|
||||||
|
@ -223,16 +223,6 @@ NS_IMETHODIMP RemoteWebProgressRequest::GetLoadFlags(nsLoadFlags* aLoadFlags) {
|
|||||||
return NS_ERROR_NOT_IMPLEMENTED;
|
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) {
|
NS_IMETHODIMP RemoteWebProgressRequest::SetLoadFlags(nsLoadFlags aLoadFlags) {
|
||||||
return NS_ERROR_NOT_IMPLEMENTED;
|
return NS_ERROR_NOT_IMPLEMENTED;
|
||||||
}
|
}
|
||||||
|
@ -833,16 +833,6 @@ nsJSChannel::SetLoadFlags(nsLoadFlags aLoadFlags) {
|
|||||||
return mStreamChannel->SetLoadFlags(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
|
NS_IMETHODIMP
|
||||||
nsJSChannel::GetLoadGroup(nsILoadGroup** aLoadGroup) {
|
nsJSChannel::GetLoadGroup(nsILoadGroup** aLoadGroup) {
|
||||||
return mStreamChannel->GetLoadGroup(aLoadGroup);
|
return mStreamChannel->GetLoadGroup(aLoadGroup);
|
||||||
|
@ -676,16 +676,6 @@ PresentationConnection::GetLoadFlags(nsLoadFlags* aLoadFlags) {
|
|||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
PresentationConnection::SetLoadFlags(nsLoadFlags aLoadFlags) { return NS_OK; }
|
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() {
|
nsresult PresentationConnection::AddIntoLoadGroup() {
|
||||||
// Avoid adding to loadgroup multiple times
|
// Avoid adding to loadgroup multiple times
|
||||||
if (mWeakLoadGroup) {
|
if (mWeakLoadGroup) {
|
||||||
|
@ -2546,16 +2546,6 @@ WebSocketImpl::SetLoadFlags(nsLoadFlags aLoadFlags) {
|
|||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
|
||||||
WebSocketImpl::GetTRRMode(nsIRequest::TRRMode* aTRRMode) {
|
|
||||||
return GetTRRModeImpl(aTRRMode);
|
|
||||||
}
|
|
||||||
|
|
||||||
NS_IMETHODIMP
|
|
||||||
WebSocketImpl::SetTRRMode(nsIRequest::TRRMode aTRRMode) {
|
|
||||||
return SetTRRModeImpl(aTRRMode);
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
class WorkerRunnableDispatcher final : public WorkerRunnable {
|
class WorkerRunnableDispatcher final : public WorkerRunnable {
|
||||||
|
@ -346,12 +346,6 @@ nsIconChannel::SetLoadFlags(uint32_t aLoadAttributes) {
|
|||||||
return mPump->SetLoadFlags(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
|
NS_IMETHODIMP
|
||||||
nsIconChannel::GetIsDocument(bool* aIsDocument) {
|
nsIconChannel::GetIsDocument(bool* aIsDocument) {
|
||||||
return NS_GetIsDocumentChannel(this, aIsDocument);
|
return NS_GetIsDocumentChannel(this, aIsDocument);
|
||||||
|
@ -231,16 +231,6 @@ nsIconChannel::SetLoadFlags(uint32_t aLoadAttributes) {
|
|||||||
return mPump->SetLoadFlags(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
|
NS_IMETHODIMP
|
||||||
nsIconChannel::GetIsDocument(bool* aIsDocument) {
|
nsIconChannel::GetIsDocument(bool* aIsDocument) {
|
||||||
return NS_GetIsDocumentChannel(this, aIsDocument);
|
return NS_GetIsDocumentChannel(this, aIsDocument);
|
||||||
|
@ -661,16 +661,6 @@ imgRequestProxy::SetLoadFlags(nsLoadFlags flags) {
|
|||||||
return NS_OK;
|
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 **/
|
/** imgIRequest methods **/
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
|
@ -614,16 +614,6 @@ nsJARChannel::SetLoadFlags(nsLoadFlags aLoadFlags) {
|
|||||||
return NS_OK;
|
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
|
NS_IMETHODIMP
|
||||||
nsJARChannel::GetIsDocument(bool* aIsDocument) {
|
nsJARChannel::GetIsDocument(bool* aIsDocument) {
|
||||||
return NS_GetIsDocumentChannel(this, aIsDocument);
|
return NS_GetIsDocumentChannel(this, aIsDocument);
|
||||||
|
@ -201,11 +201,10 @@ static inline already_AddRefed<nsIChannel> SetupIPCheckChannel(bool ipv4) {
|
|||||||
nullptr, // aPerformanceStorage
|
nullptr, // aPerformanceStorage
|
||||||
nullptr, // aLoadGroup
|
nullptr, // aLoadGroup
|
||||||
nullptr,
|
nullptr,
|
||||||
nsIRequest::LOAD_BYPASS_CACHE | // don't read from the cache
|
nsIRequest::LOAD_BYPASS_CACHE | // don't read from the cache
|
||||||
nsIRequest::INHIBIT_CACHING | // don't write the response to cache
|
nsIRequest::INHIBIT_CACHING | // don't write the response to cache
|
||||||
nsIRequest::LOAD_ANONYMOUS); // prevent privacy leaks
|
nsIRequest::LOAD_DISABLE_TRR | // check network capabilities not TRR
|
||||||
|
nsIRequest::LOAD_ANONYMOUS); // prevent privacy leaks
|
||||||
channel->SetTRRMode(nsIRequest::TRR_DISABLED_MODE);
|
|
||||||
|
|
||||||
NS_ENSURE_SUCCESS(rv, nullptr);
|
NS_ENSURE_SUCCESS(rv, nullptr);
|
||||||
|
|
||||||
|
@ -202,16 +202,6 @@ nsAsyncStreamCopier::GetLoadFlags(nsLoadFlags* aLoadFlags) {
|
|||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsAsyncStreamCopier::SetLoadFlags(nsLoadFlags aLoadFlags) { return NS_OK; }
|
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
|
NS_IMETHODIMP
|
||||||
nsAsyncStreamCopier::GetLoadGroup(nsILoadGroup** aLoadGroup) {
|
nsAsyncStreamCopier::GetLoadGroup(nsILoadGroup** aLoadGroup) {
|
||||||
*aLoadGroup = nullptr;
|
*aLoadGroup = nullptr;
|
||||||
|
@ -430,16 +430,6 @@ nsBaseChannel::SetLoadFlags(nsLoadFlags aLoadFlags) {
|
|||||||
return NS_OK;
|
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
|
NS_IMETHODIMP
|
||||||
nsBaseChannel::GetLoadGroup(nsILoadGroup** aLoadGroup) {
|
nsBaseChannel::GetLoadGroup(nsILoadGroup** aLoadGroup) {
|
||||||
NS_IF_ADDREF(*aLoadGroup = mLoadGroup);
|
NS_IF_ADDREF(*aLoadGroup = mLoadGroup);
|
||||||
|
@ -33,17 +33,15 @@ nsresult nsDNSPrefetch::Shutdown() {
|
|||||||
|
|
||||||
nsDNSPrefetch::nsDNSPrefetch(nsIURI* aURI,
|
nsDNSPrefetch::nsDNSPrefetch(nsIURI* aURI,
|
||||||
mozilla::OriginAttributes& aOriginAttributes,
|
mozilla::OriginAttributes& aOriginAttributes,
|
||||||
nsIRequest::TRRMode aTRRMode,
|
|
||||||
nsIDNSListener* aListener, bool storeTiming)
|
nsIDNSListener* aListener, bool storeTiming)
|
||||||
: mOriginAttributes(aOriginAttributes),
|
: mOriginAttributes(aOriginAttributes),
|
||||||
mStoreTiming(storeTiming),
|
mStoreTiming(storeTiming),
|
||||||
mTRRMode(aTRRMode),
|
|
||||||
mListener(do_GetWeakReference(aListener)) {
|
mListener(do_GetWeakReference(aListener)) {
|
||||||
aURI->GetAsciiHost(mHostname);
|
aURI->GetAsciiHost(mHostname);
|
||||||
mIsHttps = aURI->SchemeIs("https");
|
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.
|
// This can work properly only if this call is on the main thread.
|
||||||
// Curenlty we use nsDNSPrefetch only in nsHttpChannel which will call
|
// Curenlty we use nsDNSPrefetch only in nsHttpChannel which will call
|
||||||
// PrefetchHigh() from the main thread. Let's add assertion to catch
|
// 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.
|
// TimingsValid() before using the timing.
|
||||||
nsCOMPtr<nsIEventTarget> main = mozilla::GetMainThreadEventTarget();
|
nsCOMPtr<nsIEventTarget> main = mozilla::GetMainThreadEventTarget();
|
||||||
|
|
||||||
flags |= nsIDNSService::GetFlagsFromTRRMode(mTRRMode);
|
|
||||||
|
|
||||||
nsresult rv = sDNSService->AsyncResolveNative(
|
nsresult rv = sDNSService->AsyncResolveNative(
|
||||||
mHostname, flags | nsIDNSService::RESOLVE_SPECULATE, this, main,
|
mHostname, flags | nsIDNSService::RESOLVE_SPECULATE, this, main,
|
||||||
mOriginAttributes, getter_AddRefs(tmpOutstanding));
|
mOriginAttributes, getter_AddRefs(tmpOutstanding));
|
||||||
|
@ -25,8 +25,7 @@ class nsDNSPrefetch final : public nsIDNSListener {
|
|||||||
NS_DECL_NSIDNSLISTENER
|
NS_DECL_NSIDNSLISTENER
|
||||||
|
|
||||||
nsDNSPrefetch(nsIURI* aURI, mozilla::OriginAttributes& aOriginAttributes,
|
nsDNSPrefetch(nsIURI* aURI, mozilla::OriginAttributes& aOriginAttributes,
|
||||||
nsIRequest::TRRMode aTRRMode, nsIDNSListener* aListener,
|
nsIDNSListener* aListener, bool storeTiming);
|
||||||
bool storeTiming);
|
|
||||||
bool TimingsValid() const {
|
bool TimingsValid() const {
|
||||||
return !mStartTimestamp.IsNull() && !mEndTimestamp.IsNull();
|
return !mStartTimestamp.IsNull() && !mEndTimestamp.IsNull();
|
||||||
}
|
}
|
||||||
@ -47,12 +46,11 @@ class nsDNSPrefetch final : public nsIDNSListener {
|
|||||||
bool mIsHttps;
|
bool mIsHttps;
|
||||||
mozilla::OriginAttributes mOriginAttributes;
|
mozilla::OriginAttributes mOriginAttributes;
|
||||||
bool mStoreTiming;
|
bool mStoreTiming;
|
||||||
nsIRequest::TRRMode mTRRMode;
|
|
||||||
mozilla::TimeStamp mStartTimestamp;
|
mozilla::TimeStamp mStartTimestamp;
|
||||||
mozilla::TimeStamp mEndTimestamp;
|
mozilla::TimeStamp mEndTimestamp;
|
||||||
nsWeakPtr mListener;
|
nsWeakPtr mListener;
|
||||||
|
|
||||||
nsresult Prefetch(uint32_t flags);
|
nsresult Prefetch(uint16_t flags);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -137,68 +137,11 @@ interface nsIRequest : nsISupports
|
|||||||
*/
|
*/
|
||||||
const unsigned long LOAD_DOCUMENT_NEEDS_COOKIE = 1 << 2;
|
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.
|
* Set this flag to disable TRR for this request.
|
||||||
* 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.
|
|
||||||
*/
|
*/
|
||||||
nsIRequest_TRRMode getTRRMode();
|
const unsigned long LOAD_DISABLE_TRR = 1 << 3;
|
||||||
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);
|
|
||||||
|
|
||||||
/**************************************************************************
|
/**************************************************************************
|
||||||
* The following flags control the flow of data into the cache.
|
* The following flags control the flow of data into the cache.
|
||||||
|
@ -4,7 +4,6 @@
|
|||||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
#include "nsITransport.idl"
|
#include "nsITransport.idl"
|
||||||
#include "nsIRequest.idl"
|
|
||||||
|
|
||||||
interface nsIInterfaceRequestor;
|
interface nsIInterfaceRequestor;
|
||||||
interface nsINetAddr;
|
interface nsINetAddr;
|
||||||
@ -259,23 +258,6 @@ interface nsISocketTransport : nsITransport
|
|||||||
*/
|
*/
|
||||||
const unsigned long DONT_TRY_ESNI = (1 << 10);
|
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.
|
* An opaque flags for non-standard behavior of the TLS system.
|
||||||
* It is unlikely this will need to be set outside of telemetry studies
|
* It is unlikely this will need to be set outside of telemetry studies
|
||||||
|
@ -371,16 +371,6 @@ nsIncrementalDownload::SetLoadFlags(nsLoadFlags loadFlags) {
|
|||||||
return NS_OK;
|
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
|
NS_IMETHODIMP
|
||||||
nsIncrementalDownload::GetLoadGroup(nsILoadGroup** loadGroup) {
|
nsIncrementalDownload::GetLoadGroup(nsILoadGroup** loadGroup) {
|
||||||
return NS_ERROR_NOT_IMPLEMENTED;
|
return NS_ERROR_NOT_IMPLEMENTED;
|
||||||
|
@ -244,16 +244,6 @@ nsInputStreamPump::SetLoadFlags(nsLoadFlags aLoadFlags) {
|
|||||||
return NS_OK;
|
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
|
NS_IMETHODIMP
|
||||||
nsInputStreamPump::GetLoadGroup(nsILoadGroup** aLoadGroup) {
|
nsInputStreamPump::GetLoadGroup(nsILoadGroup** aLoadGroup) {
|
||||||
RecursiveMutexAutoLock lock(mMutex);
|
RecursiveMutexAutoLock lock(mMutex);
|
||||||
|
@ -344,16 +344,6 @@ nsLoadGroup::SetLoadFlags(uint32_t aLoadFlags) {
|
|||||||
return NS_OK;
|
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
|
NS_IMETHODIMP
|
||||||
nsLoadGroup::GetLoadGroup(nsILoadGroup** loadGroup) {
|
nsLoadGroup::GetLoadGroup(nsILoadGroup** loadGroup) {
|
||||||
nsCOMPtr<nsILoadGroup> result = mLoadGroup;
|
nsCOMPtr<nsILoadGroup> result = mLoadGroup;
|
||||||
|
@ -1039,9 +1039,6 @@ nsresult nsSocketTransport::ResolveHost() {
|
|||||||
if (mConnectionFlags & nsSocketTransport::DISABLE_TRR)
|
if (mConnectionFlags & nsSocketTransport::DISABLE_TRR)
|
||||||
dnsFlags |= nsIDNSService::RESOLVE_DISABLE_TRR;
|
dnsFlags |= nsIDNSService::RESOLVE_DISABLE_TRR;
|
||||||
|
|
||||||
dnsFlags |= nsIDNSService::GetFlagsFromTRRMode(
|
|
||||||
nsISocketTransport::GetTRRModeFromFlags(mConnectionFlags));
|
|
||||||
|
|
||||||
NS_ASSERTION(!(dnsFlags & nsIDNSService::RESOLVE_DISABLE_IPV6) ||
|
NS_ASSERTION(!(dnsFlags & nsIDNSService::RESOLVE_DISABLE_IPV6) ||
|
||||||
!(dnsFlags & nsIDNSService::RESOLVE_DISABLE_IPV4),
|
!(dnsFlags & nsIDNSService::RESOLVE_DISABLE_IPV4),
|
||||||
"Setting both RESOLVE_DISABLE_IPV6 and RESOLVE_DISABLE_IPV4");
|
"Setting both RESOLVE_DISABLE_IPV6 and RESOLVE_DISABLE_IPV4");
|
||||||
|
@ -173,10 +173,8 @@ nsresult TRR::SendHTTPRequest() {
|
|||||||
return NS_ERROR_FAILURE;
|
return NS_ERROR_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (((mType == TRRTYPE_A) || (mType == TRRTYPE_AAAA)) &&
|
if ((mType == TRRTYPE_A) || (mType == TRRTYPE_AAAA)) {
|
||||||
mRec->EffectiveTRRMode() != nsIRequest::TRR_ONLY_MODE) {
|
|
||||||
// let NS resolves skip the blacklist check
|
// let NS resolves skip the blacklist check
|
||||||
// we also don't check the blacklist for TRR only requests
|
|
||||||
MOZ_ASSERT(mRec);
|
MOZ_ASSERT(mRec);
|
||||||
|
|
||||||
if (gTRRService->IsTRRBlacklisted(mHost, mOriginSuffix, mPB, true)) {
|
if (gTRRService->IsTRRBlacklisted(mHost, mOriginSuffix, mPB, true)) {
|
||||||
@ -256,10 +254,6 @@ nsresult TRR::SendHTTPRequest() {
|
|||||||
return NS_ERROR_UNEXPECTED;
|
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(
|
rv = httpChannel->SetRequestHeader(
|
||||||
NS_LITERAL_CSTRING("Accept"),
|
NS_LITERAL_CSTRING("Accept"),
|
||||||
NS_LITERAL_CSTRING("application/dns-message"), false);
|
NS_LITERAL_CSTRING("application/dns-message"), false);
|
||||||
|
@ -21,8 +21,7 @@ static const char kOpenCaptivePortalLoginEvent[] = "captive-portal-login";
|
|||||||
static const char kClearPrivateData[] = "clear-private-data";
|
static const char kClearPrivateData[] = "clear-private-data";
|
||||||
static const char kPurge[] = "browser:purge-session-history";
|
static const char kPurge[] = "browser:purge-session-history";
|
||||||
static const char kDisableIpv6Pref[] = "network.dns.disableIPv6";
|
static const char kDisableIpv6Pref[] = "network.dns.disableIPv6";
|
||||||
static const char kPrefSkipTRRParentalControl[] =
|
static const char kCaptivedetectCanonicalURL[] = "captivedetect.canonicalURL";
|
||||||
"network.dns.skipTRR-when-parental-control-enabled";
|
|
||||||
|
|
||||||
#define TRR_PREF_PREFIX "network.trr."
|
#define TRR_PREF_PREFIX "network.trr."
|
||||||
#define TRR_PREF(x) TRR_PREF_PREFIX x
|
#define TRR_PREF(x) TRR_PREF_PREFIX x
|
||||||
@ -49,7 +48,6 @@ TRRService::TRRService()
|
|||||||
mCaptiveIsPassed(false),
|
mCaptiveIsPassed(false),
|
||||||
mUseGET(false),
|
mUseGET(false),
|
||||||
mDisableECS(true),
|
mDisableECS(true),
|
||||||
mSkipTRRWhenParentalControlEnabled(true),
|
|
||||||
mDisableAfterFails(5),
|
mDisableAfterFails(5),
|
||||||
mClearTRRBLStorage(false),
|
mClearTRRBLStorage(false),
|
||||||
mConfirmationState(CONFIRM_INIT),
|
mConfirmationState(CONFIRM_INIT),
|
||||||
@ -80,7 +78,7 @@ nsresult TRRService::Init() {
|
|||||||
if (prefBranch) {
|
if (prefBranch) {
|
||||||
prefBranch->AddObserver(TRR_PREF_PREFIX, this, true);
|
prefBranch->AddObserver(TRR_PREF_PREFIX, this, true);
|
||||||
prefBranch->AddObserver(kDisableIpv6Pref, this, true);
|
prefBranch->AddObserver(kDisableIpv6Pref, this, true);
|
||||||
prefBranch->AddObserver(kPrefSkipTRRParentalControl, this, true);
|
prefBranch->AddObserver(kCaptivedetectCanonicalURL, this, true);
|
||||||
}
|
}
|
||||||
nsCOMPtr<nsICaptivePortalService> captivePortalService =
|
nsCOMPtr<nsICaptivePortalService> captivePortalService =
|
||||||
do_GetService(NS_CAPTIVEPORTAL_CID);
|
do_GetService(NS_CAPTIVEPORTAL_CID);
|
||||||
@ -116,13 +114,9 @@ void TRRService::GetParentalControlEnabledInternal() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool TRRService::Enabled(nsIRequest::TRRMode aMode) {
|
bool TRRService::Enabled() {
|
||||||
if (mMode == MODE_TRROFF) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (mConfirmationState == CONFIRM_INIT &&
|
if (mConfirmationState == CONFIRM_INIT &&
|
||||||
(!mWaitForCaptive || mCaptiveIsPassed ||
|
(!mWaitForCaptive || mCaptiveIsPassed || (mMode == MODE_TRRONLY))) {
|
||||||
(mMode == MODE_TRRONLY || aMode == nsIRequest::TRR_ONLY_MODE))) {
|
|
||||||
LOG(("TRRService::Enabled => CONFIRM_TRYING\n"));
|
LOG(("TRRService::Enabled => CONFIRM_TRYING\n"));
|
||||||
mConfirmationState = CONFIRM_TRYING;
|
mConfirmationState = CONFIRM_TRYING;
|
||||||
}
|
}
|
||||||
@ -310,7 +304,8 @@ nsresult TRRService::ReadPrefs(const char* name) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!name || !strcmp(name, TRR_PREF("excluded-domains")) ||
|
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();
|
mExcludedDomains.Clear();
|
||||||
|
|
||||||
auto parseExcludedDomains = [this](const char* aPrefName) {
|
auto parseExcludedDomains = [this](const char* aPrefName) {
|
||||||
@ -332,12 +327,18 @@ nsresult TRRService::ReadPrefs(const char* name) {
|
|||||||
parseExcludedDomains(TRR_PREF("excluded-domains"));
|
parseExcludedDomains(TRR_PREF("excluded-domains"));
|
||||||
parseExcludedDomains(TRR_PREF("builtin-excluded-domains"));
|
parseExcludedDomains(TRR_PREF("builtin-excluded-domains"));
|
||||||
clearEntireCache = true;
|
clearEntireCache = true;
|
||||||
}
|
|
||||||
|
|
||||||
if (!name || !strcmp(name, kPrefSkipTRRParentalControl)) {
|
nsAutoCString canonicalSiteURL;
|
||||||
bool tmp;
|
Preferences::GetCString(kCaptivedetectCanonicalURL, canonicalSiteURL);
|
||||||
if (NS_SUCCEEDED(Preferences::GetBool(kPrefSkipTRRParentalControl, &tmp))) {
|
|
||||||
mSkipTRRWhenParentalControlEnabled = tmp;
|
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
|
if (!mCaptiveIsPassed) {
|
||||||
// unless the service is in a TRR=enabled mode.
|
if (mConfirmationState != CONFIRM_OK) {
|
||||||
if (mMode == MODE_TRRFIRST || mMode == MODE_TRRONLY) {
|
mConfirmationState = CONFIRM_TRYING;
|
||||||
if (!mCaptiveIsPassed) {
|
MaybeConfirm();
|
||||||
if (mConfirmationState != CONFIRM_OK) {
|
|
||||||
mConfirmationState = CONFIRM_TRYING;
|
|
||||||
MaybeConfirm();
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
LOG(("TRRservice CP clear when already up!\n"));
|
|
||||||
}
|
}
|
||||||
mCaptiveIsPassed = true;
|
} else {
|
||||||
|
LOG(("TRRservice CP clear when already up!\n"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
mCaptiveIsPassed = true;
|
||||||
|
|
||||||
} else if (!strcmp(aTopic, kClearPrivateData) || !strcmp(aTopic, kPurge)) {
|
} else if (!strcmp(aTopic, kClearPrivateData) || !strcmp(aTopic, kPurge)) {
|
||||||
// flush the TRR blacklist, both in-memory and on-disk
|
// flush the TRR blacklist, both in-memory and on-disk
|
||||||
if (mTRRBLStorage) {
|
if (mTRRBLStorage) {
|
||||||
@ -478,7 +476,7 @@ void TRRService::MaybeConfirm() {
|
|||||||
|
|
||||||
void TRRService::MaybeConfirm_locked() {
|
void TRRService::MaybeConfirm_locked() {
|
||||||
mLock.AssertCurrentThreadOwns();
|
mLock.AssertCurrentThreadOwns();
|
||||||
if (mMode == MODE_TRROFF || mConfirmer ||
|
if (TRR_DISABLED(mMode) || mConfirmer ||
|
||||||
mConfirmationState != CONFIRM_TRYING) {
|
mConfirmationState != CONFIRM_TRYING) {
|
||||||
LOG(
|
LOG(
|
||||||
("TRRService:MaybeConfirm mode=%d, mConfirmer=%p "
|
("TRRService:MaybeConfirm mode=%d, mConfirmer=%p "
|
||||||
@ -503,7 +501,7 @@ void TRRService::MaybeConfirm_locked() {
|
|||||||
bool TRRService::MaybeBootstrap(const nsACString& aPossible,
|
bool TRRService::MaybeBootstrap(const nsACString& aPossible,
|
||||||
nsACString& aResult) {
|
nsACString& aResult) {
|
||||||
MutexAutoLock lock(mLock);
|
MutexAutoLock lock(mLock);
|
||||||
if (mMode == MODE_TRROFF || mBootstrapAddr.IsEmpty()) {
|
if (TRR_DISABLED(mMode) || mBootstrapAddr.IsEmpty()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -560,7 +558,7 @@ bool TRRService::IsTRRBlacklisted(const nsACString& aHost,
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!Enabled(nsIRequest::TRR_DEFAULT_MODE)) {
|
if (!Enabled()) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -30,7 +30,7 @@ class TRRService : public nsIObserver,
|
|||||||
TRRService();
|
TRRService();
|
||||||
nsresult Init();
|
nsresult Init();
|
||||||
nsresult Start();
|
nsresult Start();
|
||||||
bool Enabled(nsIRequest::TRRMode aMode);
|
bool Enabled();
|
||||||
|
|
||||||
uint32_t Mode() { return mMode; }
|
uint32_t Mode() { return mMode; }
|
||||||
bool AllowRFC1918() { return mRfc1918; }
|
bool AllowRFC1918() { return mRfc1918; }
|
||||||
@ -40,9 +40,6 @@ class TRRService : public nsIObserver,
|
|||||||
bool WaitForAllResponses() { return mWaitForAllResponses; }
|
bool WaitForAllResponses() { return mWaitForAllResponses; }
|
||||||
bool DisableIPv6() { return mDisableIPv6; }
|
bool DisableIPv6() { return mDisableIPv6; }
|
||||||
bool DisableECS() { return mDisableECS; }
|
bool DisableECS() { return mDisableECS; }
|
||||||
bool SkipTRRWhenParentalControlEnabled() {
|
|
||||||
return mSkipTRRWhenParentalControlEnabled;
|
|
||||||
}
|
|
||||||
nsresult GetURI(nsCString& result);
|
nsresult GetURI(nsCString& result);
|
||||||
nsresult GetCredentials(nsCString& result);
|
nsresult GetCredentials(nsCString& result);
|
||||||
uint32_t GetRequestTimeout();
|
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> mWaitForAllResponses; // Don't notify until all are in
|
||||||
Atomic<bool, Relaxed> mDisableIPv6; // don't even try
|
Atomic<bool, Relaxed> mDisableIPv6; // don't even try
|
||||||
Atomic<bool, Relaxed> mDisableECS; // disable EDNS Client Subnet in requests
|
Atomic<bool, Relaxed> mDisableECS; // disable EDNS Client Subnet in requests
|
||||||
Atomic<bool, Relaxed> mSkipTRRWhenParentalControlEnabled;
|
|
||||||
Atomic<uint32_t, Relaxed>
|
Atomic<uint32_t, Relaxed>
|
||||||
mDisableAfterFails; // this many fails in a row means failed TRR service
|
mDisableAfterFails; // this many fails in a row means failed TRR service
|
||||||
|
|
||||||
|
@ -152,9 +152,8 @@ static inline bool IsLowPriority(uint16_t flags) {
|
|||||||
// this macro filters out any flags that are not used when constructing the
|
// 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 key. the significant flags are those that would affect the resulting
|
||||||
// host record (i.e., the flags that are passed down to PR_GetAddrInfoByName).
|
// host record (i.e., the flags that are passed down to PR_GetAddrInfoByName).
|
||||||
#define RES_KEY_FLAGS(_f) \
|
#define RES_KEY_FLAGS(_f) \
|
||||||
((_f) & (nsHostResolver::RES_CANON_NAME | nsHostResolver::RES_DISABLE_TRR | \
|
((_f) & (nsHostResolver::RES_CANON_NAME | nsHostResolver::RES_DISABLE_TRR))
|
||||||
nsIDNSService::RESOLVE_TRR_MODE_MASK))
|
|
||||||
|
|
||||||
#define IS_ADDR_TYPE(_type) ((_type) == nsIDNSService::RESOLVE_TYPE_DEFAULT)
|
#define IS_ADDR_TYPE(_type) ((_type) == nsIDNSService::RESOLVE_TYPE_DEFAULT)
|
||||||
#define IS_OTHER_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),
|
flags(aFlags),
|
||||||
af(aAf),
|
af(aAf),
|
||||||
pb(aPb),
|
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 {
|
bool nsHostKey::operator==(const nsHostKey& other) const {
|
||||||
return host == other.host && type == other.type &&
|
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 kPrefNativeIsLocalhost[] = "network.dns.native-is-localhost";
|
||||||
static const char kPrefThreadIdleTime[] =
|
static const char kPrefThreadIdleTime[] =
|
||||||
"network.dns.resolver-thread-extra-idle-time-seconds";
|
"network.dns.resolver-thread-extra-idle-time-seconds";
|
||||||
|
static const char kPrefSkipTRRParentalControl[] =
|
||||||
|
"network.dns.skipTRR-when-parental-control-enabled";
|
||||||
static bool sGetTtlEnabled = false;
|
static bool sGetTtlEnabled = false;
|
||||||
mozilla::Atomic<bool, mozilla::Relaxed> gNativeIsLocalhost;
|
mozilla::Atomic<bool, mozilla::Relaxed> gNativeIsLocalhost;
|
||||||
|
|
||||||
@ -572,6 +578,7 @@ nsHostResolver::nsHostResolver(uint32_t maxCacheEntries,
|
|||||||
mLock("nsHostResolver.mLock"),
|
mLock("nsHostResolver.mLock"),
|
||||||
mIdleTaskCV(mLock, "nsHostResolver.mIdleTaskCV"),
|
mIdleTaskCV(mLock, "nsHostResolver.mIdleTaskCV"),
|
||||||
mEvictionQSize(0),
|
mEvictionQSize(0),
|
||||||
|
mSkipTRRWhenParentalControlEnabled(true),
|
||||||
mShutdown(true),
|
mShutdown(true),
|
||||||
mNumIdleTasks(0),
|
mNumIdleTasks(0),
|
||||||
mActiveTaskCount(0),
|
mActiveTaskCount(0),
|
||||||
@ -595,6 +602,8 @@ nsresult nsHostResolver::Init() {
|
|||||||
|
|
||||||
mShutdown = false;
|
mShutdown = false;
|
||||||
mNCS = NetworkConnectivityService::GetSingleton();
|
mNCS = NetworkConnectivityService::GetSingleton();
|
||||||
|
mSkipTRRWhenParentalControlEnabled =
|
||||||
|
Preferences::GetBool(kPrefSkipTRRParentalControl, true);
|
||||||
|
|
||||||
// The preferences probably haven't been loaded from the disk yet, so we
|
// 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
|
// 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
|
// By-Type requests use only TRR. If TRR is disabled we can return
|
||||||
// immediately.
|
// immediately.
|
||||||
if (IS_OTHER_TYPE(type) && Mode() == MODE_TRROFF) {
|
if (IS_OTHER_TYPE(type) && TRR_DISABLED(Mode())) {
|
||||||
return NS_ERROR_UNKNOWN_HOST;
|
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
|
// returns error if no TRR resolve is issued
|
||||||
// it is impt this is not called while a native lookup is going on
|
// it is impt this is not called while a native lookup is going on
|
||||||
nsresult nsHostResolver::TrrLookup(nsHostRecord* aRec, TRR* pushedTRR) {
|
nsresult nsHostResolver::TrrLookup(nsHostRecord* aRec, TRR* pushedTRR) {
|
||||||
if (Mode() == MODE_TRROFF) {
|
|
||||||
return NS_ERROR_UNKNOWN_HOST;
|
|
||||||
}
|
|
||||||
|
|
||||||
RefPtr<nsHostRecord> rec(aRec);
|
RefPtr<nsHostRecord> rec(aRec);
|
||||||
mLock.AssertCurrentThreadOwns();
|
mLock.AssertCurrentThreadOwns();
|
||||||
|
|
||||||
@ -1212,8 +1217,7 @@ nsresult nsHostResolver::TrrLookup(nsHostRecord* aRec, TRR* pushedTRR) {
|
|||||||
#endif
|
#endif
|
||||||
MOZ_ASSERT(!rec->mResolving);
|
MOZ_ASSERT(!rec->mResolving);
|
||||||
|
|
||||||
nsIRequest::TRRMode reqMode = rec->EffectiveTRRMode();
|
if (!gTRRService || !gTRRService->Enabled()) {
|
||||||
if (!gTRRService || !gTRRService->Enabled(reqMode)) {
|
|
||||||
LOG(("TrrLookup:: %s service not enabled\n", rec->host.get()));
|
LOG(("TrrLookup:: %s service not enabled\n", rec->host.get()));
|
||||||
return NS_ERROR_UNKNOWN_HOST;
|
return NS_ERROR_UNKNOWN_HOST;
|
||||||
}
|
}
|
||||||
@ -1374,49 +1378,6 @@ ResolverMode nsHostResolver::Mode() {
|
|||||||
return MODE_NATIVEONLY;
|
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
|
// Kick-off a name resolve operation, using native resolver and/or TRR
|
||||||
nsresult nsHostResolver::NameLookup(nsHostRecord* rec) {
|
nsresult nsHostResolver::NameLookup(nsHostRecord* rec) {
|
||||||
nsresult rv = NS_ERROR_UNKNOWN_HOST;
|
nsresult rv = NS_ERROR_UNKNOWN_HOST;
|
||||||
@ -1425,8 +1386,8 @@ nsresult nsHostResolver::NameLookup(nsHostRecord* rec) {
|
|||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
rec->mResolverMode = Mode();
|
ResolverMode mode = rec->mResolverMode = Mode();
|
||||||
MOZ_ASSERT(rec->mResolverMode != MODE_RESERVED1);
|
MOZ_ASSERT(mode != MODE_RESERVED1);
|
||||||
|
|
||||||
if (rec->IsAddrRecord()) {
|
if (rec->IsAddrRecord()) {
|
||||||
RefPtr<AddrHostRecord> addrRec = do_QueryObject(rec);
|
RefPtr<AddrHostRecord> addrRec = do_QueryObject(rec);
|
||||||
@ -1441,19 +1402,30 @@ nsresult nsHostResolver::NameLookup(nsHostRecord* rec) {
|
|||||||
addrRec->mTrrAAAAUsed = AddrHostRecord::INIT;
|
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(),
|
if (rec->flags & RES_DISABLE_TRR) {
|
||||||
effectiveRequestMode));
|
if (mode == MODE_TRRONLY && !skipTRR) {
|
||||||
|
return rv;
|
||||||
|
}
|
||||||
|
mode = MODE_NATIVEONLY;
|
||||||
|
}
|
||||||
|
|
||||||
if (effectiveRequestMode != nsIRequest::TRR_DISABLED_MODE &&
|
if (!TRR_DISABLED(mode) && !skipTRR) {
|
||||||
!((rec->flags & RES_DISABLE_TRR))) {
|
|
||||||
rv = TrrLookup(rec);
|
rv = TrrLookup(rec);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (effectiveRequestMode == nsIRequest::TRR_DISABLED_MODE ||
|
if (TRR_DISABLED(mode) || ((mode == MODE_TRRFIRST) && NS_FAILED(rv)) ||
|
||||||
(effectiveRequestMode == nsIRequest::TRR_FIRST_MODE &&
|
(mode == MODE_TRRONLY && skipTRR)) {
|
||||||
(rec->flags & RES_DISABLE_TRR) && NS_FAILED(rv))) {
|
|
||||||
if (!rec->IsAddrRecord()) {
|
if (!rec->IsAddrRecord()) {
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
@ -81,12 +81,6 @@ class nsHostRecord : public mozilla::LinkedListElement<RefPtr<nsHostRecord>>,
|
|||||||
return 0;
|
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:
|
protected:
|
||||||
friend class nsHostResolver;
|
friend class nsHostResolver;
|
||||||
|
|
||||||
@ -557,6 +551,7 @@ class nsHostResolver : public nsISupports, public AHostResolver {
|
|||||||
PRTime mCreationTime;
|
PRTime mCreationTime;
|
||||||
mozilla::TimeDuration mLongIdleTimeout;
|
mozilla::TimeDuration mLongIdleTimeout;
|
||||||
mozilla::TimeDuration mShortIdleTimeout;
|
mozilla::TimeDuration mShortIdleTimeout;
|
||||||
|
bool mSkipTRRWhenParentalControlEnabled;
|
||||||
|
|
||||||
RefPtr<nsIThreadPool> mResolverThreads;
|
RefPtr<nsIThreadPool> mResolverThreads;
|
||||||
RefPtr<mozilla::net::NetworkConnectivityService> mNCS;
|
RefPtr<mozilla::net::NetworkConnectivityService> mNCS;
|
||||||
|
@ -3,7 +3,6 @@
|
|||||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
#include "nsISupports.idl"
|
#include "nsISupports.idl"
|
||||||
#include "nsIRequest.idl"
|
|
||||||
|
|
||||||
%{ C++
|
%{ C++
|
||||||
#include "mozilla/BasePrincipal.h"
|
#include "mozilla/BasePrincipal.h"
|
||||||
@ -295,22 +294,6 @@ interface nsIDNSService : nsISupports
|
|||||||
*/
|
*/
|
||||||
const unsigned long RESOLVE_REFRESH_CACHE = (1 << 10);
|
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.
|
* This ure dns request types that are currently supported.
|
||||||
* RESOLVE_TYPE_DEFAULT is standard A/AAAA lookup
|
* RESOLVE_TYPE_DEFAULT is standard A/AAAA lookup
|
||||||
|
@ -637,14 +637,14 @@ mozilla::ipc::IPCResult NeckoParent::RecvSpeculativeConnect(
|
|||||||
|
|
||||||
mozilla::ipc::IPCResult NeckoParent::RecvHTMLDNSPrefetch(
|
mozilla::ipc::IPCResult NeckoParent::RecvHTMLDNSPrefetch(
|
||||||
const nsString& hostname, const bool& isHttps,
|
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);
|
nsHTMLDNSPrefetch::Prefetch(hostname, isHttps, aOriginAttributes, flags);
|
||||||
return IPC_OK();
|
return IPC_OK();
|
||||||
}
|
}
|
||||||
|
|
||||||
mozilla::ipc::IPCResult NeckoParent::RecvCancelHTMLDNSPrefetch(
|
mozilla::ipc::IPCResult NeckoParent::RecvCancelHTMLDNSPrefetch(
|
||||||
const nsString& hostname, const bool& isHttps,
|
const nsString& hostname, const bool& isHttps,
|
||||||
const OriginAttributes& aOriginAttributes, const uint32_t& flags,
|
const OriginAttributes& aOriginAttributes, const uint16_t& flags,
|
||||||
const nsresult& reason) {
|
const nsresult& reason) {
|
||||||
nsHTMLDNSPrefetch::CancelPrefetch(hostname, isHttps, aOriginAttributes, flags,
|
nsHTMLDNSPrefetch::CancelPrefetch(hostname, isHttps, aOriginAttributes, flags,
|
||||||
reason);
|
reason);
|
||||||
|
@ -163,10 +163,10 @@ class NeckoParent : public PNeckoParent {
|
|||||||
const bool& aAnonymous);
|
const bool& aAnonymous);
|
||||||
mozilla::ipc::IPCResult RecvHTMLDNSPrefetch(
|
mozilla::ipc::IPCResult RecvHTMLDNSPrefetch(
|
||||||
const nsString& hostname, const bool& isHttps,
|
const nsString& hostname, const bool& isHttps,
|
||||||
const OriginAttributes& aOriginAttributes, const uint32_t& flags);
|
const OriginAttributes& aOriginAttributes, const uint16_t& flags);
|
||||||
mozilla::ipc::IPCResult RecvCancelHTMLDNSPrefetch(
|
mozilla::ipc::IPCResult RecvCancelHTMLDNSPrefetch(
|
||||||
const nsString& hostname, const bool& isHttps,
|
const nsString& hostname, const bool& isHttps,
|
||||||
const OriginAttributes& aOriginAttributes, const uint32_t& flags,
|
const OriginAttributes& aOriginAttributes, const uint16_t& flags,
|
||||||
const nsresult& reason);
|
const nsresult& reason);
|
||||||
PWebSocketEventListenerParent* AllocPWebSocketEventListenerParent(
|
PWebSocketEventListenerParent* AllocPWebSocketEventListenerParent(
|
||||||
const uint64_t& aInnerWindowID);
|
const uint64_t& aInnerWindowID);
|
||||||
|
@ -104,10 +104,10 @@ parent:
|
|||||||
|
|
||||||
async SpeculativeConnect(URIParams uri, nsIPrincipal principal, bool anonymous);
|
async SpeculativeConnect(URIParams uri, nsIPrincipal principal, bool anonymous);
|
||||||
async HTMLDNSPrefetch(nsString hostname, bool isHttps,
|
async HTMLDNSPrefetch(nsString hostname, bool isHttps,
|
||||||
OriginAttributes originAttributes, uint32_t flags);
|
OriginAttributes originAttributes, uint16_t flags);
|
||||||
async CancelHTMLDNSPrefetch(nsString hostname, bool isHttps,
|
async CancelHTMLDNSPrefetch(nsString hostname, bool isHttps,
|
||||||
OriginAttributes originAttributes,
|
OriginAttributes originAttributes,
|
||||||
uint32_t flags, nsresult reason);
|
uint16_t flags, nsresult reason);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* channelId is used to establish a connection between redirect channels in
|
* channelId is used to establish a connection between redirect channels in
|
||||||
|
@ -296,16 +296,6 @@ ClassifierDummyChannel::GetLoadFlags(nsLoadFlags* aLoadFlags) {
|
|||||||
return NS_ERROR_NOT_IMPLEMENTED;
|
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
|
NS_IMETHODIMP
|
||||||
ClassifierDummyChannel::SetLoadFlags(nsLoadFlags aLoadFlags) {
|
ClassifierDummyChannel::SetLoadFlags(nsLoadFlags aLoadFlags) {
|
||||||
return NS_ERROR_NOT_IMPLEMENTED;
|
return NS_ERROR_NOT_IMPLEMENTED;
|
||||||
|
@ -484,16 +484,6 @@ HttpBaseChannel::SetLoadFlags(nsLoadFlags aLoadFlags) {
|
|||||||
return NS_OK;
|
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
|
NS_IMETHODIMP
|
||||||
HttpBaseChannel::SetDocshellUserAgentOverride() {
|
HttpBaseChannel::SetDocshellUserAgentOverride() {
|
||||||
// This sets the docshell specific user agent override
|
// This sets the docshell specific user agent override
|
||||||
|
@ -141,8 +141,6 @@ class HttpBaseChannel : public nsHashPropertyBag,
|
|||||||
NS_IMETHOD SetLoadGroup(nsILoadGroup* aLoadGroup) override;
|
NS_IMETHOD SetLoadGroup(nsILoadGroup* aLoadGroup) override;
|
||||||
NS_IMETHOD GetLoadFlags(nsLoadFlags* aLoadFlags) override;
|
NS_IMETHOD GetLoadFlags(nsLoadFlags* aLoadFlags) override;
|
||||||
NS_IMETHOD SetLoadFlags(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();
|
NS_IMETHOD SetDocshellUserAgentOverride();
|
||||||
|
|
||||||
// nsIChannel
|
// nsIChannel
|
||||||
|
@ -449,16 +449,6 @@ NullHttpChannel::GetLoadFlags(nsLoadFlags* aLoadFlags) {
|
|||||||
return NS_ERROR_NOT_IMPLEMENTED;
|
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
|
NS_IMETHODIMP
|
||||||
NullHttpChannel::SetLoadFlags(nsLoadFlags aLoadFlags) {
|
NullHttpChannel::SetLoadFlags(nsLoadFlags aLoadFlags) {
|
||||||
return NS_ERROR_NOT_IMPLEMENTED;
|
return NS_ERROR_NOT_IMPLEMENTED;
|
||||||
|
@ -111,6 +111,10 @@ const char kHttp3VersionHEX[] = "ff00000017"; // this is draft 23.
|
|||||||
// on ERROR_NET_RESET.
|
// on ERROR_NET_RESET.
|
||||||
#define NS_HTTP_CONNECTION_RESTARTABLE (1 << 13)
|
#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.
|
// 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
|
// This is primarily used to allow connection sharing for websockets over http/2
|
||||||
// without accidentally allowing it for websockets not 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
|
// The connection should not use IPv6
|
||||||
#define NS_HTTP_DISABLE_IPV6 (1 << 18)
|
#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
|
// some default values
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
@ -620,10 +620,12 @@ nsresult nsHttpChannel::ContinueOnBeforeConnect(bool aShouldUpgrade,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (mIsTRRServiceChannel) {
|
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
|
// Finalize ConnectionInfo flags before SpeculativeConnect
|
||||||
mConnectionInfo->SetAnonymous((mLoadFlags & LOAD_ANONYMOUS) != 0);
|
mConnectionInfo->SetAnonymous((mLoadFlags & LOAD_ANONYMOUS) != 0);
|
||||||
@ -634,7 +636,7 @@ nsresult nsHttpChannel::ContinueOnBeforeConnect(bool aShouldUpgrade,
|
|||||||
mBeConservative);
|
mBeConservative);
|
||||||
mConnectionInfo->SetTlsFlags(mTlsFlags);
|
mConnectionInfo->SetTlsFlags(mTlsFlags);
|
||||||
mConnectionInfo->SetIsTrrServiceChannel(mIsTRRServiceChannel);
|
mConnectionInfo->SetIsTrrServiceChannel(mIsTRRServiceChannel);
|
||||||
mConnectionInfo->SetTRRMode(nsIRequest::GetTRRMode());
|
mConnectionInfo->SetTrrDisabled(mCaps & NS_HTTP_DISABLE_TRR);
|
||||||
mConnectionInfo->SetIPv4Disabled(mCaps & NS_HTTP_DISABLE_IPV4);
|
mConnectionInfo->SetIPv4Disabled(mCaps & NS_HTTP_DISABLE_IPV4);
|
||||||
mConnectionInfo->SetIPv6Disabled(mCaps & NS_HTTP_DISABLE_IPV6);
|
mConnectionInfo->SetIPv6Disabled(mCaps & NS_HTTP_DISABLE_IPV6);
|
||||||
|
|
||||||
@ -907,7 +909,7 @@ void nsHttpChannel::SpeculativeConnect() {
|
|||||||
|
|
||||||
Unused << gHttpHandler->SpeculativeConnect(
|
Unused << gHttpHandler->SpeculativeConnect(
|
||||||
mConnectionInfo, callbacks,
|
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));
|
NS_HTTP_DISABLE_IPV4 | NS_HTTP_DISABLE_IPV6));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -6839,8 +6841,8 @@ void nsHttpChannel::MaybeStartDNSPrefetch() {
|
|||||||
mCaps & NS_HTTP_REFRESH_DNS ? ", refresh requested" : ""));
|
mCaps & NS_HTTP_REFRESH_DNS ? ", refresh requested" : ""));
|
||||||
OriginAttributes originAttributes;
|
OriginAttributes originAttributes;
|
||||||
NS_GetOriginAttributes(this, originAttributes);
|
NS_GetOriginAttributes(this, originAttributes);
|
||||||
mDNSPrefetch = new nsDNSPrefetch(
|
mDNSPrefetch =
|
||||||
mURI, originAttributes, nsIRequest::GetTRRMode(), this, mTimingEnabled);
|
new nsDNSPrefetch(mURI, originAttributes, this, mTimingEnabled);
|
||||||
mDNSPrefetch->PrefetchHigh(mCaps & NS_HTTP_REFRESH_DNS);
|
mDNSPrefetch->PrefetchHigh(mCaps & NS_HTTP_REFRESH_DNS);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -106,7 +106,7 @@ void nsHttpConnectionInfo::Init(const nsACString& host, int32_t port,
|
|||||||
mOriginAttributes = originAttributes;
|
mOriginAttributes = originAttributes;
|
||||||
mTlsFlags = 0x0;
|
mTlsFlags = 0x0;
|
||||||
mIsTrrServiceChannel = false;
|
mIsTrrServiceChannel = false;
|
||||||
mTRRMode = nsIRequest::TRR_DEFAULT_MODE;
|
mTrrDisabled = false;
|
||||||
mIPv4Disabled = false;
|
mIPv4Disabled = false;
|
||||||
mIPv6Disabled = false;
|
mIPv6Disabled = false;
|
||||||
|
|
||||||
@ -234,13 +234,11 @@ void nsHttpConnectionInfo::BuildHashKey() {
|
|||||||
mHashKey.AppendLiteral("}");
|
mHashKey.AppendLiteral("}");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (GetTRRMode() != nsIRequest::TRR_DEFAULT_MODE) {
|
if (GetTrrDisabled()) {
|
||||||
// When connecting with another TRR mode, we enforce a separate connection
|
// When connecting with TRR disabled, we enforce a separate connection
|
||||||
// hashkey so that we also can trigger a fresh DNS resolver that then
|
// hashkey so that we also can trigger a fresh DNS resolver that then
|
||||||
// doesn't use TRR as the previous connection might have.
|
// doesn't use TRR as the previous connection might have.
|
||||||
mHashKey.AppendLiteral("[TRR:");
|
mHashKey.AppendLiteral("[NOTRR]");
|
||||||
mHashKey.AppendInt(GetTRRMode());
|
|
||||||
mHashKey.AppendLiteral("]");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (GetIPv4Disabled()) {
|
if (GetIPv4Disabled()) {
|
||||||
@ -327,7 +325,7 @@ already_AddRefed<nsHttpConnectionInfo> nsHttpConnectionInfo::Clone() const {
|
|||||||
clone->SetBeConservative(GetBeConservative());
|
clone->SetBeConservative(GetBeConservative());
|
||||||
clone->SetTlsFlags(GetTlsFlags());
|
clone->SetTlsFlags(GetTlsFlags());
|
||||||
clone->SetIsTrrServiceChannel(GetIsTrrServiceChannel());
|
clone->SetIsTrrServiceChannel(GetIsTrrServiceChannel());
|
||||||
clone->SetTRRMode(GetTRRMode());
|
clone->SetTrrDisabled(GetTrrDisabled());
|
||||||
clone->SetIPv4Disabled(GetIPv4Disabled());
|
clone->SetIPv4Disabled(GetIPv4Disabled());
|
||||||
clone->SetIPv6Disabled(GetIPv6Disabled());
|
clone->SetIPv6Disabled(GetIPv6Disabled());
|
||||||
MOZ_ASSERT(clone->Equals(this));
|
MOZ_ASSERT(clone->Equals(this));
|
||||||
@ -353,7 +351,7 @@ void nsHttpConnectionInfo::CloneAsDirectRoute(nsHttpConnectionInfo** outCI) {
|
|||||||
clone->SetBeConservative(GetBeConservative());
|
clone->SetBeConservative(GetBeConservative());
|
||||||
clone->SetTlsFlags(GetTlsFlags());
|
clone->SetTlsFlags(GetTlsFlags());
|
||||||
clone->SetIsTrrServiceChannel(GetIsTrrServiceChannel());
|
clone->SetIsTrrServiceChannel(GetIsTrrServiceChannel());
|
||||||
clone->SetTRRMode(GetTRRMode());
|
clone->SetTrrDisabled(GetTrrDisabled());
|
||||||
clone->SetIPv4Disabled(GetIPv4Disabled());
|
clone->SetIPv4Disabled(GetIPv4Disabled());
|
||||||
clone->SetIPv6Disabled(GetIPv6Disabled());
|
clone->SetIPv6Disabled(GetIPv6Disabled());
|
||||||
|
|
||||||
@ -380,9 +378,9 @@ nsresult nsHttpConnectionInfo::CreateWildCard(nsHttpConnectionInfo** outParam) {
|
|||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
void nsHttpConnectionInfo::SetTRRMode(nsIRequest::TRRMode aTRRMode) {
|
void nsHttpConnectionInfo::SetTrrDisabled(bool aNoTrr) {
|
||||||
if (mTRRMode != aTRRMode) {
|
if (mTrrDisabled != aNoTrr) {
|
||||||
mTRRMode = aTRRMode;
|
mTrrDisabled = aNoTrr;
|
||||||
RebuildHashKey();
|
RebuildHashKey();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -149,8 +149,10 @@ class nsHttpConnectionInfo final : public ARefBase {
|
|||||||
}
|
}
|
||||||
bool GetIsTrrServiceChannel() const { return mIsTrrServiceChannel; }
|
bool GetIsTrrServiceChannel() const { return mIsTrrServiceChannel; }
|
||||||
|
|
||||||
void SetTRRMode(nsIRequest::TRRMode aTRRMode);
|
// SetTrrDisabled means don't use TRR to resolve host names for this
|
||||||
nsIRequest::TRRMode GetTRRMode() const { return mTRRMode; }
|
// connection
|
||||||
|
void SetTrrDisabled(bool aNoTrr);
|
||||||
|
bool GetTrrDisabled() const { return mTrrDisabled; }
|
||||||
|
|
||||||
void SetIPv4Disabled(bool aNoIPv4);
|
void SetIPv4Disabled(bool aNoIPv4);
|
||||||
bool GetIPv4Disabled() const { return mIPv4Disabled; }
|
bool GetIPv4Disabled() const { return mIPv4Disabled; }
|
||||||
@ -231,11 +233,11 @@ class nsHttpConnectionInfo final : public ARefBase {
|
|||||||
bool mUsingConnect; // if will use CONNECT with http proxy
|
bool mUsingConnect; // if will use CONNECT with http proxy
|
||||||
nsCString mNPNToken;
|
nsCString mNPNToken;
|
||||||
OriginAttributes mOriginAttributes;
|
OriginAttributes mOriginAttributes;
|
||||||
nsIRequest::TRRMode mTRRMode;
|
|
||||||
|
|
||||||
uint32_t mTlsFlags;
|
uint32_t mTlsFlags;
|
||||||
uint16_t mIsolated : 1;
|
uint16_t mIsolated : 1;
|
||||||
uint16_t mIsTrrServiceChannel : 1;
|
uint16_t mIsTrrServiceChannel : 1;
|
||||||
|
uint16_t mTrrDisabled : 1;
|
||||||
uint16_t mIPv4Disabled : 1;
|
uint16_t mIPv4Disabled : 1;
|
||||||
uint16_t mIPv6Disabled : 1;
|
uint16_t mIPv6Disabled : 1;
|
||||||
|
|
||||||
|
@ -4099,8 +4099,9 @@ nsresult nsHttpConnectionMgr::nsHalfOpenSocket::SetupStreams(
|
|||||||
uint32_t tmpFlags = 0;
|
uint32_t tmpFlags = 0;
|
||||||
if (mCaps & NS_HTTP_REFRESH_DNS) tmpFlags = nsISocketTransport::BYPASS_CACHE;
|
if (mCaps & NS_HTTP_REFRESH_DNS) tmpFlags = nsISocketTransport::BYPASS_CACHE;
|
||||||
|
|
||||||
tmpFlags |= nsISocketTransport::GetFlagsFromTRRMode(
|
if (mCaps & NS_HTTP_DISABLE_TRR) {
|
||||||
NS_HTTP_TRR_MODE_FROM_FLAGS(mCaps));
|
tmpFlags = nsISocketTransport::DISABLE_TRR;
|
||||||
|
}
|
||||||
|
|
||||||
if (mCaps & NS_HTTP_LOAD_ANONYMOUS)
|
if (mCaps & NS_HTTP_LOAD_ANONYMOUS)
|
||||||
tmpFlags |= nsISocketTransport::ANONYMOUS_CONNECT;
|
tmpFlags |= nsISocketTransport::ANONYMOUS_CONNECT;
|
||||||
|
@ -377,16 +377,6 @@ nsViewSourceChannel::SetLoadFlags(uint32_t aLoadFlags) {
|
|||||||
return NS_OK;
|
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
|
NS_IMETHODIMP
|
||||||
nsViewSourceChannel::GetContentType(nsACString& aContentType) {
|
nsViewSourceChannel::GetContentType(nsACString& aContentType) {
|
||||||
NS_ENSURE_TRUE(mChannel, NS_ERROR_FAILURE);
|
NS_ENSURE_TRUE(mChannel, NS_ERROR_FAILURE);
|
||||||
|
@ -198,16 +198,6 @@ nsPartChannel::SetLoadFlags(nsLoadFlags aLoadFlags) {
|
|||||||
return NS_OK;
|
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
|
NS_IMETHODIMP
|
||||||
nsPartChannel::GetIsDocument(bool* aIsDocument) {
|
nsPartChannel::GetIsDocument(bool* aIsDocument) {
|
||||||
return NS_GetIsDocumentChannel(this, aIsDocument);
|
return NS_GetIsDocumentChannel(this, aIsDocument);
|
||||||
|
@ -1,8 +1,6 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
const { NodeServer, HttpServer } = ChromeUtils.import(
|
const { NodeServer } = ChromeUtils.import("resource://testing-common/httpd.js");
|
||||||
"resource://testing-common/httpd.js"
|
|
||||||
);
|
|
||||||
const dns = Cc["@mozilla.org/network/dns-service;1"].getService(
|
const dns = Cc["@mozilla.org/network/dns-service;1"].getService(
|
||||||
Ci.nsIDNSService
|
Ci.nsIDNSService
|
||||||
);
|
);
|
||||||
@ -101,15 +99,6 @@ registerCleanupFunction(() => {
|
|||||||
Services.prefs.clearUserPref("network.dns.native-is-localhost");
|
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 {
|
class DNSListener {
|
||||||
constructor(name, expectedAnswer, expectedSuccess = true) {
|
constructor(name, expectedAnswer, expectedSuccess = true) {
|
||||||
this.name = name;
|
this.name = name;
|
||||||
@ -155,139 +144,26 @@ class DNSListener {
|
|||||||
return this.promise.then.apply(this.promise, arguments);
|
return this.promise.then.apply(this.promise, arguments);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Cu.importGlobalProperties(["fetch"]);
|
||||||
|
|
||||||
add_task(async function test0_nodeExecute() {
|
add_task(async function test0_nodeExecute() {
|
||||||
// This test checks that moz-http2.js running in node is working.
|
// 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)
|
// 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.
|
// otherwise we may encounter random failures when the http2 server is down.
|
||||||
equal(
|
|
||||||
await NodeServer.execute(`"hello"`),
|
let env = Cc["@mozilla.org/process/environment;1"].getService(
|
||||||
"hello",
|
Ci.nsIEnvironment
|
||||||
"Check that moz-http2.js is running"
|
|
||||||
);
|
);
|
||||||
});
|
let execPort = env.get("MOZNODE_EXEC_PORT");
|
||||||
|
await fetch(`http://127.0.0.1:${execPort}/test`)
|
||||||
function makeChan(url, mode) {
|
.then(response => {
|
||||||
let chan = NetUtil.newChannel({
|
ok(true, "NodeServer is working");
|
||||||
uri: url,
|
})
|
||||||
loadUsingSystemPrincipal: true,
|
.catch(e => {
|
||||||
}).QueryInterface(Ci.nsIHttpChannel);
|
ok(false, `There was an error ${e}`);
|
||||||
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);
|
|
||||||
});
|
});
|
||||||
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
|
// verify basic A record
|
||||||
add_task(async function test1() {
|
add_task(async function test1() {
|
||||||
@ -874,61 +750,15 @@ add_task(async function test24e() {
|
|||||||
await new DNSListener("bar.example.com", "127.0.0.1");
|
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
|
// TRR-first check that captivedetect.canonicalURL is resolved via native DNS
|
||||||
add_task(async function test24f() {
|
add_task(async function test24f() {
|
||||||
dns.clearCache(true);
|
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(
|
Services.prefs.setCharPref(
|
||||||
"captivedetect.canonicalURL",
|
"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
|
await new DNSListener("test.detectportal.com", "127.0.0.1");
|
||||||
// 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));
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// TRR-first check that a domain is resolved via native DNS when parental control is enabled.
|
// 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() {
|
add_task(async function test25e() {
|
||||||
dns.clearCache(true);
|
dns.clearCache(true);
|
||||||
Services.prefs.setIntPref("network.trr.mode", 3); // TRR-only
|
Services.prefs.setIntPref("network.trr.mode", 3); // TRR-only
|
||||||
|
Services.prefs.setCharPref(
|
||||||
|
"captivedetect.canonicalURL",
|
||||||
|
"http://test.detectportal.com/success.txt"
|
||||||
|
);
|
||||||
Services.prefs.setCharPref(
|
Services.prefs.setCharPref(
|
||||||
"network.trr.uri",
|
"network.trr.uri",
|
||||||
`https://foo.example.com:${h2Port}/doh?responseIP=192.192.192.192`
|
`https://foo.example.com:${h2Port}/doh?responseIP=192.192.192.192`
|
||||||
);
|
);
|
||||||
|
|
||||||
const cpServer = new HttpServer();
|
await new DNSListener("test.detectportal.com", "127.0.0.1");
|
||||||
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));
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// TRR-only check that a domain is resolved via native DNS when parental control is enabled.
|
// 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() {
|
add_task(async function test_connection_closed_no_bootstrap_no_excluded() {
|
||||||
// This test makes sure that even in mode 3 without a bootstrap address
|
// This test exists to document what happens when we're in TRR only mode
|
||||||
// we are able to restart the TRR connection if it drops - the TRR service
|
// and we don't set a bootstrap address. We use DNS to resolve the
|
||||||
// channel will use regular DNS to resolve the TRR address.
|
// initial URI, but if the connection fails, we don't fallback to DNS
|
||||||
dns.clearCache(true);
|
dns.clearCache(true);
|
||||||
Services.prefs.setIntPref("network.trr.mode", 3); // TRR-only
|
Services.prefs.setIntPref("network.trr.mode", 3); // TRR-only
|
||||||
Services.prefs.setCharPref("network.trr.excluded-domains", "");
|
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),
|
!Components.isSuccessCode(inStatus),
|
||||||
`${inStatus} should be an error code`
|
`${inStatus} should be an error code`
|
||||||
);
|
);
|
||||||
dns.clearCache(true);
|
[, , inStatus] = await new DNSListener("bar2.example.com", undefined, false);
|
||||||
await new DNSListener("bar2.example.com", "3.3.3.3");
|
Assert.ok(
|
||||||
|
!Components.isSuccessCode(inStatus),
|
||||||
|
`${inStatus} should be an error code`
|
||||||
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
add_task(async function test_connection_closed_trr_first() {
|
add_task(async function test_connection_closed_trr_first() {
|
||||||
|
@ -720,20 +720,6 @@ impl BitsRequest {
|
|||||||
fn set_load_flags(&self, _load_flags: nsLoadFlags) -> Result<(), nsresult> {
|
fn set_load_flags(&self, _load_flags: nsLoadFlags) -> Result<(), nsresult> {
|
||||||
Err(NS_ERROR_NOT_IMPLEMENTED)
|
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 {
|
impl Drop for BitsRequest {
|
||||||
|
@ -34,7 +34,7 @@ function URLFetcher(url, timeout) {
|
|||||||
// Prevent privacy leaks
|
// Prevent privacy leaks
|
||||||
xhr.channel.loadFlags |= Ci.nsIRequest.LOAD_ANONYMOUS;
|
xhr.channel.loadFlags |= Ci.nsIRequest.LOAD_ANONYMOUS;
|
||||||
// Use the system's resolver for this check
|
// 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
|
// We except this from being classified
|
||||||
xhr.channel.loadFlags |= Ci.nsIChannel.LOAD_BYPASS_URL_CLASSIFIER;
|
xhr.channel.loadFlags |= Ci.nsIChannel.LOAD_BYPASS_URL_CLASSIFIER;
|
||||||
|
|
||||||
|
@ -447,16 +447,6 @@ StreamFilterParent::SetLoadFlags(nsLoadFlags aLoadFlags) {
|
|||||||
return mChannel->SetLoadFlags(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
|
* nsIStreamListener
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
|
@ -293,16 +293,6 @@ ExternalHelperAppParent::SetLoadFlags(nsLoadFlags aLoadFlags) {
|
|||||||
return NS_OK;
|
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
|
NS_IMETHODIMP
|
||||||
ExternalHelperAppParent::GetIsDocument(bool* aIsDocument) {
|
ExternalHelperAppParent::GetIsDocument(bool* aIsDocument) {
|
||||||
return NS_GetIsDocumentChannel(this, aIsDocument);
|
return NS_GetIsDocumentChannel(this, aIsDocument);
|
||||||
|
@ -238,14 +238,6 @@ NS_IMETHODIMP nsExtProtocolChannel::SetLoadFlags(nsLoadFlags aLoadFlags) {
|
|||||||
return NS_OK;
|
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) {
|
NS_IMETHODIMP nsExtProtocolChannel::GetIsDocument(bool* aIsDocument) {
|
||||||
return NS_GetIsDocumentChannel(this, aIsDocument);
|
return NS_GetIsDocumentChannel(this, aIsDocument);
|
||||||
}
|
}
|
||||||
|
@ -943,7 +943,7 @@ class CEnum(object):
|
|||||||
return "%s::%s " % (self.iface.name, self.basename)
|
return "%s::%s " % (self.iface.name, self.basename)
|
||||||
|
|
||||||
def rustType(self, calltype):
|
def rustType(self, calltype):
|
||||||
return "%s u%d" % ('*mut' if 'out' in calltype else '', self.width)
|
raise RustNoncompat('cenums unimplemented')
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
body = ', '.join('%s = %s' % v for v in self.variants)
|
body = ', '.join('%s = %s' % v for v in self.variants)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user