mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-04 23:08:39 +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
|
|
@ -17,7 +17,6 @@
|
|||
#include "nsReadableUtils.h"
|
||||
#include "nsServiceManagerUtils.h"
|
||||
#include "nsUnicharUtils.h"
|
||||
#include "mozilla/net/ReferrerPolicy.h"
|
||||
|
||||
using namespace mozilla;
|
||||
|
||||
|
|
@ -826,38 +825,6 @@ nsCSPParser::sourceList(nsTArray<nsCSPBaseSrc*>& outSrcs)
|
|||
}
|
||||
}
|
||||
|
||||
void
|
||||
nsCSPParser::referrerDirectiveValue(nsCSPDirective* aDir)
|
||||
{
|
||||
// directive-value = "none" / "none-when-downgrade" / "origin" / "origin-when-cross-origin" / "unsafe-url"
|
||||
// directive name is token 0, we need to examine the remaining tokens (and
|
||||
// there should only be one token in the value).
|
||||
CSPPARSERLOG(("nsCSPParser::referrerDirectiveValue"));
|
||||
|
||||
if (mCurDir.Length() != 2) {
|
||||
CSPPARSERLOG(("Incorrect number of tokens in referrer directive, got %d expected 1",
|
||||
mCurDir.Length() - 1));
|
||||
delete aDir;
|
||||
return;
|
||||
}
|
||||
|
||||
if (!mozilla::net::IsValidReferrerPolicy(mCurDir[1])) {
|
||||
CSPPARSERLOG(("invalid value for referrer directive: %s",
|
||||
NS_ConvertUTF16toUTF8(mCurDir[1]).get()));
|
||||
delete aDir;
|
||||
return;
|
||||
}
|
||||
|
||||
//referrer-directive deprecation warning
|
||||
const char16_t* params[] = { mCurDir[1].get() };
|
||||
logWarningErrorToConsole(nsIScriptError::warningFlag, "deprecatedReferrerDirective",
|
||||
params, ArrayLength(params));
|
||||
|
||||
// the referrer policy is valid, so go ahead and use it.
|
||||
mPolicy->setReferrerPolicy(&mCurDir[1]);
|
||||
mPolicy->addDirective(aDir);
|
||||
}
|
||||
|
||||
void
|
||||
nsCSPParser::requireSRIForDirectiveValue(nsRequireSRIForDirective* aDir)
|
||||
{
|
||||
|
|
@ -1170,13 +1137,6 @@ nsCSPParser::directive()
|
|||
return;
|
||||
}
|
||||
|
||||
// special case handling of the referrer directive (since it doesn't contain
|
||||
// source lists)
|
||||
if (cspDir->equals(nsIContentSecurityPolicy::REFERRER_DIRECTIVE)) {
|
||||
referrerDirectiveValue(cspDir);
|
||||
return;
|
||||
}
|
||||
|
||||
// special case handling for report-uri directive (since it doesn't contain
|
||||
// a valid source list but rather actual URIs)
|
||||
if (CSP_IsDirective(mCurDir[0], nsIContentSecurityPolicy::REPORT_URI_DIRECTIVE)) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue