Bug 1890793: Assert CallArgs::newTarget is not gray. r=spidermonkey-reviewers,sfink...
[gecko.git] / dom / base / StructuredCloneTester.h
blobd85371d86ce2b4b5cde4860591f282790b44fef5
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_StructuredCloneTester_h
8 #define mozilla_dom_StructuredCloneTester_h
10 #include "mozilla/AlreadyAddRefed.h"
11 #include "nsCOMPtr.h"
12 #include "nsISupports.h"
13 #include "nsWrapperCache.h"
15 struct JSStructuredCloneReader;
16 struct JSStructuredCloneWriter;
17 class nsIGlobalObject;
19 namespace mozilla {
21 class ErrorResult;
23 namespace dom {
25 class GlobalObject;
27 class StructuredCloneTester final : public nsISupports, public nsWrapperCache {
28 public:
29 NS_DECL_CYCLE_COLLECTING_ISUPPORTS
30 NS_DECL_CYCLE_COLLECTION_WRAPPERCACHE_CLASS(StructuredCloneTester)
32 static already_AddRefed<StructuredCloneTester> Constructor(
33 const GlobalObject& aGlobal, const bool aSerializable,
34 const bool aDeserializable);
36 bool Serializable() const;
38 bool Deserializable() const;
40 static already_AddRefed<StructuredCloneTester> ReadStructuredClone(
41 JSContext* aCx, nsIGlobalObject* aGlobal,
42 JSStructuredCloneReader* aReader);
44 bool WriteStructuredClone(JSContext* aCx,
45 JSStructuredCloneWriter* aWriter) const;
47 nsISupports* GetParentObject() const;
49 // nsWrapperCache interface
50 JSObject* WrapObject(JSContext* aCx,
51 JS::Handle<JSObject*> aGivenProto) override;
53 private:
54 StructuredCloneTester(nsISupports* aParent, const bool aSerializable,
55 const bool aDeserializable);
56 ~StructuredCloneTester() = default;
58 nsCOMPtr<nsISupports> mParent;
59 bool mSerializable;
60 bool mDeserializable;
63 } // namespace dom
64 } // namespace mozilla
66 #endif // mozilla_dom_StructuredCloneTester_h