Bug 1499995 - part 2 - TrackingDummyChannel must expose nsIHttpChannelInternal, r=ehsan, r=mayhemer
authorAndrea Marchesini <amarchesini@mozilla.com>
Thu, 25 Oct 2018 10:44:12 +0200
changeset 491256 ccd2e78000b8645cca3f3d028140e0b461ddc6be
parent 491255 a81dc13c90897abc468e8f70647a5c73b61a6017
child 491257 2393a7d9f454e3d5fc310c5ee4a1cd94fea42ab2
push id247
push userfmarier@mozilla.com
push dateSat, 27 Oct 2018 01:06:44 +0000
reviewersehsan, mayhemer
bugs1499995
milestone65.0a1
Bug 1499995 - part 2 - TrackingDummyChannel must expose nsIHttpChannelInternal, r=ehsan, r=mayhemer
netwerk/ipc/NeckoChild.cpp
netwerk/ipc/NeckoChild.h
netwerk/ipc/NeckoParent.cpp
netwerk/ipc/NeckoParent.h
netwerk/ipc/PNecko.ipdl
netwerk/protocol/http/TrackingDummyChannel.cpp
netwerk/protocol/http/TrackingDummyChannel.h
netwerk/protocol/http/TrackingDummyChannelChild.cpp
netwerk/protocol/http/TrackingDummyChannelParent.cpp
netwerk/protocol/http/TrackingDummyChannelParent.h
--- a/netwerk/ipc/NeckoChild.cpp
+++ b/netwerk/ipc/NeckoChild.cpp
@@ -532,16 +532,18 @@ NeckoChild::RecvNetworkChangeNotificatio
     obsService->NotifyObservers(nullptr, NS_NETWORK_LINK_TOPIC,
                                 NS_ConvertUTF8toUTF16(type).get());
   }
   return IPC_OK();
 }
 
 PTrackingDummyChannelChild*
 NeckoChild::AllocPTrackingDummyChannelChild(nsIURI* aURI,
+                                            nsIURI* aTopWindowURI,
+                                            const nsresult& aTopWindowURIResult,
                                             const OptionalLoadInfoArgs& aLoadInfo)
 {
   return new TrackingDummyChannelChild();
 }
 
 bool
 NeckoChild::DeallocPTrackingDummyChannelChild(PTrackingDummyChannelChild* aActor)
 {
--- a/netwerk/ipc/NeckoChild.h
+++ b/netwerk/ipc/NeckoChild.h
@@ -103,16 +103,18 @@ protected:
                                     const uint32_t& aNewLoadFlags,
                                     const OptionalLoadInfoArgs& aLoadInfoForwarder,
                                     const uint64_t& aChannelId,
                                     nsIURI* aOriginalURI,
                                     const uint64_t& aIdentifier) override;
 
   virtual PTrackingDummyChannelChild*
     AllocPTrackingDummyChannelChild(nsIURI* aURI,
+                                    nsIURI* aTopWindowURI,
+                                    const nsresult& aTopWindowURIResult,
                                     const OptionalLoadInfoArgs& aLoadInfo) override;
 
   virtual bool
     DeallocPTrackingDummyChannelChild(PTrackingDummyChannelChild* aChannel) override;
 };
 
 /**
  * Reference to the PNecko Child protocol.
--- a/netwerk/ipc/NeckoParent.cpp
+++ b/netwerk/ipc/NeckoParent.cpp
@@ -1013,41 +1013,45 @@ NeckoParent::RecvGetExtensionFD(const UR
     aResolve(invalidFD);
   }
 
   return IPC_OK();
 }
 
 PTrackingDummyChannelParent*
 NeckoParent::AllocPTrackingDummyChannelParent(nsIURI* aURI,
+                                              nsIURI* aTopWindowURI,
+                                              const nsresult& aTopWindowURIResult,
                                               const OptionalLoadInfoArgs& aLoadInfo)
 {
   RefPtr<TrackingDummyChannelParent> c = new TrackingDummyChannelParent();
   return c.forget().take();
 }
 
 mozilla::ipc::IPCResult
 NeckoParent::RecvPTrackingDummyChannelConstructor(PTrackingDummyChannelParent* aActor,
                                                   nsIURI* aURI,
+                                                  nsIURI* aTopWindowURI,
+                                                  const nsresult& aTopWindowURIResult,
                                                   const OptionalLoadInfoArgs& aLoadInfo)
 {
   TrackingDummyChannelParent* p =
     static_cast<TrackingDummyChannelParent*>(aActor);
 
   if (NS_WARN_IF(!aURI)) {
     return IPC_FAIL_NO_REASON(this);
   }
 
   nsCOMPtr<nsILoadInfo> loadInfo;
   nsresult rv = LoadInfoArgsToLoadInfo(aLoadInfo, getter_AddRefs(loadInfo));
   if (NS_WARN_IF(NS_FAILED(rv)) || !loadInfo) {
     return IPC_FAIL_NO_REASON(this);
   }
 
-  p->Init(aURI, loadInfo);
+  p->Init(aURI, aTopWindowURI, aTopWindowURIResult, loadInfo);
   return IPC_OK();
 }
 
 bool
 NeckoParent::DeallocPTrackingDummyChannelParent(PTrackingDummyChannelParent* aActor)
 {
   RefPtr<TrackingDummyChannelParent> c =
     dont_AddRef(static_cast<TrackingDummyChannelParent*>(aActor));
--- a/netwerk/ipc/NeckoParent.h
+++ b/netwerk/ipc/NeckoParent.h
@@ -238,23 +238,27 @@ protected:
                            GetExtensionStreamResolver&& aResolve) override;
 
   virtual mozilla::ipc::IPCResult
     RecvGetExtensionFD(const URIParams& aURI,
                        GetExtensionFDResolver&& aResolve) override;
 
   virtual PTrackingDummyChannelParent*
     AllocPTrackingDummyChannelParent(nsIURI* aURI,
+                                     nsIURI* aTopWindowURI,
+                                     const nsresult& aTopWindowURIResult,
                                      const OptionalLoadInfoArgs& aLoadInfo) override;
 
   virtual bool
     DeallocPTrackingDummyChannelParent(PTrackingDummyChannelParent* aChild) override;
 
   virtual mozilla::ipc::IPCResult
     RecvPTrackingDummyChannelConstructor(PTrackingDummyChannelParent* aActor,
                                          nsIURI* aURI,
+                                         nsIURI* aTopWindowURI,
+                                         const nsresult& aTopWindowURIResult,
                                          const OptionalLoadInfoArgs& aLoadInfo) override;
 };
 
 } // namespace net
 } // namespace mozilla
 
 #endif // mozilla_net_NeckoParent_h
--- a/netwerk/ipc/PNecko.ipdl
+++ b/netwerk/ipc/PNecko.ipdl
@@ -107,17 +107,19 @@ parent:
    * the parent and the child when we're redirecting to a data: URI.
    */
   async PDataChannel(uint32_t channelId);
   async PSimpleChannel(uint32_t channelId);
   async PFileChannel(uint32_t channelId);
 
   async PChannelDiverter(ChannelDiverterArgs channel);
 
-  async PTrackingDummyChannel(nsIURI uri, OptionalLoadInfoArgs loadInfo);
+  async PTrackingDummyChannel(nsIURI uri, nsIURI aTopWindowURI,
+                              nsresult aTopWindowURIResult,
+                              OptionalLoadInfoArgs loadInfo);
 
   /**
    * These are called from the child with the results of the auth prompt.
    * callbackId is the id that was passed in PBrowser::AsyncAuthPrompt,
    * corresponding to an nsIAuthPromptCallback
    */
   async OnAuthAvailable(uint64_t callbackId, nsString user,
                         nsString password, nsString domain);
--- a/netwerk/protocol/http/TrackingDummyChannel.cpp
+++ b/netwerk/protocol/http/TrackingDummyChannel.cpp
@@ -85,22 +85,27 @@ TrackingDummyChannel::StorageAllowed(nsI
 }
 
 NS_IMPL_ADDREF(TrackingDummyChannel)
 NS_IMPL_RELEASE(TrackingDummyChannel)
 
 NS_INTERFACE_MAP_BEGIN(TrackingDummyChannel)
   NS_INTERFACE_MAP_ENTRY(nsIRequest)
   NS_INTERFACE_MAP_ENTRY(nsIChannel)
+  NS_INTERFACE_MAP_ENTRY(nsIHttpChannelInternal)
   NS_INTERFACE_MAP_ENTRY_CONCRETE(TrackingDummyChannel)
 NS_INTERFACE_MAP_END
 
 TrackingDummyChannel::TrackingDummyChannel(nsIURI* aURI,
+                                           nsIURI* aTopWindowURI,
+                                           nsresult aTopWindowURIResult,
                                            nsILoadInfo* aLoadInfo)
-  : mIsTrackingResource(false)
+  : mTopWindowURI(aTopWindowURI)
+  , mTopWindowURIResult(aTopWindowURIResult)
+  , mIsTrackingResource(false)
 {
   MOZ_ASSERT(XRE_IsParentProcess());
 
   SetOriginalURI(aURI);
   SetLoadInfo(aLoadInfo);
 }
 
 TrackingDummyChannel::~TrackingDummyChannel() = default;
@@ -347,10 +352,367 @@ TrackingDummyChannel::SetLoadFlags(nsLoa
 }
 
 NS_IMETHODIMP
 TrackingDummyChannel::GetIsDocument(bool* aIsDocument)
 {
   return NS_ERROR_NOT_IMPLEMENTED;
 }
 
+//-----------------------------------------------------------------------------
+// TrackingDummyChannel::nsIHttpChannelInternal
+//-----------------------------------------------------------------------------
+
+NS_IMETHODIMP
+TrackingDummyChannel::GetDocumentURI(nsIURI** aDocumentURI)
+{
+  return NS_ERROR_NOT_IMPLEMENTED;
+}
+
+NS_IMETHODIMP
+TrackingDummyChannel::SetDocumentURI(nsIURI* aDocumentURI)
+{
+  return NS_ERROR_NOT_IMPLEMENTED;
+}
+
+NS_IMETHODIMP
+TrackingDummyChannel::GetRequestVersion(uint32_t* aMajor, uint32_t* aMinor)
+{
+  return NS_ERROR_NOT_IMPLEMENTED;
+}
+
+NS_IMETHODIMP
+TrackingDummyChannel::GetResponseVersion(uint32_t* aMajor, uint32_t* aMinor)
+{
+  return NS_ERROR_NOT_IMPLEMENTED;
+}
+
+NS_IMETHODIMP
+TrackingDummyChannel::TakeAllSecurityMessages(nsCOMArray<nsISecurityConsoleMessage>& aMessages)
+{
+  return NS_ERROR_NOT_IMPLEMENTED;
+}
+
+NS_IMETHODIMP
+TrackingDummyChannel::SetCookie(const char* aCookieHeader)
+{
+  return NS_ERROR_NOT_IMPLEMENTED;
+}
+
+NS_IMETHODIMP
+TrackingDummyChannel::SetupFallbackChannel(const char* aFallbackKey)
+{
+  return NS_ERROR_NOT_IMPLEMENTED;
+}
+
+NS_IMETHODIMP
+TrackingDummyChannel::GetThirdPartyFlags(uint32_t* aThirdPartyFlags)
+{
+  return NS_ERROR_NOT_IMPLEMENTED;
+}
+
+NS_IMETHODIMP
+TrackingDummyChannel::SetThirdPartyFlags(uint32_t aThirdPartyFlags)
+{
+  return NS_ERROR_NOT_IMPLEMENTED;
+}
+
+NS_IMETHODIMP
+TrackingDummyChannel::GetForceAllowThirdPartyCookie(bool* aForceAllowThirdPartyCookie)
+{
+  return NS_ERROR_NOT_IMPLEMENTED;
+}
+
+NS_IMETHODIMP
+TrackingDummyChannel::SetForceAllowThirdPartyCookie(bool aForceAllowThirdPartyCookie)
+{
+  return NS_ERROR_NOT_IMPLEMENTED;
+}
+
+NS_IMETHODIMP
+TrackingDummyChannel::GetCanceled(bool* aCanceled)
+{
+  return NS_ERROR_NOT_IMPLEMENTED;
+}
+
+NS_IMETHODIMP
+TrackingDummyChannel::GetChannelIsForDownload(bool* aChannlIsForDownload)
+{
+  return NS_ERROR_NOT_IMPLEMENTED;
+}
+
+NS_IMETHODIMP
+TrackingDummyChannel::SetChannelIsForDownload(bool aChannlIsForDownload)
+{
+  return NS_ERROR_NOT_IMPLEMENTED;
+}
+
+NS_IMETHODIMP
+TrackingDummyChannel::GetLocalAddress(nsACString& aLocalAddress)
+{
+  return NS_ERROR_NOT_IMPLEMENTED;
+}
+
+NS_IMETHODIMP
+TrackingDummyChannel::GetLocalPort(int32_t* aLocalPort)
+{
+  return NS_ERROR_NOT_IMPLEMENTED;
+}
+
+NS_IMETHODIMP
+TrackingDummyChannel::GetRemoteAddress(nsACString& aRemoteAddress)
+{
+  return NS_ERROR_NOT_IMPLEMENTED;
+}
+
+NS_IMETHODIMP
+TrackingDummyChannel::GetRemotePort(int32_t* aRemotePort)
+{
+  return NS_ERROR_NOT_IMPLEMENTED;
+}
+
+NS_IMETHODIMP
+TrackingDummyChannel::SetCacheKeysRedirectChain(nsTArray<nsCString>* aCacheKeys)
+{
+  return NS_ERROR_NOT_IMPLEMENTED;
+}
+
+NS_IMETHODIMP
+TrackingDummyChannel::HTTPUpgrade(const nsACString& aProtocolName,
+                                  nsIHttpUpgradeListener* aListener)
+{
+  return NS_ERROR_NOT_IMPLEMENTED;
+}
+
+NS_IMETHODIMP
+TrackingDummyChannel::GetAllowSpdy(bool* aAllowSpdy)
+{
+  return NS_ERROR_NOT_IMPLEMENTED;
+}
+
+NS_IMETHODIMP
+TrackingDummyChannel::SetAllowSpdy(bool aAllowSpdy)
+{
+  return NS_ERROR_NOT_IMPLEMENTED;
+}
+
+NS_IMETHODIMP
+TrackingDummyChannel::GetResponseTimeoutEnabled(bool* aResponseTimeoutEnabled)
+{
+  return NS_ERROR_NOT_IMPLEMENTED;
+}
+
+NS_IMETHODIMP
+TrackingDummyChannel::SetResponseTimeoutEnabled(bool aResponseTimeoutEnabled)
+{
+  return NS_ERROR_NOT_IMPLEMENTED;
+}
+
+NS_IMETHODIMP
+TrackingDummyChannel::GetInitialRwin(uint32_t* aInitialRwin)
+{
+  return NS_ERROR_NOT_IMPLEMENTED;
+}
+
+NS_IMETHODIMP
+TrackingDummyChannel::SetInitialRwin(uint32_t aInitialRwin)
+{
+  return NS_ERROR_NOT_IMPLEMENTED;
+}
+
+NS_IMETHODIMP
+TrackingDummyChannel::GetApiRedirectToURI(nsIURI** aApiRedirectToURI)
+{
+  return NS_ERROR_NOT_IMPLEMENTED;
+}
+
+NS_IMETHODIMP
+TrackingDummyChannel::GetAllowAltSvc(bool* aAllowAltSvc)
+{
+  return NS_ERROR_NOT_IMPLEMENTED;
+}
+
+NS_IMETHODIMP
+TrackingDummyChannel::SetAllowAltSvc(bool aAllowAltSvc)
+{
+  return NS_ERROR_NOT_IMPLEMENTED;
+}
+
+NS_IMETHODIMP
+TrackingDummyChannel::GetBeConservative(bool* aBeConservative)
+{
+  return NS_ERROR_NOT_IMPLEMENTED;
+}
+
+NS_IMETHODIMP
+TrackingDummyChannel::SetBeConservative(bool aBeConservative)
+{
+  return NS_ERROR_NOT_IMPLEMENTED;
+}
+
+NS_IMETHODIMP
+TrackingDummyChannel::GetTrr(bool* aTrr)
+{
+  return NS_ERROR_NOT_IMPLEMENTED;
+}
+
+NS_IMETHODIMP
+TrackingDummyChannel::SetTrr(bool aTrr)
+{
+  return NS_ERROR_NOT_IMPLEMENTED;
+}
+
+NS_IMETHODIMP
+TrackingDummyChannel::GetTlsFlags(uint32_t* aTlsFlags)
+{
+  return NS_ERROR_NOT_IMPLEMENTED;
+}
+
+NS_IMETHODIMP
+TrackingDummyChannel::SetTlsFlags(uint32_t aTlsFlags)
+{
+  return NS_ERROR_NOT_IMPLEMENTED;
+}
+
+NS_IMETHODIMP
+TrackingDummyChannel::GetLastModifiedTime(PRTime* aLastModifiedTime)
+{
+  return NS_ERROR_NOT_IMPLEMENTED;
+}
+
+NS_IMETHODIMP
+TrackingDummyChannel::GetCorsIncludeCredentials(bool* aCorsIncludeCredentials)
+{
+  return NS_ERROR_NOT_IMPLEMENTED;
+}
+
+NS_IMETHODIMP
+TrackingDummyChannel::SetCorsIncludeCredentials(bool aCorsIncludeCredentials)
+{
+  return NS_ERROR_NOT_IMPLEMENTED;
+}
+
+NS_IMETHODIMP
+TrackingDummyChannel::GetCorsMode(uint32_t* aCorsMode)
+{
+  return NS_ERROR_NOT_IMPLEMENTED;
+}
+
+NS_IMETHODIMP
+TrackingDummyChannel::SetCorsMode(uint32_t aCorsMode)
+{
+  return NS_ERROR_NOT_IMPLEMENTED;
+}
+
+NS_IMETHODIMP
+TrackingDummyChannel::GetRedirectMode(uint32_t* aRedirectMode)
+{
+  return NS_ERROR_NOT_IMPLEMENTED;
+}
+
+NS_IMETHODIMP
+TrackingDummyChannel::SetRedirectMode(uint32_t aRedirectMode)
+{
+  return NS_ERROR_NOT_IMPLEMENTED;
+}
+
+NS_IMETHODIMP
+TrackingDummyChannel::GetFetchCacheMode(uint32_t* aFetchCacheMode)
+{
+  return NS_ERROR_NOT_IMPLEMENTED;
+}
+
+NS_IMETHODIMP
+TrackingDummyChannel::SetFetchCacheMode(uint32_t aFetchCacheMode)
+{
+  return NS_ERROR_NOT_IMPLEMENTED;
+}
+
+NS_IMETHODIMP
+TrackingDummyChannel::GetTopWindowURI(nsIURI** aTopWindowURI)
+{
+  nsCOMPtr<nsIURI> topWindowURI = mTopWindowURI;
+  topWindowURI.forget(aTopWindowURI);
+  return mTopWindowURIResult;
+}
+
+NS_IMETHODIMP
+TrackingDummyChannel::SetTopWindowURIIfUnknown(nsIURI* aTopWindowURI)
+{
+  return NS_ERROR_NOT_IMPLEMENTED;
+}
+
+NS_IMETHODIMP
+TrackingDummyChannel::GetProxyURI(nsIURI** aProxyURI)
+{
+  return NS_ERROR_NOT_IMPLEMENTED;
+}
+
+void
+TrackingDummyChannel::SetCorsPreflightParameters(const nsTArray<nsCString>& aUnsafeHeaders)
+{}
+
+void
+TrackingDummyChannel::SetAltDataForChild(bool aIsForChild)
+{}
+
+NS_IMETHODIMP
+TrackingDummyChannel::GetBlockAuthPrompt(bool* aBlockAuthPrompt)
+{
+  return NS_ERROR_NOT_IMPLEMENTED;
+}
+
+NS_IMETHODIMP
+TrackingDummyChannel::SetBlockAuthPrompt(bool aBlockAuthPrompt)
+{
+  return NS_ERROR_NOT_IMPLEMENTED;
+}
+
+NS_IMETHODIMP
+TrackingDummyChannel::GetIntegrityMetadata(nsAString& aIntegrityMetadata)
+{
+  return NS_ERROR_NOT_IMPLEMENTED;
+}
+
+NS_IMETHODIMP
+TrackingDummyChannel::SetIntegrityMetadata(const nsAString& aIntegrityMetadata)
+{
+  return NS_ERROR_NOT_IMPLEMENTED;
+}
+
+NS_IMETHODIMP
+TrackingDummyChannel::GetConnectionInfoHashKey(nsACString& aConnectionInfoHashKey)
+{
+  return NS_ERROR_NOT_IMPLEMENTED;
+}
+
+NS_IMETHODIMP
+TrackingDummyChannel::GetLastRedirectFlags(uint32_t* aLastRedirectFlags)
+{
+  return NS_ERROR_NOT_IMPLEMENTED;
+}
+
+NS_IMETHODIMP
+TrackingDummyChannel::SetLastRedirectFlags(uint32_t aLastRedirectFlags)
+{
+  return NS_ERROR_NOT_IMPLEMENTED;
+}
+
+NS_IMETHODIMP
+TrackingDummyChannel::GetNavigationStartTimeStamp(TimeStamp* aNavigationStartTimeStamp)
+{
+  return NS_ERROR_NOT_IMPLEMENTED;
+}
+
+NS_IMETHODIMP
+TrackingDummyChannel::SetNavigationStartTimeStamp(TimeStamp aNavigationStartTimeStamp)
+{
+  return NS_ERROR_NOT_IMPLEMENTED;
+}
+
+NS_IMETHODIMP
+TrackingDummyChannel::CancelForTrackingProtection()
+{
+  return NS_ERROR_NOT_IMPLEMENTED;
+}
+
 } // net namespace
 } // mozilla namespace
--- a/netwerk/protocol/http/TrackingDummyChannel.h
+++ b/netwerk/protocol/http/TrackingDummyChannel.h
@@ -37,49 +37,55 @@ namespace net {
  *
  * This hack can be removed once Bug 1231208's new "parent intercept" mechanism
  * fully lands, the pref is enabled by default it stays enabled for long enough
  * to be confident we will never need/want to turn it off.  Then as part of bug
  * 1496997 we can remove this implementation.  Bug 1498259 covers removing this
  * hack in particular.
  */
 class TrackingDummyChannel final : public nsIChannel
+                                 , public nsIHttpChannelInternal
 {
 public:
   NS_DECLARE_STATIC_IID_ACCESSOR(TRACKING_DUMMY_CHANNEL_IID)
 
   NS_DECL_THREADSAFE_ISUPPORTS
   NS_DECL_NSIREQUEST
   NS_DECL_NSICHANNEL
+  NS_DECL_NSIHTTPCHANNELINTERNAL
 
   enum StorageAllowedState
   {
     eStorageGranted,
     eStorageDenied,
     eAsyncNeeded,
   };
 
   static StorageAllowedState
   StorageAllowed(nsIChannel* aChannel,
                  const std::function<void(bool)>& aCallback);
 
   TrackingDummyChannel(nsIURI* aURI,
+                       nsIURI* aTopWindowURI,
+                       nsresult aTopWindowURIResult,
                        nsILoadInfo* aLoadInfo);
 
   bool
   IsTrackingResource() const;
 
   void
   SetIsTrackingResource();
 
 private:
   ~TrackingDummyChannel();
 
   nsCOMPtr<nsILoadInfo> mLoadInfo;
   nsCOMPtr<nsIURI> mURI;
+  nsCOMPtr<nsIURI> mTopWindowURI;
+  nsresult mTopWindowURIResult;
 
   bool mIsTrackingResource;
 };
 
 NS_DEFINE_STATIC_IID_ACCESSOR(TrackingDummyChannel, TRACKING_DUMMY_CHANNEL_IID)
 
 } // net namespace
 } // mozilla namespace
--- a/netwerk/protocol/http/TrackingDummyChannelChild.cpp
+++ b/netwerk/protocol/http/TrackingDummyChannelChild.cpp
@@ -17,26 +17,39 @@ namespace net {
 TrackingDummyChannelChild::Create(nsIHttpChannel* aChannel, nsIURI* aURI,
                                   const std::function<void(bool)>& aCallback)
 {
   MOZ_ASSERT(NS_IsMainThread());
 
   MOZ_ASSERT(aChannel);
   MOZ_ASSERT(aURI);
 
+  nsCOMPtr<nsIHttpChannelInternal> httpChannelInternal =
+    do_QueryInterface(aChannel);
+  if (!httpChannelInternal) {
+    // Any non-http channel is allowed.
+    return true;
+  }
+
+  nsCOMPtr<nsIURI> topWindowURI;
+  nsresult topWindowURIResult =
+    httpChannelInternal->GetTopWindowURI(getter_AddRefs(topWindowURI));
+
   nsCOMPtr<nsILoadInfo> loadInfo = aChannel->GetLoadInfo();
   if (!loadInfo) {
     return false;
   }
 
   OptionalLoadInfoArgs loadInfoArgs;
   mozilla::ipc::LoadInfoToLoadInfoArgs(loadInfo, &loadInfoArgs);
 
   PTrackingDummyChannelChild* actor =
-    gNeckoChild->SendPTrackingDummyChannelConstructor(aURI, loadInfoArgs);
+    gNeckoChild->SendPTrackingDummyChannelConstructor(aURI, topWindowURI,
+                                                      topWindowURIResult,
+                                                      loadInfoArgs);
   if (!actor) {
     return false;
   }
 
   bool isThirdParty =
     nsContentUtils::IsThirdPartyWindowOrChannel(nullptr, aChannel, aURI);
 
   static_cast<TrackingDummyChannelChild*>(actor)->Initialize(aChannel, aURI,
@@ -72,17 +85,19 @@ TrackingDummyChannelChild::Recv__delete_
 
   if (!mChannel) {
     return IPC_OK();
   }
 
   nsCOMPtr<nsIHttpChannel> channel = std::move(mChannel);
 
   RefPtr<HttpBaseChannel> httpChannel = do_QueryObject(channel);
-  httpChannel->SetIsTrackingResource(mIsThirdParty);
+  if (aTrackingResource) {
+    httpChannel->SetIsTrackingResource(mIsThirdParty);
+  }
 
   bool storageGranted =
     AntiTrackingCommon::IsFirstPartyStorageAccessGrantedFor(httpChannel, mURI,
                                                             nullptr);
   mCallback(storageGranted);
   return IPC_OK();
 }
 
--- a/netwerk/protocol/http/TrackingDummyChannelParent.cpp
+++ b/netwerk/protocol/http/TrackingDummyChannelParent.cpp
@@ -17,31 +17,34 @@ namespace net {
 TrackingDummyChannelParent::TrackingDummyChannelParent()
   : mIPCActive(true)
 {}
 
 TrackingDummyChannelParent::~TrackingDummyChannelParent() = default;
 
 void
 TrackingDummyChannelParent::Init(nsIURI* aURI,
+                                 nsIURI* aTopWindowURI,
+                                 nsresult aTopWindowURIResult,
                                  nsILoadInfo* aLoadInfo)
 {
   MOZ_ASSERT(mIPCActive);
 
   RefPtr<TrackingDummyChannelParent> self = this;
   auto onExit = MakeScopeExit([self] {
     Unused << Send__delete__(self, false);
   });
 
   if (!aURI) {
     return;
   }
 
   RefPtr<TrackingDummyChannel> channel =
-    new TrackingDummyChannel(aURI, aLoadInfo);
+    new TrackingDummyChannel(aURI, aTopWindowURI, aTopWindowURIResult,
+                             aLoadInfo);
 
   RefPtr<nsChannelClassifier> channelClassifier =
     new nsChannelClassifier(channel);
 
   bool willCallback =
     NS_SUCCEEDED(channelClassifier->CheckIsTrackerWithLocalTable(
       [self = std::move(self), channel]() {
         if (self->mIPCActive) {
--- a/netwerk/protocol/http/TrackingDummyChannelParent.h
+++ b/netwerk/protocol/http/TrackingDummyChannelParent.h
@@ -20,16 +20,18 @@ class TrackingDummyChannelParent final :
 {
 public:
   NS_INLINE_DECL_REFCOUNTING(TrackingDummyChannelParent)
 
   TrackingDummyChannelParent();
 
   void
   Init(nsIURI* aURI,
+       nsIURI* aTopWindowURI,
+       nsresult aTopWindowURIResult,
        nsILoadInfo* aLoadInfo);
 
 private:
   ~TrackingDummyChannelParent();
 
   void
   ActorDestroy(ActorDestroyReason aWhy) override;