Coverage Report

Created: 2018-09-25 14:53

/work/obj-fuzz/dom/bindings/SVGFEOffsetElementBinding.cpp
Line
Count
Source (jump to first uncovered line)
1
/* THIS FILE IS AUTOGENERATED FROM SVGFEOffsetElement.webidl BY Codegen.py - DO NOT EDIT */
2
3
#include "SVGElementBinding.h"
4
#include "SVGFEOffsetElementBinding.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/SVGAnimatedLength.h"
11
#include "mozilla/dom/SVGAnimatedNumber.h"
12
#include "mozilla/dom/SVGAnimatedString.h"
13
#include "mozilla/dom/SVGFEOffsetElement.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 SVGFEOffsetElement_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_in1(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SVGFEOffsetElement* self, JSJitGetterCallArgs args)
30
0
{
31
0
  AUTO_PROFILER_LABEL_FAST("get SVGFEOffsetElement.in1", DOM, cx);
32
0
33
0
  auto result(StrongOrRawPtr<mozilla::dom::SVGAnimatedString>(self->In1()));
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 in1_getterinfo = {
43
  { (JSJitGetterOp)get_in1 },
44
  { prototypes::id::SVGFEOffsetElement },
45
  { PrototypeTraits<prototypes::id::SVGFEOffsetElement>::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_dx(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SVGFEOffsetElement* self, JSJitGetterCallArgs args)
62
0
{
63
0
  AUTO_PROFILER_LABEL_FAST("get SVGFEOffsetElement.dx", DOM, cx);
64
0
65
0
  auto result(StrongOrRawPtr<mozilla::dom::SVGAnimatedNumber>(self->Dx()));
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 dx_getterinfo = {
75
  { (JSJitGetterOp)get_dx },
76
  { prototypes::id::SVGFEOffsetElement },
77
  { PrototypeTraits<prototypes::id::SVGFEOffsetElement>::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_dy(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SVGFEOffsetElement* self, JSJitGetterCallArgs args)
94
0
{
95
0
  AUTO_PROFILER_LABEL_FAST("get SVGFEOffsetElement.dy", DOM, cx);
96
0
97
0
  auto result(StrongOrRawPtr<mozilla::dom::SVGAnimatedNumber>(self->Dy()));
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 dy_getterinfo = {
107
  { (JSJitGetterOp)get_dy },
108
  { prototypes::id::SVGFEOffsetElement },
109
  { PrototypeTraits<prototypes::id::SVGFEOffsetElement>::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_x(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SVGFEOffsetElement* self, JSJitGetterCallArgs args)
126
0
{
127
0
  AUTO_PROFILER_LABEL_FAST("get SVGFEOffsetElement.x", DOM, cx);
128
0
129
0
  auto result(StrongOrRawPtr<mozilla::dom::SVGAnimatedLength>(self->X()));
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 x_getterinfo = {
139
  { (JSJitGetterOp)get_x },
140
  { prototypes::id::SVGFEOffsetElement },
141
  { PrototypeTraits<prototypes::id::SVGFEOffsetElement>::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
MOZ_CAN_RUN_SCRIPT static bool
157
get_y(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SVGFEOffsetElement* self, JSJitGetterCallArgs args)
158
0
{
159
0
  AUTO_PROFILER_LABEL_FAST("get SVGFEOffsetElement.y", DOM, cx);
160
0
161
0
  auto result(StrongOrRawPtr<mozilla::dom::SVGAnimatedLength>(self->Y()));
162
0
  MOZ_ASSERT(!JS_IsExceptionPending(cx));
163
0
  if (!GetOrCreateDOMReflector(cx, result, args.rval())) {
164
0
    MOZ_ASSERT(JS_IsExceptionPending(cx));
165
0
    return false;
166
0
  }
167
0
  return true;
168
0
}
169
170
static const JSJitInfo y_getterinfo = {
171
  { (JSJitGetterOp)get_y },
172
  { prototypes::id::SVGFEOffsetElement },
173
  { PrototypeTraits<prototypes::id::SVGFEOffsetElement>::Depth },
174
  JSJitInfo::Getter,
175
  JSJitInfo::AliasNone, /* aliasSet.  Not relevant for setters. */
176
  JSVAL_TYPE_OBJECT,  /* returnType.  Not relevant for setters. */
177
  false,  /* isInfallible. False in setters. */
178
  true,  /* isMovable.  Not relevant for setters. */
179
  true, /* isEliminatable.  Not relevant for setters. */
180
  false, /* isAlwaysInSlot.  Only relevant for getters. */
181
  false, /* isLazilyCachedInSlot.  Only relevant for getters. */
182
  false,  /* isTypedMethod.  Only relevant for methods. */
183
  0   /* Reserved slot index, if we're stored in a slot, else 0. */
184
};
185
static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
186
static_assert(0 < 1, "There is no slot for us");
187
188
MOZ_CAN_RUN_SCRIPT static bool
189
get_width(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SVGFEOffsetElement* self, JSJitGetterCallArgs args)
190
0
{
191
0
  AUTO_PROFILER_LABEL_FAST("get SVGFEOffsetElement.width", DOM, cx);
192
0
193
0
  auto result(StrongOrRawPtr<mozilla::dom::SVGAnimatedLength>(self->Width()));
194
0
  MOZ_ASSERT(!JS_IsExceptionPending(cx));
195
0
  if (!GetOrCreateDOMReflector(cx, result, args.rval())) {
196
0
    MOZ_ASSERT(JS_IsExceptionPending(cx));
197
0
    return false;
198
0
  }
199
0
  return true;
200
0
}
201
202
static const JSJitInfo width_getterinfo = {
203
  { (JSJitGetterOp)get_width },
204
  { prototypes::id::SVGFEOffsetElement },
205
  { PrototypeTraits<prototypes::id::SVGFEOffsetElement>::Depth },
206
  JSJitInfo::Getter,
207
  JSJitInfo::AliasNone, /* aliasSet.  Not relevant for setters. */
208
  JSVAL_TYPE_OBJECT,  /* returnType.  Not relevant for setters. */
209
  false,  /* isInfallible. False in setters. */
210
  true,  /* isMovable.  Not relevant for setters. */
211
  true, /* isEliminatable.  Not relevant for setters. */
212
  false, /* isAlwaysInSlot.  Only relevant for getters. */
213
  false, /* isLazilyCachedInSlot.  Only relevant for getters. */
214
  false,  /* isTypedMethod.  Only relevant for methods. */
215
  0   /* Reserved slot index, if we're stored in a slot, else 0. */
216
};
217
static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
218
static_assert(0 < 1, "There is no slot for us");
219
220
MOZ_CAN_RUN_SCRIPT static bool
221
get_height(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SVGFEOffsetElement* self, JSJitGetterCallArgs args)
222
0
{
223
0
  AUTO_PROFILER_LABEL_FAST("get SVGFEOffsetElement.height", DOM, cx);
224
0
225
0
  auto result(StrongOrRawPtr<mozilla::dom::SVGAnimatedLength>(self->Height()));
226
0
  MOZ_ASSERT(!JS_IsExceptionPending(cx));
227
0
  if (!GetOrCreateDOMReflector(cx, result, args.rval())) {
228
0
    MOZ_ASSERT(JS_IsExceptionPending(cx));
229
0
    return false;
230
0
  }
231
0
  return true;
232
0
}
233
234
static const JSJitInfo height_getterinfo = {
235
  { (JSJitGetterOp)get_height },
236
  { prototypes::id::SVGFEOffsetElement },
237
  { PrototypeTraits<prototypes::id::SVGFEOffsetElement>::Depth },
238
  JSJitInfo::Getter,
239
  JSJitInfo::AliasNone, /* aliasSet.  Not relevant for setters. */
240
  JSVAL_TYPE_OBJECT,  /* returnType.  Not relevant for setters. */
241
  false,  /* isInfallible. False in setters. */
242
  true,  /* isMovable.  Not relevant for setters. */
243
  true, /* isEliminatable.  Not relevant for setters. */
244
  false, /* isAlwaysInSlot.  Only relevant for getters. */
245
  false, /* isLazilyCachedInSlot.  Only relevant for getters. */
246
  false,  /* isTypedMethod.  Only relevant for methods. */
247
  0   /* Reserved slot index, if we're stored in a slot, else 0. */
248
};
249
static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
250
static_assert(0 < 1, "There is no slot for us");
251
252
MOZ_CAN_RUN_SCRIPT static bool
253
get_result(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SVGFEOffsetElement* self, JSJitGetterCallArgs args)
254
0
{
255
0
  AUTO_PROFILER_LABEL_FAST("get SVGFEOffsetElement.result", DOM, cx);
256
0
257
0
  auto result(StrongOrRawPtr<mozilla::dom::SVGAnimatedString>(self->Result()));
258
0
  MOZ_ASSERT(!JS_IsExceptionPending(cx));
259
0
  if (!GetOrCreateDOMReflector(cx, result, args.rval())) {
260
0
    MOZ_ASSERT(JS_IsExceptionPending(cx));
261
0
    return false;
262
0
  }
263
0
  return true;
264
0
}
265
266
static const JSJitInfo result_getterinfo = {
267
  { (JSJitGetterOp)get_result },
268
  { prototypes::id::SVGFEOffsetElement },
269
  { PrototypeTraits<prototypes::id::SVGFEOffsetElement>::Depth },
270
  JSJitInfo::Getter,
271
  JSJitInfo::AliasNone, /* aliasSet.  Not relevant for setters. */
272
  JSVAL_TYPE_OBJECT,  /* returnType.  Not relevant for setters. */
273
  false,  /* isInfallible. False in setters. */
274
  true,  /* isMovable.  Not relevant for setters. */
275
  true, /* isEliminatable.  Not relevant for setters. */
276
  false, /* isAlwaysInSlot.  Only relevant for getters. */
277
  false, /* isLazilyCachedInSlot.  Only relevant for getters. */
278
  false,  /* isTypedMethod.  Only relevant for methods. */
279
  0   /* Reserved slot index, if we're stored in a slot, else 0. */
280
};
281
static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
282
static_assert(0 < 1, "There is no slot for us");
283
284
static bool
285
_addProperty(JSContext* cx, JS::Handle<JSObject*> obj, JS::Handle<jsid> id, JS::Handle<JS::Value> val)
286
0
{
287
0
  mozilla::dom::SVGFEOffsetElement* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::dom::SVGFEOffsetElement>(obj);
288
0
  // We don't want to preserve if we don't have a wrapper, and we
289
0
  // obviously can't preserve if we're not initialized.
290
0
  if (self && self->GetWrapperPreserveColor()) {
291
0
    PreserveWrapper(self);
292
0
  }
293
0
  return true;
294
0
}
295
296
static void
297
_finalize(js::FreeOp* fop, JSObject* obj)
298
0
{
299
0
  mozilla::dom::SVGFEOffsetElement* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::dom::SVGFEOffsetElement>(obj);
300
0
  if (self) {
301
0
    ClearWrapper(self, self, obj);
302
0
    AddForDeferredFinalization<mozilla::dom::SVGFEOffsetElement>(self);
303
0
  }
304
0
}
305
306
static size_t
307
_objectMoved(JSObject* obj, JSObject* old)
308
0
{
309
0
  mozilla::dom::SVGFEOffsetElement* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::dom::SVGFEOffsetElement>(obj);
310
0
  if (self) {
311
0
    UpdateWrapper(self, self, obj, old);
312
0
  }
313
0
314
0
  return 0;
315
0
}
316
317
// We deliberately use brace-elision to make Visual Studio produce better initalization code.
318
#if defined(__clang__)
319
#pragma clang diagnostic push
320
#pragma clang diagnostic ignored "-Wmissing-braces"
321
#endif
322
static const JSPropertySpec sAttributes_specs[] = {
323
  { "in1", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &in1_getterinfo, nullptr, nullptr },
324
  { "dx", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &dx_getterinfo, nullptr, nullptr },
325
  { "dy", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &dy_getterinfo, nullptr, nullptr },
326
  { "x", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &x_getterinfo, nullptr, nullptr },
327
  { "y", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &y_getterinfo, nullptr, nullptr },
328
  { "width", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &width_getterinfo, nullptr, nullptr },
329
  { "height", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &height_getterinfo, nullptr, nullptr },
330
  { "result", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &result_getterinfo, nullptr, nullptr },
331
  { nullptr, 0, nullptr, nullptr, nullptr, nullptr }
332
};
333
#if defined(__clang__)
334
#pragma clang diagnostic pop
335
#endif
336
337
338
static const Prefable<const JSPropertySpec> sAttributes[] = {
339
  { nullptr, &sAttributes_specs[0] },
340
  { nullptr, nullptr }
341
};
342
343
static_assert(1 <= 1ull << NUM_BITS_PROPERTY_INFO_PREF_INDEX,
344
    "We have a prefable index that is >= (1 << NUM_BITS_PROPERTY_INFO_PREF_INDEX)");
345
static_assert(8 <= 1ull << NUM_BITS_PROPERTY_INFO_SPEC_INDEX,
346
    "We have a spec index that is >= (1 << NUM_BITS_PROPERTY_INFO_SPEC_INDEX)");
347
348
349
static uint16_t sNativeProperties_sortedPropertyIndices[8];
350
static PropertyInfo sNativeProperties_propertyInfos[8];
351
352
static const NativePropertiesN<1> sNativeProperties = {
353
  false, 0,
354
  false, 0,
355
  false, 0,
356
  true,  0 /* sAttributes */,
357
  false, 0,
358
  false, 0,
359
  false, 0,
360
  -1,
361
  8,
362
  sNativeProperties_sortedPropertyIndices,
363
  {
364
    { sAttributes, &sNativeProperties_propertyInfos[0] }
365
  }
366
};
367
static_assert(8 < 1ull << CHAR_BIT * sizeof(sNativeProperties.propertyInfoCount),
368
    "We have a property info count that is oversized");
369
370
static const DOMIfaceAndProtoJSClass sInterfaceObjectClass = {
371
  {
372
    "Function",
373
    JSCLASS_IS_DOMIFACEANDPROTOJSCLASS | JSCLASS_HAS_RESERVED_SLOTS(DOM_INTERFACE_SLOTS_BASE),
374
    &sBoringInterfaceObjectClassClassOps,
375
    JS_NULL_CLASS_SPEC,
376
    JS_NULL_CLASS_EXT,
377
    &sInterfaceObjectClassObjectOps
378
  },
379
  eInterface,
380
  true,
381
  prototypes::id::SVGFEOffsetElement,
382
  PrototypeTraits<prototypes::id::SVGFEOffsetElement>::Depth,
383
  sNativePropertyHooks,
384
  "function SVGFEOffsetElement() {\n    [native code]\n}",
385
  SVGElement_Binding::GetConstructorObject
386
};
387
388
static const DOMIfaceAndProtoJSClass sPrototypeClass = {
389
  {
390
    "SVGFEOffsetElementPrototype",
391
    JSCLASS_IS_DOMIFACEANDPROTOJSCLASS | JSCLASS_HAS_RESERVED_SLOTS(DOM_INTERFACE_PROTO_SLOTS_BASE),
392
    JS_NULL_CLASS_OPS,
393
    JS_NULL_CLASS_SPEC,
394
    JS_NULL_CLASS_EXT,
395
    JS_NULL_OBJECT_OPS
396
  },
397
  eInterfacePrototype,
398
  false,
399
  prototypes::id::SVGFEOffsetElement,
400
  PrototypeTraits<prototypes::id::SVGFEOffsetElement>::Depth,
401
  sNativePropertyHooks,
402
  "[object SVGFEOffsetElementPrototype]",
403
  SVGElement_Binding::GetProtoObject
404
};
405
406
static const js::ClassOps sClassOps = {
407
  _addProperty, /* addProperty */
408
  nullptr,               /* delProperty */
409
  nullptr,               /* enumerate */
410
  nullptr, /* newEnumerate */
411
  nullptr, /* resolve */
412
  nullptr, /* mayResolve */
413
  _finalize, /* finalize */
414
  nullptr, /* call */
415
  nullptr,               /* hasInstance */
416
  nullptr,               /* construct */
417
  nullptr, /* trace */
418
};
419
420
static const js::ClassExtension sClassExtension = {
421
  nullptr, /* weakmapKeyDelegateOp */
422
  _objectMoved /* objectMovedOp */
423
};
424
425
static const DOMJSClass sClass = {
426
  { "SVGFEOffsetElement",
427
    JSCLASS_IS_DOMJSCLASS | JSCLASS_FOREGROUND_FINALIZE | JSCLASS_HAS_RESERVED_SLOTS(1),
428
    &sClassOps,
429
    JS_NULL_CLASS_SPEC,
430
    &sClassExtension,
431
    JS_NULL_OBJECT_OPS
432
  },
433
  { prototypes::id::EventTarget, prototypes::id::Node, prototypes::id::Element, prototypes::id::SVGElement, prototypes::id::SVGFEOffsetElement, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count },
434
  IsBaseOf<nsISupports, mozilla::dom::SVGFEOffsetElement >::value,
435
  sNativePropertyHooks,
436
  FindAssociatedGlobalForNative<mozilla::dom::SVGFEOffsetElement>::Get,
437
  GetProtoObjectHandle,
438
  GetCCParticipant<mozilla::dom::SVGFEOffsetElement>::Get()
439
};
440
static_assert(1 == DOM_INSTANCE_RESERVED_SLOTS,
441
              "Must have the right minimal number of reserved slots.");
442
static_assert(1 >= 1,
443
              "Must have enough reserved slots.");
444
445
const JSClass*
446
GetJSClass()
447
0
{
448
0
  return sClass.ToJSClass();
449
0
}
450
451
bool
452
Wrap(JSContext* aCx, mozilla::dom::SVGFEOffsetElement* aObject, nsWrapperCache* aCache, JS::Handle<JSObject*> aGivenProto, JS::MutableHandle<JSObject*> aReflector)
453
0
{
454
0
  static_assert(!IsBaseOf<NonRefcountedDOMObject, mozilla::dom::SVGFEOffsetElement>::value,
455
0
                "Shouldn't have wrappercached things that are not refcounted.");
456
0
  MOZ_ASSERT(static_cast<mozilla::dom::SVGFEOffsetElement*>(aObject) ==
457
0
             reinterpret_cast<mozilla::dom::SVGFEOffsetElement*>(aObject),
458
0
             "Multiple inheritance for mozilla::dom::SVGFEOffsetElement is broken.");
459
0
  MOZ_ASSERT(static_cast<nsSVGElement*>(aObject) ==
460
0
             reinterpret_cast<nsSVGElement*>(aObject),
461
0
             "Multiple inheritance for nsSVGElement is broken.");
462
0
  MOZ_ASSERT(static_cast<mozilla::dom::Element*>(aObject) ==
463
0
             reinterpret_cast<mozilla::dom::Element*>(aObject),
464
0
             "Multiple inheritance for mozilla::dom::Element is broken.");
465
0
  MOZ_ASSERT(static_cast<nsINode*>(aObject) ==
466
0
             reinterpret_cast<nsINode*>(aObject),
467
0
             "Multiple inheritance for nsINode is broken.");
468
0
  MOZ_ASSERT(static_cast<mozilla::dom::EventTarget*>(aObject) ==
469
0
             reinterpret_cast<mozilla::dom::EventTarget*>(aObject),
470
0
             "Multiple inheritance for mozilla::dom::EventTarget is broken.");
471
0
  MOZ_ASSERT(ToSupportsIsCorrect(aObject));
472
0
  MOZ_ASSERT_IF(aGivenProto, js::IsObjectInContextCompartment(aGivenProto, aCx));
473
0
  MOZ_ASSERT(!aCache->GetWrapper(),
474
0
             "You should probably not be using Wrap() directly; use "
475
0
             "GetOrCreateDOMReflector instead");
476
0
477
0
  MOZ_ASSERT(ToSupportsIsOnPrimaryInheritanceChain(aObject, aCache),
478
0
             "nsISupports must be on our primary inheritance chain");
479
0
480
0
  JS::Rooted<JSObject*> global(aCx, FindAssociatedGlobal(aCx, aObject->GetParentObject()));
481
0
  if (!global) {
482
0
    return false;
483
0
  }
484
0
  MOZ_ASSERT(JS_IsGlobalObject(global));
485
0
  MOZ_ASSERT(JS::ObjectIsNotGray(global));
486
0
487
0
  // That might have ended up wrapping us already, due to the wonders
488
0
  // of XBL.  Check for that, and bail out as needed.
489
0
  aReflector.set(aCache->GetWrapper());
490
0
  if (aReflector) {
491
#ifdef DEBUG
492
    AssertReflectorHasGivenProto(aCx, aReflector, aGivenProto);
493
#endif // DEBUG
494
    return true;
495
0
  }
496
0
497
0
  JSAutoRealm ar(aCx, global);
498
0
  JS::Handle<JSObject*> canonicalProto = GetProtoObjectHandle(aCx);
499
0
  if (!canonicalProto) {
500
0
    return false;
501
0
  }
502
0
  JS::Rooted<JSObject*> proto(aCx);
503
0
  if (aGivenProto) {
504
0
    proto = aGivenProto;
505
0
    // Unfortunately, while aGivenProto was in the compartment of aCx
506
0
    // coming in, we changed compartments to that of "parent" so may need
507
0
    // to wrap the proto here.
508
0
    if (js::GetContextCompartment(aCx) != js::GetObjectCompartment(proto)) {
509
0
      if (!JS_WrapObject(aCx, &proto)) {
510
0
        return false;
511
0
      }
512
0
    }
513
0
  } else {
514
0
    proto = canonicalProto;
515
0
  }
516
0
517
0
  BindingJSObjectCreator<mozilla::dom::SVGFEOffsetElement> creator(aCx);
518
0
  creator.CreateObject(aCx, sClass.ToJSClass(), proto, aObject, aReflector);
519
0
  if (!aReflector) {
520
0
    return false;
521
0
  }
522
0
523
0
  aCache->SetWrapper(aReflector);
524
0
  creator.InitializationSucceeded();
525
0
526
0
  MOZ_ASSERT(aCache->GetWrapperPreserveColor() &&
527
0
             aCache->GetWrapperPreserveColor() == aReflector);
528
0
  // If proto != canonicalProto, we have to preserve our wrapper;
529
0
  // otherwise we won't be able to properly recreate it later, since
530
0
  // we won't know what proto to use.  Note that we don't check
531
0
  // aGivenProto here, since it's entirely possible (and even
532
0
  // somewhat common) to have a non-null aGivenProto which is the
533
0
  // same as canonicalProto.
534
0
  if (proto != canonicalProto) {
535
0
    PreserveWrapper(aObject);
536
0
  }
537
0
538
0
  return true;
539
0
}
540
541
const NativePropertyHooks sNativePropertyHooks[] = { {
542
  nullptr,
543
  nullptr,
544
  nullptr,
545
  { sNativeProperties.Upcast(), nullptr },
546
  prototypes::id::SVGFEOffsetElement,
547
  constructors::id::SVGFEOffsetElement,
548
  SVGElement_Binding::sNativePropertyHooks,
549
  &DefaultXrayExpandoObjectClass
550
} };
551
552
void
553
CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, bool aDefineOnGlobal)
554
0
{
555
0
  JS::Handle<JSObject*> parentProto(SVGElement_Binding::GetProtoObjectHandle(aCx));
556
0
  if (!parentProto) {
557
0
    return;
558
0
  }
559
0
560
0
  JS::Handle<JSObject*> constructorProto(SVGElement_Binding::GetConstructorObjectHandle(aCx));
561
0
  if (!constructorProto) {
562
0
    return;
563
0
  }
564
0
565
0
  static bool sIdsInited = false;
566
0
  if (!sIdsInited && NS_IsMainThread()) {
567
0
    if (!InitIds(aCx, sNativeProperties.Upcast())) {
568
0
      return;
569
0
    }
570
0
    sIdsInited = true;
571
0
  }
572
0
573
0
  JS::Heap<JSObject*>* protoCache = &aProtoAndIfaceCache.EntrySlotOrCreate(prototypes::id::SVGFEOffsetElement);
574
0
  JS::Heap<JSObject*>* interfaceCache = &aProtoAndIfaceCache.EntrySlotOrCreate(constructors::id::SVGFEOffsetElement);
575
0
  dom::CreateInterfaceObjects(aCx, aGlobal, parentProto,
576
0
                              &sPrototypeClass.mBase, protoCache,
577
0
                              nullptr,
578
0
                              constructorProto, &sInterfaceObjectClass.mBase, 0, nullptr,
579
0
                              interfaceCache,
580
0
                              sNativeProperties.Upcast(),
581
0
                              nullptr,
582
0
                              "SVGFEOffsetElement", aDefineOnGlobal,
583
0
                              nullptr,
584
0
                              false);
585
0
}
586
587
JSObject*
588
GetConstructorObject(JSContext* aCx)
589
0
{
590
0
  return GetConstructorObjectHandle(aCx);
591
0
}
592
593
} // namespace SVGFEOffsetElement_Binding
594
595
596
597
} // namespace dom
598
} // namespace mozilla