Coverage Report

Created: 2018-09-25 14:53

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