Bug 1577558 - Add proper argument checking in AntiTrackingCommon::SaveFirstPartyStorageAccessGrantedForOriginOnParentProcess(); r=johannh
authorEhsan Akhgari <ehsan@mozilla.com>
Tue, 03 Sep 2019 12:42:20 +0000
changeset 491391 63cf143e208dc46c8a818628bad84bcfb970d000
parent 491390 55349f2ab31bf370c0406c03dd04e1ba59341a2b
child 491392 9530fc5f5e325af59477a52119717a0821296c74
push id94331
push usereakhgari@mozilla.com
push dateTue, 03 Sep 2019 14:14:17 +0000
treeherderautoland@63cf143e208d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjohannh
bugs1577558
milestone71.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 1577558 - Add proper argument checking in AntiTrackingCommon::SaveFirstPartyStorageAccessGrantedForOriginOnParentProcess(); r=johannh Differential Revision: https://phabricator.services.mozilla.com/D44287
toolkit/components/antitracking/AntiTrackingCommon.cpp
--- a/toolkit/components/antitracking/AntiTrackingCommon.cpp
+++ b/toolkit/components/antitracking/AntiTrackingCommon.cpp
@@ -1155,16 +1155,22 @@ RefPtr<mozilla::AntiTrackingCommon::Firs
 AntiTrackingCommon::SaveFirstPartyStorageAccessGrantedForOriginOnParentProcess(
     nsIPrincipal* aParentPrincipal, nsIPrincipal* aTrackingPrincipal,
     const nsCString& aTrackingOrigin, const nsCString& aGrantedOrigin,
     int aAllowMode) {
   MOZ_ASSERT(XRE_IsParentProcess());
   MOZ_ASSERT(aAllowMode == eAllow || aAllowMode == eAllowAutoGrant ||
              aAllowMode == eAllowOnAnySite);
 
+  if (!aParentPrincipal || !aTrackingPrincipal) {
+    LOG(("Invalid input arguments passed"));
+    return FirstPartyStorageAccessGrantPromise::CreateAndReject(false,
+                                                                __func__);
+  };
+
   nsCOMPtr<nsIURI> parentPrincipalURI;
   Unused << aParentPrincipal->GetURI(getter_AddRefs(parentPrincipalURI));
   LOG_SPEC(("Saving a first-party storage permission on %s for "
             "trackingOrigin=%s grantedOrigin=%s",
             _spec, aTrackingOrigin.get(), aGrantedOrigin.get()),
            parentPrincipalURI);
 
   if (NS_WARN_IF(!aParentPrincipal)) {