From 0097345ad9aa859dcf02cb0ba80685d51bc7ec16 Mon Sep 17 00:00:00 2001 From: janekptacijarabaci Date: Sat, 23 Jun 2018 04:30:08 +0200 Subject: Bug 1469150 - CSP: Scripts with valid nonce get blocked if URL redirects is fixed (follow up) --- dom/security/nsCSPService.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'dom/security') diff --git a/dom/security/nsCSPService.cpp b/dom/security/nsCSPService.cpp index f9186b309..4807c9aa4 100644 --- a/dom/security/nsCSPService.cpp +++ b/dom/security/nsCSPService.cpp @@ -288,6 +288,7 @@ CSPService::AsyncOnChannelRedirect(nsIChannel *oldChannel, nsContentUtils::InternalContentPolicyTypeToExternalOrWorker(policyType); int16_t aDecision = nsIContentPolicy::ACCEPT; + nsCOMPtr requestContext = loadInfo->GetLoadingContext(); // 1) Apply speculative CSP for preloads if (isPreload) { nsCOMPtr preloadCsp; @@ -298,7 +299,7 @@ CSPService::AsyncOnChannelRedirect(nsIChannel *oldChannel, preloadCsp->ShouldLoad(policyType, // load type per nsIContentPolicy (uint32_t) newUri, // nsIURI nullptr, // nsIURI - nullptr, // nsISupports + requestContext, // nsISupports EmptyCString(), // ACString - MIME guess originalUri, // aExtra &aDecision); @@ -317,7 +318,6 @@ CSPService::AsyncOnChannelRedirect(nsIChannel *oldChannel, loadInfo->LoadingPrincipal()->GetCsp(getter_AddRefs(csp)); if (csp) { - nsCOMPtr requestContext = loadInfo->GetLoadingContext(); // Pass originalURI as aExtra to indicate the redirect csp->ShouldLoad(policyType, // load type per nsIContentPolicy (uint32_t) newUri, // nsIURI -- cgit v1.2.3