mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-08 19:04:45 +00:00
Bug 1462357 - remove the channel and socket interface id r=bagder,baku
the id was a b2g feature only settable via chrome privd xhr and is no longer active in the code base MozReview-Commit-ID: 84GPNvhvjNb --HG-- extra : rebase_source : ab5c2229b98e1407b8b74ef2ee00dcfea45e046a
This commit is contained in:
parent
1c639cc220
commit
f18aa94399
@ -126,11 +126,6 @@ interface XMLHttpRequest : XMLHttpRequestEventTarget {
|
||||
[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);
|
||||
|
||||
|
@ -132,12 +132,6 @@ public:
|
||||
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,
|
||||
|
@ -1539,20 +1539,6 @@ XMLHttpRequestMainThread::SetOriginAttributes(const OriginAttributesDictionary&
|
||||
}
|
||||
}
|
||||
|
||||
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.
|
||||
*/
|
||||
@ -2789,8 +2775,6 @@ XMLHttpRequestMainThread::SendInternal(const BodyExtractorBase* aBody)
|
||||
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.
|
||||
|
@ -306,11 +306,6 @@ private:
|
||||
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
|
||||
@ -442,18 +437,6 @@ public:
|
||||
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,
|
||||
@ -741,10 +724,6 @@ protected:
|
||||
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.
|
||||
*/
|
||||
|
@ -148,18 +148,6 @@ public:
|
||||
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;
|
||||
|
||||
|
@ -65,13 +65,6 @@ interface nsISocketTransport : nsITransport
|
||||
[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.
|
||||
|
@ -39,7 +39,6 @@ class nsIInputStream;
|
||||
class nsIInputStreamPump;
|
||||
class nsIInterfaceRequestor;
|
||||
class nsINestedURI;
|
||||
class nsINetworkInterface;
|
||||
class nsIOutputStream;
|
||||
class nsIParentChannel;
|
||||
class nsIPersistentProperties;
|
||||
|
@ -1116,9 +1116,9 @@ nsSocketTransport::ResolveHost()
|
||||
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;
|
||||
@ -2674,22 +2674,6 @@ nsSocketTransport::GetPort(int32_t *port)
|
||||
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)
|
||||
|
@ -328,10 +328,6 @@ private:
|
||||
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;
|
||||
|
@ -57,7 +57,6 @@ void
|
||||
ChildDNSService::GetDNSRecordHashKey(const nsACString &aHost,
|
||||
const OriginAttributes &aOriginAttributes,
|
||||
uint32_t aFlags,
|
||||
const nsACString &aNetworkInterface,
|
||||
nsIDNSListener* aListener,
|
||||
nsACString &aHashKey)
|
||||
{
|
||||
@ -68,9 +67,6 @@ ChildDNSService::GetDNSRecordHashKey(const nsACString &aHost,
|
||||
aHashKey.Assign(originSuffix);
|
||||
|
||||
aHashKey.AppendInt(aFlags);
|
||||
if (!aNetworkInterface.IsEmpty()) {
|
||||
aHashKey.Append(aNetworkInterface);
|
||||
}
|
||||
aHashKey.AppendPrintf("%p", aListener);
|
||||
}
|
||||
|
||||
@ -97,9 +93,9 @@ ChildDNSService::AsyncResolve(const nsACString &hostname,
|
||||
}
|
||||
}
|
||||
|
||||
return AsyncResolveExtendedNative(hostname, flags, EmptyCString(),
|
||||
listener, target_, attrs,
|
||||
result);
|
||||
return AsyncResolveNative(hostname, flags,
|
||||
listener, target_, attrs,
|
||||
result);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
@ -109,45 +105,6 @@ ChildDNSService::AsyncResolveNative(const nsACString &hostname,
|
||||
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);
|
||||
|
||||
@ -183,13 +140,12 @@ ChildDNSService::AsyncResolveExtendedNative(const nsACString &hostname,
|
||||
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)) {
|
||||
@ -225,8 +181,8 @@ ChildDNSService::CancelAsyncResolve(const nsACString &aHostname,
|
||||
}
|
||||
}
|
||||
|
||||
return CancelAsyncResolveExtendedNative(aHostname, aFlags, EmptyCString(),
|
||||
aListener, aReason, attrs);
|
||||
return CancelAsyncResolveNative(aHostname, aFlags,
|
||||
aListener, aReason, attrs);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
@ -235,41 +191,6 @@ ChildDNSService::CancelAsyncResolveNative(const nsACString &aHostname,
|
||||
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;
|
||||
@ -279,7 +200,7 @@ ChildDNSService::CancelAsyncResolveExtendedNative(const nsACString &aHostname,
|
||||
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);
|
||||
@ -345,7 +266,7 @@ ChildDNSService::NotifyRequestDone(DNSRequestChild *aDnsRequest)
|
||||
|
||||
nsCString key;
|
||||
GetDNSRecordHashKey(aDnsRequest->mHost, aDnsRequest->mOriginAttributes, originalFlags,
|
||||
aDnsRequest->mNetworkInterface, originalListener, key);
|
||||
originalListener, key);
|
||||
|
||||
nsTArray<RefPtr<DNSRequestChild>> *hashEntry;
|
||||
|
||||
|
@ -43,7 +43,6 @@ private:
|
||||
void MOZ_ALWAYS_INLINE GetDNSRecordHashKey(const nsACString &aHost,
|
||||
const OriginAttributes &aOriginAttributes,
|
||||
uint32_t aFlags,
|
||||
const nsACString &aNetworkInterface,
|
||||
nsIDNSListener* aListener,
|
||||
nsACString &aHashKey);
|
||||
|
||||
|
@ -180,7 +180,6 @@ public:
|
||||
mDnsRequest->SendCancelDNSRequest(mDnsRequest->mHost,
|
||||
mDnsRequest->mOriginAttributes,
|
||||
mDnsRequest->mFlags,
|
||||
mDnsRequest->mNetworkInterface,
|
||||
mReasonForCancel);
|
||||
}
|
||||
return NS_OK;
|
||||
@ -197,7 +196,6 @@ private:
|
||||
DNSRequestChild::DNSRequestChild(const nsACString& aHost,
|
||||
const OriginAttributes& aOriginAttributes,
|
||||
const uint32_t& aFlags,
|
||||
const nsACString& aNetworkInterface,
|
||||
nsIDNSListener *aListener,
|
||||
nsIEventTarget *target)
|
||||
: mListener(aListener)
|
||||
@ -206,7 +204,6 @@ DNSRequestChild::DNSRequestChild(const nsACString& aHost,
|
||||
, mHost(aHost)
|
||||
, mOriginAttributes(aOriginAttributes)
|
||||
, mFlags(aFlags)
|
||||
, mNetworkInterface(aNetworkInterface)
|
||||
, mIPCOpen(false)
|
||||
{
|
||||
}
|
||||
@ -237,7 +234,7 @@ DNSRequestChild::StartRequest()
|
||||
|
||||
// Send request to Parent process.
|
||||
gNeckoChild->SendPDNSRequestConstructor(this, mHost, mOriginAttributes,
|
||||
mFlags, mNetworkInterface);
|
||||
mFlags);
|
||||
mIPCOpen = true;
|
||||
|
||||
// IPDL holds a reference until IPDL channel gets destroyed
|
||||
|
@ -27,7 +27,6 @@ public:
|
||||
DNSRequestChild(const nsACString& aHost,
|
||||
const OriginAttributes& aOriginAttributes,
|
||||
const uint32_t& aFlags,
|
||||
const nsACString& aNetworkInterface,
|
||||
nsIDNSListener *aListener, nsIEventTarget *target);
|
||||
|
||||
void AddIPDLReference() {
|
||||
@ -54,7 +53,6 @@ protected:
|
||||
nsCString mHost;
|
||||
const OriginAttributes mOriginAttributes;
|
||||
uint16_t mFlags;
|
||||
nsCString mNetworkInterface;
|
||||
bool mIPCOpen;
|
||||
};
|
||||
|
||||
|
@ -29,8 +29,7 @@ DNSRequestParent::DNSRequestParent()
|
||||
void
|
||||
DNSRequestParent::DoAsyncResolve(const nsACString &hostname,
|
||||
const OriginAttributes &originAttributes,
|
||||
uint32_t flags,
|
||||
const nsACString &networkInterface)
|
||||
uint32_t flags)
|
||||
{
|
||||
nsresult rv;
|
||||
mFlags = flags;
|
||||
@ -38,10 +37,9 @@ DNSRequestParent::DoAsyncResolve(const nsACString &hostname,
|
||||
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) {
|
||||
@ -54,16 +52,14 @@ 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();
|
||||
}
|
||||
|
@ -26,15 +26,13 @@ public:
|
||||
|
||||
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;
|
||||
|
||||
|
@ -250,8 +250,7 @@ _GetTTLData_Windows(const char* aHost, uint32_t* aResult, uint16_t aAddressFamil
|
||||
|
||||
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);
|
||||
@ -322,7 +321,7 @@ GetAddrInfoShutdown() {
|
||||
|
||||
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;
|
||||
@ -343,7 +342,7 @@ GetAddrInfo(const char* aHost, uint16_t aAddressFamily, uint16_t aFlags,
|
||||
|
||||
*aAddrInfo = nullptr;
|
||||
nsresult rv = _GetAddrInfo_Portable(aHost, aAddressFamily, aFlags,
|
||||
aNetworkInterface, aAddrInfo);
|
||||
aAddrInfo);
|
||||
|
||||
#ifdef DNSQUERY_AVAILABLE
|
||||
if (aGetTtl && NS_SUCCEEDED(rv)) {
|
||||
|
@ -38,7 +38,7 @@ class AddrInfo;
|
||||
*/
|
||||
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.
|
||||
|
@ -26,8 +26,7 @@ parent:
|
||||
// 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:
|
||||
|
@ -396,7 +396,7 @@ TRR::ReceivePush(nsIHttpChannel *pushed, nsHostRecord *pushedRec)
|
||||
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)) {
|
||||
|
@ -317,15 +317,14 @@ public:
|
||||
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
|
||||
@ -341,7 +340,6 @@ public:
|
||||
nsCOMPtr<nsIDNSListener> mListener;
|
||||
uint16_t mFlags;
|
||||
uint16_t mAF;
|
||||
nsCString mNetworkInterface;
|
||||
private:
|
||||
virtual ~nsDNSAsyncRequest() = default;
|
||||
};
|
||||
@ -396,7 +394,7 @@ 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;
|
||||
}
|
||||
|
||||
@ -810,57 +808,17 @@ nsDNSService::AsyncResolve(const nsACString &aHostname,
|
||||
}
|
||||
}
|
||||
|
||||
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!!
|
||||
@ -912,13 +870,11 @@ nsDNSService::AsyncResolveExtendedNative(const nsACString &aHostname,
|
||||
|
||||
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;
|
||||
}
|
||||
@ -941,8 +897,8 @@ nsDNSService::CancelAsyncResolve(const nsACString &aHostname,
|
||||
}
|
||||
}
|
||||
|
||||
return CancelAsyncResolveExtendedNative(aHostname, aFlags, EmptyCString(),
|
||||
aListener, aReason, attrs);
|
||||
return CancelAsyncResolveNative(aHostname, aFlags,
|
||||
aListener, aReason, attrs);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
@ -951,41 +907,6 @@ nsDNSService::CancelAsyncResolveNative(const nsACString &aHostname,
|
||||
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!!
|
||||
@ -1014,8 +935,7 @@ nsDNSService::CancelAsyncResolveExtendedNative(const nsACString &aHostname
|
||||
uint16_t af = GetAFForLookup(hostname, aFlags);
|
||||
|
||||
res->CancelAsyncRequest(hostname.get(), aOriginAttributes, aFlags, af,
|
||||
nsPromiseFlatCString(aNetworkInterface).get(), aListener,
|
||||
aReason);
|
||||
aListener, aReason);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@ -1114,7 +1034,7 @@ nsDNSService::ResolveInternal(const nsACString &aHostname,
|
||||
|
||||
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) {
|
||||
|
@ -81,10 +81,6 @@ LazyLogModule gHostResolverLog("nsHostResolver");
|
||||
}
|
||||
}
|
||||
|
||||
#define LOG_HOST(host, interface) host, \
|
||||
(interface && interface[0] != '\0') ? " on interface " : "", \
|
||||
(interface && interface[0] != '\0') ? interface : ""
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
#if defined(RES_RETRY_ON_FAILURE)
|
||||
@ -161,7 +157,6 @@ 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;
|
||||
}
|
||||
|
||||
@ -169,7 +164,7 @@ 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
|
||||
@ -177,7 +172,6 @@ nsHostKey::SizeOfExcludingThis(mozilla::MallocSizeOf mallocSizeOf) const
|
||||
{
|
||||
size_t n = 0;
|
||||
n += host.SizeOfExcludingThisIfUnshared(mallocSizeOf);
|
||||
n += netInterface.SizeOfExcludingThisIfUnshared(mallocSizeOf);
|
||||
n += originSuffix.SizeOfExcludingThisIfUnshared(mallocSizeOf);
|
||||
return n;
|
||||
}
|
||||
@ -342,8 +336,8 @@ 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()) {
|
||||
@ -358,8 +352,7 @@ nsHostRecord::Blacklisted(NetAddr *aQuery)
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
@ -371,9 +364,8 @@ 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;
|
||||
|
||||
@ -383,7 +375,7 @@ nsHostRecord::ReportUnusable(NetAddr *aAddress)
|
||||
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));
|
||||
}
|
||||
}
|
||||
@ -392,8 +384,8 @@ 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();
|
||||
}
|
||||
|
||||
@ -717,13 +709,11 @@ nsHostResolver::Shutdown()
|
||||
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) {
|
||||
@ -746,13 +736,11 @@ 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" : ""));
|
||||
|
||||
@ -789,7 +777,6 @@ nsHostResolver::ResolveHost(const char *host,
|
||||
|
||||
nsHostKey key(nsCString(host), flags, af,
|
||||
(aOriginAttributes.mPrivateBrowsingId > 0),
|
||||
nsCString(netInterface),
|
||||
originSuffix);
|
||||
RefPtr<nsHostRecord>& entry = mRecordDB.GetOrInsert(key);
|
||||
if (!entry) {
|
||||
@ -800,8 +787,7 @@ nsHostResolver::ResolveHost(const char *host,
|
||||
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);
|
||||
@ -812,8 +798,7 @@ nsHostResolver::ResolveHost(const char *host,
|
||||
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;
|
||||
@ -842,16 +827,14 @@ nsHostResolver::ResolveHost(const char *host,
|
||||
!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
|
||||
@ -862,7 +845,7 @@ nsHostResolver::ResolveHost(const char *host,
|
||||
// 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();
|
||||
@ -871,8 +854,7 @@ nsHostResolver::ResolveHost(const char *host,
|
||||
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
|
||||
@ -924,8 +906,7 @@ nsHostResolver::ResolveHost(const char *host,
|
||||
// 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;
|
||||
@ -937,8 +918,7 @@ nsHostResolver::ResolveHost(const char *host,
|
||||
// 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();
|
||||
@ -953,9 +933,9 @@ nsHostResolver::ResolveHost(const char *host,
|
||||
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) {
|
||||
@ -964,11 +944,10 @@ nsHostResolver::ResolveHost(const char *host,
|
||||
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) {
|
||||
@ -1016,7 +995,6 @@ nsHostResolver::DetachCallback(const char *host,
|
||||
const OriginAttributes &aOriginAttributes,
|
||||
uint16_t flags,
|
||||
uint16_t af,
|
||||
const char *netInterface,
|
||||
nsResolveHostCallback *aCallback,
|
||||
nsresult status)
|
||||
{
|
||||
@ -1031,7 +1009,6 @@ nsHostResolver::DetachCallback(const char *host,
|
||||
|
||||
nsHostKey key(nsCString(host), flags, af,
|
||||
(aOriginAttributes.mPrivateBrowsingId > 0),
|
||||
nsCString(netInterface),
|
||||
originSuffix);
|
||||
RefPtr<nsHostRecord> entry = mRecordDB.Get(key);
|
||||
if (entry) {
|
||||
@ -1082,8 +1059,7 @@ nsHostResolver::ConditionallyCreateThread(nsHostRecord *rec)
|
||||
}
|
||||
}
|
||||
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;
|
||||
}
|
||||
@ -1399,9 +1375,8 @@ nsHostResolver::PrepareRecordExpiration(nsHostRecord* rec) const
|
||||
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;
|
||||
}
|
||||
|
||||
@ -1418,8 +1393,8 @@ nsHostResolver::PrepareRecordExpiration(nsHostRecord* rec) const
|
||||
}
|
||||
|
||||
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
|
||||
@ -1714,8 +1689,7 @@ nsHostResolver::CompleteLookup(nsHostRecord* rec, nsresult status, AddrInfo* aNe
|
||||
}
|
||||
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;
|
||||
@ -1733,7 +1707,6 @@ nsHostResolver::CancelAsyncRequest(const char *host,
|
||||
const OriginAttributes &aOriginAttributes,
|
||||
uint16_t flags,
|
||||
uint16_t af,
|
||||
const char *netInterface,
|
||||
nsIDNSListener *aListener,
|
||||
nsresult status)
|
||||
|
||||
@ -1747,7 +1720,6 @@ nsHostResolver::CancelAsyncRequest(const char *host,
|
||||
|
||||
nsHostKey key(nsCString(host), flags, af,
|
||||
(aOriginAttributes.mPrivateBrowsingId > 0),
|
||||
nsCString(netInterface),
|
||||
originSuffix);
|
||||
RefPtr<nsHostRecord> rec = mRecordDB.Get(key);
|
||||
if (rec) {
|
||||
@ -1823,20 +1795,18 @@ nsHostResolver::ThreadFunc(void *arg)
|
||||
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
|
||||
|
||||
@ -1866,14 +1836,13 @@ nsHostResolver::ThreadFunc(void *arg)
|
||||
}
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
@ -1928,7 +1897,6 @@ nsHostResolver::GetDNSCacheEntries(nsTArray<DNSCacheEntries> *args)
|
||||
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) {
|
||||
|
@ -55,17 +55,14 @@ struct nsHostKey
|
||||
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) {
|
||||
}
|
||||
|
||||
@ -282,7 +279,6 @@ public:
|
||||
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)
|
||||
{
|
||||
@ -337,7 +333,6 @@ public:
|
||||
const mozilla::OriginAttributes &aOriginAttributes,
|
||||
uint16_t flags,
|
||||
uint16_t af,
|
||||
const char *netInterface,
|
||||
nsResolveHostCallback *callback);
|
||||
|
||||
/**
|
||||
@ -350,7 +345,6 @@ public:
|
||||
const mozilla::OriginAttributes &aOriginAttributes,
|
||||
uint16_t flags,
|
||||
uint16_t af,
|
||||
const char *netInterface,
|
||||
nsResolveHostCallback *callback,
|
||||
nsresult status);
|
||||
|
||||
@ -365,7 +359,6 @@ public:
|
||||
const mozilla::OriginAttributes &aOriginAttributes,
|
||||
uint16_t flags,
|
||||
uint16_t af,
|
||||
const char *netInterface,
|
||||
nsIDNSListener *aListener,
|
||||
nsresult status);
|
||||
/**
|
||||
@ -399,7 +392,6 @@ public:
|
||||
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;
|
||||
|
@ -128,51 +128,6 @@ interface nsIDNSService : nsISupports
|
||||
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
|
||||
|
@ -323,8 +323,7 @@ NeckoChild::DeallocPUDPSocketChild(PUDPSocketChild* child)
|
||||
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
|
||||
|
@ -64,8 +64,7 @@ protected:
|
||||
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;
|
||||
|
@ -649,8 +649,7 @@ NeckoParent::DeallocPUDPSocketParent(PUDPSocketParent* actor)
|
||||
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();
|
||||
@ -661,13 +660,11 @@ 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();
|
||||
}
|
||||
|
||||
|
@ -153,13 +153,11 @@ protected:
|
||||
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,
|
||||
|
@ -80,7 +80,7 @@ parent:
|
||||
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);
|
||||
|
||||
|
@ -1535,21 +1535,6 @@ HttpBaseChannel::SetRequestMethod(const nsACString& aMethod)
|
||||
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)
|
||||
{
|
||||
|
@ -247,8 +247,6 @@ public:
|
||||
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;
|
||||
@ -675,9 +673,6 @@ protected:
|
||||
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;
|
||||
|
@ -1602,18 +1602,6 @@ 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)
|
||||
{
|
||||
|
@ -6238,12 +6238,6 @@ nsHttpChannel::BeginConnect()
|
||||
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);
|
||||
|
@ -105,13 +105,6 @@ nsHttpConnectionInfo::Init(const nsACString &host, int32_t port,
|
||||
SetOriginServer(host, port);
|
||||
}
|
||||
|
||||
void
|
||||
nsHttpConnectionInfo::SetNetworkInterfaceId(const nsACString& aNetworkInterfaceId)
|
||||
{
|
||||
mNetworkInterfaceId = aNetworkInterfaceId;
|
||||
BuildHashKey();
|
||||
}
|
||||
|
||||
void nsHttpConnectionInfo::BuildHashKey()
|
||||
{
|
||||
//
|
||||
@ -147,11 +140,6 @@ void nsHttpConnectionInfo::BuildHashKey()
|
||||
mHashKey.AssignLiteral(".......[tlsflags0x00000000]");
|
||||
|
||||
mHashKey.Append(keyHost);
|
||||
if (!mNetworkInterfaceId.IsEmpty()) {
|
||||
mHashKey.Append('(');
|
||||
mHashKey.Append(mNetworkInterfaceId);
|
||||
mHashKey.Append(')');
|
||||
}
|
||||
mHashKey.Append(':');
|
||||
mHashKey.AppendInt(keyPort);
|
||||
if (!mUsername.IsEmpty()) {
|
||||
@ -247,10 +235,6 @@ nsHttpConnectionInfo::Clone() const
|
||||
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());
|
||||
@ -282,9 +266,6 @@ nsHttpConnectionInfo::CloneAsDirectRoute(nsHttpConnectionInfo **outCI)
|
||||
clone->SetNoSpdy(GetNoSpdy());
|
||||
clone->SetBeConservative(GetBeConservative());
|
||||
clone->SetTlsFlags(GetTlsFlags());
|
||||
if (!mNetworkInterfaceId.IsEmpty()) {
|
||||
clone->SetNetworkInterfaceId(mNetworkInterfaceId);
|
||||
}
|
||||
clone.forget(outCI);
|
||||
}
|
||||
|
||||
|
@ -74,11 +74,6 @@ public:
|
||||
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);
|
||||
@ -125,8 +120,6 @@ public:
|
||||
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; }
|
||||
|
||||
@ -169,7 +162,6 @@ private:
|
||||
int32_t mRoutedPort;
|
||||
|
||||
nsCString mHashKey;
|
||||
nsCString mNetworkInterfaceId;
|
||||
nsCString mUsername;
|
||||
nsCOMPtr<nsProxyInfo> mProxyInfo;
|
||||
bool mUsingHttpProxy;
|
||||
|
@ -4118,10 +4118,6 @@ nsHalfOpenSocket::SetupStreams(nsISocketTransport **transport,
|
||||
|
||||
socketTransport->SetQoSBits(gHttpHandler->GetQoSBits());
|
||||
|
||||
if (!ci->GetNetworkInterfaceId().IsEmpty()) {
|
||||
socketTransport->SetNetworkInterfaceId(ci->GetNetworkInterfaceId());
|
||||
}
|
||||
|
||||
rv = socketTransport->SetEventSink(this, nullptr);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
|
@ -284,11 +284,6 @@ interface nsIHttpChannelInternal : nsISupports
|
||||
*/
|
||||
[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.
|
||||
|
@ -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();
|
||||
}
|
@ -191,7 +191,6 @@ skip-if = bits != 32
|
||||
[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]
|
||||
|
@ -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");
|
||||
}
|
@ -13,7 +13,6 @@ support-files =
|
||||
!/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
|
||||
@ -70,7 +69,6 @@ support-files =
|
||||
[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]
|
||||
|
Loading…
Reference in New Issue
Block a user