Coverage Report

Created: 2018-09-25 14:53

/work/obj-fuzz/dom/bindings/SVGFEDisplacementMapElementBinding.cpp
Line
Count
Source (jump to first uncovered line)
1
/* THIS FILE IS AUTOGENERATED FROM SVGFEDisplacementMapElement.webidl BY Codegen.py - DO NOT EDIT */
2
3
#include "SVGElementBinding.h"
4
#include "SVGFEDisplacementMapElementBinding.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/SVGAnimatedLength.h"
12
#include "mozilla/dom/SVGAnimatedNumber.h"
13
#include "mozilla/dom/SVGAnimatedString.h"
14
#include "mozilla/dom/SVGFEDisplacementMapElement.h"
15
#include "mozilla/dom/XrayExpandoClass.h"
16
17
namespace mozilla {
18
namespace dom {
19
20
namespace binding_detail {}; // Just to make sure it's known as a namespace
21
using namespace mozilla::dom::binding_detail;
22
23
24
namespace SVGFEDisplacementMapElement_Binding {
25
26
static_assert(IsRefcounted<NativeType>::value == IsRefcounted<SVGElement_Binding::NativeType>::value,
27
              "Can't inherit from an interface with a different ownership model.");
28
29
MOZ_CAN_RUN_SCRIPT static bool
30
get_in1(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SVGFEDisplacementMapElement* self, JSJitGetterCallArgs args)
31
0
{
32
0
  AUTO_PROFILER_LABEL_FAST("get SVGFEDisplacementMapElement.in1", DOM, cx);
33
0
34
0
  auto result(StrongOrRawPtr<mozilla::dom::SVGAnimatedString>(self->In1()));
35
0
  MOZ_ASSERT(!JS_IsExceptionPending(cx));
36
0
  if (!GetOrCreateDOMReflector(cx, result, args.rval())) {
37
0
    MOZ_ASSERT(JS_IsExceptionPending(cx));
38
0
    return false;
39
0
  }
40
0
  return true;
41
0
}
42
43
static const JSJitInfo in1_getterinfo = {
44
  { (JSJitGetterOp)get_in1 },
45
  { prototypes::id::SVGFEDisplacementMapElement },
46
  { PrototypeTraits<prototypes::id::SVGFEDisplacementMapElement>::Depth },
47
  JSJitInfo::Getter,
48
  JSJitInfo::AliasNone, /* aliasSet.  Not relevant for setters. */
49
  JSVAL_TYPE_OBJECT,  /* returnType.  Not relevant for setters. */
50
  false,  /* isInfallible. False in setters. */
51
  true,  /* isMovable.  Not relevant for setters. */
52
  true, /* isEliminatable.  Not relevant for setters. */
53
  false, /* isAlwaysInSlot.  Only relevant for getters. */
54
  false, /* isLazilyCachedInSlot.  Only relevant for getters. */
55
  false,  /* isTypedMethod.  Only relevant for methods. */
56
  0   /* Reserved slot index, if we're stored in a slot, else 0. */
57
};
58
static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
59
static_assert(0 < 1, "There is no slot for us");
60
61
MOZ_CAN_RUN_SCRIPT static bool
62
get_in2(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SVGFEDisplacementMapElement* self, JSJitGetterCallArgs args)
63
0
{
64
0
  AUTO_PROFILER_LABEL_FAST("get SVGFEDisplacementMapElement.in2", DOM, cx);
65
0
66
0
  auto result(StrongOrRawPtr<mozilla::dom::SVGAnimatedString>(self->In2()));
67
0
  MOZ_ASSERT(!JS_IsExceptionPending(cx));
68
0
  if (!GetOrCreateDOMReflector(cx, result, args.rval())) {
69
0
    MOZ_ASSERT(JS_IsExceptionPending(cx));
70
0
    return false;
71
0
  }
72
0
  return true;
73
0
}
74
75
static const JSJitInfo in2_getterinfo = {
76
  { (JSJitGetterOp)get_in2 },
77
  { prototypes::id::SVGFEDisplacementMapElement },
78
  { PrototypeTraits<prototypes::id::SVGFEDisplacementMapElement>::Depth },
79
  JSJitInfo::Getter,
80
  JSJitInfo::AliasNone, /* aliasSet.  Not relevant for setters. */
81
  JSVAL_TYPE_OBJECT,  /* returnType.  Not relevant for setters. */
82
  false,  /* isInfallible. False in setters. */
83
  true,  /* isMovable.  Not relevant for setters. */
84
  true, /* isEliminatable.  Not relevant for setters. */
85
  false, /* isAlwaysInSlot.  Only relevant for getters. */
86
  false, /* isLazilyCachedInSlot.  Only relevant for getters. */
87
  false,  /* isTypedMethod.  Only relevant for methods. */
88
  0   /* Reserved slot index, if we're stored in a slot, else 0. */
89
};
90
static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
91
static_assert(0 < 1, "There is no slot for us");
92
93
MOZ_CAN_RUN_SCRIPT static bool
94
get_scale(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SVGFEDisplacementMapElement* self, JSJitGetterCallArgs args)
95
0
{
96
0
  AUTO_PROFILER_LABEL_FAST("get SVGFEDisplacementMapElement.scale", DOM, cx);
97
0
98
0
  auto result(StrongOrRawPtr<mozilla::dom::SVGAnimatedNumber>(self->Scale()));
99
0
  MOZ_ASSERT(!JS_IsExceptionPending(cx));
100
0
  if (!GetOrCreateDOMReflector(cx, result, args.rval())) {
101
0
    MOZ_ASSERT(JS_IsExceptionPending(cx));
102
0
    return false;
103
0
  }
104
0
  return true;
105
0
}
106
107
static const JSJitInfo scale_getterinfo = {
108
  { (JSJitGetterOp)get_scale },
109
  { prototypes::id::SVGFEDisplacementMapElement },
110
  { PrototypeTraits<prototypes::id::SVGFEDisplacementMapElement>::Depth },
111
  JSJitInfo::Getter,
112
  JSJitInfo::AliasNone, /* aliasSet.  Not relevant for setters. */
113
  JSVAL_TYPE_OBJECT,  /* returnType.  Not relevant for setters. */
114
  false,  /* isInfallible. False in setters. */
115
  true,  /* isMovable.  Not relevant for setters. */
116
  true, /* isEliminatable.  Not relevant for setters. */
117
  false, /* isAlwaysInSlot.  Only relevant for getters. */
118
  false, /* isLazilyCachedInSlot.  Only relevant for getters. */
119
  false,  /* isTypedMethod.  Only relevant for methods. */
120
  0   /* Reserved slot index, if we're stored in a slot, else 0. */
121
};
122
static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
123
static_assert(0 < 1, "There is no slot for us");
124
125
MOZ_CAN_RUN_SCRIPT static bool
126
get_xChannelSelector(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SVGFEDisplacementMapElement* self, JSJitGetterCallArgs args)
127
0
{
128
0
  AUTO_PROFILER_LABEL_FAST("get SVGFEDisplacementMapElement.xChannelSelector", DOM, cx);
129
0
130
0
  auto result(StrongOrRawPtr<mozilla::dom::SVGAnimatedEnumeration>(self->XChannelSelector()));
131
0
  MOZ_ASSERT(!JS_IsExceptionPending(cx));
132
0
  if (!GetOrCreateDOMReflector(cx, result, args.rval())) {
133
0
    MOZ_ASSERT(JS_IsExceptionPending(cx));
134
0
    return false;
135
0
  }
136
0
  return true;
137
0
}
138
139
static const JSJitInfo xChannelSelector_getterinfo = {
140
  { (JSJitGetterOp)get_xChannelSelector },
141
  { prototypes::id::SVGFEDisplacementMapElement },
142
  { PrototypeTraits<prototypes::id::SVGFEDisplacementMapElement>::Depth },
143
  JSJitInfo::Getter,
144
  JSJitInfo::AliasNone, /* aliasSet.  Not relevant for setters. */
145
  JSVAL_TYPE_OBJECT,  /* returnType.  Not relevant for setters. */
146
  false,  /* isInfallible. False in setters. */
147
  true,  /* isMovable.  Not relevant for setters. */
148
  true, /* isEliminatable.  Not relevant for setters. */
149
  false, /* isAlwaysInSlot.  Only relevant for getters. */
150
  false, /* isLazilyCachedInSlot.  Only relevant for getters. */
151
  false,  /* isTypedMethod.  Only relevant for methods. */
152
  0   /* Reserved slot index, if we're stored in a slot, else 0. */
153
};
154
static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
155
static_assert(0 < 1, "There is no slot for us");
156
157
MOZ_CAN_RUN_SCRIPT static bool
158
get_yChannelSelector(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SVGFEDisplacementMapElement* self, JSJitGetterCallArgs args)
159
0
{
160
0
  AUTO_PROFILER_LABEL_FAST("get SVGFEDisplacementMapElement.yChannelSelector", DOM, cx);
161
0
162
0
  auto result(StrongOrRawPtr<mozilla::dom::SVGAnimatedEnumeration>(self->YChannelSelector()));
163
0
  MOZ_ASSERT(!JS_IsExceptionPending(cx));
164
0
  if (!GetOrCreateDOMReflector(cx, result, args.rval())) {
165
0
    MOZ_ASSERT(JS_IsExceptionPending(cx));
166
0
    return false;
167
0
  }
168
0
  return true;
169
0
}
170
171
static const JSJitInfo yChannelSelector_getterinfo = {
172
  { (JSJitGetterOp)get_yChannelSelector },
173
  { prototypes::id::SVGFEDisplacementMapElement },
174
  { PrototypeTraits<prototypes::id::SVGFEDisplacementMapElement>::Depth },
175
  JSJitInfo::Getter,
176
  JSJitInfo::AliasNone, /* aliasSet.  Not relevant for setters. */
177
  JSVAL_TYPE_OBJECT,  /* returnType.  Not relevant for setters. */
178
  false,  /* isInfallible. False in setters. */
179
  true,  /* isMovable.  Not relevant for setters. */
180
  true, /* isEliminatable.  Not relevant for setters. */
181
  false, /* isAlwaysInSlot.  Only relevant for getters. */
182
  false, /* isLazilyCachedInSlot.  Only relevant for getters. */
183
  false,  /* isTypedMethod.  Only relevant for methods. */
184
  0   /* Reserved slot index, if we're stored in a slot, else 0. */
185
};
186
static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
187
static_assert(0 < 1, "There is no slot for us");
188
189
MOZ_CAN_RUN_SCRIPT static bool
190
get_x(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SVGFEDisplacementMapElement* self, JSJitGetterCallArgs args)
191
0
{
192
0
  AUTO_PROFILER_LABEL_FAST("get SVGFEDisplacementMapElement.x", DOM, cx);
193
0
194
0
  auto result(StrongOrRawPtr<mozilla::dom::SVGAnimatedLength>(self->X()));
195
0
  MOZ_ASSERT(!JS_IsExceptionPending(cx));
196
0
  if (!GetOrCreateDOMReflector(cx, result, args.rval())) {
197
0
    MOZ_ASSERT(JS_IsExceptionPending(cx));
198
0
    return false;
199
0
  }
200
0
  return true;
201
0
}
202
203
static const JSJitInfo x_getterinfo = {
204
  { (JSJitGetterOp)get_x },
205
  { prototypes::id::SVGFEDisplacementMapElement },
206
  { PrototypeTraits<prototypes::id::SVGFEDisplacementMapElement>::Depth },
207
  JSJitInfo::Getter,
208
  JSJitInfo::AliasNone, /* aliasSet.  Not relevant for setters. */
209
  JSVAL_TYPE_OBJECT,  /* returnType.  Not relevant for setters. */
210
  false,  /* isInfallible. False in setters. */
211
  true,  /* isMovable.  Not relevant for setters. */
212
  true, /* isEliminatable.  Not relevant for setters. */
213
  false, /* isAlwaysInSlot.  Only relevant for getters. */
214
  false, /* isLazilyCachedInSlot.  Only relevant for getters. */
215
  false,  /* isTypedMethod.  Only relevant for methods. */
216
  0   /* Reserved slot index, if we're stored in a slot, else 0. */
217
};
218
static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
219
static_assert(0 < 1, "There is no slot for us");
220
221
MOZ_CAN_RUN_SCRIPT static bool
222
get_y(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SVGFEDisplacementMapElement* self, JSJitGetterCallArgs args)
223
0
{
224
0
  AUTO_PROFILER_LABEL_FAST("get SVGFEDisplacementMapElement.y", DOM, cx);
225
0
226
0
  auto result(StrongOrRawPtr<mozilla::dom::SVGAnimatedLength>(self->Y()));
227
0
  MOZ_ASSERT(!JS_IsExceptionPending(cx));
228
0
  if (!GetOrCreateDOMReflector(cx, result, args.rval())) {
229
0
    MOZ_ASSERT(JS_IsExceptionPending(cx));
230
0
    return false;
231
0
  }
232
0
  return true;
233
0
}
234
235
static const JSJitInfo y_getterinfo = {
236
  { (JSJitGetterOp)get_y },
237
  { prototypes::id::SVGFEDisplacementMapElement },
238
  { PrototypeTraits<prototypes::id::SVGFEDisplacementMapElement>::Depth },
239
  JSJitInfo::Getter,
240
  JSJitInfo::AliasNone, /* aliasSet.  Not relevant for setters. */
241
  JSVAL_TYPE_OBJECT,  /* returnType.  Not relevant for setters. */
242
  false,  /* isInfallible. False in setters. */
243
  true,  /* isMovable.  Not relevant for setters. */
244
  true, /* isEliminatable.  Not relevant for setters. */
245
  false, /* isAlwaysInSlot.  Only relevant for getters. */
246
  false, /* isLazilyCachedInSlot.  Only relevant for getters. */
247
  false,  /* isTypedMethod.  Only relevant for methods. */
248
  0   /* Reserved slot index, if we're stored in a slot, else 0. */
249
};
250
static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
251
static_assert(0 < 1, "There is no slot for us");
252
253
MOZ_CAN_RUN_SCRIPT static bool
254
get_width(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SVGFEDisplacementMapElement* self, JSJitGetterCallArgs args)
255
0
{
256
0
  AUTO_PROFILER_LABEL_FAST("get SVGFEDisplacementMapElement.width", DOM, cx);
257
0
258
0
  auto result(StrongOrRawPtr<mozilla::dom::SVGAnimatedLength>(self->Width()));
259
0
  MOZ_ASSERT(!JS_IsExceptionPending(cx));
260
0
  if (!GetOrCreateDOMReflector(cx, result, args.rval())) {
261
0
    MOZ_ASSERT(JS_IsExceptionPending(cx));
262
0
    return false;
263
0
  }
264
0
  return true;
265
0
}
266
267
static const JSJitInfo width_getterinfo = {
268
  { (JSJitGetterOp)get_width },
269
  { prototypes::id::SVGFEDisplacementMapElement },
270
  { PrototypeTraits<prototypes::id::SVGFEDisplacementMapElement>::Depth },
271
  JSJitInfo::Getter,
272
  JSJitInfo::AliasNone, /* aliasSet.  Not relevant for setters. */
273
  JSVAL_TYPE_OBJECT,  /* returnType.  Not relevant for setters. */
274
  false,  /* isInfallible. False in setters. */
275
  true,  /* isMovable.  Not relevant for setters. */
276
  true, /* isEliminatable.  Not relevant for setters. */
277
  false, /* isAlwaysInSlot.  Only relevant for getters. */
278
  false, /* isLazilyCachedInSlot.  Only relevant for getters. */
279
  false,  /* isTypedMethod.  Only relevant for methods. */
280
  0   /* Reserved slot index, if we're stored in a slot, else 0. */
281
};
282
static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
283
static_assert(0 < 1, "There is no slot for us");
284
285
MOZ_CAN_RUN_SCRIPT static bool
286
get_height(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SVGFEDisplacementMapElement* self, JSJitGetterCallArgs args)
287
0
{
288
0
  AUTO_PROFILER_LABEL_FAST("get SVGFEDisplacementMapElement.height", DOM, cx);
289
0
290
0
  auto result(StrongOrRawPtr<mozilla::dom::SVGAnimatedLength>(self->Height()));
291
0
  MOZ_ASSERT(!JS_IsExceptionPending(cx));
292
0
  if (!GetOrCreateDOMReflector(cx, result, args.rval())) {
293
0
    MOZ_ASSERT(JS_IsExceptionPending(cx));
294
0
    return false;
295
0
  }
296
0
  return true;
297
0
}
298
299
static const JSJitInfo height_getterinfo = {
300
  { (JSJitGetterOp)get_height },
301
  { prototypes::id::SVGFEDisplacementMapElement },
302
  { PrototypeTraits<prototypes::id::SVGFEDisplacementMapElement>::Depth },
303
  JSJitInfo::Getter,
304
  JSJitInfo::AliasNone, /* aliasSet.  Not relevant for setters. */
305
  JSVAL_TYPE_OBJECT,  /* returnType.  Not relevant for setters. */
306
  false,  /* isInfallible. False in setters. */
307
  true,  /* isMovable.  Not relevant for setters. */
308
  true, /* isEliminatable.  Not relevant for setters. */
309
  false, /* isAlwaysInSlot.  Only relevant for getters. */
310
  false, /* isLazilyCachedInSlot.  Only relevant for getters. */
311
  false,  /* isTypedMethod.  Only relevant for methods. */
312
  0   /* Reserved slot index, if we're stored in a slot, else 0. */
313
};
314
static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
315
static_assert(0 < 1, "There is no slot for us");
316
317
MOZ_CAN_RUN_SCRIPT static bool
318
get_result(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SVGFEDisplacementMapElement* self, JSJitGetterCallArgs args)
319
0
{
320
0
  AUTO_PROFILER_LABEL_FAST("get SVGFEDisplacementMapElement.result", DOM, cx);
321
0
322
0
  auto result(StrongOrRawPtr<mozilla::dom::SVGAnimatedString>(self->Result()));
323
0
  MOZ_ASSERT(!JS_IsExceptionPending(cx));
324
0
  if (!GetOrCreateDOMReflector(cx, result, args.rval())) {
325
0
    MOZ_ASSERT(JS_IsExceptionPending(cx));
326
0
    return false;
327
0
  }
328
0
  return true;
329
0
}
330
331
static const JSJitInfo result_getterinfo = {
332
  { (JSJitGetterOp)get_result },
333
  { prototypes::id::SVGFEDisplacementMapElement },
334
  { PrototypeTraits<prototypes::id::SVGFEDisplacementMapElement>::Depth },
335
  JSJitInfo::Getter,
336
  JSJitInfo::AliasNone, /* aliasSet.  Not relevant for setters. */
337
  JSVAL_TYPE_OBJECT,  /* returnType.  Not relevant for setters. */
338
  false,  /* isInfallible. False in setters. */
339
  true,  /* isMovable.  Not relevant for setters. */
340
  true, /* isEliminatable.  Not relevant for setters. */
341
  false, /* isAlwaysInSlot.  Only relevant for getters. */
342
  false, /* isLazilyCachedInSlot.  Only relevant for getters. */
343
  false,  /* isTypedMethod.  Only relevant for methods. */
344
  0   /* Reserved slot index, if we're stored in a slot, else 0. */
345
};
346
static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
347
static_assert(0 < 1, "There is no slot for us");
348
349
static bool
350
_addProperty(JSContext* cx, JS::Handle<JSObject*> obj, JS::Handle<jsid> id, JS::Handle<JS::Value> val)
351
0
{
352
0
  mozilla::dom::SVGFEDisplacementMapElement* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::dom::SVGFEDisplacementMapElement>(obj);
353
0
  // We don't want to preserve if we don't have a wrapper, and we
354
0
  // obviously can't preserve if we're not initialized.
355
0
  if (self && self->GetWrapperPreserveColor()) {
356
0
    PreserveWrapper(self);
357
0
  }
358
0
  return true;
359
0
}
360
361
static void
362
_finalize(js::FreeOp* fop, JSObject* obj)
363
0
{
364
0
  mozilla::dom::SVGFEDisplacementMapElement* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::dom::SVGFEDisplacementMapElement>(obj);
365
0
  if (self) {
366
0
    ClearWrapper(self, self, obj);
367
0
    AddForDeferredFinalization<mozilla::dom::SVGFEDisplacementMapElement>(self);
368
0
  }
369
0
}
370
371
static size_t
372
_objectMoved(JSObject* obj, JSObject* old)
373
0
{
374
0
  mozilla::dom::SVGFEDisplacementMapElement* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::dom::SVGFEDisplacementMapElement>(obj);
375
0
  if (self) {
376
0
    UpdateWrapper(self, self, obj, old);
377
0
  }
378
0
379
0
  return 0;
380
0
}
381
382
// We deliberately use brace-elision to make Visual Studio produce better initalization code.
383
#if defined(__clang__)
384
#pragma clang diagnostic push
385
#pragma clang diagnostic ignored "-Wmissing-braces"
386
#endif
387
static const JSPropertySpec sAttributes_specs[] = {
388
  { "in1", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &in1_getterinfo, nullptr, nullptr },
389
  { "in2", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &in2_getterinfo, nullptr, nullptr },
390
  { "scale", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &scale_getterinfo, nullptr, nullptr },
391
  { "xChannelSelector", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &xChannelSelector_getterinfo, nullptr, nullptr },
392
  { "yChannelSelector", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &yChannelSelector_getterinfo, nullptr, nullptr },
393
  { "x", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &x_getterinfo, nullptr, nullptr },
394
  { "y", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &y_getterinfo, nullptr, nullptr },
395
  { "width", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &width_getterinfo, nullptr, nullptr },
396
  { "height", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &height_getterinfo, nullptr, nullptr },
397
  { "result", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &result_getterinfo, nullptr, nullptr },
398
  { nullptr, 0, nullptr, nullptr, nullptr, nullptr }
399
};
400
#if defined(__clang__)
401
#pragma clang diagnostic pop
402
#endif
403
404
405
static const Prefable<const JSPropertySpec> sAttributes[] = {
406
  { nullptr, &sAttributes_specs[0] },
407
  { nullptr, nullptr }
408
};
409
410
static_assert(1 <= 1ull << NUM_BITS_PROPERTY_INFO_PREF_INDEX,
411
    "We have a prefable index that is >= (1 << NUM_BITS_PROPERTY_INFO_PREF_INDEX)");
412
static_assert(10 <= 1ull << NUM_BITS_PROPERTY_INFO_SPEC_INDEX,
413
    "We have a spec index that is >= (1 << NUM_BITS_PROPERTY_INFO_SPEC_INDEX)");
414
415
// We deliberately use brace-elision to make Visual Studio produce better initalization code.
416
#if defined(__clang__)
417
#pragma clang diagnostic push
418
#pragma clang diagnostic ignored "-Wmissing-braces"
419
#endif
420
static const ConstantSpec sConstants_specs[] = {
421
  { "SVG_CHANNEL_UNKNOWN", JS::Int32Value(0) },
422
  { "SVG_CHANNEL_R", JS::Int32Value(1) },
423
  { "SVG_CHANNEL_G", JS::Int32Value(2) },
424
  { "SVG_CHANNEL_B", JS::Int32Value(3) },
425
  { "SVG_CHANNEL_A", JS::Int32Value(4) },
426
  { 0, JS::UndefinedValue() }
427
};
428
#if defined(__clang__)
429
#pragma clang diagnostic pop
430
#endif
431
432
433
static const Prefable<const ConstantSpec> sConstants[] = {
434
  { nullptr, &sConstants_specs[0] },
435
  { nullptr, nullptr }
436
};
437
438
static_assert(1 <= 1ull << NUM_BITS_PROPERTY_INFO_PREF_INDEX,
439
    "We have a prefable index that is >= (1 << NUM_BITS_PROPERTY_INFO_PREF_INDEX)");
440
static_assert(5 <= 1ull << NUM_BITS_PROPERTY_INFO_SPEC_INDEX,
441
    "We have a spec index that is >= (1 << NUM_BITS_PROPERTY_INFO_SPEC_INDEX)");
442
443
444
static uint16_t sNativeProperties_sortedPropertyIndices[15];
445
static PropertyInfo sNativeProperties_propertyInfos[15];
446
447
static const NativePropertiesN<2> sNativeProperties = {
448
  false, 0,
449
  false, 0,
450
  false, 0,
451
  true,  0 /* sAttributes */,
452
  false, 0,
453
  false, 0,
454
  true,  1 /* sConstants */,
455
  -1,
456
  15,
457
  sNativeProperties_sortedPropertyIndices,
458
  {
459
    { sAttributes, &sNativeProperties_propertyInfos[0] },
460
    { sConstants, &sNativeProperties_propertyInfos[10] }
461
  }
462
};
463
static_assert(15 < 1ull << CHAR_BIT * sizeof(sNativeProperties.propertyInfoCount),
464
    "We have a property info count that is oversized");
465
466
static const DOMIfaceAndProtoJSClass sInterfaceObjectClass = {
467
  {
468
    "Function",
469
    JSCLASS_IS_DOMIFACEANDPROTOJSCLASS | JSCLASS_HAS_RESERVED_SLOTS(DOM_INTERFACE_SLOTS_BASE),
470
    &sBoringInterfaceObjectClassClassOps,
471
    JS_NULL_CLASS_SPEC,
472
    JS_NULL_CLASS_EXT,
473
    &sInterfaceObjectClassObjectOps
474
  },
475
  eInterface,
476
  true,
477
  prototypes::id::SVGFEDisplacementMapElement,
478
  PrototypeTraits<prototypes::id::SVGFEDisplacementMapElement>::Depth,
479
  sNativePropertyHooks,
480
  "function SVGFEDisplacementMapElement() {\n    [native code]\n}",
481
  SVGElement_Binding::GetConstructorObject
482
};
483
484
static const DOMIfaceAndProtoJSClass sPrototypeClass = {
485
  {
486
    "SVGFEDisplacementMapElementPrototype",
487
    JSCLASS_IS_DOMIFACEANDPROTOJSCLASS | JSCLASS_HAS_RESERVED_SLOTS(DOM_INTERFACE_PROTO_SLOTS_BASE),
488
    JS_NULL_CLASS_OPS,
489
    JS_NULL_CLASS_SPEC,
490
    JS_NULL_CLASS_EXT,
491
    JS_NULL_OBJECT_OPS
492
  },
493
  eInterfacePrototype,
494
  false,
495
  prototypes::id::SVGFEDisplacementMapElement,
496
  PrototypeTraits<prototypes::id::SVGFEDisplacementMapElement>::Depth,
497
  sNativePropertyHooks,
498
  "[object SVGFEDisplacementMapElementPrototype]",
499
  SVGElement_Binding::GetProtoObject
500
};
501
502
static const js::ClassOps sClassOps = {
503
  _addProperty, /* addProperty */
504
  nullptr,               /* delProperty */
505
  nullptr,               /* enumerate */
506
  nullptr, /* newEnumerate */
507
  nullptr, /* resolve */
508
  nullptr, /* mayResolve */
509
  _finalize, /* finalize */
510
  nullptr, /* call */
511
  nullptr,               /* hasInstance */
512
  nullptr,               /* construct */
513
  nullptr, /* trace */
514
};
515
516
static const js::ClassExtension sClassExtension = {
517
  nullptr, /* weakmapKeyDelegateOp */
518
  _objectMoved /* objectMovedOp */
519
};
520
521
static const DOMJSClass sClass = {
522
  { "SVGFEDisplacementMapElement",
523
    JSCLASS_IS_DOMJSCLASS | JSCLASS_FOREGROUND_FINALIZE | JSCLASS_HAS_RESERVED_SLOTS(1),
524
    &sClassOps,
525
    JS_NULL_CLASS_SPEC,
526
    &sClassExtension,
527
    JS_NULL_OBJECT_OPS
528
  },
529
  { prototypes::id::EventTarget, prototypes::id::Node, prototypes::id::Element, prototypes::id::SVGElement, prototypes::id::SVGFEDisplacementMapElement, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count },
530
  IsBaseOf<nsISupports, mozilla::dom::SVGFEDisplacementMapElement >::value,
531
  sNativePropertyHooks,
532
  FindAssociatedGlobalForNative<mozilla::dom::SVGFEDisplacementMapElement>::Get,
533
  GetProtoObjectHandle,
534
  GetCCParticipant<mozilla::dom::SVGFEDisplacementMapElement>::Get()
535
};
536
static_assert(1 == DOM_INSTANCE_RESERVED_SLOTS,
537
              "Must have the right minimal number of reserved slots.");
538
static_assert(1 >= 1,
539
              "Must have enough reserved slots.");
540
541
const JSClass*
542
GetJSClass()
543
0
{
544
0
  return sClass.ToJSClass();
545
0
}
546
547
bool
548
Wrap(JSContext* aCx, mozilla::dom::SVGFEDisplacementMapElement* aObject, nsWrapperCache* aCache, JS::Handle<JSObject*> aGivenProto, JS::MutableHandle<JSObject*> aReflector)
549
0
{
550
0
  static_assert(!IsBaseOf<NonRefcountedDOMObject, mozilla::dom::SVGFEDisplacementMapElement>::value,
551
0
                "Shouldn't have wrappercached things that are not refcounted.");
552
0
  MOZ_ASSERT(static_cast<mozilla::dom::SVGFEDisplacementMapElement*>(aObject) ==
553
0
             reinterpret_cast<mozilla::dom::SVGFEDisplacementMapElement*>(aObject),
554
0
             "Multiple inheritance for mozilla::dom::SVGFEDisplacementMapElement is broken.");
555
0
  MOZ_ASSERT(static_cast<nsSVGElement*>(aObject) ==
556
0
             reinterpret_cast<nsSVGElement*>(aObject),
557
0
             "Multiple inheritance for nsSVGElement is broken.");
558
0
  MOZ_ASSERT(static_cast<mozilla::dom::Element*>(aObject) ==
559
0
             reinterpret_cast<mozilla::dom::Element*>(aObject),
560
0
             "Multiple inheritance for mozilla::dom::Element is broken.");
561
0
  MOZ_ASSERT(static_cast<nsINode*>(aObject) ==
562
0
             reinterpret_cast<nsINode*>(aObject),
563
0
             "Multiple inheritance for nsINode is broken.");
564
0
  MOZ_ASSERT(static_cast<mozilla::dom::EventTarget*>(aObject) ==
565
0
             reinterpret_cast<mozilla::dom::EventTarget*>(aObject),
566
0
             "Multiple inheritance for mozilla::dom::EventTarget is broken.");
567
0
  MOZ_ASSERT(ToSupportsIsCorrect(aObject));
568
0
  MOZ_ASSERT_IF(aGivenProto, js::IsObjectInContextCompartment(aGivenProto, aCx));
569
0
  MOZ_ASSERT(!aCache->GetWrapper(),
570
0
             "You should probably not be using Wrap() directly; use "
571
0
             "GetOrCreateDOMReflector instead");
572
0
573
0
  MOZ_ASSERT(ToSupportsIsOnPrimaryInheritanceChain(aObject, aCache),
574
0
             "nsISupports must be on our primary inheritance chain");
575
0
576
0
  JS::Rooted<JSObject*> global(aCx, FindAssociatedGlobal(aCx, aObject->GetParentObject()));
577
0
  if (!global) {
578
0
    return false;
579
0
  }
580
0
  MOZ_ASSERT(JS_IsGlobalObject(global));
581
0
  MOZ_ASSERT(JS::ObjectIsNotGray(global));
582
0
583
0
  // That might have ended up wrapping us already, due to the wonders
584
0
  // of XBL.  Check for that, and bail out as needed.
585
0
  aReflector.set(aCache->GetWrapper());
586
0
  if (aReflector) {
587
#ifdef DEBUG
588
    AssertReflectorHasGivenProto(aCx, aReflector, aGivenProto);
589
#endif // DEBUG
590
    return true;
591
0
  }
592
0
593
0
  JSAutoRealm ar(aCx, global);
594
0
  JS::Handle<JSObject*> canonicalProto = GetProtoObjectHandle(aCx);
595
0
  if (!canonicalProto) {
596
0
    return false;
597
0
  }
598
0
  JS::Rooted<JSObject*> proto(aCx);
599
0
  if (aGivenProto) {
600
0
    proto = aGivenProto;
601
0
    // Unfortunately, while aGivenProto was in the compartment of aCx
602
0
    // coming in, we changed compartments to that of "parent" so may need
603
0
    // to wrap the proto here.
604
0
    if (js::GetContextCompartment(aCx) != js::GetObjectCompartment(proto)) {
605
0
      if (!JS_WrapObject(aCx, &proto)) {
606
0
        return false;
607
0
      }
608
0
    }
609
0
  } else {
610
0
    proto = canonicalProto;
611
0
  }
612
0
613
0
  BindingJSObjectCreator<mozilla::dom::SVGFEDisplacementMapElement> creator(aCx);
614
0
  creator.CreateObject(aCx, sClass.ToJSClass(), proto, aObject, aReflector);
615
0
  if (!aReflector) {
616
0
    return false;
617
0
  }
618
0
619
0
  aCache->SetWrapper(aReflector);
620
0
  creator.InitializationSucceeded();
621
0
622
0
  MOZ_ASSERT(aCache->GetWrapperPreserveColor() &&
623
0
             aCache->GetWrapperPreserveColor() == aReflector);
624
0
  // If proto != canonicalProto, we have to preserve our wrapper;
625
0
  // otherwise we won't be able to properly recreate it later, since
626
0
  // we won't know what proto to use.  Note that we don't check
627
0
  // aGivenProto here, since it's entirely possible (and even
628
0
  // somewhat common) to have a non-null aGivenProto which is the
629
0
  // same as canonicalProto.
630
0
  if (proto != canonicalProto) {
631
0
    PreserveWrapper(aObject);
632
0
  }
633
0
634
0
  return true;
635
0
}
636
637
const NativePropertyHooks sNativePropertyHooks[] = { {
638
  nullptr,
639
  nullptr,
640
  nullptr,
641
  { sNativeProperties.Upcast(), nullptr },
642
  prototypes::id::SVGFEDisplacementMapElement,
643
  constructors::id::SVGFEDisplacementMapElement,
644
  SVGElement_Binding::sNativePropertyHooks,
645
  &DefaultXrayExpandoObjectClass
646
} };
647
648
void
649
CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, bool aDefineOnGlobal)
650
0
{
651
0
  JS::Handle<JSObject*> parentProto(SVGElement_Binding::GetProtoObjectHandle(aCx));
652
0
  if (!parentProto) {
653
0
    return;
654
0
  }
655
0
656
0
  JS::Handle<JSObject*> constructorProto(SVGElement_Binding::GetConstructorObjectHandle(aCx));
657
0
  if (!constructorProto) {
658
0
    return;
659
0
  }
660
0
661
0
  static bool sIdsInited = false;
662
0
  if (!sIdsInited && NS_IsMainThread()) {
663
0
    if (!InitIds(aCx, sNativeProperties.Upcast())) {
664
0
      return;
665
0
    }
666
0
    sIdsInited = true;
667
0
  }
668
0
669
0
  JS::Heap<JSObject*>* protoCache = &aProtoAndIfaceCache.EntrySlotOrCreate(prototypes::id::SVGFEDisplacementMapElement);
670
0
  JS::Heap<JSObject*>* interfaceCache = &aProtoAndIfaceCache.EntrySlotOrCreate(constructors::id::SVGFEDisplacementMapElement);
671
0
  dom::CreateInterfaceObjects(aCx, aGlobal, parentProto,
672
0
                              &sPrototypeClass.mBase, protoCache,
673
0
                              nullptr,
674
0
                              constructorProto, &sInterfaceObjectClass.mBase, 0, nullptr,
675
0
                              interfaceCache,
676
0
                              sNativeProperties.Upcast(),
677
0
                              nullptr,
678
0
                              "SVGFEDisplacementMapElement", aDefineOnGlobal,
679
0
                              nullptr,
680
0
                              false);
681
0
}
682
683
JSObject*
684
GetConstructorObject(JSContext* aCx)
685
0
{
686
0
  return GetConstructorObjectHandle(aCx);
687
0
}
688
689
} // namespace SVGFEDisplacementMapElement_Binding
690
691
692
693
} // namespace dom
694
} // namespace mozilla