Coverage Report

Created: 2018-09-25 14:53

/work/obj-fuzz/dist/include/mozilla/dom/FileSystemBinding.h
Line
Count
Source (jump to first uncovered line)
1
/* THIS FILE IS AUTOGENERATED FROM FileSystem.webidl BY Codegen.py - DO NOT EDIT */
2
3
#ifndef mozilla_dom_FileSystemBinding_h
4
#define mozilla_dom_FileSystemBinding_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
16
namespace mozilla {
17
namespace dom {
18
19
class DOMException;
20
class ErrorCallback;
21
struct ErrorCallbackAtoms;
22
class FileSystem;
23
struct FileSystemAtoms;
24
class FileSystemEntry;
25
class FileSystemEntryCallback;
26
struct FileSystemEntryCallbackAtoms;
27
struct FileSystemFlagsAtoms;
28
struct NativePropertyHooks;
29
class ProtoAndIfaceCache;
30
class VoidCallback;
31
struct VoidCallbackAtoms;
32
33
} // namespace dom
34
} // namespace mozilla
35
36
namespace mozilla {
37
namespace dom {
38
39
struct FileSystemFlags : public DictionaryBase
40
{
41
  MOZ_INIT_OUTSIDE_CTOR bool mCreate;
42
  MOZ_INIT_OUTSIDE_CTOR bool mExclusive;
43
44
  FileSystemFlags();
45
46
  explicit inline FileSystemFlags(const FastDictionaryInitializer& )
47
0
  {
48
0
    // Do nothing here; this is used by our "Fast" subclass
49
0
  }
50
51
  explicit inline FileSystemFlags(const FileSystemFlags& aOther)
52
0
  {
53
0
    *this = aOther;
54
0
  }
55
56
  bool
57
  Init(JSContext* cx, JS::Handle<JS::Value> val, const char* sourceDescription = "Value", bool passedToJSImpl = false);
58
59
  bool
60
  Init(const nsAString& aJSON);
61
62
  bool
63
  ToObjectInternal(JSContext* cx, JS::MutableHandle<JS::Value> rval) const;
64
65
  bool
66
  ToJSON(nsAString& aJSON) const;
67
68
  void
69
  TraceDictionary(JSTracer* trc);
70
71
  FileSystemFlags&
72
  operator=(const FileSystemFlags& aOther);
73
74
private:
75
  static bool
76
  InitIds(JSContext* cx, FileSystemFlagsAtoms* atomsCache);
77
};
78
79
namespace binding_detail {
80
struct FastFileSystemFlags : public FileSystemFlags
81
{
82
  inline FastFileSystemFlags()
83
    : FileSystemFlags(FastDictionaryInitializer())
84
0
  {
85
0
    // Doesn't matter what int we pass to the parent constructor
86
0
  }
87
};
88
} // namespace binding_detail
89
90
91
namespace FileSystem_Binding {
92
93
  typedef mozilla::dom::FileSystem NativeType;
94
95
  const JSClass*
96
  GetJSClass();
97
98
  bool
99
  Wrap(JSContext* aCx, mozilla::dom::FileSystem* aObject, nsWrapperCache* aCache, JS::Handle<JSObject*> aGivenProto, JS::MutableHandle<JSObject*> aReflector);
100
101
  template <class T>
102
  inline JSObject* Wrap(JSContext* aCx, T* aObject, JS::Handle<JSObject*> aGivenProto)
103
0
  {
104
0
    JS::Rooted<JSObject*> reflector(aCx);
105
0
    return Wrap(aCx, aObject, aObject, aGivenProto, &reflector) ? reflector.get() : nullptr;
106
0
  }
107
108
  // We declare this as an array so that retrieving a pointer to this
109
  // binding's property hooks only requires compile/link-time resolvable
110
  // address arithmetic.  Declaring it as a pointer instead would require
111
  // doing a run-time load to fetch a pointer to this binding's property
112
  // hooks.  And then structures which embedded a pointer to this structure
113
  // would require a run-time load for proper initialization, which would
114
  // then induce static constructors.  Lots of static constructors.
115
  extern const NativePropertyHooks sNativePropertyHooks[];
116
117
  void
118
  CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, bool aDefineOnGlobal);
119
120
  inline JS::Handle<JSObject*> GetProtoObjectHandle(JSContext* aCx)
121
0
  {
122
0
    /* Get the interface prototype object for this class.  This will create the
123
0
       object as needed. */
124
0
    return GetPerInterfaceObjectHandle(aCx, prototypes::id::FileSystem,
125
0
                                       &CreateInterfaceObjects,
126
0
                                       /* aDefineOnGlobal = */ true);
127
0
128
0
  }
129
130
  inline JS::Handle<JSObject*> GetConstructorObjectHandle(JSContext* aCx, bool aDefineOnGlobal = true)
131
0
  {
132
0
    /* Get the interface object for this class.  This will create the object as
133
0
       needed. */
134
0
135
0
    return GetPerInterfaceObjectHandle(aCx, constructors::id::FileSystem,
136
0
                                       &CreateInterfaceObjects,
137
0
                                       aDefineOnGlobal);
138
0
  }
139
140
  JSObject*
141
  GetConstructorObject(JSContext* aCx);
142
143
} // namespace FileSystem_Binding
144
145
146
147
class ErrorCallback : public CallbackInterface
148
{
149
public:
150
  explicit inline ErrorCallback(JSContext* aCx, JS::Handle<JSObject*> aCallback, JS::Handle<JSObject*> aCallbackGlobal, nsIGlobalObject* aIncumbentGlobal)
151
    : CallbackInterface(aCx, aCallback, aCallbackGlobal, aIncumbentGlobal)
152
0
  {
153
0
  }
154
155
  explicit inline ErrorCallback(JSObject* aCallback, JSObject* aCallbackGlobal, const FastCallbackConstructor& )
156
    : CallbackInterface(aCallback, aCallbackGlobal, FastCallbackConstructor())
157
0
  {
158
0
  }
159
160
  explicit inline ErrorCallback(JSObject* aCallback, JSObject* aCallbackGlobal, JSObject* aAsyncStack, nsIGlobalObject* aIncumbentGlobal)
161
    : CallbackInterface(aCallback, aCallbackGlobal, aAsyncStack, aIncumbentGlobal)
162
0
  {
163
0
  }
164
165
  template <typename T>
166
  inline void
167
  HandleEvent(const T& thisVal, DOMException& err, ErrorResult& aRv, const char* aExecutionReason = nullptr, ExceptionHandling aExceptionHandling = eReportExceptions, JS::Realm* aRealm = nullptr)
168
  {
169
    MOZ_ASSERT(!aRv.Failed(), "Don't pass an already-failed ErrorResult to a callback!");
170
    if (!aExecutionReason) {
171
      aExecutionReason = "ErrorCallback.handleEvent";
172
    }
173
    CallSetup s(this, aRv, aExecutionReason, aExceptionHandling, aRealm);
174
    if (!s.GetContext()) {
175
      MOZ_ASSERT(aRv.Failed());
176
      return;
177
    }
178
    JS::Rooted<JS::Value> thisValJS(s.GetContext());
179
    if (!ToJSValue(s.GetContext(), thisVal, &thisValJS)) {
180
      aRv.Throw(NS_ERROR_FAILURE);
181
      return;
182
    }
183
    return HandleEvent(s.GetContext(), thisValJS, err, aRv);
184
  }
185
186
  inline void
187
  HandleEvent(DOMException& err, ErrorResult& aRv, const char* aExecutionReason = nullptr, ExceptionHandling aExceptionHandling = eReportExceptions, JS::Realm* aRealm = nullptr)
188
0
  {
189
0
    MOZ_ASSERT(!aRv.Failed(), "Don't pass an already-failed ErrorResult to a callback!");
190
0
    if (!aExecutionReason) {
191
0
      aExecutionReason = "ErrorCallback.handleEvent";
192
0
    }
193
0
    CallSetup s(this, aRv, aExecutionReason, aExceptionHandling, aRealm);
194
0
    if (!s.GetContext()) {
195
0
      MOZ_ASSERT(aRv.Failed());
196
0
      return;
197
0
    }
198
0
    return HandleEvent(s.GetContext(), JS::UndefinedHandleValue, err, aRv);
199
0
  }
200
201
  template <typename T>
202
  inline void
203
  HandleEvent(const T& thisVal, DOMException& err, const char* aExecutionReason = nullptr)
204
  {
205
    return HandleEvent(thisVal, err, IgnoreErrors(), aExecutionReason);
206
  }
207
208
  inline void
209
  HandleEvent(DOMException& err, const char* aExecutionReason = nullptr)
210
0
  {
211
0
    return HandleEvent(err, IgnoreErrors(), aExecutionReason, eReportExceptions, nullptr);
212
0
  }
213
214
  inline bool
215
  operator==(const ErrorCallback& aOther) const
216
0
  {
217
0
    return CallbackInterface::operator==(aOther);
218
0
  }
219
220
private:
221
  void HandleEvent(JSContext* cx, JS::Handle<JS::Value> aThisVal, DOMException& err, ErrorResult& aRv);
222
223
  static bool
224
  InitIds(JSContext* cx, ErrorCallbackAtoms* atomsCache);
225
};
226
227
228
class FileSystemEntryCallback : public CallbackInterface
229
{
230
public:
231
  explicit inline FileSystemEntryCallback(JSContext* aCx, JS::Handle<JSObject*> aCallback, JS::Handle<JSObject*> aCallbackGlobal, nsIGlobalObject* aIncumbentGlobal)
232
    : CallbackInterface(aCx, aCallback, aCallbackGlobal, aIncumbentGlobal)
233
0
  {
234
0
  }
235
236
  explicit inline FileSystemEntryCallback(JSObject* aCallback, JSObject* aCallbackGlobal, const FastCallbackConstructor& )
237
    : CallbackInterface(aCallback, aCallbackGlobal, FastCallbackConstructor())
238
0
  {
239
0
  }
240
241
  explicit inline FileSystemEntryCallback(JSObject* aCallback, JSObject* aCallbackGlobal, JSObject* aAsyncStack, nsIGlobalObject* aIncumbentGlobal)
242
    : CallbackInterface(aCallback, aCallbackGlobal, aAsyncStack, aIncumbentGlobal)
243
0
  {
244
0
  }
245
246
  template <typename T>
247
  inline void
248
  HandleEvent(const T& thisVal, FileSystemEntry& entry, ErrorResult& aRv, const char* aExecutionReason = nullptr, ExceptionHandling aExceptionHandling = eReportExceptions, JS::Realm* aRealm = nullptr)
249
  {
250
    MOZ_ASSERT(!aRv.Failed(), "Don't pass an already-failed ErrorResult to a callback!");
251
    if (!aExecutionReason) {
252
      aExecutionReason = "FileSystemEntryCallback.handleEvent";
253
    }
254
    CallSetup s(this, aRv, aExecutionReason, aExceptionHandling, aRealm);
255
    if (!s.GetContext()) {
256
      MOZ_ASSERT(aRv.Failed());
257
      return;
258
    }
259
    JS::Rooted<JS::Value> thisValJS(s.GetContext());
260
    if (!ToJSValue(s.GetContext(), thisVal, &thisValJS)) {
261
      aRv.Throw(NS_ERROR_FAILURE);
262
      return;
263
    }
264
    return HandleEvent(s.GetContext(), thisValJS, entry, aRv);
265
  }
266
267
  inline void
268
  HandleEvent(FileSystemEntry& entry, ErrorResult& aRv, const char* aExecutionReason = nullptr, ExceptionHandling aExceptionHandling = eReportExceptions, JS::Realm* aRealm = nullptr)
269
0
  {
270
0
    MOZ_ASSERT(!aRv.Failed(), "Don't pass an already-failed ErrorResult to a callback!");
271
0
    if (!aExecutionReason) {
272
0
      aExecutionReason = "FileSystemEntryCallback.handleEvent";
273
0
    }
274
0
    CallSetup s(this, aRv, aExecutionReason, aExceptionHandling, aRealm);
275
0
    if (!s.GetContext()) {
276
0
      MOZ_ASSERT(aRv.Failed());
277
0
      return;
278
0
    }
279
0
    return HandleEvent(s.GetContext(), JS::UndefinedHandleValue, entry, aRv);
280
0
  }
281
282
  template <typename T>
283
  inline void
284
  HandleEvent(const T& thisVal, FileSystemEntry& entry, const char* aExecutionReason = nullptr)
285
  {
286
    return HandleEvent(thisVal, entry, IgnoreErrors(), aExecutionReason);
287
  }
288
289
  inline void
290
  HandleEvent(FileSystemEntry& entry, const char* aExecutionReason = nullptr)
291
0
  {
292
0
    return HandleEvent(entry, IgnoreErrors(), aExecutionReason, eReportExceptions, nullptr);
293
0
  }
294
295
  inline bool
296
  operator==(const FileSystemEntryCallback& aOther) const
297
0
  {
298
0
    return CallbackInterface::operator==(aOther);
299
0
  }
300
301
private:
302
  void HandleEvent(JSContext* cx, JS::Handle<JS::Value> aThisVal, FileSystemEntry& entry, ErrorResult& aRv);
303
304
  static bool
305
  InitIds(JSContext* cx, FileSystemEntryCallbackAtoms* atomsCache);
306
};
307
308
309
class VoidCallback : public CallbackInterface
310
{
311
public:
312
  explicit inline VoidCallback(JSContext* aCx, JS::Handle<JSObject*> aCallback, JS::Handle<JSObject*> aCallbackGlobal, nsIGlobalObject* aIncumbentGlobal)
313
    : CallbackInterface(aCx, aCallback, aCallbackGlobal, aIncumbentGlobal)
314
0
  {
315
0
  }
316
317
  explicit inline VoidCallback(JSObject* aCallback, JSObject* aCallbackGlobal, const FastCallbackConstructor& )
318
    : CallbackInterface(aCallback, aCallbackGlobal, FastCallbackConstructor())
319
0
  {
320
0
  }
321
322
  explicit inline VoidCallback(JSObject* aCallback, JSObject* aCallbackGlobal, JSObject* aAsyncStack, nsIGlobalObject* aIncumbentGlobal)
323
    : CallbackInterface(aCallback, aCallbackGlobal, aAsyncStack, aIncumbentGlobal)
324
0
  {
325
0
  }
326
327
  template <typename T>
328
  inline void
329
  HandleEvent(const T& thisVal, ErrorResult& aRv, const char* aExecutionReason = nullptr, ExceptionHandling aExceptionHandling = eReportExceptions, JS::Realm* aRealm = nullptr)
330
  {
331
    MOZ_ASSERT(!aRv.Failed(), "Don't pass an already-failed ErrorResult to a callback!");
332
    if (!aExecutionReason) {
333
      aExecutionReason = "VoidCallback.handleEvent";
334
    }
335
    CallSetup s(this, aRv, aExecutionReason, aExceptionHandling, aRealm);
336
    if (!s.GetContext()) {
337
      MOZ_ASSERT(aRv.Failed());
338
      return;
339
    }
340
    JS::Rooted<JS::Value> thisValJS(s.GetContext());
341
    if (!ToJSValue(s.GetContext(), thisVal, &thisValJS)) {
342
      aRv.Throw(NS_ERROR_FAILURE);
343
      return;
344
    }
345
    return HandleEvent(s.GetContext(), thisValJS, aRv);
346
  }
347
348
  inline void
349
  HandleEvent(ErrorResult& aRv, const char* aExecutionReason = nullptr, ExceptionHandling aExceptionHandling = eReportExceptions, JS::Realm* aRealm = nullptr)
350
0
  {
351
0
    MOZ_ASSERT(!aRv.Failed(), "Don't pass an already-failed ErrorResult to a callback!");
352
0
    if (!aExecutionReason) {
353
0
      aExecutionReason = "VoidCallback.handleEvent";
354
0
    }
355
0
    CallSetup s(this, aRv, aExecutionReason, aExceptionHandling, aRealm);
356
0
    if (!s.GetContext()) {
357
0
      MOZ_ASSERT(aRv.Failed());
358
0
      return;
359
0
    }
360
0
    return HandleEvent(s.GetContext(), JS::UndefinedHandleValue, aRv);
361
0
  }
362
363
  template <typename T>
364
  inline void
365
  HandleEvent(const T& thisVal, const char* aExecutionReason = nullptr)
366
  {
367
    return HandleEvent(thisVal, IgnoreErrors(), aExecutionReason);
368
  }
369
370
  inline void
371
  HandleEvent(const char* aExecutionReason = nullptr)
372
0
  {
373
0
    return HandleEvent(IgnoreErrors(), aExecutionReason, eReportExceptions, nullptr);
374
0
  }
375
376
  inline bool
377
  operator==(const VoidCallback& aOther) const
378
0
  {
379
0
    return CallbackInterface::operator==(aOther);
380
0
  }
381
382
private:
383
  void HandleEvent(JSContext* cx, JS::Handle<JS::Value> aThisVal, ErrorResult& aRv);
384
385
  static bool
386
  InitIds(JSContext* cx, VoidCallbackAtoms* atomsCache);
387
};
388
389
390
namespace binding_detail {
391
class FastErrorCallback : public ErrorCallback
392
{
393
public:
394
  explicit inline FastErrorCallback(JSObject* aCallback, JSObject* aCallbackGlobal)
395
    : ErrorCallback(aCallback, aCallbackGlobal, FastCallbackConstructor())
396
0
  {
397
0
  }
398
399
  inline void
400
  Trace(JSTracer* aTracer)
401
0
  {
402
0
    ErrorCallback::Trace(aTracer);
403
0
  }
404
405
  inline void
406
  FinishSlowJSInitIfMoreThanOneOwner(JSContext* aCx)
407
0
  {
408
0
    ErrorCallback::FinishSlowJSInitIfMoreThanOneOwner(aCx);
409
0
  }
410
};
411
} // namespace binding_detail
412
413
414
namespace binding_detail {
415
class FastFileSystemEntryCallback : public FileSystemEntryCallback
416
{
417
public:
418
  explicit inline FastFileSystemEntryCallback(JSObject* aCallback, JSObject* aCallbackGlobal)
419
    : FileSystemEntryCallback(aCallback, aCallbackGlobal, FastCallbackConstructor())
420
0
  {
421
0
  }
422
423
  inline void
424
  Trace(JSTracer* aTracer)
425
0
  {
426
0
    FileSystemEntryCallback::Trace(aTracer);
427
0
  }
428
429
  inline void
430
  FinishSlowJSInitIfMoreThanOneOwner(JSContext* aCx)
431
0
  {
432
0
    FileSystemEntryCallback::FinishSlowJSInitIfMoreThanOneOwner(aCx);
433
0
  }
434
};
435
} // namespace binding_detail
436
437
438
namespace binding_detail {
439
class FastVoidCallback : public VoidCallback
440
{
441
public:
442
  explicit inline FastVoidCallback(JSObject* aCallback, JSObject* aCallbackGlobal)
443
    : VoidCallback(aCallback, aCallbackGlobal, FastCallbackConstructor())
444
0
  {
445
0
  }
446
447
  inline void
448
  Trace(JSTracer* aTracer)
449
0
  {
450
0
    VoidCallback::Trace(aTracer);
451
0
  }
452
453
  inline void
454
  FinishSlowJSInitIfMoreThanOneOwner(JSContext* aCx)
455
0
  {
456
0
    VoidCallback::FinishSlowJSInitIfMoreThanOneOwner(aCx);
457
0
  }
458
};
459
} // namespace binding_detail
460
461
462
} // namespace dom
463
} // namespace mozilla
464
465
#endif // mozilla_dom_FileSystemBinding_h