Coverage Report

Created: 2018-09-25 14:53

/work/obj-fuzz/dist/include/mozilla/dom/FileSystemFileEntryBinding.h
Line
Count
Source (jump to first uncovered line)
1
/* THIS FILE IS AUTOGENERATED FROM FileSystemFileEntry.webidl BY Codegen.py - DO NOT EDIT */
2
3
#ifndef mozilla_dom_FileSystemFileEntryBinding_h
4
#define mozilla_dom_FileSystemFileEntryBinding_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 File;
20
class FileCallback;
21
struct FileCallbackAtoms;
22
class FileSystemFileEntry;
23
struct FileSystemFileEntryAtoms;
24
struct NativePropertyHooks;
25
class ProtoAndIfaceCache;
26
27
} // namespace dom
28
} // namespace mozilla
29
30
namespace mozilla {
31
namespace dom {
32
33
namespace FileSystemFileEntry_Binding {
34
35
  typedef mozilla::dom::FileSystemFileEntry NativeType;
36
37
  const JSClass*
38
  GetJSClass();
39
40
  bool
41
  Wrap(JSContext* aCx, mozilla::dom::FileSystemFileEntry* aObject, nsWrapperCache* aCache, JS::Handle<JSObject*> aGivenProto, JS::MutableHandle<JSObject*> aReflector);
42
43
  template <class T>
44
  inline JSObject* Wrap(JSContext* aCx, T* aObject, JS::Handle<JSObject*> aGivenProto)
45
0
  {
46
0
    JS::Rooted<JSObject*> reflector(aCx);
47
0
    return Wrap(aCx, aObject, aObject, aGivenProto, &reflector) ? reflector.get() : nullptr;
48
0
  }
49
50
  // We declare this as an array so that retrieving a pointer to this
51
  // binding's property hooks only requires compile/link-time resolvable
52
  // address arithmetic.  Declaring it as a pointer instead would require
53
  // doing a run-time load to fetch a pointer to this binding's property
54
  // hooks.  And then structures which embedded a pointer to this structure
55
  // would require a run-time load for proper initialization, which would
56
  // then induce static constructors.  Lots of static constructors.
57
  extern const NativePropertyHooks sNativePropertyHooks[];
58
59
  void
60
  CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, bool aDefineOnGlobal);
61
62
  inline JS::Handle<JSObject*> GetProtoObjectHandle(JSContext* aCx)
63
0
  {
64
0
    /* Get the interface prototype object for this class.  This will create the
65
0
       object as needed. */
66
0
    return GetPerInterfaceObjectHandle(aCx, prototypes::id::FileSystemFileEntry,
67
0
                                       &CreateInterfaceObjects,
68
0
                                       /* aDefineOnGlobal = */ true);
69
0
70
0
  }
71
72
  inline JS::Handle<JSObject*> GetConstructorObjectHandle(JSContext* aCx, bool aDefineOnGlobal = true)
73
0
  {
74
0
    /* Get the interface object for this class.  This will create the object as
75
0
       needed. */
76
0
77
0
    return GetPerInterfaceObjectHandle(aCx, constructors::id::FileSystemFileEntry,
78
0
                                       &CreateInterfaceObjects,
79
0
                                       aDefineOnGlobal);
80
0
  }
81
82
  JSObject*
83
  GetConstructorObject(JSContext* aCx);
84
85
} // namespace FileSystemFileEntry_Binding
86
87
88
89
class FileCallback : public CallbackInterface
90
{
91
public:
92
  explicit inline FileCallback(JSContext* aCx, JS::Handle<JSObject*> aCallback, JS::Handle<JSObject*> aCallbackGlobal, nsIGlobalObject* aIncumbentGlobal)
93
    : CallbackInterface(aCx, aCallback, aCallbackGlobal, aIncumbentGlobal)
94
0
  {
95
0
  }
96
97
  explicit inline FileCallback(JSObject* aCallback, JSObject* aCallbackGlobal, const FastCallbackConstructor& )
98
    : CallbackInterface(aCallback, aCallbackGlobal, FastCallbackConstructor())
99
0
  {
100
0
  }
101
102
  explicit inline FileCallback(JSObject* aCallback, JSObject* aCallbackGlobal, JSObject* aAsyncStack, nsIGlobalObject* aIncumbentGlobal)
103
    : CallbackInterface(aCallback, aCallbackGlobal, aAsyncStack, aIncumbentGlobal)
104
0
  {
105
0
  }
106
107
  template <typename T>
108
  inline void
109
  HandleEvent(const T& thisVal, File& file, ErrorResult& aRv, const char* aExecutionReason = nullptr, ExceptionHandling aExceptionHandling = eReportExceptions, JS::Realm* aRealm = nullptr)
110
  {
111
    MOZ_ASSERT(!aRv.Failed(), "Don't pass an already-failed ErrorResult to a callback!");
112
    if (!aExecutionReason) {
113
      aExecutionReason = "FileCallback.handleEvent";
114
    }
115
    CallSetup s(this, aRv, aExecutionReason, aExceptionHandling, aRealm);
116
    if (!s.GetContext()) {
117
      MOZ_ASSERT(aRv.Failed());
118
      return;
119
    }
120
    JS::Rooted<JS::Value> thisValJS(s.GetContext());
121
    if (!ToJSValue(s.GetContext(), thisVal, &thisValJS)) {
122
      aRv.Throw(NS_ERROR_FAILURE);
123
      return;
124
    }
125
    return HandleEvent(s.GetContext(), thisValJS, file, aRv);
126
  }
127
128
  inline void
129
  HandleEvent(File& file, ErrorResult& aRv, const char* aExecutionReason = nullptr, ExceptionHandling aExceptionHandling = eReportExceptions, JS::Realm* aRealm = nullptr)
130
0
  {
131
0
    MOZ_ASSERT(!aRv.Failed(), "Don't pass an already-failed ErrorResult to a callback!");
132
0
    if (!aExecutionReason) {
133
0
      aExecutionReason = "FileCallback.handleEvent";
134
0
    }
135
0
    CallSetup s(this, aRv, aExecutionReason, aExceptionHandling, aRealm);
136
0
    if (!s.GetContext()) {
137
0
      MOZ_ASSERT(aRv.Failed());
138
0
      return;
139
0
    }
140
0
    return HandleEvent(s.GetContext(), JS::UndefinedHandleValue, file, aRv);
141
0
  }
142
143
  template <typename T>
144
  inline void
145
  HandleEvent(const T& thisVal, File& file, const char* aExecutionReason = nullptr)
146
  {
147
    return HandleEvent(thisVal, file, IgnoreErrors(), aExecutionReason);
148
  }
149
150
  inline void
151
  HandleEvent(File& file, const char* aExecutionReason = nullptr)
152
0
  {
153
0
    return HandleEvent(file, IgnoreErrors(), aExecutionReason, eReportExceptions, nullptr);
154
0
  }
155
156
  inline bool
157
  operator==(const FileCallback& aOther) const
158
0
  {
159
0
    return CallbackInterface::operator==(aOther);
160
0
  }
161
162
private:
163
  void HandleEvent(JSContext* cx, JS::Handle<JS::Value> aThisVal, File& file, ErrorResult& aRv);
164
165
  static bool
166
  InitIds(JSContext* cx, FileCallbackAtoms* atomsCache);
167
};
168
169
170
namespace binding_detail {
171
class FastFileCallback : public FileCallback
172
{
173
public:
174
  explicit inline FastFileCallback(JSObject* aCallback, JSObject* aCallbackGlobal)
175
    : FileCallback(aCallback, aCallbackGlobal, FastCallbackConstructor())
176
0
  {
177
0
  }
178
179
  inline void
180
  Trace(JSTracer* aTracer)
181
0
  {
182
0
    FileCallback::Trace(aTracer);
183
0
  }
184
185
  inline void
186
  FinishSlowJSInitIfMoreThanOneOwner(JSContext* aCx)
187
0
  {
188
0
    FileCallback::FinishSlowJSInitIfMoreThanOneOwner(aCx);
189
0
  }
190
};
191
} // namespace binding_detail
192
193
194
} // namespace dom
195
} // namespace mozilla
196
197
#endif // mozilla_dom_FileSystemFileEntryBinding_h