Bug 1306300 - null check nsILoadContext in GetLoadContextCodebasePrincipal. r=baku, a=ritu
authorOlli Pettay <Olli.Pettay@helsinki.fi>
Thu, 29 Sep 2016 20:31:50 +0300
changeset 428798 3162dbd8214ff8463d6af0503d29ca5b1af3fd8f
parent 428797 108820ff3004557dc1722540bb31beed4b869882
child 428799 1ba0d5139e1af83f80259ba72add3c5d105f9866
push id33416
push userpaul@paul.cx
push dateMon, 24 Oct 2016 16:26:20 +0000
reviewersbaku, ritu
bugs1306300
milestone50.0
Bug 1306300 - null check nsILoadContext in GetLoadContextCodebasePrincipal. r=baku, a=ritu
caps/nsScriptSecurityManager.cpp
--- a/caps/nsScriptSecurityManager.cpp
+++ b/caps/nsScriptSecurityManager.cpp
@@ -1214,16 +1214,17 @@ nsScriptSecurityManager::GetAppCodebaseP
 }
 
 NS_IMETHODIMP
 nsScriptSecurityManager::
   GetLoadContextCodebasePrincipal(nsIURI* aURI,
                                   nsILoadContext* aLoadContext,
                                   nsIPrincipal** aPrincipal)
 {
+  NS_ENSURE_STATE(aLoadContext);
   DocShellOriginAttributes docShellAttrs;
   bool result = aLoadContext->GetOriginAttributes(docShellAttrs);;
   NS_ENSURE_TRUE(result, NS_ERROR_FAILURE);
 
   PrincipalOriginAttributes attrs;
   attrs.InheritFromDocShellToDoc(docShellAttrs, aURI);
 
   nsresult rv = MaybeSetAddonIdFromURI(attrs, aURI);