Bug 1637634 - Update IsOnContentBlockingAllowList in nsHttpChannel::AsyncOpen r=timhuang,necko-reviewers
☠☠ backed out by dbfad8ecbc50 ☠ ☠
authorDimi Lee <dlee@mozilla.com>
Fri, 22 May 2020 22:19:57 +0000
changeset 531729 efd4bcfa61dc7f7f654cb5702a7db4a60ca04a0b
parent 531728 a845717e4d10ad7cb65ca64b08666c373db6e1de
child 531730 42591468b4b83fe6d98e6df75acd29edf2b15754
push id37442
push userncsoregi@mozilla.com
push dateSat, 23 May 2020 09:21:24 +0000
treeherdermozilla-central@bbcc193fe0f0 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstimhuang, necko-reviewers
bugs1637634
milestone78.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 1637634 - Update IsOnContentBlockingAllowList in nsHttpChannel::AsyncOpen r=timhuang,necko-reviewers Differential Revision: https://phabricator.services.mozilla.com/D76152
netwerk/ipc/DocumentLoadListener.cpp
netwerk/protocol/http/nsHttpChannel.cpp
--- a/netwerk/ipc/DocumentLoadListener.cpp
+++ b/netwerk/ipc/DocumentLoadListener.cpp
@@ -3,17 +3,16 @@
 
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "DocumentLoadListener.h"
 
 #include "mozilla/AntiTrackingUtils.h"
-#include "mozilla/ContentBlockingAllowList.h"
 #include "mozilla/LoadInfo.h"
 #include "mozilla/MozPromiseInlines.h"  // For MozPromise::FromDomPromise
 #include "mozilla/StaticPrefs_fission.h"
 #include "mozilla/StaticPrefs_security.h"
 #include "mozilla/dom/CanonicalBrowsingContext.h"
 #include "mozilla/dom/ClientChannelHelper.h"
 #include "mozilla/dom/ContentParent.h"
 #include "mozilla/dom/ContentProcessManager.h"
@@ -408,25 +407,16 @@ bool DocumentLoadListener::Open(
 
   RefPtr<HttpBaseChannel> httpBaseChannel = do_QueryObject(mChannel, aRv);
   if (httpBaseChannel) {
     nsCOMPtr<nsIURI> topWindowURI;
     if (browsingContext->IsTop()) {
       // If this is for the top level loading, the top window URI should be the
       // URI which we are loading.
       topWindowURI = uriBeingLoaded;
-
-      // Update the IsOnContentBlockingAllowList flag in the CookieJarSettings
-      // if this is a top level loading. For sub-document loading, this flag
-      // would inherit from the parent.
-      nsCOMPtr<nsICookieJarSettings> cookieJarSettings;
-      Unused << loadInfo->GetCookieJarSettings(
-          getter_AddRefs(cookieJarSettings));
-      net::CookieJarSettings::Cast(cookieJarSettings)
-          ->UpdateIsOnContentBlockingAllowList(mChannel);
     } else if (RefPtr<WindowGlobalParent> topWindow = AntiTrackingUtils::
                    GetTopWindowExcludingExtensionAccessibleContentFrames(
                        browsingContext, uriBeingLoaded)) {
       nsCOMPtr<nsIPrincipal> topWindowPrincipal =
           topWindow->DocumentPrincipal();
       if (topWindowPrincipal && !topWindowPrincipal->GetIsNullPrincipal()) {
         auto* basePrin = BasePrincipal::Cast(topWindowPrincipal);
         basePrin->GetURI(getter_AddRefs(topWindowURI));
--- a/netwerk/protocol/http/nsHttpChannel.cpp
+++ b/netwerk/protocol/http/nsHttpChannel.cpp
@@ -1858,24 +1858,30 @@ void nsHttpChannel::SetCachedContentType
 }
 
 void nsHttpChannel::UpdateAntiTrackingInfo() {
   Unused << mLoadInfo->SetHasStoragePermission(
       AntiTrackingUtils::HasStoragePermissionInParent(this));
 
   AntiTrackingUtils::ComputeIsThirdPartyToTopWindow(this);
 
-  // We only need to set FPD for top-level loads. FPD will automatically be
-  // propagated to non-top level loads via CookieJarSetting.
   if (mLoadInfo->GetExternalContentPolicyType() ==
       nsIContentPolicy::TYPE_DOCUMENT) {
     nsCOMPtr<nsICookieJarSettings> cookieJarSettings;
     Unused << mLoadInfo->GetCookieJarSettings(
         getter_AddRefs(cookieJarSettings));
 
+    // Update the IsOnContentBlockingAllowList flag in the CookieJarSettings
+    // if this is a top level loading. For sub-document loading, this flag
+    // would inherit from the parent.
+    mozilla::net::CookieJarSettings::Cast(cookieJarSettings)
+        ->UpdateIsOnContentBlockingAllowList(this);
+
+    // We only need to set FPD for top-level loads. FPD will automatically be
+    // propagated to non-top level loads via CookieJarSetting.
     mozilla::net::CookieJarSettings::Cast(cookieJarSettings)
         ->SetFirstPartyDomain(mURI);
   }
 }
 
 nsresult nsHttpChannel::CallOnStartRequest() {
   LOG(("nsHttpChannel::CallOnStartRequest [this=%p]", this));