mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-10-22 07:07:30 +09:00
[DOM] Honor security.csp.reporting.enabled pref in more places.
This commit is contained in:
parent
3bac3ab0b5
commit
c41c1c63d5
1 changed files with 12 additions and 9 deletions
|
|
@ -263,7 +263,7 @@ nsCSPContext::permitsInternal(CSPDirective aDir,
|
||||||
// Do not send a report or notify observers if this is a preload - the
|
// Do not send a report or notify observers if this is a preload - the
|
||||||
// decision may be wrong due to the inability to get the nonce, and will
|
// decision may be wrong due to the inability to get the nonce, and will
|
||||||
// incorrectly fail the unit tests.
|
// incorrectly fail the unit tests.
|
||||||
if (!aIsPreload && aSendViolationReports) {
|
if (CSPService::sCSPReportingEnabled && !aIsPreload && aSendViolationReports) {
|
||||||
uint32_t lineNumber = 0;
|
uint32_t lineNumber = 0;
|
||||||
uint32_t columnNumber = 0;
|
uint32_t columnNumber = 0;
|
||||||
nsAutoCString spec;
|
nsAutoCString spec;
|
||||||
|
|
@ -601,6 +601,7 @@ nsCSPContext::GetAllowsInline(CSPDirective aDirective,
|
||||||
}
|
}
|
||||||
nsAutoString violatedDirective;
|
nsAutoString violatedDirective;
|
||||||
mPolicies[i]->getDirectiveStringForContentType(aDirective, violatedDirective);
|
mPolicies[i]->getDirectiveStringForContentType(aDirective, violatedDirective);
|
||||||
|
if(CSPService::sCSPReportingEnabled) {
|
||||||
reportInlineViolation(aDirective,
|
reportInlineViolation(aDirective,
|
||||||
aNonce,
|
aNonce,
|
||||||
aContent,
|
aContent,
|
||||||
|
|
@ -610,6 +611,7 @@ nsCSPContext::GetAllowsInline(CSPDirective aDirective,
|
||||||
aColumnNumber);
|
aColumnNumber);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -648,7 +650,8 @@ nsCSPContext::GetAllowsInline(CSPDirective aDirective,
|
||||||
PR_BEGIN_MACRO \
|
PR_BEGIN_MACRO \
|
||||||
static_assert(directive##_SRC_DIRECTIVE == SCRIPT_SRC_DIRECTIVE || \
|
static_assert(directive##_SRC_DIRECTIVE == SCRIPT_SRC_DIRECTIVE || \
|
||||||
directive##_SRC_DIRECTIVE == STYLE_SRC_DIRECTIVE); \
|
directive##_SRC_DIRECTIVE == STYLE_SRC_DIRECTIVE); \
|
||||||
if (!mPolicies[p]->allows(directive##_SRC_DIRECTIVE, keyword, nonceOrHash, \
|
if(CSPService::sCSPReportingEnabled && \
|
||||||
|
!mPolicies[p]->allows(directive##_SRC_DIRECTIVE, keyword, nonceOrHash, \
|
||||||
false)) { \
|
false)) { \
|
||||||
nsAutoString violatedDirective; \
|
nsAutoString violatedDirective; \
|
||||||
mPolicies[p]->getDirectiveStringForContentType( \
|
mPolicies[p]->getDirectiveStringForContentType( \
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue