Backed out changeset b462e7b742d8 (bug 1908261) for causing multiple reftest failures...
[gecko.git] / dom / reporting / CSPViolationReportBody.h
blob94175bfea95fd71ddabbf1b713f2807daf5d2a0e
1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
3 /* This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
7 #ifndef mozilla_dom_CSPViolationReportBody_h
8 #define mozilla_dom_CSPViolationReportBody_h
10 #include "mozilla/dom/Nullable.h"
11 #include "mozilla/dom/ReportBody.h"
12 #include "mozilla/dom/SecurityPolicyViolationEvent.h"
14 namespace mozilla::dom {
16 class CSPViolationReportBody final : public ReportBody {
17 public:
18 CSPViolationReportBody(
19 nsIGlobalObject* aGlobal,
20 const mozilla::dom::SecurityPolicyViolationEventInit& aEvent);
22 JSObject* WrapObject(JSContext* aCx,
23 JS::Handle<JSObject*> aGivenProto) override;
25 void GetBlockedURL(nsAString& aURL) const;
27 void GetDocumentURL(nsAString& aURL) const;
29 void GetReferrer(nsAString& aReferrer) const;
31 void GetEffectiveDirective(nsAString& aDirective) const;
33 void GetOriginalPolicy(nsAString& aPolicy) const;
35 void GetSourceFile(nsACString& aFile) const;
37 void GetSample(nsAString& aSample) const;
39 mozilla::dom::SecurityPolicyViolationEventDisposition Disposition() const;
41 uint16_t StatusCode() const;
43 Nullable<uint32_t> GetLineNumber() const;
45 Nullable<uint32_t> GetColumnNumber() const;
47 protected:
48 void ToJSON(JSONWriter& aJSONWriter) const override;
50 private:
51 ~CSPViolationReportBody();
53 const nsString mDocumentURL;
54 const nsString mBlockedURL;
55 const nsString mReferrer;
56 const nsString mEffectiveDirective;
57 const nsString mOriginalPolicy;
58 const nsCString mSourceFile;
59 const nsString mSample;
60 const mozilla::dom::SecurityPolicyViolationEventDisposition mDisposition;
61 const uint16_t mStatusCode;
62 const Nullable<uint32_t> mLineNumber;
63 const Nullable<uint32_t> mColumnNumber;
66 } // namespace mozilla::dom
68 #endif // mozilla_dom_CSPViolationReportBody_h