diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-06-12 05:35:29 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-06-12 05:35:29 +0000 |
commit | 59203c63bb777a3bacec32fb8830fba33540e809 (patch) | |
tree | 58298e711c0ff0575818c30485b44a2f21bf28a0 /dom/security/nsCSPContext.h | |
parent | Adding upstream version 126.0.1. (diff) | |
download | firefox-59203c63bb777a3bacec32fb8830fba33540e809.tar.xz firefox-59203c63bb777a3bacec32fb8830fba33540e809.zip |
Adding upstream version 127.0.upstream/127.0
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'dom/security/nsCSPContext.h')
-rw-r--r-- | dom/security/nsCSPContext.h | 38 |
1 files changed, 22 insertions, 16 deletions
diff --git a/dom/security/nsCSPContext.h b/dom/security/nsCSPContext.h index e4fe5af315..f957c85e48 100644 --- a/dom/security/nsCSPContext.h +++ b/dom/security/nsCSPContext.h @@ -32,6 +32,8 @@ class nsIEventTarget; struct ConsoleMsgQueueElem; namespace mozilla { +template <typename... Ts> +class Variant; namespace dom { class Element; } @@ -77,11 +79,23 @@ class nsCSPContext : public nsIContentSecurityPolicy { uint32_t aLineNumber, uint32_t aColumnNumber, uint32_t aSeverityFlag); + enum BlockedContentSource { + eUnknown, + eInline, + eEval, + eSelf, + eWasmEval, + }; + + // Roughly implements a violation's resource + // (https://w3c.github.io/webappsec-csp/#framework-violation). + using Resource = mozilla::Variant<nsIURI*, BlockedContentSource>; + /** * Construct SecurityPolicyViolationEventInit structure. * - * @param aBlockedURI - * A nsIURI: the source of the violation. + * @param aResource + * The source of the violation. * @param aOriginalUri * The original URI if the blocked content is a redirect, else null * @param aViolatedDirective @@ -98,10 +112,10 @@ class nsCSPContext : public nsIContentSecurityPolicy { * The output */ nsresult GatherSecurityPolicyViolationEventData( - nsIURI* aBlockedURI, const nsACString& aBlockedString, - nsIURI* aOriginalURI, const nsAString& aViolatedDirective, - uint32_t aViolatedPolicyIndex, const nsAString& aSourceFile, - const nsAString& aScriptSample, uint32_t aLineNum, uint32_t aColumnNum, + Resource& aResource, nsIURI* aOriginalURI, + const nsAString& aViolatedDirective, uint32_t aViolatedPolicyIndex, + const nsAString& aSourceFile, const nsAString& aScriptSample, + uint32_t aLineNum, uint32_t aColumnNum, mozilla::dom::SecurityPolicyViolationEventInit& aViolationEventInit); nsresult SendReports( @@ -114,20 +128,12 @@ class nsCSPContext : public nsIContentSecurityPolicy { const mozilla::dom::SecurityPolicyViolationEventInit& aViolationEventInit); - enum BlockedContentSource { - eUnknown, - eInline, - eEval, - eSelf, - eWasmEval, - }; - nsresult AsyncReportViolation( mozilla::dom::Element* aTriggeringElement, nsICSPEventListener* aCSPEventListener, nsIURI* aBlockedURI, BlockedContentSource aBlockedContentSource, nsIURI* aOriginalURI, - const nsAString& aViolatedDirective, - const nsAString& aViolatedDirectiveString, + const nsAString& aViolatedDirectiveName, + const nsAString& aViolatedDirectiveNameAndValue, const CSPDirective aEffectiveDirective, uint32_t aViolatedPolicyIndex, const nsAString& aObserverSubject, const nsAString& aSourceFile, bool aReportSample, const nsAString& aScriptSample, uint32_t aLineNum, |