Coverage Report

Created: 2018-09-25 14:53

/work/obj-fuzz/dist/include/mozilla/dom/PushSubscriptionBinding.h
Line
Count
Source (jump to first uncovered line)
1
/* THIS FILE IS AUTOGENERATED FROM PushSubscription.webidl BY Codegen.py - DO NOT EDIT */
2
3
#ifndef mozilla_dom_PushSubscriptionBinding_h
4
#define mozilla_dom_PushSubscriptionBinding_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/Nullable.h"
12
#include "mozilla/dom/PrototypeList.h"
13
#include "mozilla/dom/TypedArray.h"
14
#include "mozilla/dom/UnionTypes.h"
15
16
namespace mozilla {
17
namespace dom {
18
19
class ArrayBufferViewOrArrayBuffer;
20
struct NativePropertyHooks;
21
class OwningArrayBufferViewOrArrayBuffer;
22
class ProtoAndIfaceCache;
23
class PushSubscription;
24
struct PushSubscriptionAtoms;
25
struct PushSubscriptionInitAtoms;
26
struct PushSubscriptionJSONAtoms;
27
struct PushSubscriptionKeys;
28
struct PushSubscriptionKeysAtoms;
29
30
} // namespace dom
31
} // namespace mozilla
32
33
namespace mozilla {
34
namespace dom {
35
36
enum class PushEncryptionKeyName : uint8_t {
37
  P256dh,
38
  Auth,
39
  EndGuard_
40
};
41
42
namespace PushEncryptionKeyNameValues {
43
extern const EnumEntry strings[3];
44
} // namespace PushEncryptionKeyNameValues
45
46
bool
47
ToJSValue(JSContext* aCx, PushEncryptionKeyName aArgument, JS::MutableHandle<JS::Value> aValue);
48
49
50
struct PushSubscriptionInit : public DictionaryBase
51
{
52
  MOZ_INIT_OUTSIDE_CTOR Optional<Nullable<OwningArrayBufferViewOrArrayBuffer >> mAppServerKey;
53
  MOZ_INIT_OUTSIDE_CTOR Optional<Nullable<ArrayBuffer>> mAuthSecret;
54
  MOZ_INIT_OUTSIDE_CTOR nsString mEndpoint;
55
  MOZ_INIT_OUTSIDE_CTOR Optional<Nullable<ArrayBuffer>> mP256dhKey;
56
  MOZ_INIT_OUTSIDE_CTOR nsString mScope;
57
58
  PushSubscriptionInit();
59
60
  explicit inline PushSubscriptionInit(const FastDictionaryInitializer& )
61
0
  {
62
0
    // Do nothing here; this is used by our "Fast" subclass
63
0
  }
64
65
private:
66
  PushSubscriptionInit(const PushSubscriptionInit&) = delete;
67
  PushSubscriptionInit& operator=(const PushSubscriptionInit&) = delete;
68
69
  static bool
70
  InitIds(JSContext* cx, PushSubscriptionInitAtoms* atomsCache);
71
72
public:
73
  bool
74
  Init(JSContext* cx, JS::Handle<JS::Value> val, const char* sourceDescription = "Value", bool passedToJSImpl = false);
75
76
  bool
77
  ToObjectInternal(JSContext* cx, JS::MutableHandle<JS::Value> rval) const;
78
79
  void
80
  TraceDictionary(JSTracer* trc);
81
};
82
83
namespace binding_detail {
84
struct FastPushSubscriptionInit : public PushSubscriptionInit
85
{
86
  inline FastPushSubscriptionInit()
87
    : PushSubscriptionInit(FastDictionaryInitializer())
88
0
  {
89
0
    // Doesn't matter what int we pass to the parent constructor
90
0
  }
91
};
92
} // namespace binding_detail
93
94
95
struct PushSubscriptionKeys : public DictionaryBase
96
{
97
  MOZ_INIT_OUTSIDE_CTOR Optional<nsCString> mAuth;
98
  MOZ_INIT_OUTSIDE_CTOR Optional<nsCString> mP256dh;
99
100
  PushSubscriptionKeys();
101
102
  explicit inline PushSubscriptionKeys(const FastDictionaryInitializer& )
103
0
  {
104
0
    // Do nothing here; this is used by our "Fast" subclass
105
0
  }
106
107
  explicit inline PushSubscriptionKeys(const PushSubscriptionKeys& aOther)
108
0
  {
109
0
    *this = aOther;
110
0
  }
111
112
  bool
113
  Init(JSContext* cx, JS::Handle<JS::Value> val, const char* sourceDescription = "Value", bool passedToJSImpl = false);
114
115
  bool
116
  Init(const nsAString& aJSON);
117
118
  bool
119
  ToObjectInternal(JSContext* cx, JS::MutableHandle<JS::Value> rval) const;
120
121
  bool
122
  ToJSON(nsAString& aJSON) const;
123
124
  void
125
  TraceDictionary(JSTracer* trc);
126
127
  PushSubscriptionKeys&
128
  operator=(const PushSubscriptionKeys& aOther);
129
130
private:
131
  static bool
132
  InitIds(JSContext* cx, PushSubscriptionKeysAtoms* atomsCache);
133
};
134
135
namespace binding_detail {
136
struct FastPushSubscriptionKeys : public PushSubscriptionKeys
137
{
138
  inline FastPushSubscriptionKeys()
139
    : PushSubscriptionKeys(FastDictionaryInitializer())
140
0
  {
141
0
    // Doesn't matter what int we pass to the parent constructor
142
0
  }
143
};
144
} // namespace binding_detail
145
146
147
struct PushSubscriptionJSON : public DictionaryBase
148
{
149
  MOZ_INIT_OUTSIDE_CTOR Optional<nsString> mEndpoint;
150
  MOZ_INIT_OUTSIDE_CTOR PushSubscriptionKeys mKeys;
151
152
  PushSubscriptionJSON();
153
154
  explicit inline PushSubscriptionJSON(const FastDictionaryInitializer& )
155
    : mKeys(FastDictionaryInitializer())
156
0
  {
157
0
    // Do nothing here; this is used by our "Fast" subclass
158
0
  }
159
160
  explicit inline PushSubscriptionJSON(const PushSubscriptionJSON& aOther)
161
    : mKeys(FastDictionaryInitializer())
162
0
  {
163
0
    *this = aOther;
164
0
  }
165
166
  bool
167
  Init(JSContext* cx, JS::Handle<JS::Value> val, const char* sourceDescription = "Value", bool passedToJSImpl = false);
168
169
  bool
170
  Init(const nsAString& aJSON);
171
172
  bool
173
  ToObjectInternal(JSContext* cx, JS::MutableHandle<JS::Value> rval) const;
174
175
  bool
176
  ToJSON(nsAString& aJSON) const;
177
178
  void
179
  TraceDictionary(JSTracer* trc);
180
181
  PushSubscriptionJSON&
182
  operator=(const PushSubscriptionJSON& aOther);
183
184
private:
185
  static bool
186
  InitIds(JSContext* cx, PushSubscriptionJSONAtoms* atomsCache);
187
};
188
189
namespace binding_detail {
190
struct FastPushSubscriptionJSON : public PushSubscriptionJSON
191
{
192
  inline FastPushSubscriptionJSON()
193
    : PushSubscriptionJSON(FastDictionaryInitializer())
194
0
  {
195
0
    // Doesn't matter what int we pass to the parent constructor
196
0
  }
197
};
198
} // namespace binding_detail
199
200
201
namespace PushSubscription_Binding {
202
203
  typedef mozilla::dom::PushSubscription NativeType;
204
205
  bool
206
  ConstructorEnabled(JSContext* aCx, JS::Handle<JSObject*> aObj);
207
208
  const JSClass*
209
  GetJSClass();
210
211
  bool
212
  Wrap(JSContext* aCx, mozilla::dom::PushSubscription* aObject, nsWrapperCache* aCache, JS::Handle<JSObject*> aGivenProto, JS::MutableHandle<JSObject*> aReflector);
213
214
  template <class T>
215
  inline JSObject* Wrap(JSContext* aCx, T* aObject, JS::Handle<JSObject*> aGivenProto)
216
0
  {
217
0
    JS::Rooted<JSObject*> reflector(aCx);
218
0
    return Wrap(aCx, aObject, aObject, aGivenProto, &reflector) ? reflector.get() : nullptr;
219
0
  }
220
221
  // We declare this as an array so that retrieving a pointer to this
222
  // binding's property hooks only requires compile/link-time resolvable
223
  // address arithmetic.  Declaring it as a pointer instead would require
224
  // doing a run-time load to fetch a pointer to this binding's property
225
  // hooks.  And then structures which embedded a pointer to this structure
226
  // would require a run-time load for proper initialization, which would
227
  // then induce static constructors.  Lots of static constructors.
228
  extern const NativePropertyHooks sNativePropertyHooks[];
229
230
  void
231
  CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, bool aDefineOnGlobal);
232
233
  inline JS::Handle<JSObject*> GetProtoObjectHandle(JSContext* aCx)
234
0
  {
235
0
    /* Get the interface prototype object for this class.  This will create the
236
0
       object as needed. */
237
0
    return GetPerInterfaceObjectHandle(aCx, prototypes::id::PushSubscription,
238
0
                                       &CreateInterfaceObjects,
239
0
                                       /* aDefineOnGlobal = */ true);
240
0
241
0
  }
242
243
  inline JS::Handle<JSObject*> GetConstructorObjectHandle(JSContext* aCx, bool aDefineOnGlobal = true)
244
0
  {
245
0
    /* Get the interface object for this class.  This will create the object as
246
0
       needed. */
247
0
248
0
    return GetPerInterfaceObjectHandle(aCx, constructors::id::PushSubscription,
249
0
                                       &CreateInterfaceObjects,
250
0
                                       aDefineOnGlobal);
251
0
  }
252
253
  JSObject*
254
  GetConstructorObject(JSContext* aCx);
255
256
} // namespace PushSubscription_Binding
257
258
259
260
} // namespace dom
261
} // namespace mozilla
262
263
#endif // mozilla_dom_PushSubscriptionBinding_h