Bug 1658010 - Add null pointer check before notifying content block event r=xeonchen
authorDimi Lee <dlee@mozilla.com>
Sat, 08 Aug 2020 06:00:00 +0000
changeset 543991 fa0dbdf15f291e814b4854d515d7ef3e4548b7fb
parent 543990 5631575db5383d8f9e76177857c1822c40afb7d8
child 543992 a8bff4f8990574f3532937511bf43225b28549aa
push id37682
push userccoroiu@mozilla.com
push dateSat, 08 Aug 2020 09:35:45 +0000
treeherdermozilla-central@fa0dbdf15f29 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersxeonchen
bugs1658010
milestone81.0a1
first release with
nightly linux32
fa0dbdf15f29 / 81.0a1 / 20200808093545 / files
nightly linux64
fa0dbdf15f29 / 81.0a1 / 20200808093545 / files
nightly mac
fa0dbdf15f29 / 81.0a1 / 20200808093545 / files
nightly win32
fa0dbdf15f29 / 81.0a1 / 20200808093545 / files
nightly win64
fa0dbdf15f29 / 81.0a1 / 20200808093545 / files
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
releases
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1658010 - Add null pointer check before notifying content block event r=xeonchen Differential Revision: https://phabricator.services.mozilla.com/D86421
toolkit/components/antitracking/ContentBlocking.cpp
--- a/toolkit/components/antitracking/ContentBlocking.cpp
+++ b/toolkit/components/antitracking/ContentBlocking.cpp
@@ -594,16 +594,20 @@ ContentBlocking::CompleteAllowAccessFor(
     return;
   }
 
   Document* doc = parentInner->GetExtantDoc();
   if (NS_WARN_IF(!doc)) {
     return;
   }
 
+  if (!doc->GetChannel()) {
+    return;
+  }
+
   // Theoratically this can be done in the parent process. But right now,
   // we need the channel while notifying content blocking events, and
   // we don't have a trivial way to obtain the channel in the parent
   // via BrowsingContext. So we just ask the child to do the work.
   ContentBlockingNotifier::OnEvent(
       doc->GetChannel(), false,
       CookieJarSettings::IsRejectThirdPartyWithExceptions(aCookieBehavior)
           ? nsIWebProgressListener::STATE_COOKIES_BLOCKED_FOREIGN