mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-10-31 19:47:32 +09:00
Issue #1959 - Don't apply CSPs to explicit data documents and images.
This resolves #1959
This commit is contained in:
parent
1022f11503
commit
8831656c85
1 changed files with 15 additions and 1 deletions
|
|
@ -2504,6 +2504,21 @@ nsDocument::InitCSP(nsIChannel* aChannel)
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// If this is explicitly loaded as a data document, no need to set a CSP.
|
||||||
|
if (mLoadedAsData) {
|
||||||
|
return NS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
// If this is an image, no need to set a CSP.
|
||||||
|
// If we don't do this, SVG images will be parsed as normal XML documents and
|
||||||
|
// subject to served CSPs, which might block internally applied inline styles.
|
||||||
|
// See UXP issue #1959.
|
||||||
|
nsCOMPtr<nsILoadInfo> loadInfo = aChannel->GetLoadInfo();
|
||||||
|
if (loadInfo->GetExternalContentPolicyType() ==
|
||||||
|
nsIContentPolicy::TYPE_IMAGE) {
|
||||||
|
return NS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
nsAutoCString tCspHeaderValue, tCspROHeaderValue;
|
nsAutoCString tCspHeaderValue, tCspROHeaderValue;
|
||||||
|
|
||||||
nsCOMPtr<nsIHttpChannel> httpChannel;
|
nsCOMPtr<nsIHttpChannel> httpChannel;
|
||||||
|
|
@ -2532,7 +2547,6 @@ nsDocument::InitCSP(nsIChannel* aChannel)
|
||||||
|
|
||||||
// Check if this is a signed content to apply default CSP.
|
// Check if this is a signed content to apply default CSP.
|
||||||
bool applySignedContentCSP = false;
|
bool applySignedContentCSP = false;
|
||||||
nsCOMPtr<nsILoadInfo> loadInfo = aChannel->GetLoadInfo();
|
|
||||||
if (loadInfo && loadInfo->GetVerifySignedContent()) {
|
if (loadInfo && loadInfo->GetVerifySignedContent()) {
|
||||||
applySignedContentCSP = true;
|
applySignedContentCSP = true;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue