Coverage Report

Created: 2018-09-25 14:53

/work/obj-fuzz/dist/include/mozilla/dom/URLSearchParamsBinding.h
Line
Count
Source (jump to first uncovered line)
1
/* THIS FILE IS AUTOGENERATED FROM URLSearchParams.webidl BY Codegen.py - DO NOT EDIT */
2
3
#ifndef mozilla_dom_URLSearchParamsBinding_h
4
#define mozilla_dom_URLSearchParamsBinding_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/FakeString.h"
12
#include "mozilla/dom/IterableIterator.h"
13
#include "mozilla/dom/Nullable.h"
14
#include "mozilla/dom/PrototypeList.h"
15
#include "mozilla/dom/Record.h"
16
#include "mozilla/dom/UnionMember.h"
17
18
namespace mozilla {
19
namespace dom {
20
21
struct NativePropertyHooks;
22
class ProtoAndIfaceCache;
23
class URLSearchParams;
24
struct URLSearchParamsAtoms;
25
26
} // namespace dom
27
} // namespace mozilla
28
29
namespace mozilla {
30
namespace dom {
31
32
class USVStringSequenceSequenceOrUSVStringUSVStringRecordOrUSVString
33
{
34
  friend class USVStringSequenceSequenceOrUSVStringUSVStringRecordOrUSVStringArgument;
35
  enum Type
36
  {
37
    eUninitialized,
38
    eUSVStringSequenceSequence,
39
    eUSVStringUSVStringRecord,
40
    eUSVString
41
  };
42
43
  union Value
44
  {
45
    UnionMember<binding_detail::AutoSequence<Sequence<nsString>> > mUSVStringSequenceSequence;
46
    UnionMember<Record<nsString, nsString> > mUSVStringUSVStringRecord;
47
    UnionMember<binding_detail::FakeString > mUSVString;
48
49
  };
50
51
  Type mType;
52
  Value mValue;
53
54
  USVStringSequenceSequenceOrUSVStringUSVStringRecordOrUSVString(const USVStringSequenceSequenceOrUSVStringUSVStringRecordOrUSVString&) = delete;
55
  USVStringSequenceSequenceOrUSVStringUSVStringRecordOrUSVString& operator=(const USVStringSequenceSequenceOrUSVStringUSVStringRecordOrUSVString&) = delete;
56
public:
57
  explicit inline USVStringSequenceSequenceOrUSVStringUSVStringRecordOrUSVString()
58
    : mType(eUninitialized)
59
0
  {
60
0
  }
61
62
  inline ~USVStringSequenceSequenceOrUSVStringUSVStringRecordOrUSVString()
63
0
  {
64
0
    Uninit();
65
0
  }
66
67
  inline binding_detail::AutoSequence<Sequence<nsString>>&
68
  RawSetAsUSVStringSequenceSequence()
69
0
  {
70
0
    if (mType == eUSVStringSequenceSequence) {
71
0
      return mValue.mUSVStringSequenceSequence.Value();
72
0
    }
73
0
    MOZ_ASSERT(mType == eUninitialized);
74
0
    mType = eUSVStringSequenceSequence;
75
0
    return mValue.mUSVStringSequenceSequence.SetValue();
76
0
  }
77
78
  inline binding_detail::AutoSequence<Sequence<nsString>>&
79
  SetAsUSVStringSequenceSequence()
80
0
  {
81
0
    if (mType == eUSVStringSequenceSequence) {
82
0
      return mValue.mUSVStringSequenceSequence.Value();
83
0
    }
84
0
    Uninit();
85
0
    mType = eUSVStringSequenceSequence;
86
0
    return mValue.mUSVStringSequenceSequence.SetValue();
87
0
  }
88
89
  inline bool
90
  IsUSVStringSequenceSequence() const
91
0
  {
92
0
    return mType == eUSVStringSequenceSequence;
93
0
  }
94
95
  inline binding_detail::AutoSequence<Sequence<nsString>>&
96
  GetAsUSVStringSequenceSequence()
97
0
  {
98
0
    MOZ_ASSERT(IsUSVStringSequenceSequence(), "Wrong type!");
99
0
    return mValue.mUSVStringSequenceSequence.Value();
100
0
  }
101
102
  inline const Sequence<Sequence<nsString>>&
103
  GetAsUSVStringSequenceSequence() const
104
0
  {
105
0
    MOZ_ASSERT(IsUSVStringSequenceSequence(), "Wrong type!");
106
0
    return mValue.mUSVStringSequenceSequence.Value();
107
0
  }
108
109
  inline Record<nsString, nsString>&
110
  RawSetAsUSVStringUSVStringRecord()
111
0
  {
112
0
    if (mType == eUSVStringUSVStringRecord) {
113
0
      return mValue.mUSVStringUSVStringRecord.Value();
114
0
    }
115
0
    MOZ_ASSERT(mType == eUninitialized);
116
0
    mType = eUSVStringUSVStringRecord;
117
0
    return mValue.mUSVStringUSVStringRecord.SetValue();
118
0
  }
119
120
  inline Record<nsString, nsString>&
121
  SetAsUSVStringUSVStringRecord()
122
0
  {
123
0
    if (mType == eUSVStringUSVStringRecord) {
124
0
      return mValue.mUSVStringUSVStringRecord.Value();
125
0
    }
126
0
    Uninit();
127
0
    mType = eUSVStringUSVStringRecord;
128
0
    return mValue.mUSVStringUSVStringRecord.SetValue();
129
0
  }
130
131
  inline bool
132
  IsUSVStringUSVStringRecord() const
133
0
  {
134
0
    return mType == eUSVStringUSVStringRecord;
135
0
  }
136
137
  inline Record<nsString, nsString>&
138
  GetAsUSVStringUSVStringRecord()
139
0
  {
140
0
    MOZ_ASSERT(IsUSVStringUSVStringRecord(), "Wrong type!");
141
0
    return mValue.mUSVStringUSVStringRecord.Value();
142
0
  }
143
144
  inline const Record<nsString, nsString>&
145
  GetAsUSVStringUSVStringRecord() const
146
0
  {
147
0
    MOZ_ASSERT(IsUSVStringUSVStringRecord(), "Wrong type!");
148
0
    return mValue.mUSVStringUSVStringRecord.Value();
149
0
  }
150
151
  inline binding_detail::FakeString&
152
  RawSetAsUSVString()
153
0
  {
154
0
    if (mType == eUSVString) {
155
0
      return mValue.mUSVString.Value();
156
0
    }
157
0
    MOZ_ASSERT(mType == eUninitialized);
158
0
    mType = eUSVString;
159
0
    return mValue.mUSVString.SetValue();
160
0
  }
161
162
  inline binding_detail::FakeString&
163
  SetAsUSVString()
164
0
  {
165
0
    if (mType == eUSVString) {
166
0
      return mValue.mUSVString.Value();
167
0
    }
168
0
    Uninit();
169
0
    mType = eUSVString;
170
0
    return mValue.mUSVString.SetValue();
171
0
  }
172
173
  inline bool
174
  IsUSVString() const
175
0
  {
176
0
    return mType == eUSVString;
177
0
  }
178
179
  inline binding_detail::FakeString&
180
  GetAsUSVString()
181
0
  {
182
0
    MOZ_ASSERT(IsUSVString(), "Wrong type!");
183
0
    return mValue.mUSVString.Value();
184
0
  }
185
186
  inline const nsAString&
187
  GetAsUSVString() const
188
0
  {
189
0
    MOZ_ASSERT(IsUSVString(), "Wrong type!");
190
0
    return mValue.mUSVString.Value();
191
0
  }
192
193
  inline void
194
  Uninit()
195
  {
196
    switch (mType) {
197
      case eUninitialized: {
198
        break;
199
      }
200
      case eUSVStringSequenceSequence: {
201
        DestroyUSVStringSequenceSequence();
202
        break;
203
      }
204
      case eUSVStringUSVStringRecord: {
205
        DestroyUSVStringUSVStringRecord();
206
        break;
207
      }
208
      case eUSVString: {
209
        DestroyUSVString();
210
        break;
211
      }
212
    }
213
  }
214
215
  bool
216
  ToJSVal(JSContext* cx, JS::Handle<JSObject*> scopeObj, JS::MutableHandle<JS::Value> rval) const;
217
218
private:
219
  inline void
220
  DestroyUSVStringSequenceSequence()
221
0
  {
222
0
    MOZ_ASSERT(IsUSVStringSequenceSequence(), "Wrong type!");
223
0
    mValue.mUSVStringSequenceSequence.Destroy();
224
0
    mType = eUninitialized;
225
0
  }
226
227
  inline void
228
  DestroyUSVStringUSVStringRecord()
229
0
  {
230
0
    MOZ_ASSERT(IsUSVStringUSVStringRecord(), "Wrong type!");
231
0
    mValue.mUSVStringUSVStringRecord.Destroy();
232
0
    mType = eUninitialized;
233
0
  }
234
235
  inline void
236
  DestroyUSVString()
237
0
  {
238
0
    MOZ_ASSERT(IsUSVString(), "Wrong type!");
239
0
    mValue.mUSVString.Destroy();
240
0
    mType = eUninitialized;
241
0
  }
242
};
243
244
245
class OwningUSVStringSequenceSequenceOrUSVStringUSVStringRecordOrUSVString : public AllOwningUnionBase
246
{
247
  friend void ImplCycleCollectionUnlink(OwningUSVStringSequenceSequenceOrUSVStringUSVStringRecordOrUSVString& aUnion);
248
  enum Type
249
  {
250
    eUninitialized,
251
    eUSVStringSequenceSequence,
252
    eUSVStringUSVStringRecord,
253
    eUSVString
254
  };
255
256
  union Value
257
  {
258
    UnionMember<Sequence<Sequence<nsString>> > mUSVStringSequenceSequence;
259
    UnionMember<Record<nsString, nsString> > mUSVStringUSVStringRecord;
260
    UnionMember<nsString > mUSVString;
261
262
  };
263
264
  Type mType;
265
  Value mValue;
266
267
  OwningUSVStringSequenceSequenceOrUSVStringUSVStringRecordOrUSVString(const OwningUSVStringSequenceSequenceOrUSVStringUSVStringRecordOrUSVString&) = delete;
268
  OwningUSVStringSequenceSequenceOrUSVStringUSVStringRecordOrUSVString& operator=(const OwningUSVStringSequenceSequenceOrUSVStringUSVStringRecordOrUSVString&) = delete;
269
public:
270
  explicit inline OwningUSVStringSequenceSequenceOrUSVStringUSVStringRecordOrUSVString()
271
    : mType(eUninitialized)
272
0
  {
273
0
  }
274
275
  inline ~OwningUSVStringSequenceSequenceOrUSVStringUSVStringRecordOrUSVString()
276
0
  {
277
0
    Uninit();
278
0
  }
279
280
  Sequence<Sequence<nsString>>&
281
  RawSetAsUSVStringSequenceSequence();
282
283
  Sequence<Sequence<nsString>>&
284
  SetAsUSVStringSequenceSequence();
285
286
  bool
287
  TrySetToUSVStringSequenceSequence(JSContext* cx, JS::Handle<JS::Value> value, bool& tryNext, bool passedToJSImpl = false);
288
289
  inline bool
290
  IsUSVStringSequenceSequence() const
291
0
  {
292
0
    return mType == eUSVStringSequenceSequence;
293
0
  }
294
295
  inline Sequence<Sequence<nsString>>&
296
  GetAsUSVStringSequenceSequence()
297
0
  {
298
0
    MOZ_ASSERT(IsUSVStringSequenceSequence(), "Wrong type!");
299
0
    return mValue.mUSVStringSequenceSequence.Value();
300
0
  }
301
302
  inline Sequence<Sequence<nsString>> const &
303
  GetAsUSVStringSequenceSequence() const
304
0
  {
305
0
    MOZ_ASSERT(IsUSVStringSequenceSequence(), "Wrong type!");
306
0
    return mValue.mUSVStringSequenceSequence.Value();
307
0
  }
308
309
  Record<nsString, nsString>&
310
  RawSetAsUSVStringUSVStringRecord();
311
312
  Record<nsString, nsString>&
313
  SetAsUSVStringUSVStringRecord();
314
315
  bool
316
  TrySetToUSVStringUSVStringRecord(JSContext* cx, JS::Handle<JS::Value> value, bool& tryNext, bool passedToJSImpl = false);
317
318
  inline bool
319
  IsUSVStringUSVStringRecord() const
320
0
  {
321
0
    return mType == eUSVStringUSVStringRecord;
322
0
  }
323
324
  inline Record<nsString, nsString>&
325
  GetAsUSVStringUSVStringRecord()
326
0
  {
327
0
    MOZ_ASSERT(IsUSVStringUSVStringRecord(), "Wrong type!");
328
0
    return mValue.mUSVStringUSVStringRecord.Value();
329
0
  }
330
331
  inline Record<nsString, nsString> const &
332
  GetAsUSVStringUSVStringRecord() const
333
0
  {
334
0
    MOZ_ASSERT(IsUSVStringUSVStringRecord(), "Wrong type!");
335
0
    return mValue.mUSVStringUSVStringRecord.Value();
336
0
  }
337
338
  nsString&
339
  RawSetAsUSVString();
340
341
  nsString&
342
  SetAsUSVString();
343
344
  bool
345
  TrySetToUSVString(JSContext* cx, JS::Handle<JS::Value> value, bool& tryNext, bool passedToJSImpl = false);
346
347
  inline void
348
  SetStringData(const nsString::char_type* aData, nsString::size_type aLength)
349
0
  {
350
0
    RawSetAsUSVString().Assign(aData, aLength);
351
0
  }
352
353
  inline bool
354
  IsUSVString() const
355
0
  {
356
0
    return mType == eUSVString;
357
0
  }
358
359
  inline nsString&
360
  GetAsUSVString()
361
0
  {
362
0
    MOZ_ASSERT(IsUSVString(), "Wrong type!");
363
0
    return mValue.mUSVString.Value();
364
0
  }
365
366
  inline nsString const &
367
  GetAsUSVString() const
368
0
  {
369
0
    MOZ_ASSERT(IsUSVString(), "Wrong type!");
370
0
    return mValue.mUSVString.Value();
371
0
  }
372
373
  void
374
  Uninit();
375
376
  bool
377
  ToJSVal(JSContext* cx, JS::Handle<JSObject*> scopeObj, JS::MutableHandle<JS::Value> rval) const;
378
379
  void
380
  TraceUnion(JSTracer* trc);
381
382
private:
383
  void
384
  DestroyUSVStringSequenceSequence();
385
386
  void
387
  DestroyUSVStringUSVStringRecord();
388
389
  void
390
  DestroyUSVString();
391
};
392
393
394
namespace URLSearchParams_Binding {
395
396
  typedef mozilla::dom::URLSearchParams NativeType;
397
398
  const JSClass*
399
  GetJSClass();
400
401
  bool
402
  Wrap(JSContext* aCx, mozilla::dom::URLSearchParams* aObject, nsWrapperCache* aCache, JS::Handle<JSObject*> aGivenProto, JS::MutableHandle<JSObject*> aReflector);
403
404
  template <class T>
405
  inline JSObject* Wrap(JSContext* aCx, T* aObject, JS::Handle<JSObject*> aGivenProto)
406
0
  {
407
0
    JS::Rooted<JSObject*> reflector(aCx);
408
0
    return Wrap(aCx, aObject, aObject, aGivenProto, &reflector) ? reflector.get() : nullptr;
409
0
  }
410
411
  // We declare this as an array so that retrieving a pointer to this
412
  // binding's property hooks only requires compile/link-time resolvable
413
  // address arithmetic.  Declaring it as a pointer instead would require
414
  // doing a run-time load to fetch a pointer to this binding's property
415
  // hooks.  And then structures which embedded a pointer to this structure
416
  // would require a run-time load for proper initialization, which would
417
  // then induce static constructors.  Lots of static constructors.
418
  extern const NativePropertyHooks sNativePropertyHooks[];
419
420
  void
421
  CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, bool aDefineOnGlobal);
422
423
  inline JS::Handle<JSObject*> GetProtoObjectHandle(JSContext* aCx)
424
0
  {
425
0
    /* Get the interface prototype object for this class.  This will create the
426
0
       object as needed. */
427
0
    return GetPerInterfaceObjectHandle(aCx, prototypes::id::URLSearchParams,
428
0
                                       &CreateInterfaceObjects,
429
0
                                       /* aDefineOnGlobal = */ true);
430
0
431
0
  }
432
433
  inline JS::Handle<JSObject*> GetConstructorObjectHandle(JSContext* aCx, bool aDefineOnGlobal = true)
434
0
  {
435
0
    /* Get the interface object for this class.  This will create the object as
436
0
       needed. */
437
0
438
0
    return GetPerInterfaceObjectHandle(aCx, constructors::id::URLSearchParams,
439
0
                                       &CreateInterfaceObjects,
440
0
                                       aDefineOnGlobal);
441
0
  }
442
443
  JSObject*
444
  GetConstructorObject(JSContext* aCx);
445
446
} // namespace URLSearchParams_Binding
447
448
449
450
namespace URLSearchParamsIterator_Binding {
451
452
  typedef mozilla::dom::IterableIterator<mozilla::dom::URLSearchParams> NativeType;
453
454
  const JSClass*
455
  GetJSClass();
456
457
  bool
458
  Wrap(JSContext* aCx, mozilla::dom::IterableIterator<mozilla::dom::URLSearchParams>* aObject, JS::Handle<JSObject*> aGivenProto, JS::MutableHandle<JSObject*> aReflector);
459
460
  // We declare this as an array so that retrieving a pointer to this
461
  // binding's property hooks only requires compile/link-time resolvable
462
  // address arithmetic.  Declaring it as a pointer instead would require
463
  // doing a run-time load to fetch a pointer to this binding's property
464
  // hooks.  And then structures which embedded a pointer to this structure
465
  // would require a run-time load for proper initialization, which would
466
  // then induce static constructors.  Lots of static constructors.
467
  extern const NativePropertyHooks sNativePropertyHooks[];
468
469
  void
470
  CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, bool aDefineOnGlobal);
471
472
  inline JS::Handle<JSObject*> GetProtoObjectHandle(JSContext* aCx)
473
0
  {
474
0
    /* Get the interface prototype object for this class.  This will create the
475
0
       object as needed. */
476
0
    return GetPerInterfaceObjectHandle(aCx, prototypes::id::URLSearchParamsIterator,
477
0
                                       &CreateInterfaceObjects,
478
0
                                       /* aDefineOnGlobal = */ true);
479
0
480
0
  }
481
482
} // namespace URLSearchParamsIterator_Binding
483
484
485
486
} // namespace dom
487
} // namespace mozilla
488
489
#endif // mozilla_dom_URLSearchParamsBinding_h