tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

CSPViolationReportBody.h (2017B)


      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/. */
      6 
      7 #ifndef mozilla_dom_CSPViolationReportBody_h
      8 #define mozilla_dom_CSPViolationReportBody_h
      9 
     10 #include "mozilla/dom/Nullable.h"
     11 #include "mozilla/dom/ReportBody.h"
     12 #include "mozilla/dom/SecurityPolicyViolationEvent.h"
     13 
     14 namespace mozilla::dom {
     15 
     16 class CSPViolationReportBody final : public ReportBody {
     17 public:
     18  CSPViolationReportBody(
     19      nsIGlobalObject* aGlobal,
     20      const mozilla::dom::SecurityPolicyViolationEventInit& aEvent);
     21 
     22  JSObject* WrapObject(JSContext* aCx,
     23                       JS::Handle<JSObject*> aGivenProto) override;
     24 
     25  void GetBlockedURL(nsAString& aURL) const;
     26 
     27  void GetDocumentURL(nsAString& aURL) const;
     28 
     29  void GetReferrer(nsAString& aReferrer) const;
     30 
     31  void GetEffectiveDirective(nsAString& aDirective) const;
     32 
     33  void GetOriginalPolicy(nsAString& aPolicy) const;
     34 
     35  void GetSourceFile(nsACString& aFile) const;
     36 
     37  void GetSample(nsAString& aSample) const;
     38 
     39  mozilla::dom::SecurityPolicyViolationEventDisposition Disposition() const;
     40 
     41  uint16_t StatusCode() const;
     42 
     43  Nullable<uint32_t> GetLineNumber() const;
     44 
     45  Nullable<uint32_t> GetColumnNumber() const;
     46 
     47 protected:
     48  void ToJSON(JSONWriter& aJSONWriter) const override;
     49 
     50 private:
     51  ~CSPViolationReportBody();
     52 
     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;
     64 };
     65 
     66 }  // namespace mozilla::dom
     67 
     68 #endif  // mozilla_dom_CSPViolationReportBody_h