Coverage Report

Created: 2018-09-25 14:53

/work/obj-fuzz/dom/bindings/SVGGradientElementBinding.cpp
Line
Count
Source (jump to first uncovered line)
1
/* THIS FILE IS AUTOGENERATED FROM SVGGradientElement.webidl BY Codegen.py - DO NOT EDIT */
2
3
#include "SVGElementBinding.h"
4
#include "SVGGradientElementBinding.h"
5
#include "WrapperFactory.h"
6
#include "mozilla/OwningNonNull.h"
7
#include "mozilla/dom/BindingUtils.h"
8
#include "mozilla/dom/DOMJSClass.h"
9
#include "mozilla/dom/NonRefcountedDOMObject.h"
10
#include "mozilla/dom/SVGAnimatedEnumeration.h"
11
#include "mozilla/dom/SVGAnimatedString.h"
12
#include "mozilla/dom/SVGAnimatedTransformList.h"
13
#include "mozilla/dom/SVGGradientElement.h"
14
#include "mozilla/dom/XrayExpandoClass.h"
15
16
namespace mozilla {
17
namespace dom {
18
19
namespace binding_detail {}; // Just to make sure it's known as a namespace
20
using namespace mozilla::dom::binding_detail;
21
22
23
namespace SVGGradientElement_Binding {
24
25
static_assert(IsRefcounted<NativeType>::value == IsRefcounted<SVGElement_Binding::NativeType>::value,
26
              "Can't inherit from an interface with a different ownership model.");
27
28
MOZ_CAN_RUN_SCRIPT static bool
29
get_gradientUnits(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SVGGradientElement* self, JSJitGetterCallArgs args)
30
0
{
31
0
  AUTO_PROFILER_LABEL_FAST("get SVGGradientElement.gradientUnits", DOM, cx);
32
0
33
0
  auto result(StrongOrRawPtr<mozilla::dom::SVGAnimatedEnumeration>(self->GradientUnits()));
34
0
  MOZ_ASSERT(!JS_IsExceptionPending(cx));
35
0
  if (!GetOrCreateDOMReflector(cx, result, args.rval())) {
36
0
    MOZ_ASSERT(JS_IsExceptionPending(cx));
37
0
    return false;
38
0
  }
39
0
  return true;
40
0
}
41
42
static const JSJitInfo gradientUnits_getterinfo = {
43
  { (JSJitGetterOp)get_gradientUnits },
44
  { prototypes::id::SVGGradientElement },
45
  { PrototypeTraits<prototypes::id::SVGGradientElement>::Depth },
46
  JSJitInfo::Getter,
47
  JSJitInfo::AliasNone, /* aliasSet.  Not relevant for setters. */
48
  JSVAL_TYPE_OBJECT,  /* returnType.  Not relevant for setters. */
49
  false,  /* isInfallible. False in setters. */
50
  true,  /* isMovable.  Not relevant for setters. */
51
  true, /* isEliminatable.  Not relevant for setters. */
52
  false, /* isAlwaysInSlot.  Only relevant for getters. */
53
  false, /* isLazilyCachedInSlot.  Only relevant for getters. */
54
  false,  /* isTypedMethod.  Only relevant for methods. */
55
  0   /* Reserved slot index, if we're stored in a slot, else 0. */
56
};
57
static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
58
static_assert(0 < 1, "There is no slot for us");
59
60
MOZ_CAN_RUN_SCRIPT static bool
61
get_gradientTransform(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SVGGradientElement* self, JSJitGetterCallArgs args)
62
0
{
63
0
  AUTO_PROFILER_LABEL_FAST("get SVGGradientElement.gradientTransform", DOM, cx);
64
0
65
0
  auto result(StrongOrRawPtr<mozilla::dom::SVGAnimatedTransformList>(self->GradientTransform()));
66
0
  MOZ_ASSERT(!JS_IsExceptionPending(cx));
67
0
  if (!GetOrCreateDOMReflector(cx, result, args.rval())) {
68
0
    MOZ_ASSERT(JS_IsExceptionPending(cx));
69
0
    return false;
70
0
  }
71
0
  return true;
72
0
}
73
74
static const JSJitInfo gradientTransform_getterinfo = {
75
  { (JSJitGetterOp)get_gradientTransform },
76
  { prototypes::id::SVGGradientElement },
77
  { PrototypeTraits<prototypes::id::SVGGradientElement>::Depth },
78
  JSJitInfo::Getter,
79
  JSJitInfo::AliasNone, /* aliasSet.  Not relevant for setters. */
80
  JSVAL_TYPE_OBJECT,  /* returnType.  Not relevant for setters. */
81
  false,  /* isInfallible. False in setters. */
82
  true,  /* isMovable.  Not relevant for setters. */
83
  true, /* isEliminatable.  Not relevant for setters. */
84
  false, /* isAlwaysInSlot.  Only relevant for getters. */
85
  false, /* isLazilyCachedInSlot.  Only relevant for getters. */
86
  false,  /* isTypedMethod.  Only relevant for methods. */
87
  0   /* Reserved slot index, if we're stored in a slot, else 0. */
88
};
89
static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
90
static_assert(0 < 1, "There is no slot for us");
91
92
MOZ_CAN_RUN_SCRIPT static bool
93
get_spreadMethod(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SVGGradientElement* self, JSJitGetterCallArgs args)
94
0
{
95
0
  AUTO_PROFILER_LABEL_FAST("get SVGGradientElement.spreadMethod", DOM, cx);
96
0
97
0
  auto result(StrongOrRawPtr<mozilla::dom::SVGAnimatedEnumeration>(self->SpreadMethod()));
98
0
  MOZ_ASSERT(!JS_IsExceptionPending(cx));
99
0
  if (!GetOrCreateDOMReflector(cx, result, args.rval())) {
100
0
    MOZ_ASSERT(JS_IsExceptionPending(cx));
101
0
    return false;
102
0
  }
103
0
  return true;
104
0
}
105
106
static const JSJitInfo spreadMethod_getterinfo = {
107
  { (JSJitGetterOp)get_spreadMethod },
108
  { prototypes::id::SVGGradientElement },
109
  { PrototypeTraits<prototypes::id::SVGGradientElement>::Depth },
110
  JSJitInfo::Getter,
111
  JSJitInfo::AliasNone, /* aliasSet.  Not relevant for setters. */
112
  JSVAL_TYPE_OBJECT,  /* returnType.  Not relevant for setters. */
113
  false,  /* isInfallible. False in setters. */
114
  true,  /* isMovable.  Not relevant for setters. */
115
  true, /* isEliminatable.  Not relevant for setters. */
116
  false, /* isAlwaysInSlot.  Only relevant for getters. */
117
  false, /* isLazilyCachedInSlot.  Only relevant for getters. */
118
  false,  /* isTypedMethod.  Only relevant for methods. */
119
  0   /* Reserved slot index, if we're stored in a slot, else 0. */
120
};
121
static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
122
static_assert(0 < 1, "There is no slot for us");
123
124
MOZ_CAN_RUN_SCRIPT static bool
125
get_href(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SVGGradientElement* self, JSJitGetterCallArgs args)
126
0
{
127
0
  AUTO_PROFILER_LABEL_FAST("get SVGGradientElement.href", DOM, cx);
128
0
129
0
  auto result(StrongOrRawPtr<mozilla::dom::SVGAnimatedString>(self->Href()));
130
0
  MOZ_ASSERT(!JS_IsExceptionPending(cx));
131
0
  if (!GetOrCreateDOMReflector(cx, result, args.rval())) {
132
0
    MOZ_ASSERT(JS_IsExceptionPending(cx));
133
0
    return false;
134
0
  }
135
0
  return true;
136
0
}
137
138
static const JSJitInfo href_getterinfo = {
139
  { (JSJitGetterOp)get_href },
140
  { prototypes::id::SVGGradientElement },
141
  { PrototypeTraits<prototypes::id::SVGGradientElement>::Depth },
142
  JSJitInfo::Getter,
143
  JSJitInfo::AliasNone, /* aliasSet.  Not relevant for setters. */
144
  JSVAL_TYPE_OBJECT,  /* returnType.  Not relevant for setters. */
145
  false,  /* isInfallible. False in setters. */
146
  true,  /* isMovable.  Not relevant for setters. */
147
  true, /* isEliminatable.  Not relevant for setters. */
148
  false, /* isAlwaysInSlot.  Only relevant for getters. */
149
  false, /* isLazilyCachedInSlot.  Only relevant for getters. */
150
  false,  /* isTypedMethod.  Only relevant for methods. */
151
  0   /* Reserved slot index, if we're stored in a slot, else 0. */
152
};
153
static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
154
static_assert(0 < 1, "There is no slot for us");
155
156
// We deliberately use brace-elision to make Visual Studio produce better initalization code.
157
#if defined(__clang__)
158
#pragma clang diagnostic push
159
#pragma clang diagnostic ignored "-Wmissing-braces"
160
#endif
161
static const JSPropertySpec sAttributes_specs[] = {
162
  { "gradientUnits", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &gradientUnits_getterinfo, nullptr, nullptr },
163
  { "gradientTransform", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &gradientTransform_getterinfo, nullptr, nullptr },
164
  { "spreadMethod", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &spreadMethod_getterinfo, nullptr, nullptr },
165
  { "href", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &href_getterinfo, nullptr, nullptr },
166
  { nullptr, 0, nullptr, nullptr, nullptr, nullptr }
167
};
168
#if defined(__clang__)
169
#pragma clang diagnostic pop
170
#endif
171
172
173
static const Prefable<const JSPropertySpec> sAttributes[] = {
174
  { nullptr, &sAttributes_specs[0] },
175
  { nullptr, nullptr }
176
};
177
178
static_assert(1 <= 1ull << NUM_BITS_PROPERTY_INFO_PREF_INDEX,
179
    "We have a prefable index that is >= (1 << NUM_BITS_PROPERTY_INFO_PREF_INDEX)");
180
static_assert(4 <= 1ull << NUM_BITS_PROPERTY_INFO_SPEC_INDEX,
181
    "We have a spec index that is >= (1 << NUM_BITS_PROPERTY_INFO_SPEC_INDEX)");
182
183
// We deliberately use brace-elision to make Visual Studio produce better initalization code.
184
#if defined(__clang__)
185
#pragma clang diagnostic push
186
#pragma clang diagnostic ignored "-Wmissing-braces"
187
#endif
188
static const ConstantSpec sConstants_specs[] = {
189
  { "SVG_SPREADMETHOD_UNKNOWN", JS::Int32Value(0) },
190
  { "SVG_SPREADMETHOD_PAD", JS::Int32Value(1) },
191
  { "SVG_SPREADMETHOD_REFLECT", JS::Int32Value(2) },
192
  { "SVG_SPREADMETHOD_REPEAT", JS::Int32Value(3) },
193
  { 0, JS::UndefinedValue() }
194
};
195
#if defined(__clang__)
196
#pragma clang diagnostic pop
197
#endif
198
199
200
static const Prefable<const ConstantSpec> sConstants[] = {
201
  { nullptr, &sConstants_specs[0] },
202
  { nullptr, nullptr }
203
};
204
205
static_assert(1 <= 1ull << NUM_BITS_PROPERTY_INFO_PREF_INDEX,
206
    "We have a prefable index that is >= (1 << NUM_BITS_PROPERTY_INFO_PREF_INDEX)");
207
static_assert(4 <= 1ull << NUM_BITS_PROPERTY_INFO_SPEC_INDEX,
208
    "We have a spec index that is >= (1 << NUM_BITS_PROPERTY_INFO_SPEC_INDEX)");
209
210
211
static uint16_t sNativeProperties_sortedPropertyIndices[8];
212
static PropertyInfo sNativeProperties_propertyInfos[8];
213
214
static const NativePropertiesN<2> sNativeProperties = {
215
  false, 0,
216
  false, 0,
217
  false, 0,
218
  true,  0 /* sAttributes */,
219
  false, 0,
220
  false, 0,
221
  true,  1 /* sConstants */,
222
  -1,
223
  8,
224
  sNativeProperties_sortedPropertyIndices,
225
  {
226
    { sAttributes, &sNativeProperties_propertyInfos[0] },
227
    { sConstants, &sNativeProperties_propertyInfos[4] }
228
  }
229
};
230
static_assert(8 < 1ull << CHAR_BIT * sizeof(sNativeProperties.propertyInfoCount),
231
    "We have a property info count that is oversized");
232
233
static const DOMIfaceAndProtoJSClass sInterfaceObjectClass = {
234
  {
235
    "Function",
236
    JSCLASS_IS_DOMIFACEANDPROTOJSCLASS | JSCLASS_HAS_RESERVED_SLOTS(DOM_INTERFACE_SLOTS_BASE),
237
    &sBoringInterfaceObjectClassClassOps,
238
    JS_NULL_CLASS_SPEC,
239
    JS_NULL_CLASS_EXT,
240
    &sInterfaceObjectClassObjectOps
241
  },
242
  eInterface,
243
  true,
244
  prototypes::id::SVGGradientElement,
245
  PrototypeTraits<prototypes::id::SVGGradientElement>::Depth,
246
  sNativePropertyHooks,
247
  "function SVGGradientElement() {\n    [native code]\n}",
248
  SVGElement_Binding::GetConstructorObject
249
};
250
251
static const DOMIfaceAndProtoJSClass sPrototypeClass = {
252
  {
253
    "SVGGradientElementPrototype",
254
    JSCLASS_IS_DOMIFACEANDPROTOJSCLASS | JSCLASS_HAS_RESERVED_SLOTS(DOM_INTERFACE_PROTO_SLOTS_BASE),
255
    JS_NULL_CLASS_OPS,
256
    JS_NULL_CLASS_SPEC,
257
    JS_NULL_CLASS_EXT,
258
    JS_NULL_OBJECT_OPS
259
  },
260
  eInterfacePrototype,
261
  false,
262
  prototypes::id::SVGGradientElement,
263
  PrototypeTraits<prototypes::id::SVGGradientElement>::Depth,
264
  sNativePropertyHooks,
265
  "[object SVGGradientElementPrototype]",
266
  SVGElement_Binding::GetProtoObject
267
};
268
269
const NativePropertyHooks sNativePropertyHooks[] = { {
270
  nullptr,
271
  nullptr,
272
  nullptr,
273
  { sNativeProperties.Upcast(), nullptr },
274
  prototypes::id::SVGGradientElement,
275
  constructors::id::SVGGradientElement,
276
  SVGElement_Binding::sNativePropertyHooks,
277
  &DefaultXrayExpandoObjectClass
278
} };
279
280
void
281
CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, bool aDefineOnGlobal)
282
0
{
283
0
  JS::Handle<JSObject*> parentProto(SVGElement_Binding::GetProtoObjectHandle(aCx));
284
0
  if (!parentProto) {
285
0
    return;
286
0
  }
287
0
288
0
  JS::Handle<JSObject*> constructorProto(SVGElement_Binding::GetConstructorObjectHandle(aCx));
289
0
  if (!constructorProto) {
290
0
    return;
291
0
  }
292
0
293
0
  static bool sIdsInited = false;
294
0
  if (!sIdsInited && NS_IsMainThread()) {
295
0
    if (!InitIds(aCx, sNativeProperties.Upcast())) {
296
0
      return;
297
0
    }
298
0
    sIdsInited = true;
299
0
  }
300
0
301
0
  JS::Heap<JSObject*>* protoCache = &aProtoAndIfaceCache.EntrySlotOrCreate(prototypes::id::SVGGradientElement);
302
0
  JS::Heap<JSObject*>* interfaceCache = &aProtoAndIfaceCache.EntrySlotOrCreate(constructors::id::SVGGradientElement);
303
0
  dom::CreateInterfaceObjects(aCx, aGlobal, parentProto,
304
0
                              &sPrototypeClass.mBase, protoCache,
305
0
                              nullptr,
306
0
                              constructorProto, &sInterfaceObjectClass.mBase, 0, nullptr,
307
0
                              interfaceCache,
308
0
                              sNativeProperties.Upcast(),
309
0
                              nullptr,
310
0
                              "SVGGradientElement", aDefineOnGlobal,
311
0
                              nullptr,
312
0
                              false);
313
0
}
314
315
JSObject*
316
GetProtoObject(JSContext* aCx)
317
0
{
318
0
  return GetProtoObjectHandle(aCx);
319
0
}
320
321
JSObject*
322
GetConstructorObject(JSContext* aCx)
323
0
{
324
0
  return GetConstructorObjectHandle(aCx);
325
0
}
326
327
} // namespace SVGGradientElement_Binding
328
329
330
331
} // namespace dom
332
} // namespace mozilla