Bug 1518948 - Wrong loadInfo check in CSPService::AsyncOnChannelRedirect, r=ckerschb
authorAndrea Marchesini <amarchesini@mozilla.com>
Thu, 10 Jan 2019 10:52:13 +0100
changeset 453241 50f5048d3b938dc22b2f065de9329fd4b9b5cdc6
parent 453240 a853501137bfb898c73b52fca41284993ba0f06b
child 453242 2b1a30512b0dd5721d6fcca0686658f31d066b7a
push id35350
push userbtara@mozilla.com
push dateThu, 10 Jan 2019 17:21:43 +0000
treeherdermozilla-central@d0a6668cf2fe [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersckerschb
bugs1518948
milestone66.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 1518948 - Wrong loadInfo check in CSPService::AsyncOnChannelRedirect, r=ckerschb
dom/security/nsCSPService.cpp
--- a/dom/security/nsCSPService.cpp
+++ b/dom/security/nsCSPService.cpp
@@ -263,25 +263,25 @@ CSPService::AsyncOnChannelRedirect(nsICh
   }
 
   nsCOMPtr<nsIURI> newUri;
   nsresult rv = newChannel->GetURI(getter_AddRefs(newUri));
   NS_ENSURE_SUCCESS(rv, rv);
 
   nsCOMPtr<nsILoadInfo> loadInfo = oldChannel->GetLoadInfo();
 
-  nsCOMPtr<nsICSPEventListener> cspEventListener;
-  rv = loadInfo->GetCspEventListener(getter_AddRefs(cspEventListener));
-  NS_ENSURE_SUCCESS(rv, rv);
-
   // if no loadInfo on the channel, nothing for us to do
   if (!loadInfo) {
     return NS_OK;
   }
 
+  nsCOMPtr<nsICSPEventListener> cspEventListener;
+  rv = loadInfo->GetCspEventListener(getter_AddRefs(cspEventListener));
+  NS_ENSURE_SUCCESS(rv, rv);
+
   // No need to continue processing if CSP is disabled or if the protocol
   // is *not* subject to CSP.
   // Please note, the correct way to opt-out of CSP using a custom
   // protocolHandler is to set one of the nsIProtocolHandler flags
   // that are whitelistet in subjectToCSP()
   nsContentPolicyType policyType = loadInfo->InternalContentPolicyType();
   if (!StaticPrefs::security_csp_enable() ||
       !subjectToCSP(newUri, policyType)) {