Bug 1223743 - CSP: Check baseChannel for CSP when loading multipart channel (r=sicking)

This commit is contained in:
Christoph Kerschbaumer 2015-12-14 10:06:56 -08:00
parent 66c4d1d72e
commit f49ac41af8

View File

@ -2678,6 +2678,16 @@ nsDocument::InitCSP(nsIChannel* aChannel)
nsAutoCString tCspHeaderValue, tCspROHeaderValue;
nsCOMPtr<nsIHttpChannel> httpChannel = do_QueryInterface(aChannel);
if (!httpChannel) {
// check baseChannel for CSP when loading a multipart channel
nsCOMPtr<nsIMultiPartChannel> multipart = do_QueryInterface(aChannel);
if (multipart) {
nsCOMPtr<nsIChannel> baseChannel;
multipart->GetBaseChannel(getter_AddRefs(baseChannel));
httpChannel = do_QueryInterface(baseChannel);
}
}
if (httpChannel) {
httpChannel->GetResponseHeader(
NS_LITERAL_CSTRING("content-security-policy"),