Bug 1337893 - Part 3: Updating Necko for DNS changes. r=valentin
authorTim Huang <tihuang@mozilla.com>
Wed, 15 Feb 2017 17:48:15 +0800
changeset 346279 a98c0d18ca5e674181625cbe6c07c5c85853c0f2
parent 346278 7405ef5589cc1f141c22bc2de596c010be4d6c17
child 346280 2e4be7d6a0a85c13e5205584dd1f4066d92324a4
push id87766
push usercbook@mozilla.com
push dateTue, 07 Mar 2017 14:18:49 +0000
treeherdermozilla-inbound@32132a071a4e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersvalentin
bugs1337893
milestone54.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1337893 - Part 3: Updating Necko for DNS changes. r=valentin MozReview-Commit-ID: AVEp3hP7XqB
netwerk/base/Dashboard.cpp
netwerk/base/Predictor.cpp
netwerk/base/ProxyAutoConfig.cpp
netwerk/base/nsDNSPrefetch.cpp
netwerk/base/nsDNSPrefetch.h
netwerk/base/nsSocketTransport2.cpp
netwerk/base/nsUDPSocket.cpp
netwerk/base/nsUDPSocket.h
netwerk/ipc/NeckoParent.cpp
netwerk/ipc/NeckoParent.h
netwerk/protocol/http/nsHttpChannel.cpp
netwerk/protocol/websocket/WebSocketChannel.cpp
netwerk/socket/nsSOCKSIOLayer.cpp
netwerk/test/unit/test_dns_cancel.js
netwerk/test/unit/test_dns_disable_ipv4.js
netwerk/test/unit/test_dns_disable_ipv6.js
netwerk/test/unit/test_dns_localredirect.js
netwerk/test/unit/test_dns_offline.js
netwerk/test/unit/test_dns_onion.js
netwerk/test/unit/test_dns_per_interface.js
netwerk/test/unit/test_dns_service.js
--- a/netwerk/base/Dashboard.cpp
+++ b/netwerk/base/Dashboard.cpp
@@ -743,19 +743,20 @@ Dashboard::RequestDNSLookup(const nsACSt
             return rv;
         }
     }
 
     RefPtr<LookupHelper> helper = new LookupHelper();
     helper->mCallback =
         new nsMainThreadPtrHolder<NetDashboardCallback>(aCallback, true);
     helper->mThread = NS_GetCurrentThread();
-    rv = mDnsService->AsyncResolve(aHost, 0, helper.get(),
-                                   NS_GetCurrentThread(),
-                                   getter_AddRefs(helper->mCancel));
+    OriginAttributes attrs;
+    rv = mDnsService->AsyncResolveNative(aHost, 0, helper.get(),
+                                         NS_GetCurrentThread(), attrs,
+                                         getter_AddRefs(helper->mCancel));
     return rv;
 }
 
 void
 HttpConnInfo::SetHTTP1ProtocolVersion(uint8_t pv)
 {
     switch (pv) {
     case NS_HTTP_VERSION_0_9:
--- a/netwerk/base/Predictor.cpp
+++ b/netwerk/base/Predictor.cpp
@@ -1440,21 +1440,21 @@ Predictor::RunPredictions(nsIURI *referr
   for (i = 0; i < len; ++i) {
     nsCOMPtr<nsIURI> uri = preresolves[i];
     ++totalPredictions;
     ++totalPreresolves;
     nsAutoCString hostname;
     uri->GetAsciiHost(hostname);
     PREDICTOR_LOG(("    doing preresolve %s", hostname.get()));
     nsCOMPtr<nsICancelable> tmpCancelable;
-    mDnsService->AsyncResolve(hostname,
-                              (nsIDNSService::RESOLVE_PRIORITY_MEDIUM |
-                               nsIDNSService::RESOLVE_SPECULATE),
-                              mDNSListener, nullptr,
-                              getter_AddRefs(tmpCancelable));
+    mDnsService->AsyncResolveNative(hostname,
+                                    (nsIDNSService::RESOLVE_PRIORITY_MEDIUM |
+                                     nsIDNSService::RESOLVE_SPECULATE),
+                                    mDNSListener, nullptr, originAttributes,
+                                    getter_AddRefs(tmpCancelable));
     predicted = true;
     if (verifier) {
       PREDICTOR_LOG(("    sending preresolve verification"));
       verifier->OnPredictDNS(uri);
     }
   }
 
   return predicted;
--- a/netwerk/base/ProxyAutoConfig.cpp
+++ b/netwerk/base/ProxyAutoConfig.cpp
@@ -400,22 +400,24 @@ ProxyAutoConfig::ResolveAddress(const ns
                                 NetAddr *aNetAddr,
                                 unsigned int aTimeout)
 {
   nsCOMPtr<nsIDNSService> dns = do_GetService(NS_DNSSERVICE_CONTRACTID);
   if (!dns)
     return false;
 
   RefPtr<PACResolver> helper = new PACResolver();
+  OriginAttributes attrs;
 
-  if (NS_FAILED(dns->AsyncResolve(aHostName,
-                                  nsIDNSService::RESOLVE_PRIORITY_MEDIUM,
-                                  helper,
-                                  NS_GetCurrentThread(),
-                                  getter_AddRefs(helper->mRequest))))
+  if (NS_FAILED(dns->AsyncResolveNative(aHostName,
+                                        nsIDNSService::RESOLVE_PRIORITY_MEDIUM,
+                                        helper,
+                                        NS_GetCurrentThread(),
+                                        attrs,
+                                        getter_AddRefs(helper->mRequest))))
     return false;
 
   if (aTimeout && helper->mRequest) {
     if (!mTimer)
       mTimer = do_CreateInstance(NS_TIMER_CONTRACTID);
     if (mTimer) {
       mTimer->InitWithCallback(helper, aTimeout, nsITimer::TYPE_ONE_SHOT);
       helper->mTimer = mTimer;
--- a/netwerk/base/nsDNSPrefetch.cpp
+++ b/netwerk/base/nsDNSPrefetch.cpp
@@ -27,19 +27,21 @@ nsDNSPrefetch::Initialize(nsIDNSService 
 nsresult
 nsDNSPrefetch::Shutdown()
 {
     NS_IF_RELEASE(sDNSService);
     return NS_OK;
 }
 
 nsDNSPrefetch::nsDNSPrefetch(nsIURI *aURI,
+                             mozilla::OriginAttributes& aOriginAttributes,
                              nsIDNSListener *aListener,
                              bool storeTiming)
-    : mStoreTiming(storeTiming)
+    : mOriginAttributes(aOriginAttributes)
+    , mStoreTiming(storeTiming)
     , mListener(do_GetWeakReference(aListener))
 {
     aURI->GetAsciiHost(mHostname);
 }
 
 nsresult 
 nsDNSPrefetch::Prefetch(uint16_t flags)
 {
@@ -53,20 +55,20 @@ nsDNSPrefetch::Prefetch(uint16_t flags)
 
     if (mStoreTiming)
         mStartTimestamp = mozilla::TimeStamp::Now();
     // If AsyncResolve fails, for example because prefetching is disabled,
     // then our timing will be useless. However, in such a case,
     // mEndTimestamp will be a null timestamp and callers should check
     // TimingsValid() before using the timing.
     nsCOMPtr<nsIThread> mainThread = do_GetMainThread();
-    return sDNSService->AsyncResolve(mHostname,
-                                     flags | nsIDNSService::RESOLVE_SPECULATE,
-                                     this, mainThread,
-                                     getter_AddRefs(tmpOutstanding));
+    return sDNSService->AsyncResolveNative(mHostname,
+                                           flags | nsIDNSService::RESOLVE_SPECULATE,
+                                           this, mainThread, mOriginAttributes,
+                                           getter_AddRefs(tmpOutstanding));
 }
 
 nsresult
 nsDNSPrefetch::PrefetchLow(bool refreshDNS)
 {
     return Prefetch(nsIDNSService::RESOLVE_PRIORITY_LOW |
       (refreshDNS ? nsIDNSService::RESOLVE_BYPASS_CACHE : 0));
 }
--- a/netwerk/base/nsDNSPrefetch.h
+++ b/netwerk/base/nsDNSPrefetch.h
@@ -5,31 +5,33 @@
 
 #ifndef nsDNSPrefetch_h___
 #define nsDNSPrefetch_h___
 
 #include "nsWeakReference.h"
 #include "nsString.h"
 #include "mozilla/TimeStamp.h"
 #include "mozilla/Attributes.h"
+#include "mozilla/BasePrincipal.h"
 
 #include "nsIDNSListener.h"
 
 class nsIURI;
 class nsIDNSService;
 
 class nsDNSPrefetch final : public nsIDNSListener
 {
     ~nsDNSPrefetch() {}
 
 public:
     NS_DECL_THREADSAFE_ISUPPORTS
     NS_DECL_NSIDNSLISTENER
   
-    nsDNSPrefetch(nsIURI *aURI, nsIDNSListener *aListener, bool storeTiming);
+    nsDNSPrefetch(nsIURI *aURI, mozilla::OriginAttributes& aOriginAttributes,
+                  nsIDNSListener *aListener, bool storeTiming);
     bool TimingsValid() const {
         return !mStartTimestamp.IsNull() && !mEndTimestamp.IsNull();
     }
     // Only use the two timings if TimingsValid() returns true
     const mozilla::TimeStamp& StartTimestamp() const { return mStartTimestamp; }
     const mozilla::TimeStamp& EndTimestamp() const { return mEndTimestamp; }
 
     static nsresult Initialize(nsIDNSService *aDNSService);
@@ -37,16 +39,17 @@ public:
 
     // Call one of the following methods to start the Prefetch.
     nsresult PrefetchHigh(bool refreshDNS = false);
     nsresult PrefetchMedium(bool refreshDNS = false);
     nsresult PrefetchLow(bool refreshDNS = false);
   
 private:
     nsCString mHostname;
+    mozilla::OriginAttributes mOriginAttributes;
     bool mStoreTiming;
     mozilla::TimeStamp mStartTimestamp;
     mozilla::TimeStamp mEndTimestamp;
     nsWeakPtr mListener;
 
     nsresult Prefetch(uint16_t flags);
 };
 
--- a/netwerk/base/nsSocketTransport2.cpp
+++ b/netwerk/base/nsSocketTransport2.cpp
@@ -1096,18 +1096,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->AsyncResolveExtended(SocketHost(), dnsFlags, mNetworkInterfaceId, this,
-                                   nullptr, getter_AddRefs(mDNSRequest));
+    rv = dns->AsyncResolveExtendedNative(SocketHost(), dnsFlags, mNetworkInterfaceId,
+                                         this, nullptr, mOriginAttributes,
+                                         getter_AddRefs(mDNSRequest));
     if (NS_SUCCEEDED(rv)) {
         SOCKET_LOG(("  advancing to STATE_RESOLVING\n"));
         mState = STATE_RESOLVING;
     }
     return rv;
 }
 
 nsresult
--- a/netwerk/base/nsUDPSocket.cpp
+++ b/netwerk/base/nsUDPSocket.cpp
@@ -50,29 +50,30 @@ PostEvent(nsUDPSocket *s, nsUDPSocketFun
 {
   if (!gSocketTransportService)
     return NS_ERROR_FAILURE;
 
   return gSocketTransportService->Dispatch(NewRunnableMethod(s, func), NS_DISPATCH_NORMAL);
 }
 
 static nsresult
-ResolveHost(const nsACString &host, nsIDNSListener *listener)
+ResolveHost(const nsACString &host, const OriginAttributes& aOriginAttributes,
+            nsIDNSListener *listener)
 {
   nsresult rv;
 
   nsCOMPtr<nsIDNSService> dns =
       do_GetService("@mozilla.org/network/dns-service;1", &rv);
   if (NS_FAILED(rv)) {
     return rv;
   }
 
   nsCOMPtr<nsICancelable> tmpOutstanding;
-  return dns->AsyncResolve(host, 0, listener, nullptr,
-                           getter_AddRefs(tmpOutstanding));
+  return dns->AsyncResolveNative(host, 0, listener, nullptr, aOriginAttributes,
+                                 getter_AddRefs(tmpOutstanding));
 
 }
 
 static nsresult
 CheckIOStatus(const NetAddr *aAddr)
 {
   MOZ_ASSERT(gIOService);
 
@@ -259,16 +260,17 @@ nsUDPMessage::GetDataAsTArray()
 
 //-----------------------------------------------------------------------------
 // nsUDPSocket
 //-----------------------------------------------------------------------------
 
 nsUDPSocket::nsUDPSocket()
   : mLock("nsUDPSocket.mLock")
   , mFD(nullptr)
+  , mOriginAttributes()
   , mAttached(false)
   , mByteReadCount(0)
   , mByteWriteCount(0)
 {
   mAddr.raw.family = PR_AF_UNSPEC;
   // we want to be able to access the STS directly, and it may not have been
   // constructed yet.  the STS constructor sets gSocketTransportService.
   if (!gSocketTransportService)
@@ -621,16 +623,19 @@ nsUDPSocket::InitWithAddress(const NetAd
 
   rv = CheckIOStatus(aAddr);
   if (NS_FAILED(rv)) {
     return rv;
   }
 
   bool addressReuse = (aOptionalArgc == 1) ? aAddressReuse : true;
 
+  if (aPrincipal) {
+    mOriginAttributes = aPrincipal->OriginAttributesRef();
+  }
   //
   // configure listening socket...
   //
 
   mFD = PR_OpenUDPSocket(aAddr->raw.family);
   if (!mFD)
   {
     NS_WARNING("unable to create UDP socket");
@@ -1199,17 +1204,17 @@ nsUDPSocket::Send(const nsACString &aHos
 
   FallibleTArray<uint8_t> fallibleArray;
   if (!fallibleArray.InsertElementsAt(0, aData, aDataLength, fallible)) {
     return NS_ERROR_OUT_OF_MEMORY;
   }
 
   nsCOMPtr<nsIDNSListener> listener = new PendingSend(this, aPort, fallibleArray);
 
-  nsresult rv = ResolveHost(aHost, listener);
+  nsresult rv = ResolveHost(aHost, mOriginAttributes, listener);
   NS_ENSURE_SUCCESS(rv, rv);
 
   *_retval = aDataLength;
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsUDPSocket::SendWithAddr(nsINetAddr *aAddr, const uint8_t *aData,
@@ -1272,17 +1277,17 @@ nsUDPSocket::SendWithAddress(const NetAd
 NS_IMETHODIMP
 nsUDPSocket::SendBinaryStream(const nsACString &aHost, uint16_t aPort,
                               nsIInputStream *aStream)
 {
   NS_ENSURE_ARG(aStream);
 
   nsCOMPtr<nsIDNSListener> listener = new PendingSendStream(this, aPort, aStream);
 
-  return ResolveHost(aHost, listener);
+  return ResolveHost(aHost, mOriginAttributes, listener);
 }
 
 NS_IMETHODIMP
 nsUDPSocket::SendBinaryStreamWithAddress(const NetAddr *aAddr, nsIInputStream *aStream)
 {
   NS_ENSURE_ARG(aAddr);
   NS_ENSURE_ARG(aStream);
 
--- a/netwerk/base/nsUDPSocket.h
+++ b/netwerk/base/nsUDPSocket.h
@@ -60,16 +60,17 @@ private:
 
   void CloseSocket();
 
   // lock protects access to mListener;
   // so mListener is not cleared while being used/locked.
   Mutex                                mLock;
   PRFileDesc                          *mFD;
   NetAddr                              mAddr;
+  OriginAttributes                     mOriginAttributes;
   nsCOMPtr<nsIUDPSocketListener>       mListener;
   nsCOMPtr<nsIEventTarget>             mListenerTarget;
   bool                                 mAttached;
   RefPtr<nsSocketTransportService>     mSts;
 
   uint64_t   mByteReadCount;
   uint64_t   mByteWriteCount;
 };
--- a/netwerk/ipc/NeckoParent.cpp
+++ b/netwerk/ipc/NeckoParent.cpp
@@ -682,26 +682,28 @@ NeckoParent::RecvSpeculativeConnect(cons
     }
 
   }
   return IPC_OK();
 }
 
 mozilla::ipc::IPCResult
 NeckoParent::RecvHTMLDNSPrefetch(const nsString& hostname,
+                                 const OriginAttributes& aOriginAttributes,
                                  const uint16_t& flags)
 {
   nsHTMLDNSPrefetch::Prefetch(hostname, flags);
   return IPC_OK();
 }
 
 mozilla::ipc::IPCResult
 NeckoParent::RecvCancelHTMLDNSPrefetch(const nsString& hostname,
-                                 const uint16_t& flags,
-                                 const nsresult& reason)
+                                       const OriginAttributes& aOriginAttributes,
+                                       const uint16_t& flags,
+                                       const nsresult& reason)
 {
   nsHTMLDNSPrefetch::CancelPrefetch(hostname, flags, reason);
   return IPC_OK();
 }
 
 PChannelDiverterParent*
 NeckoParent::AllocPChannelDiverterParent(const ChannelDiverterArgs& channel)
 {
--- a/netwerk/ipc/NeckoParent.h
+++ b/netwerk/ipc/NeckoParent.h
@@ -157,18 +157,20 @@ protected:
                                                              const OriginAttributes& aOriginAttributes,
                                                              const uint32_t& flags,
                                                              const nsCString& aNetworkInterface) 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,
+                                                            const OriginAttributes& aOriginAttributes,
                                                             const uint16_t& flags,
                                                             const nsresult& reason) override;
   virtual PWebSocketEventListenerParent*
     AllocPWebSocketEventListenerParent(const uint64_t& aInnerWindowID) override;
   virtual bool DeallocPWebSocketEventListenerParent(PWebSocketEventListenerParent*) override;
 
   virtual PDataChannelParent*
     AllocPDataChannelParent(const uint32_t& channelId) override;
--- a/netwerk/protocol/http/nsHttpChannel.cpp
+++ b/netwerk/protocol/http/nsHttpChannel.cpp
@@ -6002,17 +6002,18 @@ nsHttpChannel::BeginConnect()
         // timing information from it. There is no guarantee that we actually
         // use the DNS prefetch data for the real connection, but as we keep
         // this data around for 3 minutes by default, this should almost always
         // be correct, and even when it isn't, the timing still represents _a_
         // valid DNS lookup timing for the site, even if it is not _the_
         // timing we used.
         LOG(("nsHttpChannel::BeginConnect [this=%p] prefetching%s\n",
              this, mCaps & NS_HTTP_REFRESH_DNS ? ", refresh requested" : ""));
-        mDNSPrefetch = new nsDNSPrefetch(mURI, this, mTimingEnabled);
+        mDNSPrefetch = new nsDNSPrefetch(mURI, originAttributes,
+                                         this, mTimingEnabled);
         mDNSPrefetch->PrefetchHigh(mCaps & NS_HTTP_REFRESH_DNS);
     }
 
     // Adjust mCaps according to our request headers:
     //  - If "Connection: close" is set as a request header, then do not bother
     //    trying to establish a keep-alive connection.
     if (mRequestHead.HasHeaderValue(nsHttp::Connection, "close"))
         mCaps &= ~(NS_HTTP_ALLOW_KEEPALIVE);
--- a/netwerk/protocol/websocket/WebSocketChannel.cpp
+++ b/netwerk/protocol/websocket/WebSocketChannel.cpp
@@ -2869,17 +2869,19 @@ WebSocketChannel::DoAdmissionDNS()
   NS_ENSURE_SUCCESS(rv, rv);
   if (mPort == -1)
     mPort = (mEncrypted ? kDefaultWSSPort : kDefaultWSPort);
   nsCOMPtr<nsIDNSService> dns = do_GetService(NS_DNSSERVICE_CONTRACTID, &rv);
   NS_ENSURE_SUCCESS(rv, rv);
   nsCOMPtr<nsIThread> mainThread;
   NS_GetMainThread(getter_AddRefs(mainThread));
   MOZ_ASSERT(!mCancelable);
-  return dns->AsyncResolve(hostName, 0, this, mainThread, getter_AddRefs(mCancelable));
+  return dns->AsyncResolveNative(hostName, 0, this,
+                                 mainThread, mLoadInfo->GetOriginAttributes(),
+                                 getter_AddRefs(mCancelable));
 }
 
 nsresult
 WebSocketChannel::ApplyForAdmission()
 {
   LOG(("WebSocketChannel::ApplyForAdmission() %p\n", this));
 
   // Websockets has a policy of 1 session at a time being allowed in the
--- a/netwerk/socket/nsSOCKSIOLayer.cpp
+++ b/netwerk/socket/nsSOCKSIOLayer.cpp
@@ -459,20 +459,22 @@ nsSOCKSSocketInfo::StartDNS(PRFileDesc *
 
     nsCOMPtr<nsIDNSService> dns = do_GetService(NS_DNSSERVICE_CONTRACTID);
     if (!dns)
         return PR_FAILURE;
 
     nsCString proxyHost;
     mProxy->GetHost(proxyHost);
 
+    mozilla::OriginAttributes attrs;
+
     mFD  = fd;
-    nsresult rv = dns->AsyncResolve(proxyHost, 0, this,
-                                    NS_GetCurrentThread(),
-                                    getter_AddRefs(mLookup));
+    nsresult rv = dns->AsyncResolveNative(proxyHost, 0, this,
+                                          NS_GetCurrentThread(), attrs,
+                                          getter_AddRefs(mLookup));
 
     if (NS_FAILED(rv)) {
         LOGERROR(("socks: DNS lookup for SOCKS proxy %s failed",
                   proxyHost.get()));
         return PR_FAILURE;
     }
     mState = SOCKS_DNS_IN_PROGRESS;
     PR_SetError(PR_IN_PROGRESS_ERROR, 0);
--- a/netwerk/test/unit/test_dns_cancel.js
+++ b/netwerk/test/unit/test_dns_cancel.js
@@ -49,35 +49,43 @@ var listener2 = {
     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 with cancelAsyncResolve.
-  requestList1Canceled1 = dns.asyncResolve(hostname2, flags, listener1, mainThread);
-  dns.cancelAsyncResolve(hostname2, flags, listener1, Cr.NS_ERROR_ABORT);
+  requestList1Canceled1 = dns.asyncResolve(hostname2, flags, listener1,
+                                           mainThread, defaultOriginAttributes);
+  dns.cancelAsyncResolve(hostname2, flags, listener1,
+                         Cr.NS_ERROR_ABORT, defaultOriginAttributes);
 
   // This one will not be canceled.
-  requestList1NotCanceled = dns.asyncResolve(hostname1, flags, listener1, mainThread);
+  requestList1NotCanceled = dns.asyncResolve(hostname1, flags, listener1,
+                                             mainThread, defaultOriginAttributes);
 
   // This one will be canceled with cancel(Cr.NS_ERROR_ABORT).
-  requestList1Canceled2 = dns.asyncResolve(hostname1, flags, listener1, mainThread);
+  requestList1Canceled2 = dns.asyncResolve(hostname1, flags, listener1,
+                                           mainThread, defaultOriginAttributes);
   requestList1Canceled2.cancel(Cr.NS_ERROR_ABORT);
 
   // This one will not be canceled.
-  requestList2NotCanceled = dns.asyncResolve(hostname1, flags, listener2, mainThread);
+  requestList2NotCanceled = dns.asyncResolve(hostname1, flags, listener2,
+                                             mainThread, defaultOriginAttributes);
 
   // This one will be canceled with cancel(Cr.NS_ERROR_ABORT).
-  requestList2Canceled = dns.asyncResolve(hostname2, flags, listener2, mainThread);
+  requestList2Canceled = dns.asyncResolve(hostname2, flags, listener2,
+                                          mainThread, defaultOriginAttributes);
   requestList2Canceled.cancel(Cr.NS_ERROR_ABORT);
 
   do_test_pending();
   do_test_pending();
 }
--- a/netwerk/test/unit/test_dns_disable_ipv4.js
+++ b/netwerk/test/unit/test_dns_disable_ipv4.js
@@ -23,18 +23,21 @@ var listener = {
       } catch (e) {
         break;
       }
     }
     do_test_finished();
   }
 };
 
+const defaultOriginAttributes = {};
+
 function run_test() {
   do_test_pending();
   try {
-    dns.asyncResolve("example.org", Ci.nsIDNSService.RESOLVE_DISABLE_IPV4, listener, null);
+    dns.asyncResolve("example.org", Ci.nsIDNSService.RESOLVE_DISABLE_IPV4,
+                     listener, null, defaultOriginAttributes);
   } catch (e) {
     dump(e);
     do_check_true(false);
     do_test_finished();
   }
 }
--- a/netwerk/test/unit/test_dns_disable_ipv6.js
+++ b/netwerk/test/unit/test_dns_disable_ipv6.js
@@ -24,18 +24,21 @@ var listener = {
       } catch (e) {
         break;
       }
     }
     do_test_finished();
   }
 };
 
+const defaultOriginAttributes = {};
+
 function run_test() {
   do_test_pending();
   try {
-    dns.asyncResolve("example.com", Ci.nsIDNSService.RESOLVE_DISABLE_IPV6, listener, null);
+    dns.asyncResolve("example.com", Ci.nsIDNSService.RESOLVE_DISABLE_IPV6,
+                     listener, null, defaultOriginAttributes);
   } catch (e) {
     dump(e);
     do_check_true(false);
     do_test_finished();
   }
 }
--- a/netwerk/test/unit/test_dns_localredirect.js
+++ b/netwerk/test/unit/test_dns_localredirect.js
@@ -14,18 +14,21 @@ var listener = {
     if (aIID.equals(Ci.nsIDNSListener) ||
         aIID.equals(Ci.nsISupports)) {
       return this;
     }
     throw Cr.NS_ERROR_NO_INTERFACE;
   }
 };
 
+const defaultOriginAttributes = {};
+
 function run_test() {
   prefs.setCharPref("network.dns.localDomains", "local.vingtetun.org");
 
   var threadManager = Cc["@mozilla.org/thread-manager;1"].getService(Ci.nsIThreadManager);
   var mainThread = threadManager.currentThread;
-  dns.asyncResolve("local.vingtetun.org", 0, listener, mainThread);
+  dns.asyncResolve("local.vingtetun.org", 0, listener,
+                   mainThread, defaultOriginAttributes);
 
   do_test_pending();
 }
 
--- a/netwerk/test/unit/test_dns_offline.js
+++ b/netwerk/test/unit/test_dns_offline.js
@@ -27,22 +27,24 @@ var listener3 = {
     do_check_eq(inStatus, Cr.NS_OK);
     var answer = inRecord.getNextAddrAsString();
     do_check_true(answer == "127.0.0.1" || answer == "::1");
     cleanup();
     do_test_finished();
   }
 };
 
+const defaultOriginAttributes = {};
+
 function run_test() {
   do_test_pending();
   prefs.setBoolPref("network.dns.offline-localhost", false);
   ioService.offline = true;
   try {
-    dns.asyncResolve("localhost", 0, listener1, mainThread);
+    dns.asyncResolve("localhost", 0, listener1, mainThread, defaultOriginAttributes);
   } catch (e) {
       do_check_eq(e.result, Cr.NS_ERROR_OFFLINE);
       test2();
       do_test_finished();
   }
 }
 
 function test2() {
@@ -50,25 +52,25 @@ function test2() {
   prefs.setBoolPref("network.dns.offline-localhost", true);
   ioService.offline = false;
   ioService.offline = true;
   // we need to let the main thread run and apply the changes
   do_timeout(0, test2Continued);
 }
 
 function test2Continued() {
-  dns.asyncResolve("localhost", 0, listener2, mainThread);
+  dns.asyncResolve("localhost", 0, listener2, mainThread, defaultOriginAttributes);
 }
 
 function test3() {
   do_test_pending();
   ioService.offline = false;
   // we need to let the main thread run and apply the changes
   do_timeout(0, test3Continued);
 }
 
 function test3Continued() {
-  dns.asyncResolve("localhost", 0, listener3, mainThread);
+  dns.asyncResolve("localhost", 0, listener3, mainThread, defaultOriginAttributes);
 }
 
 function cleanup() {
   prefs.clearUserPref("network.dns.offline-localhost");
 }
--- a/netwerk/test/unit/test_dns_onion.js
+++ b/netwerk/test/unit/test_dns_onion.js
@@ -32,25 +32,29 @@ var listenerDontBlock = {
     if (aIID.equals(Ci.nsIDNSListener) ||
         aIID.equals(Ci.nsISupports)) {
       return this;
     }
     throw Cr.NS_ERROR_NO_INTERFACE;
   }
 };
 
+const defaultOriginAttributes = {};
+
 function do_test_dontBlock() {
   prefs.setBoolPref("network.dns.blockDotOnion", false);
-  dns.asyncResolve("private.onion", 0, listenerDontBlock, mainThread);
+  dns.asyncResolve("private.onion", 0, listenerDontBlock,
+                   mainThread, defaultOriginAttributes);
 }
 
 function do_test_block() {
   prefs.setBoolPref("network.dns.blockDotOnion", true);
   try {
-    dns.asyncResolve("private.onion", 0, listenerBlock, mainThread);
+    dns.asyncResolve("private.onion", 0, listenerBlock,
+                     mainThread, defaultOriginAttributes);
   } catch (e) {
     // it is ok for this negative test to fail fast
     do_check_true(true);
     do_test_dontBlock();
   }
 }
 
 function all_done() {
--- a/netwerk/test/unit/test_dns_per_interface.js
+++ b/netwerk/test/unit/test_dns_per_interface.js
@@ -42,38 +42,45 @@ var listener = {
     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,
+  requestWithInterfaceCanceled = dns.asyncResolveExtended(hostname,
+                                                          flags,
                                                           netInterface1,
                                                           listener,
-                                                          mainThread);
+                                                          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);
+  requestWithoutInterfaceNotCanceled = dns.asyncResolve(hostname, flags, listener,
+                                                        mainThread,
+                                                        defaultOriginAttributes);
 
   // This one will not be canceled.
-  requestWithInterfaceNotCanceled = dns.asyncResolveExtended(hostname, flags,
+  requestWithInterfaceNotCanceled = dns.asyncResolveExtended(hostname,
+                                                             flags,
                                                              netInterface2,
                                                              listener,
-                                                             mainThread);
+                                                             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/test_dns_service.js
+++ b/netwerk/test/unit/test_dns_service.js
@@ -11,16 +11,18 @@ var listener = {
     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;
-  dns.asyncResolve("localhost", 0, listener, mainThread);
+  dns.asyncResolve("localhost", 0, listener, mainThread, defaultOriginAttributes);
 
   do_test_pending();
 }