Bug 1306300, null check nsILoadContext in GetLoadContextCodebasePrincipal, r=baku
authorOlli Pettay <Olli.Pettay@helsinki.fi>
Thu, 29 Sep 2016 20:31:50 +0300
changeset 315860 14d41b959f3a21fb40c49fa66dc1c7b23642afe8
parent 315859 f451982cae7cd667dea82640196cd6942beef235
child 315861 4cb1b2ae58c0ad71fb41c095b4bf09947da0fb51
push id20634
push usercbook@mozilla.com
push dateFri, 30 Sep 2016 10:10:13 +0000
treeherderfx-team@afe79b010d13 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbaku
bugs1306300
milestone52.0a1
Bug 1306300, null check nsILoadContext in GetLoadContextCodebasePrincipal, r=baku
caps/nsScriptSecurityManager.cpp
--- a/caps/nsScriptSecurityManager.cpp
+++ b/caps/nsScriptSecurityManager.cpp
@@ -1164,16 +1164,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);