Bug 1121857 - CSP: document.baseURI should not get blocked if baseURI is null. r=sstamm, a=sledru
authorChristoph Kerschbaumer <mozilla@christophkerschbaumer.com>
Thu, 15 Jan 2015 10:05:06 -0800
changeset 242978 a9b183f77f8d
parent 242977 0c36034999bb
child 242979 7f32601dd394
push id4353
push userryanvm@gmail.com
push date2015-01-22 18:19 +0000
treeherdermozilla-beta@a41c84bee024 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssstamm, sledru
bugs1121857
milestone36.0
Bug 1121857 - CSP: document.baseURI should not get blocked if baseURI is null. r=sstamm, a=sledru
dom/base/nsDocument.cpp
--- a/dom/base/nsDocument.cpp
+++ b/dom/base/nsDocument.cpp
@@ -3558,17 +3558,17 @@ nsDocument::SetBaseURI(nsIURI* aURI)
       return NS_OK;
     }
   }
 
   // Check if CSP allows this base-uri
   nsCOMPtr<nsIContentSecurityPolicy> csp;
   nsresult rv = NodePrincipal()->GetCsp(getter_AddRefs(csp));
   NS_ENSURE_SUCCESS(rv, rv);
-  if (csp) {
+  if (csp && aURI) {
     bool permitsBaseURI = false;
     rv = csp->PermitsBaseURI(aURI, &permitsBaseURI);
     NS_ENSURE_SUCCESS(rv, rv);
     if (!permitsBaseURI) {
       return NS_OK;
     }
   }