Bug 1547191 - Make sure ThirdPartyUtil::GetBaseDomainFromWindow() correctly deals with nullptr arguments; r=baku a=pascalc
authorEhsan Akhgari <ehsan@mozilla.com>
Fri, 26 Apr 2019 17:47:02 +0000
changeset 526387 e9bdef8981147f7838c32db18d98062aff05ee0f
parent 526386 9d654bcc7cae40a6158827030d6ce179ca2392a9
child 526388 9d5221dfb552ab7d00130cebbd66a3b674b1ae2e
push id2032
push userffxbld-merge
push dateMon, 13 May 2019 09:36:57 +0000
treeherdermozilla-release@455c1065dcbe [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbaku, pascalc
bugs1547191
milestone67.0
Bug 1547191 - Make sure ThirdPartyUtil::GetBaseDomainFromWindow() correctly deals with nullptr arguments; r=baku a=pascalc Differential Revision: https://phabricator.services.mozilla.com/D29030
dom/base/ThirdPartyUtil.h
--- a/dom/base/ThirdPartyUtil.h
+++ b/dom/base/ThirdPartyUtil.h
@@ -32,19 +32,17 @@ class ThirdPartyUtil final : public mozI
                             const nsCString& aSecondDomain) {
     // Check strict equality.
     return aFirstDomain != aSecondDomain;
   }
   nsresult IsThirdPartyInternal(const nsCString& aFirstDomain,
                                 nsIURI* aSecondURI, bool* aResult);
 
   nsCString GetBaseDomainFromWindow(nsPIDOMWindowOuter* aWindow) {
-    MOZ_ASSERT(aWindow);
-
-    mozilla::dom::Document* doc = aWindow->GetExtantDoc();
+    mozilla::dom::Document* doc = aWindow ? aWindow->GetExtantDoc() : nullptr;
 
     if (!doc) {
       return EmptyCString();
     }
 
     return doc->GetBaseDomain();
   }