Coverage Report

Created: 2018-09-25 14:53

/work/obj-fuzz/dist/include/mozilla/dom/FontFaceSetBinding.h
Line
Count
Source (jump to first uncovered line)
1
/* THIS FILE IS AUTOGENERATED FROM FontFaceSet.webidl BY Codegen.py - DO NOT EDIT */
2
3
#ifndef mozilla_dom_FontFaceSetBinding_h
4
#define mozilla_dom_FontFaceSetBinding_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/CallbackFunction.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 FontFace;
20
class FontFaceSet;
21
struct FontFaceSetAtoms;
22
class FontFaceSetForEachCallback;
23
class FontFaceSetIterator;
24
struct FontFaceSetIteratorAtoms;
25
struct FontFaceSetIteratorResultAtoms;
26
struct NativePropertyHooks;
27
class ProtoAndIfaceCache;
28
29
} // namespace dom
30
} // namespace mozilla
31
32
namespace mozilla {
33
namespace dom {
34
35
enum class FontFaceSetLoadStatus : uint8_t {
36
  Loading,
37
  Loaded,
38
  EndGuard_
39
};
40
41
namespace FontFaceSetLoadStatusValues {
42
extern const EnumEntry strings[3];
43
} // namespace FontFaceSetLoadStatusValues
44
45
bool
46
ToJSValue(JSContext* aCx, FontFaceSetLoadStatus aArgument, JS::MutableHandle<JS::Value> aValue);
47
48
49
struct FontFaceSetIteratorResult : public DictionaryBase
50
{
51
  MOZ_INIT_OUTSIDE_CTOR bool mDone;
52
  MOZ_INIT_OUTSIDE_CTOR JS::Value mValue;
53
54
  FontFaceSetIteratorResult();
55
56
  explicit inline FontFaceSetIteratorResult(const FastDictionaryInitializer& )
57
    : mValue(JS::UndefinedValue())
58
0
  {
59
0
    // Do nothing here; this is used by our "Fast" subclass
60
0
  }
61
62
private:
63
  FontFaceSetIteratorResult(const FontFaceSetIteratorResult&) = delete;
64
  FontFaceSetIteratorResult& operator=(const FontFaceSetIteratorResult&) = delete;
65
66
  static bool
67
  InitIds(JSContext* cx, FontFaceSetIteratorResultAtoms* atomsCache);
68
69
public:
70
  bool
71
  Init(JSContext* cx, JS::Handle<JS::Value> val, const char* sourceDescription = "Value", bool passedToJSImpl = false);
72
73
  bool
74
  ToObjectInternal(JSContext* cx, JS::MutableHandle<JS::Value> rval) const;
75
76
  void
77
  TraceDictionary(JSTracer* trc);
78
};
79
80
namespace binding_detail {
81
struct FastFontFaceSetIteratorResult : public FontFaceSetIteratorResult
82
{
83
  inline FastFontFaceSetIteratorResult()
84
    : FontFaceSetIteratorResult(FastDictionaryInitializer())
85
0
  {
86
0
    // Doesn't matter what int we pass to the parent constructor
87
0
  }
88
};
89
} // namespace binding_detail
90
91
92
class FontFaceSetForEachCallback : public CallbackFunction
93
{
94
public:
95
  explicit inline FontFaceSetForEachCallback(JSContext* aCx, JS::Handle<JSObject*> aCallback, JS::Handle<JSObject*> aCallbackGlobal, nsIGlobalObject* aIncumbentGlobal)
96
    : CallbackFunction(aCx, aCallback, aCallbackGlobal, aIncumbentGlobal)
97
0
  {
98
0
    MOZ_ASSERT(JS::IsCallable(mCallback));
99
0
  }
100
101
  explicit inline FontFaceSetForEachCallback(JSObject* aCallback, JSObject* aCallbackGlobal, const FastCallbackConstructor& )
102
    : CallbackFunction(aCallback, aCallbackGlobal, FastCallbackConstructor())
103
0
  {
104
0
    MOZ_ASSERT(JS::IsCallable(mCallback));
105
0
  }
106
107
  explicit inline FontFaceSetForEachCallback(JSObject* aCallback, JSObject* aCallbackGlobal, JSObject* aAsyncStack, nsIGlobalObject* aIncumbentGlobal)
108
    : CallbackFunction(aCallback, aCallbackGlobal, aAsyncStack, aIncumbentGlobal)
109
0
  {
110
0
    MOZ_ASSERT(JS::IsCallable(mCallback));
111
0
  }
112
113
  explicit inline FontFaceSetForEachCallback(CallbackFunction* aOther)
114
    : CallbackFunction(aOther)
115
0
  {
116
0
  }
117
118
  template <typename T>
119
  inline void
120
  Call(const T& thisVal, FontFace& value, FontFace& key, FontFaceSet& set, ErrorResult& aRv, const char* aExecutionReason = nullptr, ExceptionHandling aExceptionHandling = eReportExceptions, JS::Realm* aRealm = nullptr)
121
0
  {
122
0
    MOZ_ASSERT(!aRv.Failed(), "Don't pass an already-failed ErrorResult to a callback!");
123
0
    if (!aExecutionReason) {
124
0
      aExecutionReason = "FontFaceSetForEachCallback";
125
0
    }
126
0
    CallSetup s(this, aRv, aExecutionReason, aExceptionHandling, aRealm);
127
0
    if (!s.GetContext()) {
128
0
      MOZ_ASSERT(aRv.Failed());
129
0
      return;
130
0
    }
131
0
    JS::Rooted<JS::Value> thisValJS(s.GetContext());
132
0
    if (!ToJSValue(s.GetContext(), thisVal, &thisValJS)) {
133
0
      aRv.Throw(NS_ERROR_FAILURE);
134
0
      return;
135
0
    }
136
0
    return Call(s.GetContext(), thisValJS, value, key, set, aRv);
137
0
  }
138
139
  inline void
140
  Call(FontFace& value, FontFace& key, FontFaceSet& set, ErrorResult& aRv, const char* aExecutionReason = nullptr, ExceptionHandling aExceptionHandling = eReportExceptions, JS::Realm* aRealm = nullptr)
141
0
  {
142
0
    MOZ_ASSERT(!aRv.Failed(), "Don't pass an already-failed ErrorResult to a callback!");
143
0
    if (!aExecutionReason) {
144
0
      aExecutionReason = "FontFaceSetForEachCallback";
145
0
    }
146
0
    CallSetup s(this, aRv, aExecutionReason, aExceptionHandling, aRealm);
147
0
    if (!s.GetContext()) {
148
0
      MOZ_ASSERT(aRv.Failed());
149
0
      return;
150
0
    }
151
0
    return Call(s.GetContext(), JS::UndefinedHandleValue, value, key, set, aRv);
152
0
  }
153
154
  template <typename T>
155
  inline void
156
  Call(const T& thisVal, FontFace& value, FontFace& key, FontFaceSet& set, const char* aExecutionReason = nullptr)
157
  {
158
    return Call(thisVal, value, key, set, IgnoreErrors(), aExecutionReason);
159
  }
160
161
  inline void
162
  Call(FontFace& value, FontFace& key, FontFaceSet& set, const char* aExecutionReason = nullptr)
163
0
  {
164
0
    return Call(value, key, set, IgnoreErrors(), aExecutionReason, eReportExceptions, nullptr);
165
0
  }
166
167
  inline bool
168
  operator==(const FontFaceSetForEachCallback& aOther) const
169
0
  {
170
0
    return CallbackFunction::operator==(aOther);
171
0
  }
172
173
private:
174
  void Call(JSContext* cx, JS::Handle<JS::Value> aThisVal, FontFace& value, FontFace& key, FontFaceSet& set, ErrorResult& aRv);
175
};
176
177
178
namespace binding_detail {
179
class FastFontFaceSetForEachCallback : public FontFaceSetForEachCallback
180
{
181
public:
182
  explicit inline FastFontFaceSetForEachCallback(JSObject* aCallback, JSObject* aCallbackGlobal)
183
    : FontFaceSetForEachCallback(aCallback, aCallbackGlobal, FastCallbackConstructor())
184
0
  {
185
0
  }
186
187
  inline void
188
  Trace(JSTracer* aTracer)
189
0
  {
190
0
    FontFaceSetForEachCallback::Trace(aTracer);
191
0
  }
192
193
  inline void
194
  FinishSlowJSInitIfMoreThanOneOwner(JSContext* aCx)
195
0
  {
196
0
    FontFaceSetForEachCallback::FinishSlowJSInitIfMoreThanOneOwner(aCx);
197
0
  }
198
};
199
} // namespace binding_detail
200
201
202
namespace FontFaceSet_Binding {
203
204
  typedef mozilla::dom::FontFaceSet NativeType;
205
206
  bool
207
  ConstructorEnabled(JSContext* aCx, JS::Handle<JSObject*> aObj);
208
209
  const JSClass*
210
  GetJSClass();
211
212
  bool
213
  Wrap(JSContext* aCx, mozilla::dom::FontFaceSet* aObject, nsWrapperCache* aCache, JS::Handle<JSObject*> aGivenProto, JS::MutableHandle<JSObject*> aReflector);
214
215
  template <class T>
216
  inline JSObject* Wrap(JSContext* aCx, T* aObject, JS::Handle<JSObject*> aGivenProto)
217
0
  {
218
0
    JS::Rooted<JSObject*> reflector(aCx);
219
0
    return Wrap(aCx, aObject, aObject, aGivenProto, &reflector) ? reflector.get() : nullptr;
220
0
  }
221
222
  // We declare this as an array so that retrieving a pointer to this
223
  // binding's property hooks only requires compile/link-time resolvable
224
  // address arithmetic.  Declaring it as a pointer instead would require
225
  // doing a run-time load to fetch a pointer to this binding's property
226
  // hooks.  And then structures which embedded a pointer to this structure
227
  // would require a run-time load for proper initialization, which would
228
  // then induce static constructors.  Lots of static constructors.
229
  extern const NativePropertyHooks sNativePropertyHooks[];
230
231
  void
232
  CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, bool aDefineOnGlobal);
233
234
  inline JS::Handle<JSObject*> GetProtoObjectHandle(JSContext* aCx)
235
0
  {
236
0
    /* Get the interface prototype object for this class.  This will create the
237
0
       object as needed. */
238
0
    return GetPerInterfaceObjectHandle(aCx, prototypes::id::FontFaceSet,
239
0
                                       &CreateInterfaceObjects,
240
0
                                       /* aDefineOnGlobal = */ true);
241
0
242
0
  }
243
244
  inline JS::Handle<JSObject*> GetConstructorObjectHandle(JSContext* aCx, bool aDefineOnGlobal = true)
245
0
  {
246
0
    /* Get the interface object for this class.  This will create the object as
247
0
       needed. */
248
0
249
0
    return GetPerInterfaceObjectHandle(aCx, constructors::id::FontFaceSet,
250
0
                                       &CreateInterfaceObjects,
251
0
                                       aDefineOnGlobal);
252
0
  }
253
254
  JSObject*
255
  GetConstructorObject(JSContext* aCx);
256
257
} // namespace FontFaceSet_Binding
258
259
260
261
namespace FontFaceSetIterator_Binding {
262
263
  typedef mozilla::dom::FontFaceSetIterator NativeType;
264
265
  const JSClass*
266
  GetJSClass();
267
268
  bool
269
  Wrap(JSContext* aCx, mozilla::dom::FontFaceSetIterator* aObject, JS::Handle<JSObject*> aGivenProto, JS::MutableHandle<JSObject*> aReflector);
270
271
  // We declare this as an array so that retrieving a pointer to this
272
  // binding's property hooks only requires compile/link-time resolvable
273
  // address arithmetic.  Declaring it as a pointer instead would require
274
  // doing a run-time load to fetch a pointer to this binding's property
275
  // hooks.  And then structures which embedded a pointer to this structure
276
  // would require a run-time load for proper initialization, which would
277
  // then induce static constructors.  Lots of static constructors.
278
  extern const NativePropertyHooks sNativePropertyHooks[];
279
280
  void
281
  CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, bool aDefineOnGlobal);
282
283
  inline JS::Handle<JSObject*> GetProtoObjectHandle(JSContext* aCx)
284
0
  {
285
0
    /* Get the interface prototype object for this class.  This will create the
286
0
       object as needed. */
287
0
    return GetPerInterfaceObjectHandle(aCx, prototypes::id::FontFaceSetIterator,
288
0
                                       &CreateInterfaceObjects,
289
0
                                       /* aDefineOnGlobal = */ true);
290
0
291
0
  }
292
293
} // namespace FontFaceSetIterator_Binding
294
295
296
297
} // namespace dom
298
} // namespace mozilla
299
300
#endif // mozilla_dom_FontFaceSetBinding_h