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_EmptyBody_h
8 #define mozilla_dom_EmptyBody_h
10 #include "nsISupportsImpl.h"
12 #include "mozilla/dom/Fetch.h"
22 class EmptyBody final
: public FetchBody
<EmptyBody
> {
23 NS_DECL_ISUPPORTS_INHERITED
24 NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS_INHERITED(EmptyBody
,
28 static already_AddRefed
<EmptyBody
> Create(
29 nsIGlobalObject
* aGlobal
, mozilla::ipc::PrincipalInfo
* aPrincipalInfo
,
30 AbortSignalImpl
* aAbortSignalImpl
, const nsACString
& aMimeType
,
33 nsIGlobalObject
* GetParentObject() const { return mOwner
; }
35 AbortSignalImpl
* GetSignalImpl() const override
{ return mAbortSignalImpl
; }
37 const UniquePtr
<mozilla::ipc::PrincipalInfo
>& GetPrincipalInfo() const {
38 return mPrincipalInfo
;
41 void GetMimeType(nsACString
& aMimeType
) { aMimeType
= mMimeType
; }
43 void GetBody(nsIInputStream
** aStream
, int64_t* aBodyLength
= nullptr);
45 using FetchBody::BodyBlobURISpec
;
47 const nsACString
& BodyBlobURISpec() const { return EmptyCString(); }
49 using FetchBody::BodyLocalPath
;
51 const nsAString
& BodyLocalPath() const { return EmptyString(); }
54 EmptyBody(nsIGlobalObject
* aGlobal
,
55 mozilla::ipc::PrincipalInfo
* aPrincipalInfo
,
56 AbortSignalImpl
* aAbortSignalImpl
, const nsACString
& aMimeType
,
57 already_AddRefed
<nsIInputStream
> mBodyStream
);
61 UniquePtr
<mozilla::ipc::PrincipalInfo
> mPrincipalInfo
;
62 RefPtr
<AbortSignalImpl
> mAbortSignalImpl
;
64 nsCOMPtr
<nsIInputStream
> mBodyStream
;
68 } // namespace mozilla
70 #endif // mozilla_dom_EmptyBody_h