mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-05 23:38:38 +09:00
Issue #2728 - Remove obsolete CSP referrer policy.
This has been superseded by the dedicated Referrer-policy header. Resolves #2728
This commit is contained in:
parent
d7f01911b8
commit
0331e633bd
16 changed files with 14 additions and 606 deletions
|
|
@ -398,48 +398,6 @@ nsCSPContext::GetEnforcesFrameAncestors(bool *outEnforcesFrameAncestors)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsCSPContext::GetReferrerPolicy(uint32_t* outPolicy, bool* outIsSet)
|
||||
{
|
||||
*outIsSet = false;
|
||||
*outPolicy = mozilla::net::RP_Default;
|
||||
nsAutoString refpol;
|
||||
mozilla::net::ReferrerPolicy previousPolicy = mozilla::net::RP_Default;
|
||||
for (uint32_t i = 0; i < mPolicies.Length(); i++) {
|
||||
mPolicies[i]->getReferrerPolicy(refpol);
|
||||
// only set the referrer policy if not delievered through a CSPRO and
|
||||
// note that and an empty string in refpol means it wasn't set
|
||||
// (that's the default in nsCSPPolicy).
|
||||
if (!mPolicies[i]->getReportOnlyFlag() && !refpol.IsEmpty()) {
|
||||
// Referrer Directive in CSP is no more used and going to be replaced by
|
||||
// Referrer-Policy HTTP header. But we still keep using referrer directive,
|
||||
// and would remove it later.
|
||||
// Referrer Directive specs is not fully compliant with new referrer policy
|
||||
// specs. What we are using here:
|
||||
// - If the value of the referrer directive is invalid, the user agent
|
||||
// should set the referrer policy to no-referrer.
|
||||
// - If there are two policies that specify a referrer policy, then they
|
||||
// must agree or the employed policy is no-referrer.
|
||||
if (!mozilla::net::IsValidReferrerPolicy(refpol)) {
|
||||
*outPolicy = mozilla::net::RP_No_Referrer;
|
||||
*outIsSet = true;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
uint32_t currentPolicy = mozilla::net::ReferrerPolicyFromString(refpol);
|
||||
if (*outIsSet && previousPolicy != currentPolicy) {
|
||||
*outPolicy = mozilla::net::RP_No_Referrer;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
*outPolicy = currentPolicy;
|
||||
*outIsSet = true;
|
||||
}
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsCSPContext::AppendPolicy(const nsAString& aPolicyString,
|
||||
bool aReportOnly,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue