--- a/dom/webidl/XMLHttpRequest.webidl
+++ b/dom/webidl/XMLHttpRequest.webidl
@@ -121,21 +121,16 @@ interface XMLHttpRequest : XMLHttpReques
// Mozilla-specific stuff
[ChromeOnly, SetterThrows]
attribute boolean mozBackgroundRequest;
[ChromeOnly, Exposed=Window]
readonly attribute MozChannel? channel;
- // A platform-specific identifer to represent the network interface
- // which the HTTP request would occur on.
- [ChromeOnly, Exposed=Window]
- attribute ByteString? networkInterfaceId;
-
[Throws, ChromeOnly, Exposed=Window]
any getInterface(IID iid);
[ChromeOnly, Exposed=Window]
void setOriginAttributes(optional OriginAttributesDictionary originAttributes);
[ChromeOnly, Throws]
void sendInputStream(InputStream body);
--- a/dom/xhr/XMLHttpRequest.h
+++ b/dom/xhr/XMLHttpRequest.h
@@ -127,22 +127,16 @@ public:
MozBackgroundRequest() const = 0;
virtual void
SetMozBackgroundRequest(bool aMozBackgroundRequest, ErrorResult& aRv) = 0;
virtual nsIChannel*
GetChannel() const = 0;
- virtual void
- GetNetworkInterfaceId(nsACString& aId) const = 0;
-
- virtual void
- SetNetworkInterfaceId(const nsACString& aId) = 0;
-
// We need a GetInterface callable from JS for chrome JS
virtual void
GetInterface(JSContext* aCx, nsIJSID* aIID,
JS::MutableHandle<JS::Value> aRetval,
ErrorResult& aRv) = 0;
virtual void
SetOriginAttributes(const mozilla::dom::OriginAttributesDictionary& aAttrs) = 0;
--- a/dom/xhr/XMLHttpRequestMainThread.cpp
+++ b/dom/xhr/XMLHttpRequestMainThread.cpp
@@ -1534,30 +1534,16 @@ XMLHttpRequestMainThread::SetOriginAttri
nsCOMPtr<nsILoadInfo> loadInfo = mChannel->GetLoadInfo();
MOZ_ASSERT(loadInfo);
if (loadInfo) {
loadInfo->SetOriginAttributes(attrs);
}
}
-void
-XMLHttpRequestMainThread::PopulateNetworkInterfaceId()
-{
- if (mNetworkInterfaceId.IsEmpty()) {
- return;
- }
- nsCOMPtr<nsIHttpChannelInternal> channel(do_QueryInterface(mChannel));
- if (!channel) {
- return;
- }
- DebugOnly<nsresult> rv = channel->SetNetworkInterfaceId(mNetworkInterfaceId);
- MOZ_ASSERT(NS_SUCCEEDED(rv));
-}
-
/*
* "Copy" from a stream.
*/
nsresult
XMLHttpRequestMainThread::StreamReaderFunc(nsIInputStream* in,
void* closure,
const char* fromRawSegment,
uint32_t toOffset,
@@ -2784,18 +2770,16 @@ XMLHttpRequestMainThread::SendInternal(c
// If open() failed to create the channel, then throw a network error
// as per spec. We really should create the channel here in send(), but
// we have internal code relying on the channel being created in open().
if (!mChannel) {
mFlagSend = true; // so CloseRequestWithError sets us to DONE.
return MaybeSilentSendFailure(NS_ERROR_DOM_NETWORK_ERR);
}
- PopulateNetworkInterfaceId();
-
// XXX We should probably send a warning to the JS console
// if there are no event listeners set and we are doing
// an asynchronous call.
mUploadTransferred = 0;
mUploadTotal = 0;
// By default we don't have any upload, so mark upload complete.
mUploadComplete = true;
--- a/dom/xhr/XMLHttpRequestMainThread.h
+++ b/dom/xhr/XMLHttpRequestMainThread.h
@@ -301,21 +301,16 @@ private:
virtual ~XMLHttpRequestMainThread();
nsresult MaybeSilentSendFailure(nsresult aRv);
nsresult SendInternal(const BodyExtractorBase* aBody);
bool IsCrossSiteCORSRequest() const;
bool IsDeniedCrossSiteCORSRequest();
- // Tell our channel what network interface ID we were told to use.
- // If it's an HTTP channel and we were told to use a non-default
- // interface ID.
- void PopulateNetworkInterfaceId();
-
void UnsuppressEventHandlingAndResume();
// Check pref "dom.mapped_arraybuffer.enabled" to make sure ArrayBuffer is
// supported.
static bool IsMappedArrayBufferEnabled();
// Check pref "dom.xhr.lowercase_header.enabled" to make sure lowercased
// response header is supported.
@@ -437,28 +432,16 @@ public:
MozSystem() const override;
virtual nsIChannel*
GetChannel() const override
{
return mChannel;
}
- virtual void
- GetNetworkInterfaceId(nsACString& aId) const override
- {
- aId = mNetworkInterfaceId;
- }
-
- virtual void
- SetNetworkInterfaceId(const nsACString& aId) override
- {
- mNetworkInterfaceId = aId;
- }
-
// We need a GetInterface callable from JS for chrome JS
virtual void
GetInterface(JSContext* aCx, nsIJSID* aIID,
JS::MutableHandle<JS::Value> aRetval,
ErrorResult& aRv) override;
// This fires a trusted readystatechange event, which is not cancelable and
// doesn't bubble.
@@ -736,20 +719,16 @@ protected:
// Ordering of OnProgress and OnDataAvailable is undefined.
int64_t mLoadTransferred;
nsCOMPtr<nsITimer> mProgressNotifier;
void HandleProgressTimerCallback();
bool mIsSystem;
bool mIsAnon;
- // A platform-specific identifer to represent the network interface
- // that this request is associated with.
- nsCString mNetworkInterfaceId;
-
/**
* Close the XMLHttpRequest's channels.
*/
void CloseRequest();
void TerminateOngoingFetch();
/**
--- a/dom/xhr/XMLHttpRequestWorker.h
+++ b/dom/xhr/XMLHttpRequestWorker.h
@@ -143,28 +143,16 @@ public:
SetMozBackgroundRequest(bool aBackgroundRequest, ErrorResult& aRv) override;
virtual nsIChannel*
GetChannel() const override
{
MOZ_CRASH("This method cannot be called on workers.");
}
- virtual void
- GetNetworkInterfaceId(nsACString& aId) const override
- {
- MOZ_CRASH("This method cannot be called on workers.");
- }
-
- virtual void
- SetNetworkInterfaceId(const nsACString& aId) override
- {
- MOZ_CRASH("This method cannot be called on workers.");
- }
-
virtual XMLHttpRequestUpload*
GetUpload(ErrorResult& aRv) override;
virtual void
Send(JSContext* aCx,
const Nullable<DocumentOrBlobOrArrayBufferViewOrArrayBufferOrFormDataOrURLSearchParamsOrUSVString>& aData,
ErrorResult& aRv) override;
--- a/netwerk/base/nsISocketTransport.idl
+++ b/netwerk/base/nsISocketTransport.idl
@@ -61,23 +61,16 @@ interface nsISocketTransport : nsITransp
[noscript, nostdcall, binaryname(GetOriginAttributes)]
OriginAttributes binaryGetOriginAttributes();
[noscript, nostdcall, binaryname(SetOriginAttributes)]
void binarySetOriginAttributes(in const_OriginAttributesRef aOriginAttrs);
/**
- * The platform-specific network interface id that this socket
- * associated with. Note that this attribute can be only accessed
- * in the socket thread.
- */
- attribute ACString networkInterfaceId;
-
- /**
* Returns the IP address of the socket connection peer. This
* attribute is defined only once a connection has been established.
*/
[noscript] NetAddr getPeerAddr();
/**
* Returns the IP address of the initiating end. This attribute
* is defined only once a connection has been established.
--- a/netwerk/base/nsNetUtil.h
+++ b/netwerk/base/nsNetUtil.h
@@ -34,17 +34,16 @@ class nsIChannelPolicy;
class nsIDownloadObserver;
class nsIEventTarget;
class nsIFileProtocolHandler;
class nsIFileStream;
class nsIInputStream;
class nsIInputStreamPump;
class nsIInterfaceRequestor;
class nsINestedURI;
-class nsINetworkInterface;
class nsIOutputStream;
class nsIParentChannel;
class nsIPersistentProperties;
class nsIProxyInfo;
class nsIRequestObserver;
class nsIStreamListener;
class nsIStreamLoader;
class nsIStreamLoaderObserver;
--- a/netwerk/base/nsSocketTransport2.cpp
+++ b/netwerk/base/nsSocketTransport2.cpp
@@ -1111,19 +1111,19 @@ nsSocketTransport::ResolveHost()
"Setting both RESOLVE_DISABLE_IPV6 and RESOLVE_DISABLE_IPV4");
SendStatus(NS_NET_STATUS_RESOLVING_HOST);
if (!SocketHost().Equals(mOriginHost)) {
SOCKET_LOG(("nsSocketTransport %p origin %s doing dns for %s\n",
this, mOriginHost.get(), SocketHost().get()));
}
- rv = dns->AsyncResolveExtendedNative(SocketHost(), dnsFlags, mNetworkInterfaceId,
- this, nullptr, mOriginAttributes,
- getter_AddRefs(mDNSRequest));
+ rv = dns->AsyncResolveNative(SocketHost(), dnsFlags,
+ this, nullptr, mOriginAttributes,
+ getter_AddRefs(mDNSRequest));
if (NS_SUCCEEDED(rv)) {
SOCKET_LOG((" advancing to STATE_RESOLVING\n"));
mState = STATE_RESOLVING;
}
return rv;
}
nsresult
@@ -2670,32 +2670,16 @@ nsSocketTransport::GetHost(nsACString &h
NS_IMETHODIMP
nsSocketTransport::GetPort(int32_t *port)
{
*port = (int32_t) SocketPort();
return NS_OK;
}
NS_IMETHODIMP
-nsSocketTransport::GetNetworkInterfaceId(nsACString &aNetworkInterfaceId)
-{
- MOZ_ASSERT(OnSocketThread(), "not on socket thread");
- aNetworkInterfaceId = mNetworkInterfaceId;
- return NS_OK;
-}
-
-NS_IMETHODIMP
-nsSocketTransport::SetNetworkInterfaceId(const nsACString &aNetworkInterfaceId)
-{
- MOZ_ASSERT(OnSocketThread(), "not on socket thread");
- mNetworkInterfaceId = aNetworkInterfaceId;
- return NS_OK;
-}
-
-NS_IMETHODIMP
nsSocketTransport::GetScriptableOriginAttributes(JSContext* aCx,
JS::MutableHandle<JS::Value> aOriginAttributes)
{
if (NS_WARN_IF(!ToJSValue(aCx, mOriginAttributes, aOriginAttributes))) {
return NS_ERROR_FAILURE;
}
return NS_OK;
}
--- a/netwerk/base/nsSocketTransport2.h
+++ b/netwerk/base/nsSocketTransport2.h
@@ -323,20 +323,16 @@ private:
//-------------------------------------------------------------------------
// socket state vars:
uint32_t mState; // STATE_??? flags
bool mAttached;
bool mInputClosed;
bool mOutputClosed;
- // The platform-specific network interface id that this socket
- // associated with.
- nsCString mNetworkInterfaceId;
-
// this flag is used to determine if the results of a host lookup arrive
// recursively or not. this flag is not protected by any lock.
bool mResolving;
nsCOMPtr<nsICancelable> mDNSRequest;
nsCOMPtr<nsIDNSRecord> mDNSRecord;
// mNetAddr/mSelfAddr is valid from GetPeerAddr()/GetSelfAddr() once we have
--- a/netwerk/dns/ChildDNSService.cpp
+++ b/netwerk/dns/ChildDNSService.cpp
@@ -52,30 +52,26 @@ ChildDNSService::ChildDNSService()
{
MOZ_ASSERT(IsNeckoChild());
}
void
ChildDNSService::GetDNSRecordHashKey(const nsACString &aHost,
const OriginAttributes &aOriginAttributes,
uint32_t aFlags,
- const nsACString &aNetworkInterface,
nsIDNSListener* aListener,
nsACString &aHashKey)
{
aHashKey.Assign(aHost);
nsAutoCString originSuffix;
aOriginAttributes.CreateSuffix(originSuffix);
aHashKey.Assign(originSuffix);
aHashKey.AppendInt(aFlags);
- if (!aNetworkInterface.IsEmpty()) {
- aHashKey.Append(aNetworkInterface);
- }
aHashKey.AppendPrintf("%p", aListener);
}
//-----------------------------------------------------------------------------
// ChildDNSService::nsIDNSService
//-----------------------------------------------------------------------------
NS_IMETHODIMP
@@ -92,68 +88,29 @@ ChildDNSService::AsyncResolve(const nsAC
if (aArgc == 1) {
if (!aOriginAttributes.isObject() ||
!attrs.Init(aCx, aOriginAttributes)) {
return NS_ERROR_INVALID_ARG;
}
}
- return AsyncResolveExtendedNative(hostname, flags, EmptyCString(),
- listener, target_, attrs,
- result);
+ return AsyncResolveNative(hostname, flags,
+ listener, target_, attrs,
+ result);
}
NS_IMETHODIMP
ChildDNSService::AsyncResolveNative(const nsACString &hostname,
uint32_t flags,
nsIDNSListener *listener,
nsIEventTarget *target_,
const OriginAttributes &aOriginAttributes,
nsICancelable **result)
{
- return AsyncResolveExtendedNative(hostname, flags, EmptyCString(),
- listener, target_, aOriginAttributes,
- result);
-}
-
-NS_IMETHODIMP
-ChildDNSService::AsyncResolveExtended(const nsACString &aHostname,
- uint32_t flags,
- const nsACString &aNetworkInterface,
- nsIDNSListener *listener,
- nsIEventTarget *target_,
- JS::HandleValue aOriginAttributes,
- JSContext *aCx,
- uint8_t aArgc,
- nsICancelable **result)
-{
- OriginAttributes attrs;
-
- if (aArgc == 1) {
- if (!aOriginAttributes.isObject() ||
- !attrs.Init(aCx, aOriginAttributes)) {
- return NS_ERROR_INVALID_ARG;
- }
- }
-
- return AsyncResolveExtendedNative(aHostname, flags, aNetworkInterface,
- listener, target_, attrs,
- result);
-}
-
-NS_IMETHODIMP
-ChildDNSService::AsyncResolveExtendedNative(const nsACString &hostname,
- uint32_t flags,
- const nsACString &aNetworkInterface,
- nsIDNSListener *listener,
- nsIEventTarget *target_,
- const OriginAttributes &aOriginAttributes,
- nsICancelable **result)
-{
NS_ENSURE_TRUE(gNeckoChild != nullptr, NS_ERROR_FAILURE);
if (mDisablePrefetch && (flags & RESOLVE_SPECULATE)) {
return NS_ERROR_DNS_LOOKUP_QUEUE_FULL;
}
// We need original flags for the pending requests hash.
uint32_t originalFlags = flags;
@@ -178,23 +135,22 @@ ChildDNSService::AsyncResolveExtendedNat
// (or in parent in nsDNSService.cpp) but doesn't hurt.
listener = new DNSListenerProxy(listener, target);
}
RefPtr<DNSRequestChild> childReq =
new DNSRequestChild(hostname,
aOriginAttributes,
flags,
- aNetworkInterface,
listener, target);
{
MutexAutoLock lock(mPendingRequestsLock);
nsCString key;
- GetDNSRecordHashKey(hostname, aOriginAttributes, originalFlags, aNetworkInterface,
+ GetDNSRecordHashKey(hostname, aOriginAttributes, originalFlags,
originalListener, key);
nsTArray<RefPtr<DNSRequestChild>> *hashEntry;
if (mPendingRequests.Get(key, &hashEntry)) {
hashEntry->AppendElement(childReq);
} else {
hashEntry = new nsTArray<RefPtr<DNSRequestChild>>();
hashEntry->AppendElement(childReq);
mPendingRequests.Put(key, hashEntry);
@@ -220,71 +176,36 @@ ChildDNSService::CancelAsyncResolve(cons
if (aArgc == 1) {
if (!aOriginAttributes.isObject() ||
!attrs.Init(aCx, aOriginAttributes)) {
return NS_ERROR_INVALID_ARG;
}
}
- return CancelAsyncResolveExtendedNative(aHostname, aFlags, EmptyCString(),
- aListener, aReason, attrs);
+ return CancelAsyncResolveNative(aHostname, aFlags,
+ aListener, aReason, attrs);
}
NS_IMETHODIMP
ChildDNSService::CancelAsyncResolveNative(const nsACString &aHostname,
uint32_t aFlags,
nsIDNSListener *aListener,
nsresult aReason,
const OriginAttributes &aOriginAttributes)
{
- return CancelAsyncResolveExtendedNative(aHostname, aFlags, EmptyCString(),
- aListener, aReason, aOriginAttributes);
-}
-
-NS_IMETHODIMP
-ChildDNSService::CancelAsyncResolveExtended(const nsACString &aHostname,
- uint32_t aFlags,
- const nsACString &aNetworkInterface,
- nsIDNSListener *aListener,
- nsresult aReason,
- JS::HandleValue aOriginAttributes,
- JSContext *aCx,
- uint8_t aArgc)
-{
- OriginAttributes attrs;
-
- if (aArgc == 1) {
- if (!aOriginAttributes.isObject() ||
- !attrs.Init(aCx, aOriginAttributes)) {
- return NS_ERROR_INVALID_ARG;
- }
- }
-
- return CancelAsyncResolveExtendedNative(aHostname, aFlags, aNetworkInterface,
- aListener, aReason, attrs);
-}
-
-NS_IMETHODIMP
-ChildDNSService::CancelAsyncResolveExtendedNative(const nsACString &aHostname,
- uint32_t aFlags,
- const nsACString &aNetworkInterface,
- nsIDNSListener *aListener,
- nsresult aReason,
- const OriginAttributes &aOriginAttributes)
-{
if (mDisablePrefetch && (aFlags & RESOLVE_SPECULATE)) {
return NS_ERROR_DNS_LOOKUP_QUEUE_FULL;
}
MutexAutoLock lock(mPendingRequestsLock);
nsTArray<RefPtr<DNSRequestChild>> *hashEntry;
nsCString key;
GetDNSRecordHashKey(aHostname, aOriginAttributes, aFlags,
- aNetworkInterface, aListener, key);
+ aListener, key);
if (mPendingRequests.Get(key, &hashEntry)) {
// We cancel just one.
hashEntry->ElementAt(0)->Cancel(aReason);
}
return NS_OK;
}
@@ -340,17 +261,17 @@ ChildDNSService::NotifyRequestDone(DNSRe
return;
}
}
MutexAutoLock lock(mPendingRequestsLock);
nsCString key;
GetDNSRecordHashKey(aDnsRequest->mHost, aDnsRequest->mOriginAttributes, originalFlags,
- aDnsRequest->mNetworkInterface, originalListener, key);
+ originalListener, key);
nsTArray<RefPtr<DNSRequestChild>> *hashEntry;
if (mPendingRequests.Get(key, &hashEntry)) {
int idx;
if ((idx = hashEntry->IndexOf(aDnsRequest))) {
hashEntry->RemoveElementAt(idx);
if (hashEntry->IsEmpty()) {
--- a/netwerk/dns/ChildDNSService.h
+++ b/netwerk/dns/ChildDNSService.h
@@ -38,17 +38,16 @@ public:
bool GetOffline() const;
private:
virtual ~ChildDNSService() = default;
void MOZ_ALWAYS_INLINE GetDNSRecordHashKey(const nsACString &aHost,
const OriginAttributes &aOriginAttributes,
uint32_t aFlags,
- const nsACString &aNetworkInterface,
nsIDNSListener* aListener,
nsACString &aHashKey);
bool mFirstTime;
bool mDisablePrefetch;
// We need to remember pending dns requests to be able to cancel them.
nsClassHashtable<nsCStringHashKey, nsTArray<RefPtr<DNSRequestChild>>> mPendingRequests;
--- a/netwerk/dns/DNSRequestChild.cpp
+++ b/netwerk/dns/DNSRequestChild.cpp
@@ -175,43 +175,40 @@ public:
NS_IMETHOD Run() override
{
if (mDnsRequest->mIPCOpen) {
// Send request to Parent process.
mDnsRequest->SendCancelDNSRequest(mDnsRequest->mHost,
mDnsRequest->mOriginAttributes,
mDnsRequest->mFlags,
- mDnsRequest->mNetworkInterface,
mReasonForCancel);
}
return NS_OK;
}
private:
RefPtr<DNSRequestChild> mDnsRequest;
nsresult mReasonForCancel;
};
//-----------------------------------------------------------------------------
// DNSRequestChild
//-----------------------------------------------------------------------------
DNSRequestChild::DNSRequestChild(const nsACString& aHost,
const OriginAttributes& aOriginAttributes,
const uint32_t& aFlags,
- const nsACString& aNetworkInterface,
nsIDNSListener *aListener,
nsIEventTarget *target)
: mListener(aListener)
, mTarget(target)
, mResultStatus(NS_OK)
, mHost(aHost)
, mOriginAttributes(aOriginAttributes)
, mFlags(aFlags)
- , mNetworkInterface(aNetworkInterface)
, mIPCOpen(false)
{
}
void
DNSRequestChild::StartRequest()
{
// we can only do IPDL on the main thread
@@ -232,17 +229,17 @@ DNSRequestChild::StartRequest()
mozilla::dom::ContentChild* cc =
static_cast<mozilla::dom::ContentChild*>(gNeckoChild->Manager());
if (cc->IsShuttingDown()) {
return;
}
// Send request to Parent process.
gNeckoChild->SendPDNSRequestConstructor(this, mHost, mOriginAttributes,
- mFlags, mNetworkInterface);
+ mFlags);
mIPCOpen = true;
// IPDL holds a reference until IPDL channel gets destroyed
AddIPDLReference();
}
void
DNSRequestChild::CallOnLookupComplete()
--- a/netwerk/dns/DNSRequestChild.h
+++ b/netwerk/dns/DNSRequestChild.h
@@ -22,17 +22,16 @@ class DNSRequestChild final
{
public:
NS_DECL_THREADSAFE_ISUPPORTS
NS_DECL_NSICANCELABLE
DNSRequestChild(const nsACString& aHost,
const OriginAttributes& aOriginAttributes,
const uint32_t& aFlags,
- const nsACString& aNetworkInterface,
nsIDNSListener *aListener, nsIEventTarget *target);
void AddIPDLReference() {
AddRef();
}
void ReleaseIPDLReference();
// Sends IPDL request to parent
@@ -49,16 +48,15 @@ protected:
nsCOMPtr<nsIDNSListener> mListener;
nsCOMPtr<nsIEventTarget> mTarget;
nsCOMPtr<nsIDNSRecord> mResultRecord;
nsresult mResultStatus;
nsCString mHost;
const OriginAttributes mOriginAttributes;
uint16_t mFlags;
- nsCString mNetworkInterface;
bool mIPCOpen;
};
} // namespace net
} // namespace mozilla
#endif // mozilla_net_DNSRequestChild_h
--- a/netwerk/dns/DNSRequestParent.cpp
+++ b/netwerk/dns/DNSRequestParent.cpp
@@ -24,51 +24,47 @@ DNSRequestParent::DNSRequestParent()
, mIPCClosed(false)
{
}
void
DNSRequestParent::DoAsyncResolve(const nsACString &hostname,
const OriginAttributes &originAttributes,
- uint32_t flags,
- const nsACString &networkInterface)
+ uint32_t flags)
{
nsresult rv;
mFlags = flags;
nsCOMPtr<nsIDNSService> dns = do_GetService(NS_DNSSERVICE_CONTRACTID, &rv);
if (NS_SUCCEEDED(rv)) {
nsCOMPtr<nsIEventTarget> main = GetMainThreadEventTarget();
nsCOMPtr<nsICancelable> unused;
- rv = dns->AsyncResolveExtendedNative(hostname, flags,
- networkInterface, this,
- main, originAttributes,
- getter_AddRefs(unused));
+ rv = dns->AsyncResolveNative(hostname, flags, this,
+ main, originAttributes,
+ getter_AddRefs(unused));
}
if (NS_FAILED(rv) && !mIPCClosed) {
mIPCClosed = true;
Unused << SendLookupCompleted(DNSRequestResponse(rv));
}
}
mozilla::ipc::IPCResult
DNSRequestParent::RecvCancelDNSRequest(const nsCString& hostName,
const OriginAttributes& originAttributes,
const uint32_t& flags,
- const nsCString& networkInterface,
const nsresult& reason)
{
nsresult rv;
nsCOMPtr<nsIDNSService> dns = do_GetService(NS_DNSSERVICE_CONTRACTID, &rv);
if (NS_SUCCEEDED(rv)) {
- rv = dns->CancelAsyncResolveExtendedNative(hostName, flags,
- networkInterface,
- this, reason,
- originAttributes);
+ rv = dns->CancelAsyncResolveNative(hostName, flags,
+ this, reason,
+ originAttributes);
}
return IPC_OK();
}
mozilla::ipc::IPCResult
DNSRequestParent::Recv__delete__()
{
mIPCClosed = true;
--- a/netwerk/dns/DNSRequestParent.h
+++ b/netwerk/dns/DNSRequestParent.h
@@ -21,25 +21,23 @@ class DNSRequestParent
public:
NS_DECL_ISUPPORTS
NS_DECL_NSIDNSLISTENER
DNSRequestParent();
void DoAsyncResolve(const nsACString &hostname,
const OriginAttributes &originAttributes,
- uint32_t flags,
- const nsACString &networkInterface);
+ uint32_t flags);
// Pass args here rather than storing them in the parent; they are only
// needed if the request is to be canceled.
mozilla::ipc::IPCResult RecvCancelDNSRequest(const nsCString& hostName,
const OriginAttributes& originAttributes,
const uint32_t& flags,
- const nsCString& networkInterface,
const nsresult& reason) override;
mozilla::ipc::IPCResult Recv__delete__() override;
protected:
virtual void ActorDestroy(ActorDestroyReason why) override;
private:
virtual ~DNSRequestParent() = default;
--- a/netwerk/dns/GetAddrInfo.cpp
+++ b/netwerk/dns/GetAddrInfo.cpp
@@ -245,18 +245,17 @@ static MOZ_ALWAYS_INLINE nsresult
#endif
////////////////////////////////////
// PORTABLE RUNTIME IMPLEMENTATION//
////////////////////////////////////
static MOZ_ALWAYS_INLINE nsresult
_GetAddrInfo_Portable(const char* aCanonHost, uint16_t aAddressFamily,
- uint16_t aFlags, const char* aNetworkInterface,
- AddrInfo** aAddrInfo)
+ uint16_t aFlags, AddrInfo** aAddrInfo)
{
MOZ_ASSERT(aCanonHost);
MOZ_ASSERT(aAddrInfo);
// We accept the same aFlags that nsHostResolver::ResolveHost accepts, but we
// need to translate the aFlags into a form that PR_GetAddrInfoByName
// accepts.
int prFlags = PR_AI_ADDRCONFIG;
@@ -317,17 +316,17 @@ GetAddrInfoShutdown() {
return _GetAddrInfoShutdown_Windows();
#else
return NS_OK;
#endif
}
nsresult
GetAddrInfo(const char* aHost, uint16_t aAddressFamily, uint16_t aFlags,
- const char* aNetworkInterface, AddrInfo** aAddrInfo, bool aGetTtl)
+ AddrInfo** aAddrInfo, bool aGetTtl)
{
if (NS_WARN_IF(!aHost) || NS_WARN_IF(!aAddrInfo)) {
return NS_ERROR_NULL_POINTER;
}
#ifdef DNSQUERY_AVAILABLE
// The GetTTLData needs the canonical name to function properly
if (aGetTtl) {
@@ -338,17 +337,17 @@ GetAddrInfo(const char* aHost, uint16_t
if (gNativeIsLocalhost) {
// pretend we use the given host but use IPv4 localhost instead!
aHost = "localhost";
aAddressFamily = PR_AF_INET;
}
*aAddrInfo = nullptr;
nsresult rv = _GetAddrInfo_Portable(aHost, aAddressFamily, aFlags,
- aNetworkInterface, aAddrInfo);
+ aAddrInfo);
#ifdef DNSQUERY_AVAILABLE
if (aGetTtl && NS_SUCCEEDED(rv)) {
// Figure out the canonical name, or if that fails, just use the host name
// we have.
const char *name = nullptr;
if (*aAddrInfo != nullptr && (*aAddrInfo)->mCanonicalName) {
name = (*aAddrInfo)->mCanonicalName;
--- a/netwerk/dns/GetAddrInfo.h
+++ b/netwerk/dns/GetAddrInfo.h
@@ -33,17 +33,17 @@ class AddrInfo;
* hostname (PR_AI_NOCANONNAME will be ignored if the TTL is retrieved).
* @param aAddrInfo[out] Will point to the results of the host lookup, or be
* null if the lookup failed.
* @param aGetTtl[in] If true, the TTL will be retrieved if DNS provides the
* answers..
*/
nsresult
GetAddrInfo(const char* aHost, uint16_t aAddressFamily, uint16_t aFlags,
- const char* aNetworkInterface, AddrInfo** aAddrInfo, bool aGetTtl);
+ AddrInfo** aAddrInfo, bool aGetTtl);
/**
* Initialize the GetAddrInfo module.
*
* GetAddrInfoShutdown() should be called for every time this function is
* called.
*/
nsresult
--- a/netwerk/dns/PDNSRequest.ipdl
+++ b/netwerk/dns/PDNSRequest.ipdl
@@ -21,18 +21,17 @@ async protocol PDNSRequest
manager PNecko;
parent:
// constructor in PNecko takes AsyncResolve args that initialize request
// Pass args here rather than storing them in the parent; they are only
// needed if the request is to be canceled.
async CancelDNSRequest(nsCString hostName, OriginAttributes originAttributes,
- uint32_t flags, nsCString networkInterface,
- nsresult reason);
+ uint32_t flags, nsresult reason);
async __delete__();
child:
async LookupCompleted(DNSRequestResponse reply);
};
} //namespace net
--- a/netwerk/dns/TRR.cpp
+++ b/netwerk/dns/TRR.cpp
@@ -391,17 +391,17 @@ TRR::ReceivePush(nsIHttpChannel *pushed,
LOG(("TRR::ReceivePush failed to decode %s\n", mHost.get()));
return NS_ERROR_UNEXPECTED;
}
RefPtr<nsHostRecord> hostRecord;
nsresult rv;
rv = mHostResolver->GetHostRecord(mHost.get(),
pushedRec->flags, pushedRec->af,
- pushedRec->pb, pushedRec->netInterface,
+ pushedRec->pb,
pushedRec->originSuffix,
getter_AddRefs(hostRecord));
if (NS_FAILED(rv)) {
return rv;
}
rv = mHostResolver->TrrLookup_unlocked(hostRecord, this);
if (NS_FAILED(rv)) {
--- a/netwerk/dns/nsDNSService2.cpp
+++ b/netwerk/dns/nsDNSService2.cpp
@@ -312,41 +312,39 @@ public:
NS_DECL_THREADSAFE_ISUPPORTS
NS_DECL_NSICANCELABLE
nsDNSAsyncRequest(nsHostResolver *res,
const nsACString &host,
const OriginAttributes &attrs,
nsIDNSListener *listener,
uint16_t flags,
- uint16_t af,
- const nsACString &netInterface)
+ uint16_t af)
: mResolver(res)
, mHost(host)
, mOriginAttributes(attrs)
, mListener(listener)
, mFlags(flags)
, mAF(af)
- , mNetworkInterface(netInterface) {}
+ { }
void OnResolveHostComplete(nsHostResolver *, nsHostRecord *, nsresult) override;
// Returns TRUE if the DNS listener arg is the same as the member listener
// Used in Cancellations to remove DNS requests associated with a
// particular hostname and nsIDNSListener
bool EqualsAsyncListener(nsIDNSListener *aListener) override;
size_t SizeOfIncludingThis(mozilla::MallocSizeOf) const override;
RefPtr<nsHostResolver> mResolver;
nsCString mHost; // hostname we're resolving
const OriginAttributes mOriginAttributes; // The originAttributes for this resolving
nsCOMPtr<nsIDNSListener> mListener;
uint16_t mFlags;
uint16_t mAF;
- nsCString mNetworkInterface;
private:
virtual ~nsDNSAsyncRequest() = default;
};
NS_IMPL_ISUPPORTS(nsDNSAsyncRequest, nsICancelable)
void
nsDNSAsyncRequest::OnResolveHostComplete(nsHostResolver *resolver,
@@ -391,17 +389,17 @@ nsDNSAsyncRequest::SizeOfIncludingThis(M
return n;
}
NS_IMETHODIMP
nsDNSAsyncRequest::Cancel(nsresult reason)
{
NS_ENSURE_ARG(NS_FAILED(reason));
mResolver->DetachCallback(mHost.get(), mOriginAttributes, mFlags, mAF,
- mNetworkInterface.get(), this, reason);
+ this, reason);
return NS_OK;
}
//-----------------------------------------------------------------------------
class nsDNSSyncRequest
: public nsResolveHostCallback
{
@@ -805,68 +803,28 @@ nsDNSService::AsyncResolve(const nsACStr
if (aArgc == 1) {
if (!aOriginAttributes.isObject() ||
!attrs.Init(aCx, aOriginAttributes)) {
return NS_ERROR_INVALID_ARG;
}
}
- return AsyncResolveExtendedNative(aHostname, flags, EmptyCString(),
- listener, target_, attrs,
- result);
+ return AsyncResolveNative(aHostname, flags, listener,
+ target_, attrs, result);
}
NS_IMETHODIMP
nsDNSService::AsyncResolveNative(const nsACString &aHostname,
uint32_t flags,
- nsIDNSListener *listener,
+ nsIDNSListener *aListener,
nsIEventTarget *target_,
const OriginAttributes &aOriginAttributes,
nsICancelable **result)
{
- return AsyncResolveExtendedNative(aHostname, flags, EmptyCString(),
- listener, target_, aOriginAttributes,
- result);
-}
-
-NS_IMETHODIMP
-nsDNSService::AsyncResolveExtended(const nsACString &aHostname,
- uint32_t flags,
- const nsACString &aNetworkInterface,
- nsIDNSListener *listener,
- nsIEventTarget *target_,
- JS::HandleValue aOriginAttributes,
- JSContext *aCx,
- uint8_t aArgc,
- nsICancelable **result)
-{
- OriginAttributes attrs;
-
- if (aArgc == 1) {
- if (!aOriginAttributes.isObject() ||
- !attrs.Init(aCx, aOriginAttributes)) {
- return NS_ERROR_INVALID_ARG;
- }
- }
-
- return AsyncResolveExtendedNative(aHostname, flags, aNetworkInterface,
- listener, target_, attrs,
- result);
-}
-
-NS_IMETHODIMP
-nsDNSService::AsyncResolveExtendedNative(const nsACString &aHostname,
- uint32_t flags,
- const nsACString &aNetworkInterface,
- nsIDNSListener *aListener,
- nsIEventTarget *target_,
- const OriginAttributes &aOriginAttributes,
- nsICancelable **result)
-{
// grab reference to global host resolver and IDN service. beware
// simultaneous shutdown!!
RefPtr<nsHostResolver> res;
nsCOMPtr<nsIIDNService> idn;
nsCOMPtr<nsIEventTarget> target = target_;
nsCOMPtr<nsIDNSListener> listener = aListener;
bool localDomain = false;
{
@@ -907,23 +865,21 @@ nsDNSService::AsyncResolveExtendedNative
if (target) {
listener = new DNSListenerProxy(listener, target);
}
uint16_t af = GetAFForLookup(hostname, flags);
MOZ_ASSERT(listener);
RefPtr<nsDNSAsyncRequest> req =
- new nsDNSAsyncRequest(res, hostname, aOriginAttributes, listener, flags, af,
- aNetworkInterface);
+ new nsDNSAsyncRequest(res, hostname, aOriginAttributes, listener, flags, af);
if (!req)
return NS_ERROR_OUT_OF_MEMORY;
- rv = res->ResolveHost(req->mHost.get(), req->mOriginAttributes, flags, af,
- req->mNetworkInterface.get(), req);
+ rv = res->ResolveHost(req->mHost.get(), req->mOriginAttributes, flags, af, req);
req.forget(result);
return rv;
}
NS_IMETHODIMP
nsDNSService::CancelAsyncResolve(const nsACString &aHostname,
uint32_t aFlags,
nsIDNSListener *aListener,
@@ -936,62 +892,27 @@ nsDNSService::CancelAsyncResolve(const n
if (aArgc == 1) {
if (!aOriginAttributes.isObject() ||
!attrs.Init(aCx, aOriginAttributes)) {
return NS_ERROR_INVALID_ARG;
}
}
- return CancelAsyncResolveExtendedNative(aHostname, aFlags, EmptyCString(),
- aListener, aReason, attrs);
+ return CancelAsyncResolveNative(aHostname, aFlags,
+ aListener, aReason, attrs);
}
NS_IMETHODIMP
nsDNSService::CancelAsyncResolveNative(const nsACString &aHostname,
uint32_t aFlags,
nsIDNSListener *aListener,
nsresult aReason,
const OriginAttributes &aOriginAttributes)
{
- return CancelAsyncResolveExtendedNative(aHostname, aFlags, EmptyCString(),
- aListener, aReason, aOriginAttributes);
-}
-
-NS_IMETHODIMP
-nsDNSService::CancelAsyncResolveExtended(const nsACString &aHostname,
- uint32_t aFlags,
- const nsACString &aNetworkInterface,
- nsIDNSListener *aListener,
- nsresult aReason,
- JS::HandleValue aOriginAttributes,
- JSContext *aCx,
- uint8_t aArgc)
-{
- OriginAttributes attrs;
-
- if (aArgc == 1) {
- if (!aOriginAttributes.isObject() ||
- !attrs.Init(aCx, aOriginAttributes)) {
- return NS_ERROR_INVALID_ARG;
- }
- }
-
- return CancelAsyncResolveExtendedNative(aHostname, aFlags, aNetworkInterface,
- aListener, aReason, attrs);
-}
-
-NS_IMETHODIMP
-nsDNSService::CancelAsyncResolveExtendedNative(const nsACString &aHostname,
- uint32_t aFlags,
- const nsACString &aNetworkInterface,
- nsIDNSListener *aListener,
- nsresult aReason,
- const OriginAttributes &aOriginAttributes)
-{
// grab reference to global host resolver and IDN service. beware
// simultaneous shutdown!!
RefPtr<nsHostResolver> res;
nsCOMPtr<nsIIDNService> idn;
bool localDomain = false;
{
MutexAutoLock lock(mLock);
@@ -1009,18 +930,17 @@ nsDNSService::CancelAsyncResolveExtended
nsresult rv = PreprocessHostname(localDomain, aHostname, idn, hostname);
if (NS_FAILED(rv)) {
return rv;
}
uint16_t af = GetAFForLookup(hostname, aFlags);
res->CancelAsyncRequest(hostname.get(), aOriginAttributes, aFlags, af,
- nsPromiseFlatCString(aNetworkInterface).get(), aListener,
- aReason);
+ aListener, aReason);
return NS_OK;
}
NS_IMETHODIMP
nsDNSService::Resolve(const nsACString &aHostname,
uint32_t flags,
JS::HandleValue aOriginAttributes,
JSContext *aCx,
@@ -1109,17 +1029,17 @@ nsDNSService::ResolveInternal(const nsAC
if (!mon)
return NS_ERROR_OUT_OF_MEMORY;
PR_EnterMonitor(mon);
RefPtr<nsDNSSyncRequest> syncReq = new nsDNSSyncRequest(mon);
uint16_t af = GetAFForLookup(hostname, flags);
- rv = res->ResolveHost(hostname.get(), aOriginAttributes, flags, af, "", syncReq);
+ rv = res->ResolveHost(hostname.get(), aOriginAttributes, flags, af, syncReq);
if (NS_SUCCEEDED(rv)) {
// wait for result
while (!syncReq->mDone) {
PR_Wait(mon, PR_INTERVAL_NO_TIMEOUT);
}
if (NS_FAILED(syncReq->mStatus)) {
rv = syncReq->mStatus;
--- a/netwerk/dns/nsHostResolver.cpp
+++ b/netwerk/dns/nsHostResolver.cpp
@@ -76,20 +76,16 @@ static_assert(HighThreadThreshold <= MAX
namespace mozilla {
namespace net {
LazyLogModule gHostResolverLog("nsHostResolver");
#define LOG(args) MOZ_LOG(mozilla::net::gHostResolverLog, mozilla::LogLevel::Debug, args)
#define LOG_ENABLED() MOZ_LOG_TEST(mozilla::net::gHostResolverLog, mozilla::LogLevel::Debug)
}
}
-#define LOG_HOST(host, interface) host, \
- (interface && interface[0] != '\0') ? " on interface " : "", \
- (interface && interface[0] != '\0') ? interface : ""
-
//----------------------------------------------------------------------------
#if defined(RES_RETRY_ON_FAILURE)
// this class represents the resolver state for a given thread. if we
// encounter a lookup failure, then we can invoke the Reset method on an
// instance of this class to reset the resolver (in case /etc/resolv.conf
// for example changed). this is mainly an issue on GNU systems since glibc
@@ -156,33 +152,31 @@ IsLowPriority(uint16_t flags)
#define RES_KEY_FLAGS(_f) ((_f) & nsHostResolver::RES_CANON_NAME)
bool
nsHostKey::operator==(const nsHostKey& other) const
{
return host == other.host &&
RES_KEY_FLAGS (flags) == RES_KEY_FLAGS(other.flags) &&
af == other.af &&
- netInterface == other.netInterface &&
originSuffix == other.originSuffix;
}
PLDHashNumber
nsHostKey::Hash() const
{
return AddToHash(HashString(host.get()), RES_KEY_FLAGS(flags), af,
- HashString(netInterface.get()), HashString(originSuffix.get()));
+ HashString(originSuffix.get()));
}
size_t
nsHostKey::SizeOfExcludingThis(mozilla::MallocSizeOf mallocSizeOf) const
{
size_t n = 0;
n += host.SizeOfExcludingThisIfUnshared(mallocSizeOf);
- n += netInterface.SizeOfExcludingThisIfUnshared(mallocSizeOf);
n += originSuffix.SizeOfExcludingThisIfUnshared(mallocSizeOf);
return n;
}
nsHostRecord::nsHostRecord(const nsHostKey& key)
: nsHostKey(key)
, addr_info_lock("nsHostRecord.addr_info_lock")
, addr_info_gencnt(0)
@@ -337,68 +331,66 @@ nsHostRecord::~nsHostRecord()
Telemetry::Accumulate(Telemetry::DNS_BLACKLIST_COUNT, mBlacklistedCount);
delete addr_info;
}
bool
nsHostRecord::Blacklisted(NetAddr *aQuery)
{
// must call locked
- LOG(("Checking blacklist for host [%s%s%s], host record [%p].\n",
- LOG_HOST(host.get(), netInterface.get()), this));
+ LOG(("Checking blacklist for host [%s], host record [%p].\n",
+ host.get(), this));
// skip the string conversion for the common case of no blacklist
if (!mBlacklistedItems.Length()) {
return false;
}
char buf[kIPv6CStrBufSize];
if (!NetAddrToString(aQuery, buf, sizeof(buf))) {
return false;
}
nsDependentCString strQuery(buf);
for (uint32_t i = 0; i < mBlacklistedItems.Length(); i++) {
if (mBlacklistedItems.ElementAt(i).Equals(strQuery)) {
- LOG(("Address [%s] is blacklisted for host [%s%s%s].\n", buf,
- LOG_HOST(host.get(), netInterface.get())));
+ LOG(("Address [%s] is blacklisted for host [%s].\n", buf, host.get()));
return true;
}
}
return false;
}
void
nsHostRecord::ReportUnusable(NetAddr *aAddress)
{
// must call locked
- LOG(("Adding address to blacklist for host [%s%s%s], host record [%p]."
- "used trr=%d\n", LOG_HOST(host.get(), netInterface.get()),
- this, mTRRSuccess));
+ LOG(("Adding address to blacklist for host [%s], host record [%p]."
+ "used trr=%d\n", host.get(), this, mTRRSuccess));
++mBlacklistedCount;
if (negative)
mDoomed = true;
char buf[kIPv6CStrBufSize];
if (NetAddrToString(aAddress, buf, sizeof(buf))) {
LOG(("Successfully adding address [%s] to blacklist for host "
- "[%s%s%s].\n", buf, LOG_HOST(host.get(), netInterface.get())));
+ "[%s].\n", buf, host.get()));
mBlacklistedItems.AppendElement(nsCString(buf));
}
}
void
nsHostRecord::ResetBlacklist()
{
// must call locked
- LOG(("Resetting blacklist for host [%s%s%s], host record [%p].\n",
- LOG_HOST(host.get(), netInterface.get()), this));
+ LOG(("Resetting blacklist for host [%s], host record [%p].\n",
+ host.get(), this));
mBlacklistedItems.Clear();
}
nsHostRecord::ExpirationStatus
nsHostRecord::CheckExpiration(const mozilla::TimeStamp& now) const {
if (!mGraceStart.IsNull() && now >= mGraceStart
&& !mValidEnd.IsNull() && now < mValidEnd) {
return nsHostRecord::EXP_GRACE;
@@ -712,23 +704,21 @@ nsHostResolver::Shutdown()
NS_WARNING_ASSERTION(NS_SUCCEEDED(rv),
"Failed to shutdown GetAddrInfo");
}
}
nsresult
nsHostResolver::GetHostRecord(const char *host,
uint16_t flags, uint16_t af, bool pb,
- const nsCString &netInterface,
const nsCString &originSuffix,
nsHostRecord **result)
{
MutexAutoLock lock(mLock);
- nsHostKey key(nsCString(host), flags, af, pb,
- netInterface, originSuffix);
+ nsHostKey key(nsCString(host), flags, af, pb, originSuffix);
RefPtr<nsHostRecord>& entry = mRecordDB.GetOrInsert(key);
if (!entry) {
entry = new nsHostRecord(key);
}
RefPtr<nsHostRecord> rec = entry;
if (rec->addr) {
@@ -741,23 +731,21 @@ nsHostResolver::GetHostRecord(const char
return NS_OK;
}
nsresult
nsHostResolver::ResolveHost(const char *host,
const OriginAttributes &aOriginAttributes,
uint16_t flags,
uint16_t af,
- const char *netInterface,
nsResolveHostCallback *aCallback)
{
NS_ENSURE_TRUE(host && *host, NS_ERROR_UNEXPECTED);
- NS_ENSURE_TRUE(netInterface, NS_ERROR_UNEXPECTED);
- LOG(("Resolving host [%s%s%s]%s%s.\n", LOG_HOST(host, netInterface),
+ LOG(("Resolving host [%s]%s%s.\n", host,
flags & RES_BYPASS_CACHE ? " - bypassing cache" : "",
flags & RES_REFRESH_CACHE ? " - refresh cache" : ""));
// ensure that we are working with a valid hostname before proceeding. see
// bug 304904 for details.
if (!net_IsValidHostName(nsDependentCString(host)))
return NS_ERROR_UNKNOWN_HOST;
@@ -784,41 +772,38 @@ nsHostResolver::ResolveHost(const char
// any pending callbacks, then add to pending callbacks queue,
// and return. otherwise, add ourselves as first pending
// callback, and proceed to do the lookup.
nsAutoCString originSuffix;
aOriginAttributes.CreateSuffix(originSuffix);
nsHostKey key(nsCString(host), flags, af,
(aOriginAttributes.mPrivateBrowsingId > 0),
- nsCString(netInterface),
originSuffix);
RefPtr<nsHostRecord>& entry = mRecordDB.GetOrInsert(key);
if (!entry) {
entry = new nsHostRecord(key);
}
RefPtr<nsHostRecord> rec = entry;
MOZ_ASSERT(rec, "Record should not be null");
if (!(flags & RES_BYPASS_CACHE) &&
rec->HasUsableResult(TimeStamp::NowLoRes(), flags)) {
- LOG((" Using cached record for host [%s%s%s].\n",
- LOG_HOST(host, netInterface)));
+ LOG((" Using cached record for host [%s].\n", host));
// put reference to host record on stack...
result = rec;
Telemetry::Accumulate(Telemetry::DNS_LOOKUP_METHOD2, METHOD_HIT);
// For entries that are in the grace period
// or all cached negative entries, use the cache but start a new
// lookup in the background
ConditionallyRefreshRecord(rec, host);
if (rec->negative) {
- LOG((" Negative cache entry for host [%s%s%s].\n",
- LOG_HOST(host, netInterface)));
+ LOG((" Negative cache entry for host [%s].\n", host));
Telemetry::Accumulate(Telemetry::DNS_LOOKUP_METHOD2,
METHOD_NEGATIVE_HIT);
status = NS_ERROR_UNKNOWN_HOST;
}
} else if (rec->addr) {
// if the host name is an IP address literal and has been parsed,
// go ahead and use it.
LOG((" Using cached address for IP Literal [%s].\n", host));
@@ -837,47 +822,44 @@ nsHostResolver::ResolveHost(const char
// put reference to host record on stack...
Telemetry::Accumulate(Telemetry::DNS_LOOKUP_METHOD2,
METHOD_LITERAL);
result = rec;
} else if (mPendingCount >= MAX_NON_PRIORITY_REQUESTS &&
!IsHighPriority(flags) &&
!rec->mResolving) {
LOG((" Lookup queue full: dropping %s priority request for "
- "host [%s%s%s].\n",
- IsMediumPriority(flags) ? "medium" : "low",
- LOG_HOST(host, netInterface)));
+ "host [%s].\n",
+ IsMediumPriority(flags) ? "medium" : "low", host));
Telemetry::Accumulate(Telemetry::DNS_LOOKUP_METHOD2,
METHOD_OVERFLOW);
// This is a lower priority request and we are swamped, so refuse it.
rv = NS_ERROR_DNS_LOOKUP_QUEUE_FULL;
} else if (flags & RES_OFFLINE) {
- LOG((" Offline request for host [%s%s%s]; ignoring.\n",
- LOG_HOST(host, netInterface)));
+ LOG((" Offline request for host [%s]; ignoring.\n", host));
rv = NS_ERROR_OFFLINE;
} else if (!rec->mResolving) {
// If this is an IPV4 or IPV6 specific request, check if there is
// an AF_UNSPEC entry we can use. Otherwise, hit the resolver...
if (!(flags & RES_BYPASS_CACHE) &&
((af == PR_AF_INET) || (af == PR_AF_INET6))) {
// First, search for an entry with AF_UNSPEC
const nsHostKey unspecKey(nsCString(host), flags, PR_AF_UNSPEC,
(aOriginAttributes.mPrivateBrowsingId > 0),
- nsCString(netInterface), originSuffix);
+ originSuffix);
RefPtr<nsHostRecord> unspecRec = mRecordDB.Get(unspecKey);
TimeStamp now = TimeStamp::NowLoRes();
if (unspecRec && unspecRec->HasUsableResult(now, flags)) {
MOZ_ASSERT(unspecRec->addr_info || unspecRec->negative,
"Entry should be resolved or negative.");
- LOG((" Trying AF_UNSPEC entry for host [%s%s%s] af: %s.\n",
- LOG_HOST(host, netInterface),
+ LOG((" Trying AF_UNSPEC entry for host [%s] af: %s.\n", host,
(af == PR_AF_INET) ? "AF_INET" : "AF_INET6"));
// We need to lock in case any other thread is reading
// addr_info.
MutexAutoLock lock(rec->addr_info_lock);
// XXX: note that this actually leaks addr_info.
// For some reason, freeing the memory causes a crash in
@@ -919,61 +901,58 @@ nsHostResolver::ResolveHost(const char
METHOD_HIT);
ConditionallyRefreshRecord(rec, host);
} else if (af == PR_AF_INET6) {
// For AF_INET6, a new lookup means another AF_UNSPEC
// lookup. We have already iterated through the
// AF_UNSPEC addresses, so we mark this record as
// negative.
LOG((" No AF_INET6 in AF_UNSPEC entry: "
- "host [%s%s%s] unknown host.",
- LOG_HOST(host, netInterface)));
+ "host [%s] unknown host.", host));
result = rec;
rec->negative = true;
status = NS_ERROR_UNKNOWN_HOST;
Telemetry::Accumulate(Telemetry::DNS_LOOKUP_METHOD2,
METHOD_NEGATIVE_HIT);
}
}
}
// If no valid address was found in the cache or this is an
// AF_UNSPEC request, then start a new lookup.
if (!result) {
- LOG((" No usable address in cache for host [%s%s%s].",
- LOG_HOST(host, netInterface)));
+ LOG((" No usable address in cache for host [%s].", host));
if (flags & RES_REFRESH_CACHE) {
rec->Invalidate();
}
// Add callback to the list of pending callbacks.
rec->mCallbacks.insertBack(callback);
rec->flags = flags;
rv = NameLookup(rec);
Telemetry::Accumulate(Telemetry::DNS_LOOKUP_METHOD2,
METHOD_NETWORK_FIRST);
if (NS_FAILED(rv) && callback->isInList()) {
callback->remove();
} else {
- LOG((" DNS lookup for host [%s%s%s] blocking "
+ LOG((" DNS lookup for host [%s] blocking "
"pending 'getaddrinfo' query: callback [%p]",
- LOG_HOST(host, netInterface), callback.get()));
+ host, callback.get()));
}
}
} else if (rec->mDidCallbacks) {
// record is still pending more (TRR) data; make the callback
// at once
result = rec;
// make it count as a hit
Telemetry::Accumulate(Telemetry::DNS_LOOKUP_METHOD2, METHOD_HIT);
- LOG((" Host [%s%s%s] re-using early TRR resolve data\n",
- LOG_HOST(host, netInterface)));
+ LOG((" Host [%s] re-using early TRR resolve data\n", host));
} else {
- LOG((" Host [%s%s%s] is being resolved. Appending callback "
- "[%p].", LOG_HOST(host, netInterface), callback.get()));
+ LOG((" Host [%s] is being resolved. Appending callback "
+ "[%p].", host, callback.get()));
rec->mCallbacks.insertBack(callback);
if (rec->onQueue) {
Telemetry::Accumulate(Telemetry::DNS_LOOKUP_METHOD2,
METHOD_NETWORK_SHARED);
// Consider the case where we are on a pending queue of
// lower priority than the request is being made at.
@@ -1011,32 +990,30 @@ nsHostResolver::ResolveHost(const char
return rv;
}
void
nsHostResolver::DetachCallback(const char *host,
const OriginAttributes &aOriginAttributes,
uint16_t flags,
uint16_t af,
- const char *netInterface,
nsResolveHostCallback *aCallback,
nsresult status)
{
RefPtr<nsHostRecord> rec;
RefPtr<nsResolveHostCallback> callback(aCallback);
{
MutexAutoLock lock(mLock);
nsAutoCString originSuffix;
aOriginAttributes.CreateSuffix(originSuffix);
nsHostKey key(nsCString(host), flags, af,
(aOriginAttributes.mPrivateBrowsingId > 0),
- nsCString(netInterface),
originSuffix);
RefPtr<nsHostRecord> entry = mRecordDB.Get(key);
if (entry) {
// walk list looking for |callback|... we cannot assume
// that it will be there!
for (nsResolveHostCallback* c: entry->mCallbacks) {
if (c == callback) {
@@ -1077,18 +1054,17 @@ nsHostResolver::ConditionallyCreateThrea
0);
if (!thr) {
mThreadCount--;
NS_RELEASE_THIS();
return NS_ERROR_OUT_OF_MEMORY;
}
}
else {
- LOG((" Unable to find a thread for looking up host [%s%s%s].\n",
- LOG_HOST(rec->host.get(), rec->netInterface.get())));
+ LOG((" Unable to find a thread for looking up host [%s].\n", rec->host.get()));
}
return NS_OK;
}
// make sure the mTrrLock is held when this is used!
#define TRROutstanding() ((rec->mTrrA || rec->mTrrAAAA))
nsresult
@@ -1394,37 +1370,36 @@ void
nsHostResolver::PrepareRecordExpiration(nsHostRecord* rec) const
{
// NOTE: rec->addr_info_lock is already held by parent
MOZ_ASSERT(((bool)rec->addr_info) != rec->negative);
mLock.AssertCurrentThreadOwns();
if (!rec->addr_info) {
rec->SetExpiration(TimeStamp::NowLoRes(),
NEGATIVE_RECORD_LIFETIME, 0);
- LOG(("Caching host [%s%s%s] negative record for %u seconds.\n",
- LOG_HOST(rec->host.get(), rec->netInterface.get()),
- NEGATIVE_RECORD_LIFETIME));
+ LOG(("Caching host [%s] negative record for %u seconds.\n",
+ rec->host.get(), NEGATIVE_RECORD_LIFETIME));
return;
}
unsigned int lifetime = mDefaultCacheLifetime;
unsigned int grace = mDefaultGracePeriod;
unsigned int ttl = mDefaultCacheLifetime;
if (sGetTtlEnabled || rec->addr_info->IsTRR()) {
if (rec->addr_info && rec->addr_info->ttl != AddrInfo::NO_TTL_DATA) {
ttl = rec->addr_info->ttl;
}
lifetime = ttl;
grace = 0;
}
rec->SetExpiration(TimeStamp::NowLoRes(), lifetime, grace);
- LOG(("Caching host [%s%s%s] record for %u seconds (grace %d).",
- LOG_HOST(rec->host.get(), rec->netInterface.get()), lifetime, grace));
+ LOG(("Caching host [%s] record for %u seconds (grace %d).",
+ rec->host.get(), lifetime, grace));
}
static nsresult
merge_rrset(AddrInfo *rrto, AddrInfo *rrfrom)
{
if (!rrto || !rrfrom) {
return NS_ERROR_NULL_POINTER;
}
@@ -1709,18 +1684,17 @@ nsHostResolver::CompleteLookup(nsHostRec
{
MutexAutoLock lock(rec->addr_info_lock);
if(rec->addr_info && rec->addr_info->IsTRR()) {
fromTRR = true;
}
}
if (!fromTRR &&
!mShutdown && !rec->mGetTtl && !rec->mResolving && sGetTtlEnabled) {
- LOG(("Issuing second async lookup for TTL for host [%s%s%s].",
- LOG_HOST(rec->host.get(), rec->netInterface.get())));
+ LOG(("Issuing second async lookup for TTL for host [%s].", rec->host.get()));
rec->flags =
(rec->flags & ~RES_PRIORITY_MEDIUM) | RES_PRIORITY_LOW |
RES_DISABLE_TRR;
DebugOnly<nsresult> rv = NameLookup(rec);
NS_WARNING_ASSERTION(
NS_SUCCEEDED(rv),
"Could not issue second async lookup for TTL.");
}
@@ -1728,31 +1702,29 @@ nsHostResolver::CompleteLookup(nsHostRec
return LOOKUP_OK;
}
void
nsHostResolver::CancelAsyncRequest(const char *host,
const OriginAttributes &aOriginAttributes,
uint16_t flags,
uint16_t af,
- const char *netInterface,
nsIDNSListener *aListener,
nsresult status)
{
MutexAutoLock lock(mLock);
nsAutoCString originSuffix;
aOriginAttributes.CreateSuffix(originSuffix);
// Lookup the host record associated with host, flags & address family
nsHostKey key(nsCString(host), flags, af,
(aOriginAttributes.mPrivateBrowsingId > 0),
- nsCString(netInterface),
originSuffix);
RefPtr<nsHostRecord> rec = mRecordDB.Get(key);
if (rec) {
nsHostRecord* recPtr = nullptr;
for (RefPtr<nsResolveHostCallback> c : rec->mCallbacks) {
if (c->EqualsAsyncListener(aListener)) {
c->remove();
@@ -1818,30 +1790,28 @@ nsHostResolver::ThreadFunc(void *arg)
if (!resolver->GetHostToLookup(getter_AddRefs(tmpRec))) {
break; // thread shutdown signal
}
// GetHostToLookup() returns an owning reference
MOZ_ASSERT(tmpRec);
rec.swap(tmpRec);
}
- LOG(("DNS lookup thread - Calling getaddrinfo for host [%s%s%s].\n",
- LOG_HOST(rec->host.get(), rec->netInterface.get())));
-
+ LOG(("DNS lookup thread - Calling getaddrinfo for host [%s].\n",
+ rec->host.get()));
+
TimeStamp startTime = TimeStamp::Now();
bool getTtl = rec->mGetTtl;
nsresult status = GetAddrInfo(rec->host.get(), rec->af,
- rec->flags,
- rec->netInterface.get(), &ai,
+ rec->flags, &ai,
getTtl);
#if defined(RES_RETRY_ON_FAILURE)
if (NS_FAILED(status) && rs.Reset()) {
status = GetAddrInfo(rec->host.get(), rec->af,
- rec->flags, rec->netInterface.get(), &ai,
- getTtl);
+ rec->flags, &ai, getTtl);
}
#endif
{ // obtain lock to check shutdown and manage inter-module telemetry
MutexAutoLock lock(resolver->mLock);
if (!resolver->mShutdown) {
TimeDuration elapsed = TimeStamp::Now() - startTime;
@@ -1861,24 +1831,23 @@ nsHostResolver::ThreadFunc(void *arg)
}
Telemetry::Accumulate(histogramID, millis);
} else {
Telemetry::Accumulate(Telemetry::DNS_FAILED_LOOKUP_TIME, millis);
}
}
}
- LOG(("DNS lookup thread - lookup completed for host [%s%s%s]: %s.\n",
- LOG_HOST(rec->host.get(), rec->netInterface.get()),
+ LOG(("DNS lookup thread - lookup completed for host [%s]: %s.\n",
+ rec->host.get(),
ai ? "success" : "failure: unknown host"));
if (LOOKUP_RESOLVEAGAIN == resolver->CompleteLookup(rec, status, ai, rec->pb)) {
// leave 'rec' assigned and loop to make a renewed host resolve
- LOG(("DNS lookup thread - Re-resolving host [%s%s%s].\n",
- LOG_HOST(rec->host.get(), rec->netInterface.get())));
+ LOG(("DNS lookup thread - Re-resolving host [%s].\n", rec->host.get()));
} else {
rec = nullptr;
}
} while(true);
resolver->mThreadCount--;
resolver = nullptr;
LOG(("DNS lookup thread - queue empty, thread finished.\n"));
@@ -1923,17 +1892,16 @@ nsHostResolver::GetDNSCacheEntries(nsTAr
MOZ_ASSERT(rec, "rec should never be null here!");
if (!rec || !rec->addr_info) {
continue;
}
DNSCacheEntries info;
info.hostname = rec->host;
info.family = rec->af;
- info.netInterface = rec->netInterface;
info.expiration =
(int64_t)(rec->mValidEnd - TimeStamp::NowLoRes()).ToSeconds();
if (info.expiration <= 0) {
// We only need valid DNS cache entries
continue;
}
{
--- a/netwerk/dns/nsHostResolver.h
+++ b/netwerk/dns/nsHostResolver.h
@@ -50,27 +50,24 @@ extern mozilla::Atomic<bool, mozilla::Re
MAX_RESOLVER_THREADS_FOR_HIGH_PRIORITY)
struct nsHostKey
{
const nsCString host;
uint16_t flags;
uint16_t af;
bool pb;
- const nsCString netInterface;
const nsCString originSuffix;
nsHostKey(const nsACString& host, uint16_t flags,
- uint16_t af, bool pb, const nsACString& netInterface,
- const nsACString& originSuffix)
+ uint16_t af, bool pb, const nsACString& originSuffix)
: host(host)
, flags(flags)
, af(af)
, pb(pb)
- , netInterface(netInterface)
, originSuffix(originSuffix) {
}
bool operator==(const nsHostKey& other) const;
size_t SizeOfExcludingThis(mozilla::MallocSizeOf mallocSizeOf) const;
PLDHashNumber Hash() const;
};
@@ -277,17 +274,16 @@ public:
enum LookupStatus {
LOOKUP_OK,
LOOKUP_RESOLVEAGAIN,
};
virtual LookupStatus CompleteLookup(nsHostRecord *, nsresult, mozilla::net::AddrInfo *, bool pb) = 0;
virtual nsresult GetHostRecord(const char *host,
uint16_t flags, uint16_t af, bool pb,
- const nsCString &netInterface,
const nsCString &originSuffix,
nsHostRecord **result)
{
return NS_ERROR_FAILURE;
}
virtual nsresult TrrLookup_unlocked(nsHostRecord *, mozilla::net::TRR *pushedTRR = nullptr)
{
return NS_ERROR_FAILURE;
@@ -332,45 +328,42 @@ public:
* above the callback will occur re-entrantly from an unspecified thread. the
* host lookup cannot be canceled (cancelation can be layered above this by
* having the callback implementation return without doing anything).
*/
nsresult ResolveHost(const char *hostname,
const mozilla::OriginAttributes &aOriginAttributes,
uint16_t flags,
uint16_t af,
- const char *netInterface,
nsResolveHostCallback *callback);
/**
* removes the specified callback from the nsHostRecord for the given
* hostname, originAttributes, flags, and address family. these parameters
* should correspond to the parameters passed to ResolveHost. this function
* executes the callback if the callback is still pending with the given status.
*/
void DetachCallback(const char *hostname,
const mozilla::OriginAttributes &aOriginAttributes,
uint16_t flags,
uint16_t af,
- const char *netInterface,
nsResolveHostCallback *callback,
nsresult status);
/**
* Cancels an async request associated with the hostname, originAttributes, flags,
* address family and listener. Cancels first callback found which matches
* these criteria. These parameters should correspond to the parameters
* passed to ResolveHost. If this is the last callback associated with the
* host record, it is removed from any request queues it might be on.
*/
void CancelAsyncRequest(const char *host,
const mozilla::OriginAttributes &aOriginAttributes,
uint16_t flags,
uint16_t af,
- const char *netInterface,
nsIDNSListener *aListener,
nsresult status);
/**
* values for the flags parameter passed to ResolveHost and DetachCallback
* that may be bitwise OR'd together.
*
* NOTE: in this implementation, these flags correspond exactly in value
* to the flags defined on nsIDNSService.
@@ -394,17 +387,16 @@ public:
/**
* Flush the DNS cache.
*/
void FlushCache();
LookupStatus CompleteLookup(nsHostRecord *, nsresult, mozilla::net::AddrInfo *, bool pb) override;
nsresult GetHostRecord(const char *host,
uint16_t flags, uint16_t af, bool pb,
- const nsCString &netInterface,
const nsCString &originSuffix,
nsHostRecord **result) override;
nsresult TrrLookup_unlocked(nsHostRecord *, mozilla::net::TRR *pushedTRR = nullptr) override;
private:
explicit nsHostResolver(uint32_t maxCacheEntries,
uint32_t defaultCacheEntryLifetime,
uint32_t defaultGracePeriod);
--- a/netwerk/dns/nsIDNSService.idl
+++ b/netwerk/dns/nsIDNSService.idl
@@ -124,61 +124,16 @@ interface nsIDNSService : nsISupports
[notxpcom]
nsresult resolveNative(in AUTF8String aHostName,
in unsigned long aFlags,
in OriginAttributes aOriginAttributes,
out nsIDNSRecord aResult);
/**
- * kicks off an asynchronous host lookup.
- *
- * This function is identical to asyncResolve except an additional
- * parameter aNetwortInterface. If parameter aNetworkInterface is an empty
- * string function will return the same result as asyncResolve.
- * Setting aNetworkInterface is deprecated.
- */
- [implicit_jscontext, optional_argc]
- nsICancelable asyncResolveExtended(in AUTF8String aHostName,
- in unsigned long aFlags,
- in AUTF8String aNetworkInterface,
- in nsIDNSListener aListener,
- in nsIEventTarget aListenerTarget,
- [optional] in jsval aOriginAttributes);
-
- [notxpcom]
- nsresult asyncResolveExtendedNative(in AUTF8String aHostName,
- in unsigned long aFlags,
- in AUTF8String aNetworkInterface,
- in nsIDNSListener aListener,
- in nsIEventTarget aListenerTarget,
- in OriginAttributes aOriginAttributes,
- out nsICancelable aResult);
-
- /**
- * Attempts to cancel a previously requested async DNS lookup
- * This is an extended versin with a additional parameter aNetworkInterface
- */
- [implicit_jscontext, optional_argc]
- void cancelAsyncResolveExtended(in AUTF8String aHostName,
- in unsigned long aFlags,
- in AUTF8String aNetworkInterface,
- in nsIDNSListener aListener,
- in nsresult aReason,
- [optional] in jsval aOriginAttributes);
-
- [notxpcom]
- nsresult cancelAsyncResolveExtendedNative(in AUTF8String aHostName,
- in unsigned long aFlags,
- in AUTF8String aNetworkInterface,
- in nsIDNSListener aListener,
- in nsresult aReason,
- in OriginAttributes aOriginAttributes);
-
- /**
* The method takes a pointer to an nsTArray
* and fills it with cache entry data
* Called by the networking dashboard
*/
[noscript] void getDNSCacheEntries(in EntriesArray args);
/**
* @return the hostname of the operating system.
--- a/netwerk/ipc/NeckoChild.cpp
+++ b/netwerk/ipc/NeckoChild.cpp
@@ -318,18 +318,17 @@ NeckoChild::DeallocPUDPSocketChild(PUDPS
UDPSocketChild* p = static_cast<UDPSocketChild*>(child);
p->ReleaseIPDLReference();
return true;
}
PDNSRequestChild*
NeckoChild::AllocPDNSRequestChild(const nsCString& aHost,
const OriginAttributes& aOriginAttributes,
- const uint32_t& aFlags,
- const nsCString& aNetworkInterface)
+ const uint32_t& aFlags)
{
// We don't allocate here: instead we always use IPDL constructor that takes
// an existing object
NS_NOTREACHED("AllocPDNSRequestChild should not be called on child");
return nullptr;
}
bool
--- a/netwerk/ipc/NeckoChild.h
+++ b/netwerk/ipc/NeckoChild.h
@@ -59,18 +59,17 @@ protected:
const uint16_t& aBacklog,
const bool& aUseArrayBuffers) override;
virtual bool DeallocPTCPServerSocketChild(PTCPServerSocketChild*) override;
virtual PUDPSocketChild* AllocPUDPSocketChild(const Principal& aPrincipal,
const nsCString& aFilter) override;
virtual bool DeallocPUDPSocketChild(PUDPSocketChild*) override;
virtual PDNSRequestChild* AllocPDNSRequestChild(const nsCString& aHost,
const OriginAttributes& aOriginAttributes,
- const uint32_t& aFlags,
- const nsCString& aNetworkInterface) override;
+ const uint32_t& aFlags) override;
virtual bool DeallocPDNSRequestChild(PDNSRequestChild*) override;
virtual PDataChannelChild* AllocPDataChannelChild(const uint32_t& channelId) override;
virtual bool DeallocPDataChannelChild(PDataChannelChild* child) override;
virtual PFileChannelChild* AllocPFileChannelChild(const uint32_t& channelId) override;
virtual bool DeallocPFileChannelChild(PFileChannelChild* child) override;
virtual PSimpleChannelChild* AllocPSimpleChannelChild(const uint32_t& channelId) override;
virtual bool DeallocPSimpleChannelChild(PSimpleChannelChild* child) override;
virtual PChannelDiverterChild*
--- a/netwerk/ipc/NeckoParent.cpp
+++ b/netwerk/ipc/NeckoParent.cpp
@@ -644,35 +644,32 @@ NeckoParent::DeallocPUDPSocketParent(PUD
UDPSocketParent* p = static_cast<UDPSocketParent*>(actor);
p->Release();
return true;
}
PDNSRequestParent*
NeckoParent::AllocPDNSRequestParent(const nsCString& aHost,
const OriginAttributes& aOriginAttributes,
- const uint32_t& aFlags,
- const nsCString& aNetworkInterface)
+ const uint32_t& aFlags)
{
DNSRequestParent *p = new DNSRequestParent();
p->AddRef();
return p;
}
mozilla::ipc::IPCResult
NeckoParent::RecvPDNSRequestConstructor(PDNSRequestParent* aActor,
const nsCString& aHost,
const OriginAttributes& aOriginAttributes,
- const uint32_t& aFlags,
- const nsCString& aNetworkInterface)
+ const uint32_t& aFlags)
{
static_cast<DNSRequestParent*>(aActor)->DoAsyncResolve(aHost,
aOriginAttributes,
- aFlags,
- aNetworkInterface);
+ aFlags);
return IPC_OK();
}
bool
NeckoParent::DeallocPDNSRequestParent(PDNSRequestParent* aParent)
{
DNSRequestParent *p = static_cast<DNSRequestParent*>(aParent);
p->Release();
--- a/netwerk/ipc/NeckoParent.h
+++ b/netwerk/ipc/NeckoParent.h
@@ -148,23 +148,21 @@ protected:
virtual PUDPSocketParent* AllocPUDPSocketParent(const Principal& aPrincipal,
const nsCString& aFilter) override;
virtual mozilla::ipc::IPCResult RecvPUDPSocketConstructor(PUDPSocketParent*,
const Principal& aPrincipal,
const nsCString& aFilter) override;
virtual bool DeallocPUDPSocketParent(PUDPSocketParent*) override;
virtual PDNSRequestParent* AllocPDNSRequestParent(const nsCString& aHost,
const OriginAttributes& aOriginAttributes,
- const uint32_t& aFlags,
- const nsCString& aNetworkInterface) override;
+ const uint32_t& aFlags) override;
virtual mozilla::ipc::IPCResult RecvPDNSRequestConstructor(PDNSRequestParent* actor,
const nsCString& hostName,
const OriginAttributes& aOriginAttributes,
- const uint32_t& flags,
- const nsCString& aNetworkInterface) override;
+ const uint32_t& flags) override;
virtual bool DeallocPDNSRequestParent(PDNSRequestParent*) override;
virtual mozilla::ipc::IPCResult RecvSpeculativeConnect(const URIParams& aURI,
const Principal& aPrincipal,
const bool& aAnonymous) override;
virtual mozilla::ipc::IPCResult RecvHTMLDNSPrefetch(const nsString& hostname,
const OriginAttributes& aOriginAttributes,
const uint16_t& flags) override;
virtual mozilla::ipc::IPCResult RecvCancelHTMLDNSPrefetch(const nsString& hostname,
--- a/netwerk/ipc/PNecko.ipdl
+++ b/netwerk/ipc/PNecko.ipdl
@@ -75,17 +75,17 @@ parent:
FTPChannelCreationArgs args);
async PWebSocket(PBrowserOrId browser, SerializedLoadContext loadContext,
uint32_t aSerialID);
async PTCPServerSocket(uint16_t localPort, uint16_t backlog, bool useArrayBuffers);
async PUDPSocket(Principal principal, nsCString filter);
async PDNSRequest(nsCString hostName, OriginAttributes originAttributes,
- uint32_t flags, nsCString networkInterface);
+ uint32_t flags);
async PWebSocketEventListener(uint64_t aInnerWindowID);
/* Predictor Methods */
async PredPredict(OptionalURIParams targetURI, OptionalURIParams sourceURI,
uint32_t reason, OriginAttributes originAttributes,
bool hasVerifier);
async PredLearn(URIParams targetURI, OptionalURIParams sourceURI,
--- a/netwerk/protocol/http/HttpBaseChannel.cpp
+++ b/netwerk/protocol/http/HttpBaseChannel.cpp
@@ -1531,31 +1531,16 @@ HttpBaseChannel::SetRequestMethod(const
if (!nsHttp::IsValidToken(flatMethod))
return NS_ERROR_INVALID_ARG;
mRequestHead.SetMethod(flatMethod);
return NS_OK;
}
NS_IMETHODIMP
-HttpBaseChannel::GetNetworkInterfaceId(nsACString& aNetworkInterfaceId)
-{
- aNetworkInterfaceId = mNetworkInterfaceId;
- return NS_OK;
-}
-
-NS_IMETHODIMP
-HttpBaseChannel::SetNetworkInterfaceId(const nsACString& aNetworkInterfaceId)
-{
- ENSURE_CALLED_BEFORE_CONNECT();
- mNetworkInterfaceId = aNetworkInterfaceId;
- return NS_OK;
-}
-
-NS_IMETHODIMP
HttpBaseChannel::GetReferrer(nsIURI **referrer)
{
NS_ENSURE_ARG_POINTER(referrer);
*referrer = mReferrer;
NS_IF_ADDREF(*referrer);
return NS_OK;
}
--- a/netwerk/protocol/http/HttpBaseChannel.h
+++ b/netwerk/protocol/http/HttpBaseChannel.h
@@ -242,18 +242,16 @@ public:
NS_IMETHOD SetTlsFlags(uint32_t aTlsFlags) override;
NS_IMETHOD GetApiRedirectToURI(nsIURI * *aApiRedirectToURI) override;
virtual MOZ_MUST_USE nsresult AddSecurityMessage(const nsAString &aMessageTag, const nsAString &aMessageCategory);
NS_IMETHOD TakeAllSecurityMessages(nsCOMArray<nsISecurityConsoleMessage> &aMessages) override;
NS_IMETHOD GetResponseTimeoutEnabled(bool *aEnable) override;
NS_IMETHOD SetResponseTimeoutEnabled(bool aEnable) override;
NS_IMETHOD GetInitialRwin(uint32_t* aRwin) override;
NS_IMETHOD SetInitialRwin(uint32_t aRwin) override;
- NS_IMETHOD GetNetworkInterfaceId(nsACString& aNetworkInterfaceId) override;
- NS_IMETHOD SetNetworkInterfaceId(const nsACString& aNetworkInterfaceId) override;
NS_IMETHOD ForcePending(bool aForcePending) override;
NS_IMETHOD GetLastModifiedTime(PRTime* lastModifiedTime) override;
NS_IMETHOD GetCorsIncludeCredentials(bool* aInclude) override;
NS_IMETHOD SetCorsIncludeCredentials(bool aInclude) override;
NS_IMETHOD GetCorsMode(uint32_t* aCorsMode) override;
NS_IMETHOD SetCorsMode(uint32_t aCorsMode) override;
NS_IMETHOD GetRedirectMode(uint32_t* aRedirectMode) override;
NS_IMETHOD SetRedirectMode(uint32_t aRedirectMode) override;
@@ -670,19 +668,16 @@ protected:
// Defaults to false. Is set to true at the begining of OnStartRequest.
// Used to ensure methods can't be called before OnStartRequest.
bool mAfterOnStartRequestBegun;
uint64_t mTransferSize;
uint64_t mDecodedBodySize;
uint64_t mEncodedBodySize;
- // The network interface id that's associated with this channel.
- nsCString mNetworkInterfaceId;
-
uint64_t mRequestContextID;
bool EnsureRequestContextID();
nsCOMPtr<nsIRequestContext> mRequestContext;
bool EnsureRequestContext();
// Adds/removes this channel as a non-tailed request in its request context
// these helpers ensure we add it only once and remove it only when added
// via mAddedAsNonTailRequest member tracking.
--- a/netwerk/protocol/http/TunnelUtils.cpp
+++ b/netwerk/protocol/http/TunnelUtils.cpp
@@ -1598,28 +1598,16 @@ SocketTransportShim::GetHost(nsACString
NS_IMETHODIMP
SocketTransportShim::GetTimeout(uint32_t aType, uint32_t *_retval)
{
return mWrapped->GetTimeout(aType, _retval);
}
NS_IMETHODIMP
-SocketTransportShim::GetNetworkInterfaceId(nsACString &aNetworkInterfaceId)
-{
- return mWrapped->GetNetworkInterfaceId(aNetworkInterfaceId);
-}
-
-NS_IMETHODIMP
-SocketTransportShim::SetNetworkInterfaceId(const nsACString &aNetworkInterfaceId)
-{
- return mWrapped->SetNetworkInterfaceId(aNetworkInterfaceId);
-}
-
-NS_IMETHODIMP
SocketTransportShim::SetTimeout(uint32_t aType, uint32_t aValue)
{
return mWrapped->SetTimeout(aType, aValue);
}
NS_IMETHODIMP
SocketTransportShim::SetReuseAddrPort(bool aReuseAddrPort)
{
--- a/netwerk/protocol/http/nsHttpChannel.cpp
+++ b/netwerk/protocol/http/nsHttpChannel.cpp
@@ -6233,22 +6233,16 @@ nsHttpChannel::BeginConnect()
} else {
LOG(("nsHttpChannel %p Using default connection info", this));
mConnectionInfo = new nsHttpConnectionInfo(host, port, EmptyCString(), mUsername, proxyInfo,
originAttributes, isHttps);
Telemetry::Accumulate(Telemetry::HTTP_TRANSACTION_USE_ALTSVC, false);
}
- // Set network interface id only when it's not empty to avoid
- // rebuilding hash key.
- if (!mNetworkInterfaceId.IsEmpty()) {
- mConnectionInfo->SetNetworkInterfaceId(mNetworkInterfaceId);
- }
-
mAuthProvider =
do_CreateInstance("@mozilla.org/network/http-channel-auth-provider;1",
&rv);
if (NS_SUCCEEDED(rv))
rv = mAuthProvider->Init(this);
if (NS_FAILED(rv)) {
return rv;
}
--- a/netwerk/protocol/http/nsHttpConnectionInfo.cpp
+++ b/netwerk/protocol/http/nsHttpConnectionInfo.cpp
@@ -100,23 +100,16 @@ nsHttpConnectionInfo::Init(const nsACStr
resolveFlags & nsIProtocolProxyService::RESOLVE_ALWAYS_TUNNEL) {
mUsingConnect = true;
}
}
SetOriginServer(host, port);
}
-void
-nsHttpConnectionInfo::SetNetworkInterfaceId(const nsACString& aNetworkInterfaceId)
-{
- mNetworkInterfaceId = aNetworkInterfaceId;
- BuildHashKey();
-}
-
void nsHttpConnectionInfo::BuildHashKey()
{
//
// build hash key:
//
// the hash key uniquely identifies the connection type. two connections
// are "equal" if they end up talking the same protocol to the same server
// and are both used for anonymous or non-anonymous connection only;
@@ -142,21 +135,16 @@ void nsHttpConnectionInfo::BuildHashKey(
// byte 3 is P/. P is for a private browising channel
// byte 4 is I/. I is for insecure scheme on TLS for http:// uris
// byte 5 is X/. X is for disallow_spdy flag
// byte 6 is C/. C is for be Conservative
mHashKey.AssignLiteral(".......[tlsflags0x00000000]");
mHashKey.Append(keyHost);
- if (!mNetworkInterfaceId.IsEmpty()) {
- mHashKey.Append('(');
- mHashKey.Append(mNetworkInterfaceId);
- mHashKey.Append(')');
- }
mHashKey.Append(':');
mHashKey.AppendInt(keyPort);
if (!mUsername.IsEmpty()) {
mHashKey.Append('[');
mHashKey.Append(mUsername);
mHashKey.Append(']');
}
@@ -242,20 +230,16 @@ nsHttpConnectionInfo::Clone() const
clone = new nsHttpConnectionInfo(mOrigin, mOriginPort, mNPNToken, mUsername, mProxyInfo,
mOriginAttributes, mEndToEndSSL);
} else {
MOZ_ASSERT(mEndToEndSSL);
clone = new nsHttpConnectionInfo(mOrigin, mOriginPort, mNPNToken, mUsername, mProxyInfo,
mOriginAttributes, mRoutedHost, mRoutedPort);
}
- if (!mNetworkInterfaceId.IsEmpty()) {
- clone->SetNetworkInterfaceId(mNetworkInterfaceId);
- }
-
// Make sure the anonymous, insecure-scheme, and private flags are transferred
clone->SetAnonymous(GetAnonymous());
clone->SetPrivate(GetPrivate());
clone->SetInsecureScheme(GetInsecureScheme());
clone->SetNoSpdy(GetNoSpdy());
clone->SetBeConservative(GetBeConservative());
clone->SetTlsFlags(GetTlsFlags());
MOZ_ASSERT(clone->Equals(this));
@@ -277,19 +261,16 @@ nsHttpConnectionInfo::CloneAsDirectRoute
mOriginAttributes, mEndToEndSSL);
// Make sure the anonymous, insecure-scheme, and private flags are transferred
clone->SetAnonymous(GetAnonymous());
clone->SetPrivate(GetPrivate());
clone->SetInsecureScheme(GetInsecureScheme());
clone->SetNoSpdy(GetNoSpdy());
clone->SetBeConservative(GetBeConservative());
clone->SetTlsFlags(GetTlsFlags());
- if (!mNetworkInterfaceId.IsEmpty()) {
- clone->SetNetworkInterfaceId(mNetworkInterfaceId);
- }
clone.forget(outCI);
}
nsresult
nsHttpConnectionInfo::CreateWildCard(nsHttpConnectionInfo **outParam)
{
// T???mozilla.org:443 (https:proxy.ducksong.com:3128) [specifc form]
// TS??*:0 (https:proxy.ducksong.com:3128) [wildcard form]
--- a/netwerk/protocol/http/nsHttpConnectionInfo.h
+++ b/netwerk/protocol/http/nsHttpConnectionInfo.h
@@ -69,21 +69,16 @@ public:
const nsCString &GetOrigin() const { return mOrigin; }
const char *Origin() const { return mOrigin.get(); }
int32_t OriginPort() const { return mOriginPort; }
const nsCString &GetRoutedHost() const { return mRoutedHost; }
const char *RoutedHost() const { return mRoutedHost.get(); }
int32_t RoutedPort() const { return mRoutedPort; }
- // With overhead rebuilding the hash key. The initial
- // network interface is empty. So you can reduce one call
- // if there's no explicit route after ctor.
- void SetNetworkInterfaceId(const nsACString& aNetworkInterfaceId);
-
// OK to treat these as an infalible allocation
nsHttpConnectionInfo* Clone() const;
void CloneAsDirectRoute(nsHttpConnectionInfo **outParam);
MOZ_MUST_USE nsresult CreateWildCard(nsHttpConnectionInfo **outParam);
const char *ProxyHost() const { return mProxyInfo ? mProxyInfo->Host().get() : nullptr; }
int32_t ProxyPort() const { return mProxyInfo ? mProxyInfo->Port() : -1; }
const char *ProxyType() const { return mProxyInfo ? mProxyInfo->Type() : nullptr; }
@@ -120,18 +115,16 @@ public:
void SetBeConservative(bool aBeConservative)
{ mHashKey.SetCharAt(aBeConservative ? 'C' : '.', 6); }
bool GetBeConservative() const { return mHashKey.CharAt(6) == 'C'; }
void SetTlsFlags(uint32_t aTlsFlags);
uint32_t GetTlsFlags() const { return mTlsFlags; }
- const nsCString &GetNetworkInterfaceId() const { return mNetworkInterfaceId; }
-
const nsCString &GetNPNToken() { return mNPNToken; }
const nsCString &GetUsername() { return mUsername; }
const OriginAttributes &GetOriginAttributes() { return mOriginAttributes; }
// Returns true for any kind of proxy (http, socks, https, etc..)
bool UsingProxy();
@@ -164,17 +157,16 @@ private:
void SetOriginServer(const nsACString &host, int32_t port);
nsCString mOrigin;
int32_t mOriginPort;
nsCString mRoutedHost;
int32_t mRoutedPort;
nsCString mHashKey;
- nsCString mNetworkInterfaceId;
nsCString mUsername;
nsCOMPtr<nsProxyInfo> mProxyInfo;
bool mUsingHttpProxy;
bool mUsingHttpsProxy;
bool mEndToEndSSL;
bool mUsingConnect; // if will use CONNECT with http proxy
nsCString mNPNToken;
OriginAttributes mOriginAttributes;
--- a/netwerk/protocol/http/nsHttpConnectionMgr.cpp
+++ b/netwerk/protocol/http/nsHttpConnectionMgr.cpp
@@ -4113,20 +4113,16 @@ nsHalfOpenSocket::SetupStreams(nsISocket
const OriginAttributes& originAttributes = mEnt->mConnInfo->GetOriginAttributes();
if (originAttributes != OriginAttributes()) {
socketTransport->SetOriginAttributes(originAttributes);
}
socketTransport->SetQoSBits(gHttpHandler->GetQoSBits());
- if (!ci->GetNetworkInterfaceId().IsEmpty()) {
- socketTransport->SetNetworkInterfaceId(ci->GetNetworkInterfaceId());
- }
-
rv = socketTransport->SetEventSink(this, nullptr);
NS_ENSURE_SUCCESS(rv, rv);
rv = socketTransport->SetSecurityCallbacks(this);
NS_ENSURE_SUCCESS(rv, rv);
Telemetry::Accumulate(Telemetry::HTTP_CONNECTION_ENTRY_CACHE_HIT_1,
mEnt->mUsedForConnection);
--- a/netwerk/protocol/http/nsIHttpChannelInternal.idl
+++ b/netwerk/protocol/http/nsIHttpChannelInternal.idl
@@ -280,21 +280,16 @@ interface nsIHttpChannelInternal : nsISu
/**
* Set top-level window URI to this channel only when the topWindowURI
* is null and there is no window associated to this channel.
* Note that the current usage of this method is only for xpcshell test.
*/
[must_use] void setTopWindowURIIfUnknown(in nsIURI topWindowURI);
/**
- * The network interface id that's associated with this channel.
- */
- [must_use] attribute ACString networkInterfaceId;
-
- /**
* Read the proxy URI, which, if non-null, will be used to resolve
* proxies for this channel.
*/
[must_use] readonly attribute nsIURI proxyURI;
/**
* Make cross-origin CORS loads happen with a CORS preflight, and specify
* the CORS preflight parameters.
deleted file mode 100644
--- a/netwerk/test/unit/test_dns_per_interface.js
+++ /dev/null
@@ -1,86 +0,0 @@
-var dns = Cc["@mozilla.org/network/dns-service;1"].getService(Ci.nsIDNSService);
-
-// This test checks DNSService host resolver when a network interface is supplied
-// as well. In the test 3 request are sent: two with a network interface set
-// and one without a network interface.
-// All requests have the same host to be resolved and the same flags.
-// One of the request with the network interface will be canceled.
-// The request with and without a network interface should not be mixed during
-// the requests lifetime.
-
-var netInterface1 = "interface1";
-var netInterface2 = "interface2";
-
-// We are not using localhost because on e10s a host resolve callback is almost
-// always faster than a cancel request, therefore cancel operation would not be
-// tested.
-var hostname = "thisshouldnotexist.mozilla.com";
-
-// 3 requests.
-var requestWithInterfaceCanceled;
-var requestWithoutInterfaceNotCanceled;
-var requestWithInterfaceNotCanceled;
-
-var listener = {
- onLookupComplete: function(inRequest, inRecord, inStatus) {
- // Two requests should be resolved and one request should be canceled.
- // Since cancalation of a request is racy we will check only for not
- // canceled request - they should not be canceled.
- if ((inRequest == requestWithoutInterfaceNotCanceled) ||
- (inRequest == requestWithInterfaceNotCanceled)) {
- // This request should not be canceled.
- Assert.notEqual(inStatus, Cr.NS_ERROR_ABORT);
-
- do_test_finished();
- } else if (inRequest == requestWithInterfaceCanceled) {
- // We do not check the outcome for this one because it is racy -
- // whether the request cancelation is faster than resolving the request.
- do_test_finished();
- }
- },
- QueryInterface: function(aIID) {
- if (aIID.equals(Ci.nsIDNSListener) ||
- aIID.equals(Ci.nsISupports)) {
- return this;
- }
- throw Cr.NS_ERROR_NO_INTERFACE;
- }
-};
-
-const defaultOriginAttributes = {};
-
-function run_test() {
- var threadManager = Cc["@mozilla.org/thread-manager;1"]
- .getService(Ci.nsIThreadManager);
- var mainThread = threadManager.currentThread;
-
- var flags = Ci.nsIDNSService.RESOLVE_BYPASS_CACHE;
-
- // This one will be canceled.
- requestWithInterfaceCanceled = dns.asyncResolveExtended(hostname,
- flags,
- netInterface1,
- listener,
- mainThread,
- defaultOriginAttributes);
- requestWithInterfaceCanceled.cancel(Cr.NS_ERROR_ABORT);
-
- // This one will not be canceled. This is the request without a network
- // interface.
- requestWithoutInterfaceNotCanceled = dns.asyncResolve(hostname, flags, listener,
- mainThread,
- defaultOriginAttributes);
-
- // This one will not be canceled.
- requestWithInterfaceNotCanceled = dns.asyncResolveExtended(hostname,
- flags,
- netInterface2,
- listener,
- mainThread,
- defaultOriginAttributes);
- // We wait for notifications for the requests.
- // For each request onLookupComplete will be called.
- do_test_pending();
- do_test_pending();
- do_test_pending();
-}
--- a/netwerk/test/unit/xpcshell.ini
+++ b/netwerk/test/unit/xpcshell.ini
@@ -186,17 +186,16 @@ skip-if = bits != 32
[test_compareURIs.js]
[test_compressappend.js]
[test_content_encoding_gzip.js]
[test_content_sniffer.js]
[test_cookie_header.js]
[test_cookiejars.js]
[test_cookiejars_safebrowsing.js]
[test_dns_cancel.js]
-[test_dns_per_interface.js]
[test_data_protocol.js]
[test_dns_service.js]
[test_dns_offline.js]
[test_dns_onion.js]
[test_dns_originAttributes.js]
[test_dns_localredirect.js]
[test_dns_proxy_bypass.js]
[test_duplicate_headers.js]
deleted file mode 100644
--- a/netwerk/test/unit_ipc/test_dns_per_interface_wrap.js
+++ /dev/null
@@ -1,7 +0,0 @@
-//
-// Run test script in content process instead of chrome (xpcshell's default)
-//
-
-function run_test() {
- run_test_in_child("../unit/test_dns_per_interface.js");
-}
--- a/netwerk/test/unit_ipc/xpcshell.ini
+++ b/netwerk/test/unit_ipc/xpcshell.ini
@@ -8,17 +8,16 @@ support-files =
!/netwerk/test/unit/test_bug528292.js
!/netwerk/test/unit/test_cache-entry-id.js
!/netwerk/test/unit/test_cache_jar.js
!/netwerk/test/unit/test_cacheflags.js
!/netwerk/test/unit/test_channel_close.js
!/netwerk/test/unit/test_cookie_header.js
!/netwerk/test/unit/test_cookiejars.js
!/netwerk/test/unit/test_dns_cancel.js
- !/netwerk/test/unit/test_dns_per_interface.js
!/netwerk/test/unit/test_dns_service.js
!/netwerk/test/unit/test_duplicate_headers.js
!/netwerk/test/unit/test_event_sink.js
!/netwerk/test/unit/test_getHost.js
!/netwerk/test/unit/test_head.js
!/netwerk/test/unit/test_headers.js
!/netwerk/test/unit/test_httpsuspend.js
!/netwerk/test/unit/test_post.js
@@ -65,17 +64,16 @@ support-files =
[test_bug248970_cookie_wrap.js]
[test_cacheflags_wrap.js]
[test_cache-entry-id_wrap.js]
[test_cache_jar_wrap.js]
[test_channel_close_wrap.js]
[test_cookie_header_wrap.js]
[test_cookiejars_wrap.js]
[test_dns_cancel_wrap.js]
-[test_dns_per_interface_wrap.js]
[test_dns_service_wrap.js]
[test_duplicate_headers_wrap.js]
[test_event_sink_wrap.js]
[test_head_wrap.js]
[test_headers_wrap.js]
[test_httpsuspend_wrap.js]
[test_post_wrap.js]
[test_predictor_wrap.js]