Coverage Report

Created: 2018-09-25 14:53

/work/obj-fuzz/dom/bindings/SVGFEPointLightElementBinding.cpp
Line
Count
Source (jump to first uncovered line)
1
/* THIS FILE IS AUTOGENERATED FROM SVGFEPointLightElement.webidl BY Codegen.py - DO NOT EDIT */
2
3
#include "SVGElementBinding.h"
4
#include "SVGFEPointLightElementBinding.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/SVGAnimatedNumber.h"
11
#include "mozilla/dom/SVGFEPointLightElement.h"
12
#include "mozilla/dom/XrayExpandoClass.h"
13
14
namespace mozilla {
15
namespace dom {
16
17
namespace binding_detail {}; // Just to make sure it's known as a namespace
18
using namespace mozilla::dom::binding_detail;
19
20
21
namespace SVGFEPointLightElement_Binding {
22
23
static_assert(IsRefcounted<NativeType>::value == IsRefcounted<SVGElement_Binding::NativeType>::value,
24
              "Can't inherit from an interface with a different ownership model.");
25
26
MOZ_CAN_RUN_SCRIPT static bool
27
get_x(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SVGFEPointLightElement* self, JSJitGetterCallArgs args)
28
0
{
29
0
  AUTO_PROFILER_LABEL_FAST("get SVGFEPointLightElement.x", DOM, cx);
30
0
31
0
  auto result(StrongOrRawPtr<mozilla::dom::SVGAnimatedNumber>(self->X()));
32
0
  MOZ_ASSERT(!JS_IsExceptionPending(cx));
33
0
  if (!GetOrCreateDOMReflector(cx, result, args.rval())) {
34
0
    MOZ_ASSERT(JS_IsExceptionPending(cx));
35
0
    return false;
36
0
  }
37
0
  return true;
38
0
}
39
40
static const JSJitInfo x_getterinfo = {
41
  { (JSJitGetterOp)get_x },
42
  { prototypes::id::SVGFEPointLightElement },
43
  { PrototypeTraits<prototypes::id::SVGFEPointLightElement>::Depth },
44
  JSJitInfo::Getter,
45
  JSJitInfo::AliasNone, /* aliasSet.  Not relevant for setters. */
46
  JSVAL_TYPE_OBJECT,  /* returnType.  Not relevant for setters. */
47
  false,  /* isInfallible. False in setters. */
48
  true,  /* isMovable.  Not relevant for setters. */
49
  true, /* isEliminatable.  Not relevant for setters. */
50
  false, /* isAlwaysInSlot.  Only relevant for getters. */
51
  false, /* isLazilyCachedInSlot.  Only relevant for getters. */
52
  false,  /* isTypedMethod.  Only relevant for methods. */
53
  0   /* Reserved slot index, if we're stored in a slot, else 0. */
54
};
55
static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
56
static_assert(0 < 1, "There is no slot for us");
57
58
MOZ_CAN_RUN_SCRIPT static bool
59
get_y(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SVGFEPointLightElement* self, JSJitGetterCallArgs args)
60
0
{
61
0
  AUTO_PROFILER_LABEL_FAST("get SVGFEPointLightElement.y", DOM, cx);
62
0
63
0
  auto result(StrongOrRawPtr<mozilla::dom::SVGAnimatedNumber>(self->Y()));
64
0
  MOZ_ASSERT(!JS_IsExceptionPending(cx));
65
0
  if (!GetOrCreateDOMReflector(cx, result, args.rval())) {
66
0
    MOZ_ASSERT(JS_IsExceptionPending(cx));
67
0
    return false;
68
0
  }
69
0
  return true;
70
0
}
71
72
static const JSJitInfo y_getterinfo = {
73
  { (JSJitGetterOp)get_y },
74
  { prototypes::id::SVGFEPointLightElement },
75
  { PrototypeTraits<prototypes::id::SVGFEPointLightElement>::Depth },
76
  JSJitInfo::Getter,
77
  JSJitInfo::AliasNone, /* aliasSet.  Not relevant for setters. */
78
  JSVAL_TYPE_OBJECT,  /* returnType.  Not relevant for setters. */
79
  false,  /* isInfallible. False in setters. */
80
  true,  /* isMovable.  Not relevant for setters. */
81
  true, /* isEliminatable.  Not relevant for setters. */
82
  false, /* isAlwaysInSlot.  Only relevant for getters. */
83
  false, /* isLazilyCachedInSlot.  Only relevant for getters. */
84
  false,  /* isTypedMethod.  Only relevant for methods. */
85
  0   /* Reserved slot index, if we're stored in a slot, else 0. */
86
};
87
static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
88
static_assert(0 < 1, "There is no slot for us");
89
90
MOZ_CAN_RUN_SCRIPT static bool
91
get_z(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SVGFEPointLightElement* self, JSJitGetterCallArgs args)
92
0
{
93
0
  AUTO_PROFILER_LABEL_FAST("get SVGFEPointLightElement.z", DOM, cx);
94
0
95
0
  auto result(StrongOrRawPtr<mozilla::dom::SVGAnimatedNumber>(self->Z()));
96
0
  MOZ_ASSERT(!JS_IsExceptionPending(cx));
97
0
  if (!GetOrCreateDOMReflector(cx, result, args.rval())) {
98
0
    MOZ_ASSERT(JS_IsExceptionPending(cx));
99
0
    return false;
100
0
  }
101
0
  return true;
102
0
}
103
104
static const JSJitInfo z_getterinfo = {
105
  { (JSJitGetterOp)get_z },
106
  { prototypes::id::SVGFEPointLightElement },
107
  { PrototypeTraits<prototypes::id::SVGFEPointLightElement>::Depth },
108
  JSJitInfo::Getter,
109
  JSJitInfo::AliasNone, /* aliasSet.  Not relevant for setters. */
110
  JSVAL_TYPE_OBJECT,  /* returnType.  Not relevant for setters. */
111
  false,  /* isInfallible. False in setters. */
112
  true,  /* isMovable.  Not relevant for setters. */
113
  true, /* isEliminatable.  Not relevant for setters. */
114
  false, /* isAlwaysInSlot.  Only relevant for getters. */
115
  false, /* isLazilyCachedInSlot.  Only relevant for getters. */
116
  false,  /* isTypedMethod.  Only relevant for methods. */
117
  0   /* Reserved slot index, if we're stored in a slot, else 0. */
118
};
119
static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
120
static_assert(0 < 1, "There is no slot for us");
121
122
static bool
123
_addProperty(JSContext* cx, JS::Handle<JSObject*> obj, JS::Handle<jsid> id, JS::Handle<JS::Value> val)
124
0
{
125
0
  mozilla::dom::SVGFEPointLightElement* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::dom::SVGFEPointLightElement>(obj);
126
0
  // We don't want to preserve if we don't have a wrapper, and we
127
0
  // obviously can't preserve if we're not initialized.
128
0
  if (self && self->GetWrapperPreserveColor()) {
129
0
    PreserveWrapper(self);
130
0
  }
131
0
  return true;
132
0
}
133
134
static void
135
_finalize(js::FreeOp* fop, JSObject* obj)
136
0
{
137
0
  mozilla::dom::SVGFEPointLightElement* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::dom::SVGFEPointLightElement>(obj);
138
0
  if (self) {
139
0
    ClearWrapper(self, self, obj);
140
0
    AddForDeferredFinalization<mozilla::dom::SVGFEPointLightElement>(self);
141
0
  }
142
0
}
143
144
static size_t
145
_objectMoved(JSObject* obj, JSObject* old)
146
0
{
147
0
  mozilla::dom::SVGFEPointLightElement* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::dom::SVGFEPointLightElement>(obj);
148
0
  if (self) {
149
0
    UpdateWrapper(self, self, obj, old);
150
0
  }
151
0
152
0
  return 0;
153
0
}
154
155
// We deliberately use brace-elision to make Visual Studio produce better initalization code.
156
#if defined(__clang__)
157
#pragma clang diagnostic push
158
#pragma clang diagnostic ignored "-Wmissing-braces"
159
#endif
160
static const JSPropertySpec sAttributes_specs[] = {
161
  { "x", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &x_getterinfo, nullptr, nullptr },
162
  { "y", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &y_getterinfo, nullptr, nullptr },
163
  { "z", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &z_getterinfo, nullptr, nullptr },
164
  { nullptr, 0, nullptr, nullptr, nullptr, nullptr }
165
};
166
#if defined(__clang__)
167
#pragma clang diagnostic pop
168
#endif
169
170
171
static const Prefable<const JSPropertySpec> sAttributes[] = {
172
  { nullptr, &sAttributes_specs[0] },
173
  { nullptr, nullptr }
174
};
175
176
static_assert(1 <= 1ull << NUM_BITS_PROPERTY_INFO_PREF_INDEX,
177
    "We have a prefable index that is >= (1 << NUM_BITS_PROPERTY_INFO_PREF_INDEX)");
178
static_assert(3 <= 1ull << NUM_BITS_PROPERTY_INFO_SPEC_INDEX,
179
    "We have a spec index that is >= (1 << NUM_BITS_PROPERTY_INFO_SPEC_INDEX)");
180
181
182
static uint16_t sNativeProperties_sortedPropertyIndices[3];
183
static PropertyInfo sNativeProperties_propertyInfos[3];
184
185
static const NativePropertiesN<1> sNativeProperties = {
186
  false, 0,
187
  false, 0,
188
  false, 0,
189
  true,  0 /* sAttributes */,
190
  false, 0,
191
  false, 0,
192
  false, 0,
193
  -1,
194
  3,
195
  sNativeProperties_sortedPropertyIndices,
196
  {
197
    { sAttributes, &sNativeProperties_propertyInfos[0] }
198
  }
199
};
200
static_assert(3 < 1ull << CHAR_BIT * sizeof(sNativeProperties.propertyInfoCount),
201
    "We have a property info count that is oversized");
202
203
static const DOMIfaceAndProtoJSClass sInterfaceObjectClass = {
204
  {
205
    "Function",
206
    JSCLASS_IS_DOMIFACEANDPROTOJSCLASS | JSCLASS_HAS_RESERVED_SLOTS(DOM_INTERFACE_SLOTS_BASE),
207
    &sBoringInterfaceObjectClassClassOps,
208
    JS_NULL_CLASS_SPEC,
209
    JS_NULL_CLASS_EXT,
210
    &sInterfaceObjectClassObjectOps
211
  },
212
  eInterface,
213
  true,
214
  prototypes::id::SVGFEPointLightElement,
215
  PrototypeTraits<prototypes::id::SVGFEPointLightElement>::Depth,
216
  sNativePropertyHooks,
217
  "function SVGFEPointLightElement() {\n    [native code]\n}",
218
  SVGElement_Binding::GetConstructorObject
219
};
220
221
static const DOMIfaceAndProtoJSClass sPrototypeClass = {
222
  {
223
    "SVGFEPointLightElementPrototype",
224
    JSCLASS_IS_DOMIFACEANDPROTOJSCLASS | JSCLASS_HAS_RESERVED_SLOTS(DOM_INTERFACE_PROTO_SLOTS_BASE),
225
    JS_NULL_CLASS_OPS,
226
    JS_NULL_CLASS_SPEC,
227
    JS_NULL_CLASS_EXT,
228
    JS_NULL_OBJECT_OPS
229
  },
230
  eInterfacePrototype,
231
  false,
232
  prototypes::id::SVGFEPointLightElement,
233
  PrototypeTraits<prototypes::id::SVGFEPointLightElement>::Depth,
234
  sNativePropertyHooks,
235
  "[object SVGFEPointLightElementPrototype]",
236
  SVGElement_Binding::GetProtoObject
237
};
238
239
static const js::ClassOps sClassOps = {
240
  _addProperty, /* addProperty */
241
  nullptr,               /* delProperty */
242
  nullptr,               /* enumerate */
243
  nullptr, /* newEnumerate */
244
  nullptr, /* resolve */
245
  nullptr, /* mayResolve */
246
  _finalize, /* finalize */
247
  nullptr, /* call */
248
  nullptr,               /* hasInstance */
249
  nullptr,               /* construct */
250
  nullptr, /* trace */
251
};
252
253
static const js::ClassExtension sClassExtension = {
254
  nullptr, /* weakmapKeyDelegateOp */
255
  _objectMoved /* objectMovedOp */
256
};
257
258
static const DOMJSClass sClass = {
259
  { "SVGFEPointLightElement",
260
    JSCLASS_IS_DOMJSCLASS | JSCLASS_FOREGROUND_FINALIZE | JSCLASS_HAS_RESERVED_SLOTS(1),
261
    &sClassOps,
262
    JS_NULL_CLASS_SPEC,
263
    &sClassExtension,
264
    JS_NULL_OBJECT_OPS
265
  },
266
  { prototypes::id::EventTarget, prototypes::id::Node, prototypes::id::Element, prototypes::id::SVGElement, prototypes::id::SVGFEPointLightElement, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count },
267
  IsBaseOf<nsISupports, mozilla::dom::SVGFEPointLightElement >::value,
268
  sNativePropertyHooks,
269
  FindAssociatedGlobalForNative<mozilla::dom::SVGFEPointLightElement>::Get,
270
  GetProtoObjectHandle,
271
  GetCCParticipant<mozilla::dom::SVGFEPointLightElement>::Get()
272
};
273
static_assert(1 == DOM_INSTANCE_RESERVED_SLOTS,
274
              "Must have the right minimal number of reserved slots.");
275
static_assert(1 >= 1,
276
              "Must have enough reserved slots.");
277
278
const JSClass*
279
GetJSClass()
280
0
{
281
0
  return sClass.ToJSClass();
282
0
}
283
284
bool
285
Wrap(JSContext* aCx, mozilla::dom::SVGFEPointLightElement* aObject, nsWrapperCache* aCache, JS::Handle<JSObject*> aGivenProto, JS::MutableHandle<JSObject*> aReflector)
286
0
{
287
0
  static_assert(!IsBaseOf<NonRefcountedDOMObject, mozilla::dom::SVGFEPointLightElement>::value,
288
0
                "Shouldn't have wrappercached things that are not refcounted.");
289
0
  MOZ_ASSERT(static_cast<mozilla::dom::SVGFEPointLightElement*>(aObject) ==
290
0
             reinterpret_cast<mozilla::dom::SVGFEPointLightElement*>(aObject),
291
0
             "Multiple inheritance for mozilla::dom::SVGFEPointLightElement is broken.");
292
0
  MOZ_ASSERT(static_cast<nsSVGElement*>(aObject) ==
293
0
             reinterpret_cast<nsSVGElement*>(aObject),
294
0
             "Multiple inheritance for nsSVGElement is broken.");
295
0
  MOZ_ASSERT(static_cast<mozilla::dom::Element*>(aObject) ==
296
0
             reinterpret_cast<mozilla::dom::Element*>(aObject),
297
0
             "Multiple inheritance for mozilla::dom::Element is broken.");
298
0
  MOZ_ASSERT(static_cast<nsINode*>(aObject) ==
299
0
             reinterpret_cast<nsINode*>(aObject),
300
0
             "Multiple inheritance for nsINode is broken.");
301
0
  MOZ_ASSERT(static_cast<mozilla::dom::EventTarget*>(aObject) ==
302
0
             reinterpret_cast<mozilla::dom::EventTarget*>(aObject),
303
0
             "Multiple inheritance for mozilla::dom::EventTarget is broken.");
304
0
  MOZ_ASSERT(ToSupportsIsCorrect(aObject));
305
0
  MOZ_ASSERT_IF(aGivenProto, js::IsObjectInContextCompartment(aGivenProto, aCx));
306
0
  MOZ_ASSERT(!aCache->GetWrapper(),
307
0
             "You should probably not be using Wrap() directly; use "
308
0
             "GetOrCreateDOMReflector instead");
309
0
310
0
  MOZ_ASSERT(ToSupportsIsOnPrimaryInheritanceChain(aObject, aCache),
311
0
             "nsISupports must be on our primary inheritance chain");
312
0
313
0
  JS::Rooted<JSObject*> global(aCx, FindAssociatedGlobal(aCx, aObject->GetParentObject()));
314
0
  if (!global) {
315
0
    return false;
316
0
  }
317
0
  MOZ_ASSERT(JS_IsGlobalObject(global));
318
0
  MOZ_ASSERT(JS::ObjectIsNotGray(global));
319
0
320
0
  // That might have ended up wrapping us already, due to the wonders
321
0
  // of XBL.  Check for that, and bail out as needed.
322
0
  aReflector.set(aCache->GetWrapper());
323
0
  if (aReflector) {
324
#ifdef DEBUG
325
    AssertReflectorHasGivenProto(aCx, aReflector, aGivenProto);
326
#endif // DEBUG
327
    return true;
328
0
  }
329
0
330
0
  JSAutoRealm ar(aCx, global);
331
0
  JS::Handle<JSObject*> canonicalProto = GetProtoObjectHandle(aCx);
332
0
  if (!canonicalProto) {
333
0
    return false;
334
0
  }
335
0
  JS::Rooted<JSObject*> proto(aCx);
336
0
  if (aGivenProto) {
337
0
    proto = aGivenProto;
338
0
    // Unfortunately, while aGivenProto was in the compartment of aCx
339
0
    // coming in, we changed compartments to that of "parent" so may need
340
0
    // to wrap the proto here.
341
0
    if (js::GetContextCompartment(aCx) != js::GetObjectCompartment(proto)) {
342
0
      if (!JS_WrapObject(aCx, &proto)) {
343
0
        return false;
344
0
      }
345
0
    }
346
0
  } else {
347
0
    proto = canonicalProto;
348
0
  }
349
0
350
0
  BindingJSObjectCreator<mozilla::dom::SVGFEPointLightElement> creator(aCx);
351
0
  creator.CreateObject(aCx, sClass.ToJSClass(), proto, aObject, aReflector);
352
0
  if (!aReflector) {
353
0
    return false;
354
0
  }
355
0
356
0
  aCache->SetWrapper(aReflector);
357
0
  creator.InitializationSucceeded();
358
0
359
0
  MOZ_ASSERT(aCache->GetWrapperPreserveColor() &&
360
0
             aCache->GetWrapperPreserveColor() == aReflector);
361
0
  // If proto != canonicalProto, we have to preserve our wrapper;
362
0
  // otherwise we won't be able to properly recreate it later, since
363
0
  // we won't know what proto to use.  Note that we don't check
364
0
  // aGivenProto here, since it's entirely possible (and even
365
0
  // somewhat common) to have a non-null aGivenProto which is the
366
0
  // same as canonicalProto.
367
0
  if (proto != canonicalProto) {
368
0
    PreserveWrapper(aObject);
369
0
  }
370
0
371
0
  return true;
372
0
}
373
374
const NativePropertyHooks sNativePropertyHooks[] = { {
375
  nullptr,
376
  nullptr,
377
  nullptr,
378
  { sNativeProperties.Upcast(), nullptr },
379
  prototypes::id::SVGFEPointLightElement,
380
  constructors::id::SVGFEPointLightElement,
381
  SVGElement_Binding::sNativePropertyHooks,
382
  &DefaultXrayExpandoObjectClass
383
} };
384
385
void
386
CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, bool aDefineOnGlobal)
387
0
{
388
0
  JS::Handle<JSObject*> parentProto(SVGElement_Binding::GetProtoObjectHandle(aCx));
389
0
  if (!parentProto) {
390
0
    return;
391
0
  }
392
0
393
0
  JS::Handle<JSObject*> constructorProto(SVGElement_Binding::GetConstructorObjectHandle(aCx));
394
0
  if (!constructorProto) {
395
0
    return;
396
0
  }
397
0
398
0
  static bool sIdsInited = false;
399
0
  if (!sIdsInited && NS_IsMainThread()) {
400
0
    if (!InitIds(aCx, sNativeProperties.Upcast())) {
401
0
      return;
402
0
    }
403
0
    sIdsInited = true;
404
0
  }
405
0
406
0
  JS::Heap<JSObject*>* protoCache = &aProtoAndIfaceCache.EntrySlotOrCreate(prototypes::id::SVGFEPointLightElement);
407
0
  JS::Heap<JSObject*>* interfaceCache = &aProtoAndIfaceCache.EntrySlotOrCreate(constructors::id::SVGFEPointLightElement);
408
0
  dom::CreateInterfaceObjects(aCx, aGlobal, parentProto,
409
0
                              &sPrototypeClass.mBase, protoCache,
410
0
                              nullptr,
411
0
                              constructorProto, &sInterfaceObjectClass.mBase, 0, nullptr,
412
0
                              interfaceCache,
413
0
                              sNativeProperties.Upcast(),
414
0
                              nullptr,
415
0
                              "SVGFEPointLightElement", aDefineOnGlobal,
416
0
                              nullptr,
417
0
                              false);
418
0
}
419
420
JSObject*
421
GetConstructorObject(JSContext* aCx)
422
0
{
423
0
  return GetConstructorObjectHandle(aCx);
424
0
}
425
426
} // namespace SVGFEPointLightElement_Binding
427
428
429
430
} // namespace dom
431
} // namespace mozilla