Coverage Report

Created: 2018-09-25 14:53

/work/obj-fuzz/dist/include/mozilla/dom/RTCSessionDescriptionBinding.h
Line
Count
Source (jump to first uncovered line)
1
/* THIS FILE IS AUTOGENERATED FROM RTCSessionDescription.webidl BY Codegen.py - DO NOT EDIT */
2
3
#ifndef mozilla_dom_RTCSessionDescriptionBinding_h
4
#define mozilla_dom_RTCSessionDescriptionBinding_h
5
6
#include "GeckoProfiler.h"
7
#include "js/RootingAPI.h"
8
#include "jspubtd.h"
9
#include "mozilla/ErrorResult.h"
10
#include "mozilla/dom/BindingDeclarations.h"
11
#include "mozilla/dom/CallbackInterface.h"
12
#include "mozilla/dom/Nullable.h"
13
#include "mozilla/dom/PrototypeList.h"
14
#include "mozilla/dom/ToJSValue.h"
15
#include "nsWeakReference.h"
16
17
namespace mozilla {
18
namespace dom {
19
20
struct NativePropertyHooks;
21
class ProtoAndIfaceCache;
22
class RTCSessionDescription;
23
struct RTCSessionDescriptionAtoms;
24
struct RTCSessionDescriptionInit;
25
struct RTCSessionDescriptionInitAtoms;
26
27
} // namespace dom
28
} // namespace mozilla
29
30
namespace mozilla {
31
namespace dom {
32
33
enum class RTCSdpType : uint8_t {
34
  Offer,
35
  Pranswer,
36
  Answer,
37
  Rollback,
38
  EndGuard_
39
};
40
41
namespace RTCSdpTypeValues {
42
extern const EnumEntry strings[5];
43
} // namespace RTCSdpTypeValues
44
45
bool
46
ToJSValue(JSContext* aCx, RTCSdpType aArgument, JS::MutableHandle<JS::Value> aValue);
47
48
49
struct RTCSessionDescriptionInit : public DictionaryBase
50
{
51
  MOZ_INIT_OUTSIDE_CTOR nsString mSdp;
52
  MOZ_INIT_OUTSIDE_CTOR RTCSdpType mType;
53
54
  RTCSessionDescriptionInit();
55
56
  explicit inline RTCSessionDescriptionInit(const FastDictionaryInitializer& )
57
0
  {
58
0
    // Do nothing here; this is used by our "Fast" subclass
59
0
  }
60
61
  explicit inline RTCSessionDescriptionInit(const RTCSessionDescriptionInit& aOther)
62
0
  {
63
0
    *this = aOther;
64
0
  }
65
66
  bool
67
  Init(JSContext* cx, JS::Handle<JS::Value> val, const char* sourceDescription = "Value", bool passedToJSImpl = false);
68
69
  bool
70
  Init(const nsAString& aJSON);
71
72
  bool
73
  ToObjectInternal(JSContext* cx, JS::MutableHandle<JS::Value> rval) const;
74
75
  bool
76
  ToJSON(nsAString& aJSON) const;
77
78
  void
79
  TraceDictionary(JSTracer* trc);
80
81
  RTCSessionDescriptionInit&
82
  operator=(const RTCSessionDescriptionInit& aOther);
83
84
private:
85
  static bool
86
  InitIds(JSContext* cx, RTCSessionDescriptionInitAtoms* atomsCache);
87
};
88
89
namespace binding_detail {
90
struct FastRTCSessionDescriptionInit : public RTCSessionDescriptionInit
91
{
92
  inline FastRTCSessionDescriptionInit()
93
    : RTCSessionDescriptionInit(FastDictionaryInitializer())
94
0
  {
95
0
    // Doesn't matter what int we pass to the parent constructor
96
0
  }
97
};
98
} // namespace binding_detail
99
100
101
namespace RTCSessionDescription_Binding {
102
103
  typedef mozilla::dom::RTCSessionDescription NativeType;
104
105
  MOZ_CAN_RUN_SCRIPT bool
106
  CollectJSONAttributes(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::RTCSessionDescription* self, JS::Rooted<JSObject*>& result);
107
108
  bool
109
  ConstructorEnabled(JSContext* aCx, JS::Handle<JSObject*> aObj);
110
111
  const JSClass*
112
  GetJSClass();
113
114
  bool
115
  Wrap(JSContext* aCx, mozilla::dom::RTCSessionDescription* aObject, nsWrapperCache* aCache, JS::Handle<JSObject*> aGivenProto, JS::MutableHandle<JSObject*> aReflector);
116
117
  template <class T>
118
  inline JSObject* Wrap(JSContext* aCx, T* aObject, JS::Handle<JSObject*> aGivenProto)
119
0
  {
120
0
    JS::Rooted<JSObject*> reflector(aCx);
121
0
    return Wrap(aCx, aObject, aObject, aGivenProto, &reflector) ? reflector.get() : nullptr;
122
0
  }
123
124
  // We declare this as an array so that retrieving a pointer to this
125
  // binding's property hooks only requires compile/link-time resolvable
126
  // address arithmetic.  Declaring it as a pointer instead would require
127
  // doing a run-time load to fetch a pointer to this binding's property
128
  // hooks.  And then structures which embedded a pointer to this structure
129
  // would require a run-time load for proper initialization, which would
130
  // then induce static constructors.  Lots of static constructors.
131
  extern const NativePropertyHooks sNativePropertyHooks[];
132
133
  void
134
  CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, bool aDefineOnGlobal);
135
136
  inline JS::Handle<JSObject*> GetProtoObjectHandle(JSContext* aCx)
137
0
  {
138
0
    /* Get the interface prototype object for this class.  This will create the
139
0
       object as needed. */
140
0
    return GetPerInterfaceObjectHandle(aCx, prototypes::id::RTCSessionDescription,
141
0
                                       &CreateInterfaceObjects,
142
0
                                       /* aDefineOnGlobal = */ true);
143
0
144
0
  }
145
146
  JSObject*
147
  GetProtoObject(JSContext* aCx);
148
149
  inline JS::Handle<JSObject*> GetConstructorObjectHandle(JSContext* aCx, bool aDefineOnGlobal = true)
150
0
  {
151
0
    /* Get the interface object for this class.  This will create the object as
152
0
       needed. */
153
0
154
0
    return GetPerInterfaceObjectHandle(aCx, constructors::id::RTCSessionDescription,
155
0
                                       &CreateInterfaceObjects,
156
0
                                       aDefineOnGlobal);
157
0
  }
158
159
  JSObject*
160
  GetConstructorObject(JSContext* aCx);
161
162
} // namespace RTCSessionDescription_Binding
163
164
165
166
class RTCSessionDescriptionJSImpl : public CallbackInterface
167
{
168
public:
169
  explicit inline RTCSessionDescriptionJSImpl(JSContext* aCx, JS::Handle<JSObject*> aCallback, JS::Handle<JSObject*> aCallbackGlobal, nsIGlobalObject* aIncumbentGlobal)
170
    : CallbackInterface(aCx, aCallback, aCallbackGlobal, aIncumbentGlobal)
171
0
  {
172
0
  }
173
174
  explicit inline RTCSessionDescriptionJSImpl(JSObject* aCallback, JSObject* aCallbackGlobal, const FastCallbackConstructor& )
175
    : CallbackInterface(aCallback, aCallbackGlobal, FastCallbackConstructor())
176
0
  {
177
0
  }
178
179
  explicit inline RTCSessionDescriptionJSImpl(JSObject* aCallback, JSObject* aCallbackGlobal, JSObject* aAsyncStack, nsIGlobalObject* aIncumbentGlobal)
180
    : CallbackInterface(aCallback, aCallbackGlobal, aAsyncStack, aIncumbentGlobal)
181
0
  {
182
0
  }
183
184
  void ToJSON(JS::MutableHandle<JSObject*> aRetVal, ErrorResult& aRv, JS::Realm* aRealm = nullptr);
185
186
  void __Init(const RTCSessionDescriptionInit& descriptionInitDict, ErrorResult& aRv, JS::Realm* aRealm = nullptr);
187
188
  inline bool
189
  operator==(const RTCSessionDescriptionJSImpl& aOther) const
190
0
  {
191
0
    return CallbackInterface::operator==(aOther);
192
0
  }
193
194
  RTCSdpType GetType(ErrorResult& aRv, JS::Realm* aRealm = nullptr);
195
196
  void GetSdp(nsString& aRetVal, ErrorResult& aRv, JS::Realm* aRealm = nullptr);
197
198
  void SetType(RTCSdpType arg, ErrorResult& aRv, JS::Realm* aRealm = nullptr);
199
200
  void SetSdp(const nsAString& arg, ErrorResult& aRv, JS::Realm* aRealm = nullptr);
201
202
private:
203
  static bool
204
  InitIds(JSContext* cx, RTCSessionDescriptionAtoms* atomsCache);
205
};
206
207
208
class RTCSessionDescription : public nsSupportsWeakReference,
209
                              public nsWrapperCache
210
{
211
public:
212
  NS_DECL_CYCLE_COLLECTING_ISUPPORTS
213
  NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(RTCSessionDescription)
214
215
private:
216
  RefPtr<RTCSessionDescriptionJSImpl> mImpl;
217
  nsCOMPtr<nsIGlobalObject> mParent;
218
219
public:
220
  RTCSessionDescription(JS::Handle<JSObject*> aJSImplObject, JS::Handle<JSObject*> aJSImplGlobal, nsIGlobalObject* aParent);
221
222
protected:
223
  virtual ~RTCSessionDescription();
224
225
public:
226
  nsISupports* GetParentObject() const;
227
228
  virtual JSObject* WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
229
230
  static already_AddRefed<RTCSessionDescription> Constructor(const GlobalObject& global, JSContext* cx, const RTCSessionDescriptionInit& descriptionInitDict, ErrorResult& aRv, JS::Handle<JSObject*> aGivenProto = nullptr);
231
232
  RTCSdpType GetType(ErrorResult& aRv, JS::Realm* aRealm = nullptr) const;
233
234
  void SetType(RTCSdpType arg, ErrorResult& aRv, JS::Realm* aRealm = nullptr);
235
236
  void GetSdp(nsString& aRetVal, ErrorResult& aRv, JS::Realm* aRealm = nullptr) const;
237
238
  void SetSdp(const nsAString& arg, ErrorResult& aRv, JS::Realm* aRealm = nullptr);
239
240
  void ToJSON(JS::MutableHandle<JSObject*> aRetVal, ErrorResult& aRv, JS::Realm* aRealm = nullptr);
241
242
  static bool
243
  _Create(JSContext* cx, unsigned argc, JS::Value* vp);
244
};
245
246
247
} // namespace dom
248
} // namespace mozilla
249
250
#endif // mozilla_dom_RTCSessionDescriptionBinding_h