Bug 1890277: part 2) Add `require-trusted-types-for` directive to CSP parser, guarded...
[gecko.git] / dom / base / DecompressionStream.h
blob0e8e4d07c177ae12d34bfde604d9be7463ac0720
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim:set ts=2 sw=2 sts=2 et cindent: */
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 DOM_DECOMPRESSIONSTREAM_H_
8 #define DOM_DECOMPRESSIONSTREAM_H_
10 #include "js/TypeDecls.h"
11 #include "mozilla/Attributes.h"
12 #include "mozilla/ErrorResult.h"
13 #include "mozilla/dom/BindingDeclarations.h"
14 #include "nsCycleCollectionParticipant.h"
15 #include "nsWrapperCache.h"
17 namespace mozilla::dom {
19 class ReadableStream;
20 class WritableStream;
21 class TransformStream;
23 enum class CompressionFormat : uint8_t;
25 class DecompressionStream final : public nsISupports, public nsWrapperCache {
26 public:
27 NS_DECL_CYCLE_COLLECTING_ISUPPORTS
28 NS_DECL_CYCLE_COLLECTION_WRAPPERCACHE_CLASS(DecompressionStream)
30 public:
31 DecompressionStream(nsISupports* aGlobal, TransformStream& aStream);
33 protected:
34 ~DecompressionStream();
36 public:
37 nsISupports* GetParentObject() const { return mGlobal; }
39 JSObject* WrapObject(JSContext* aCx,
40 JS::Handle<JSObject*> aGivenProto) override;
42 // TODO: Mark as MOZ_CAN_RUN_SCRIPT when IDL constructors can be (bug 1749042)
43 MOZ_CAN_RUN_SCRIPT_BOUNDARY static already_AddRefed<DecompressionStream>
44 Constructor(const GlobalObject& global, CompressionFormat format,
45 ErrorResult& aRv);
47 already_AddRefed<ReadableStream> Readable() const;
49 already_AddRefed<WritableStream> Writable() const;
51 private:
52 nsCOMPtr<nsISupports> mGlobal;
54 RefPtr<TransformStream> mStream;
57 } // namespace mozilla::dom
59 #endif // DOM_DECOMPRESSIONSTREAM_H_