Report.h (1508B)
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_Report_h 8 #define mozilla_dom_Report_h 9 10 #include "js/TypeDecls.h" 11 #include "mozilla/AlreadyAddRefed.h" 12 #include "mozilla/RefPtr.h" 13 #include "nsCOMPtr.h" 14 #include "nsCycleCollectionParticipant.h" 15 #include "nsISupports.h" 16 #include "nsString.h" 17 #include "nsWrapperCache.h" 18 19 class nsIGlobalObject; 20 21 namespace mozilla::dom { 22 23 class ReportBody; 24 25 class Report final : public nsISupports, public nsWrapperCache { 26 public: 27 NS_DECL_CYCLE_COLLECTING_ISUPPORTS 28 NS_DECL_CYCLE_COLLECTION_WRAPPERCACHE_CLASS(Report) 29 30 Report(nsIGlobalObject* aGlobal, const nsAString& aType, 31 const nsAString& aURL, ReportBody* aBody); 32 33 already_AddRefed<Report> Clone(); 34 35 JSObject* WrapObject(JSContext* aCx, 36 JS::Handle<JSObject*> aGivenProto) override; 37 38 nsIGlobalObject* GetParentObject() const { return mGlobal; } 39 40 const nsString& Type() const; 41 42 void GetType(nsAString& aType) const; 43 void GetUrl(nsAString& aURL) const; 44 45 ReportBody* GetBody() const; 46 47 private: 48 ~Report(); 49 50 nsCOMPtr<nsIGlobalObject> mGlobal; 51 52 nsString mType; 53 nsString mURL; 54 RefPtr<ReportBody> mBody; 55 }; 56 57 } // namespace mozilla::dom 58 59 #endif // mozilla_dom_Report_h