Coverage Report

Created: 2018-09-25 14:53

/work/obj-fuzz/dom/bindings/SVGMarkerElementBinding.cpp
Line
Count
Source (jump to first uncovered line)
1
/* THIS FILE IS AUTOGENERATED FROM SVGMarkerElement.webidl BY Codegen.py - DO NOT EDIT */
2
3
#include "SVGAnimatedPreserveAspectRatio.h"
4
#include "SVGElementBinding.h"
5
#include "SVGMarkerElementBinding.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/SVGAngle.h"
12
#include "mozilla/dom/SVGAnimatedAngle.h"
13
#include "mozilla/dom/SVGAnimatedEnumeration.h"
14
#include "mozilla/dom/SVGAnimatedLength.h"
15
#include "mozilla/dom/SVGAnimatedRect.h"
16
#include "mozilla/dom/SVGMarkerElement.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 SVGMarkerElement_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_refX(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SVGMarkerElement* self, JSJitGetterCallArgs args)
33
0
{
34
0
  AUTO_PROFILER_LABEL_FAST("get SVGMarkerElement.refX", DOM, cx);
35
0
36
0
  auto result(StrongOrRawPtr<mozilla::dom::SVGAnimatedLength>(self->RefX()));
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 refX_getterinfo = {
46
  { (JSJitGetterOp)get_refX },
47
  { prototypes::id::SVGMarkerElement },
48
  { PrototypeTraits<prototypes::id::SVGMarkerElement>::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_refY(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SVGMarkerElement* self, JSJitGetterCallArgs args)
65
0
{
66
0
  AUTO_PROFILER_LABEL_FAST("get SVGMarkerElement.refY", DOM, cx);
67
0
68
0
  auto result(StrongOrRawPtr<mozilla::dom::SVGAnimatedLength>(self->RefY()));
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 refY_getterinfo = {
78
  { (JSJitGetterOp)get_refY },
79
  { prototypes::id::SVGMarkerElement },
80
  { PrototypeTraits<prototypes::id::SVGMarkerElement>::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_markerUnits(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SVGMarkerElement* self, JSJitGetterCallArgs args)
97
0
{
98
0
  AUTO_PROFILER_LABEL_FAST("get SVGMarkerElement.markerUnits", DOM, cx);
99
0
100
0
  auto result(StrongOrRawPtr<mozilla::dom::SVGAnimatedEnumeration>(self->MarkerUnits()));
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 markerUnits_getterinfo = {
110
  { (JSJitGetterOp)get_markerUnits },
111
  { prototypes::id::SVGMarkerElement },
112
  { PrototypeTraits<prototypes::id::SVGMarkerElement>::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_markerWidth(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SVGMarkerElement* self, JSJitGetterCallArgs args)
129
0
{
130
0
  AUTO_PROFILER_LABEL_FAST("get SVGMarkerElement.markerWidth", DOM, cx);
131
0
132
0
  auto result(StrongOrRawPtr<mozilla::dom::SVGAnimatedLength>(self->MarkerWidth()));
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 markerWidth_getterinfo = {
142
  { (JSJitGetterOp)get_markerWidth },
143
  { prototypes::id::SVGMarkerElement },
144
  { PrototypeTraits<prototypes::id::SVGMarkerElement>::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_markerHeight(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SVGMarkerElement* self, JSJitGetterCallArgs args)
161
0
{
162
0
  AUTO_PROFILER_LABEL_FAST("get SVGMarkerElement.markerHeight", DOM, cx);
163
0
164
0
  auto result(StrongOrRawPtr<mozilla::dom::SVGAnimatedLength>(self->MarkerHeight()));
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 markerHeight_getterinfo = {
174
  { (JSJitGetterOp)get_markerHeight },
175
  { prototypes::id::SVGMarkerElement },
176
  { PrototypeTraits<prototypes::id::SVGMarkerElement>::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_orientType(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SVGMarkerElement* self, JSJitGetterCallArgs args)
193
0
{
194
0
  AUTO_PROFILER_LABEL_FAST("get SVGMarkerElement.orientType", DOM, cx);
195
0
196
0
  auto result(StrongOrRawPtr<mozilla::dom::SVGAnimatedEnumeration>(self->OrientType()));
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 orientType_getterinfo = {
206
  { (JSJitGetterOp)get_orientType },
207
  { prototypes::id::SVGMarkerElement },
208
  { PrototypeTraits<prototypes::id::SVGMarkerElement>::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_orientAngle(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SVGMarkerElement* self, JSJitGetterCallArgs args)
225
0
{
226
0
  AUTO_PROFILER_LABEL_FAST("get SVGMarkerElement.orientAngle", DOM, cx);
227
0
228
0
  auto result(StrongOrRawPtr<mozilla::dom::SVGAnimatedAngle>(self->OrientAngle()));
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 orientAngle_getterinfo = {
238
  { (JSJitGetterOp)get_orientAngle },
239
  { prototypes::id::SVGMarkerElement },
240
  { PrototypeTraits<prototypes::id::SVGMarkerElement>::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
setOrientToAuto(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SVGMarkerElement* self, const JSJitMethodCallArgs& args)
257
0
{
258
0
  AUTO_PROFILER_LABEL_FAST("SVGMarkerElement.setOrientToAuto", DOM, cx);
259
0
260
0
  self->SetOrientToAuto();
261
0
  MOZ_ASSERT(!JS_IsExceptionPending(cx));
262
0
  args.rval().setUndefined();
263
0
  return true;
264
0
}
265
266
static const JSJitInfo setOrientToAuto_methodinfo = {
267
  { (JSJitGetterOp)setOrientToAuto },
268
  { prototypes::id::SVGMarkerElement },
269
  { PrototypeTraits<prototypes::id::SVGMarkerElement>::Depth },
270
  JSJitInfo::Method,
271
  JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
272
  JSVAL_TYPE_UNDEFINED,  /* returnType.  Not relevant for setters. */
273
  true,  /* isInfallible. False in setters. */
274
  false,  /* isMovable.  Not relevant for setters. */
275
  false, /* 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
MOZ_CAN_RUN_SCRIPT static bool
285
setOrientToAngle(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SVGMarkerElement* self, const JSJitMethodCallArgs& args)
286
0
{
287
0
  AUTO_PROFILER_LABEL_FAST("SVGMarkerElement.setOrientToAngle", DOM, cx);
288
0
289
0
  if (MOZ_UNLIKELY(args.length() < 1)) {
290
0
    return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "SVGMarkerElement.setOrientToAngle");
291
0
  }
292
0
  NonNull<mozilla::dom::SVGAngle> arg0;
293
0
  if (args[0].isObject()) {
294
0
    {
295
0
      nsresult rv = UnwrapObject<prototypes::id::SVGAngle, mozilla::dom::SVGAngle>(args[0], arg0);
296
0
      if (NS_FAILED(rv)) {
297
0
        ThrowErrorMessage(cx, MSG_DOES_NOT_IMPLEMENT_INTERFACE, "Argument 1 of SVGMarkerElement.setOrientToAngle", "SVGAngle");
298
0
        return false;
299
0
      }
300
0
    }
301
0
  } else {
302
0
    ThrowErrorMessage(cx, MSG_NOT_OBJECT, "Argument 1 of SVGMarkerElement.setOrientToAngle");
303
0
    return false;
304
0
  }
305
0
  FastErrorResult rv;
306
0
  self->SetOrientToAngle(MOZ_KnownLive(NonNullHelper(arg0)), rv);
307
0
  if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
308
0
    return false;
309
0
  }
310
0
  MOZ_ASSERT(!JS_IsExceptionPending(cx));
311
0
  args.rval().setUndefined();
312
0
  return true;
313
0
}
314
315
static const JSJitInfo setOrientToAngle_methodinfo = {
316
  { (JSJitGetterOp)setOrientToAngle },
317
  { prototypes::id::SVGMarkerElement },
318
  { PrototypeTraits<prototypes::id::SVGMarkerElement>::Depth },
319
  JSJitInfo::Method,
320
  JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
321
  JSVAL_TYPE_UNDEFINED,  /* returnType.  Not relevant for setters. */
322
  false,  /* isInfallible. False in setters. */
323
  false,  /* isMovable.  Not relevant for setters. */
324
  false, /* isEliminatable.  Not relevant for setters. */
325
  false, /* isAlwaysInSlot.  Only relevant for getters. */
326
  false, /* isLazilyCachedInSlot.  Only relevant for getters. */
327
  false,  /* isTypedMethod.  Only relevant for methods. */
328
  0   /* Reserved slot index, if we're stored in a slot, else 0. */
329
};
330
static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
331
static_assert(0 < 1, "There is no slot for us");
332
333
MOZ_CAN_RUN_SCRIPT static bool
334
get_viewBox(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SVGMarkerElement* self, JSJitGetterCallArgs args)
335
0
{
336
0
  AUTO_PROFILER_LABEL_FAST("get SVGMarkerElement.viewBox", DOM, cx);
337
0
338
0
  auto result(StrongOrRawPtr<mozilla::dom::SVGAnimatedRect>(self->ViewBox()));
339
0
  MOZ_ASSERT(!JS_IsExceptionPending(cx));
340
0
  if (!GetOrCreateDOMReflector(cx, result, args.rval())) {
341
0
    MOZ_ASSERT(JS_IsExceptionPending(cx));
342
0
    return false;
343
0
  }
344
0
  return true;
345
0
}
346
347
static const JSJitInfo viewBox_getterinfo = {
348
  { (JSJitGetterOp)get_viewBox },
349
  { prototypes::id::SVGMarkerElement },
350
  { PrototypeTraits<prototypes::id::SVGMarkerElement>::Depth },
351
  JSJitInfo::Getter,
352
  JSJitInfo::AliasNone, /* aliasSet.  Not relevant for setters. */
353
  JSVAL_TYPE_OBJECT,  /* returnType.  Not relevant for setters. */
354
  false,  /* isInfallible. False in setters. */
355
  true,  /* isMovable.  Not relevant for setters. */
356
  true, /* isEliminatable.  Not relevant for setters. */
357
  false, /* isAlwaysInSlot.  Only relevant for getters. */
358
  false, /* isLazilyCachedInSlot.  Only relevant for getters. */
359
  false,  /* isTypedMethod.  Only relevant for methods. */
360
  0   /* Reserved slot index, if we're stored in a slot, else 0. */
361
};
362
static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
363
static_assert(0 < 1, "There is no slot for us");
364
365
MOZ_CAN_RUN_SCRIPT static bool
366
get_preserveAspectRatio(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SVGMarkerElement* self, JSJitGetterCallArgs args)
367
0
{
368
0
  AUTO_PROFILER_LABEL_FAST("get SVGMarkerElement.preserveAspectRatio", DOM, cx);
369
0
370
0
  auto result(StrongOrRawPtr<mozilla::dom::DOMSVGAnimatedPreserveAspectRatio>(self->PreserveAspectRatio()));
371
0
  MOZ_ASSERT(!JS_IsExceptionPending(cx));
372
0
  if (!GetOrCreateDOMReflector(cx, result, args.rval())) {
373
0
    MOZ_ASSERT(JS_IsExceptionPending(cx));
374
0
    return false;
375
0
  }
376
0
  return true;
377
0
}
378
379
static const JSJitInfo preserveAspectRatio_getterinfo = {
380
  { (JSJitGetterOp)get_preserveAspectRatio },
381
  { prototypes::id::SVGMarkerElement },
382
  { PrototypeTraits<prototypes::id::SVGMarkerElement>::Depth },
383
  JSJitInfo::Getter,
384
  JSJitInfo::AliasNone, /* aliasSet.  Not relevant for setters. */
385
  JSVAL_TYPE_OBJECT,  /* returnType.  Not relevant for setters. */
386
  false,  /* isInfallible. False in setters. */
387
  true,  /* isMovable.  Not relevant for setters. */
388
  true, /* isEliminatable.  Not relevant for setters. */
389
  false, /* isAlwaysInSlot.  Only relevant for getters. */
390
  false, /* isLazilyCachedInSlot.  Only relevant for getters. */
391
  false,  /* isTypedMethod.  Only relevant for methods. */
392
  0   /* Reserved slot index, if we're stored in a slot, else 0. */
393
};
394
static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
395
static_assert(0 < 1, "There is no slot for us");
396
397
static bool
398
_addProperty(JSContext* cx, JS::Handle<JSObject*> obj, JS::Handle<jsid> id, JS::Handle<JS::Value> val)
399
0
{
400
0
  mozilla::dom::SVGMarkerElement* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::dom::SVGMarkerElement>(obj);
401
0
  // We don't want to preserve if we don't have a wrapper, and we
402
0
  // obviously can't preserve if we're not initialized.
403
0
  if (self && self->GetWrapperPreserveColor()) {
404
0
    PreserveWrapper(self);
405
0
  }
406
0
  return true;
407
0
}
408
409
static void
410
_finalize(js::FreeOp* fop, JSObject* obj)
411
0
{
412
0
  mozilla::dom::SVGMarkerElement* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::dom::SVGMarkerElement>(obj);
413
0
  if (self) {
414
0
    ClearWrapper(self, self, obj);
415
0
    AddForDeferredFinalization<mozilla::dom::SVGMarkerElement>(self);
416
0
  }
417
0
}
418
419
static size_t
420
_objectMoved(JSObject* obj, JSObject* old)
421
0
{
422
0
  mozilla::dom::SVGMarkerElement* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::dom::SVGMarkerElement>(obj);
423
0
  if (self) {
424
0
    UpdateWrapper(self, self, obj, old);
425
0
  }
426
0
427
0
  return 0;
428
0
}
429
430
// We deliberately use brace-elision to make Visual Studio produce better initalization code.
431
#if defined(__clang__)
432
#pragma clang diagnostic push
433
#pragma clang diagnostic ignored "-Wmissing-braces"
434
#endif
435
static const JSFunctionSpec sMethods_specs[] = {
436
  JS_FNSPEC("setOrientToAuto", (GenericMethod<NormalThisPolicy, ThrowExceptions>), reinterpret_cast<const JSJitInfo*>(&setOrientToAuto_methodinfo), 0, JSPROP_ENUMERATE, nullptr),
437
  JS_FNSPEC("setOrientToAngle", (GenericMethod<NormalThisPolicy, ThrowExceptions>), reinterpret_cast<const JSJitInfo*>(&setOrientToAngle_methodinfo), 1, JSPROP_ENUMERATE, nullptr),
438
  JS_FS_END
439
};
440
#if defined(__clang__)
441
#pragma clang diagnostic pop
442
#endif
443
444
445
static const Prefable<const JSFunctionSpec> sMethods[] = {
446
  { nullptr, &sMethods_specs[0] },
447
  { nullptr, nullptr }
448
};
449
450
static_assert(1 <= 1ull << NUM_BITS_PROPERTY_INFO_PREF_INDEX,
451
    "We have a prefable index that is >= (1 << NUM_BITS_PROPERTY_INFO_PREF_INDEX)");
452
static_assert(2 <= 1ull << NUM_BITS_PROPERTY_INFO_SPEC_INDEX,
453
    "We have a spec index that is >= (1 << NUM_BITS_PROPERTY_INFO_SPEC_INDEX)");
454
455
// We deliberately use brace-elision to make Visual Studio produce better initalization code.
456
#if defined(__clang__)
457
#pragma clang diagnostic push
458
#pragma clang diagnostic ignored "-Wmissing-braces"
459
#endif
460
static const JSPropertySpec sAttributes_specs[] = {
461
  { "refX", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &refX_getterinfo, nullptr, nullptr },
462
  { "refY", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &refY_getterinfo, nullptr, nullptr },
463
  { "markerUnits", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &markerUnits_getterinfo, nullptr, nullptr },
464
  { "markerWidth", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &markerWidth_getterinfo, nullptr, nullptr },
465
  { "markerHeight", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &markerHeight_getterinfo, nullptr, nullptr },
466
  { "orientType", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &orientType_getterinfo, nullptr, nullptr },
467
  { "orientAngle", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &orientAngle_getterinfo, nullptr, nullptr },
468
  { "viewBox", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &viewBox_getterinfo, nullptr, nullptr },
469
  { "preserveAspectRatio", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &preserveAspectRatio_getterinfo, nullptr, nullptr },
470
  { nullptr, 0, nullptr, nullptr, nullptr, nullptr }
471
};
472
#if defined(__clang__)
473
#pragma clang diagnostic pop
474
#endif
475
476
477
static const Prefable<const JSPropertySpec> sAttributes[] = {
478
  { nullptr, &sAttributes_specs[0] },
479
  { nullptr, nullptr }
480
};
481
482
static_assert(1 <= 1ull << NUM_BITS_PROPERTY_INFO_PREF_INDEX,
483
    "We have a prefable index that is >= (1 << NUM_BITS_PROPERTY_INFO_PREF_INDEX)");
484
static_assert(9 <= 1ull << NUM_BITS_PROPERTY_INFO_SPEC_INDEX,
485
    "We have a spec index that is >= (1 << NUM_BITS_PROPERTY_INFO_SPEC_INDEX)");
486
487
// We deliberately use brace-elision to make Visual Studio produce better initalization code.
488
#if defined(__clang__)
489
#pragma clang diagnostic push
490
#pragma clang diagnostic ignored "-Wmissing-braces"
491
#endif
492
static const ConstantSpec sConstants_specs[] = {
493
  { "SVG_MARKERUNITS_UNKNOWN", JS::Int32Value(0) },
494
  { "SVG_MARKERUNITS_USERSPACEONUSE", JS::Int32Value(1) },
495
  { "SVG_MARKERUNITS_STROKEWIDTH", JS::Int32Value(2) },
496
  { "SVG_MARKER_ORIENT_UNKNOWN", JS::Int32Value(0) },
497
  { "SVG_MARKER_ORIENT_AUTO", JS::Int32Value(1) },
498
  { "SVG_MARKER_ORIENT_ANGLE", JS::Int32Value(2) },
499
  { 0, JS::UndefinedValue() }
500
};
501
#if defined(__clang__)
502
#pragma clang diagnostic pop
503
#endif
504
505
506
static const Prefable<const ConstantSpec> sConstants[] = {
507
  { nullptr, &sConstants_specs[0] },
508
  { nullptr, nullptr }
509
};
510
511
static_assert(1 <= 1ull << NUM_BITS_PROPERTY_INFO_PREF_INDEX,
512
    "We have a prefable index that is >= (1 << NUM_BITS_PROPERTY_INFO_PREF_INDEX)");
513
static_assert(6 <= 1ull << NUM_BITS_PROPERTY_INFO_SPEC_INDEX,
514
    "We have a spec index that is >= (1 << NUM_BITS_PROPERTY_INFO_SPEC_INDEX)");
515
516
517
static uint16_t sNativeProperties_sortedPropertyIndices[17];
518
static PropertyInfo sNativeProperties_propertyInfos[17];
519
520
static const NativePropertiesN<3> sNativeProperties = {
521
  false, 0,
522
  false, 0,
523
  true,  0 /* sMethods */,
524
  true,  1 /* sAttributes */,
525
  false, 0,
526
  false, 0,
527
  true,  2 /* sConstants */,
528
  -1,
529
  17,
530
  sNativeProperties_sortedPropertyIndices,
531
  {
532
    { sMethods, &sNativeProperties_propertyInfos[0] },
533
    { sAttributes, &sNativeProperties_propertyInfos[2] },
534
    { sConstants, &sNativeProperties_propertyInfos[11] }
535
  }
536
};
537
static_assert(17 < 1ull << CHAR_BIT * sizeof(sNativeProperties.propertyInfoCount),
538
    "We have a property info count that is oversized");
539
540
static const DOMIfaceAndProtoJSClass sInterfaceObjectClass = {
541
  {
542
    "Function",
543
    JSCLASS_IS_DOMIFACEANDPROTOJSCLASS | JSCLASS_HAS_RESERVED_SLOTS(DOM_INTERFACE_SLOTS_BASE),
544
    &sBoringInterfaceObjectClassClassOps,
545
    JS_NULL_CLASS_SPEC,
546
    JS_NULL_CLASS_EXT,
547
    &sInterfaceObjectClassObjectOps
548
  },
549
  eInterface,
550
  true,
551
  prototypes::id::SVGMarkerElement,
552
  PrototypeTraits<prototypes::id::SVGMarkerElement>::Depth,
553
  sNativePropertyHooks,
554
  "function SVGMarkerElement() {\n    [native code]\n}",
555
  SVGElement_Binding::GetConstructorObject
556
};
557
558
static const DOMIfaceAndProtoJSClass sPrototypeClass = {
559
  {
560
    "SVGMarkerElementPrototype",
561
    JSCLASS_IS_DOMIFACEANDPROTOJSCLASS | JSCLASS_HAS_RESERVED_SLOTS(DOM_INTERFACE_PROTO_SLOTS_BASE),
562
    JS_NULL_CLASS_OPS,
563
    JS_NULL_CLASS_SPEC,
564
    JS_NULL_CLASS_EXT,
565
    JS_NULL_OBJECT_OPS
566
  },
567
  eInterfacePrototype,
568
  false,
569
  prototypes::id::SVGMarkerElement,
570
  PrototypeTraits<prototypes::id::SVGMarkerElement>::Depth,
571
  sNativePropertyHooks,
572
  "[object SVGMarkerElementPrototype]",
573
  SVGElement_Binding::GetProtoObject
574
};
575
576
static const js::ClassOps sClassOps = {
577
  _addProperty, /* addProperty */
578
  nullptr,               /* delProperty */
579
  nullptr,               /* enumerate */
580
  nullptr, /* newEnumerate */
581
  nullptr, /* resolve */
582
  nullptr, /* mayResolve */
583
  _finalize, /* finalize */
584
  nullptr, /* call */
585
  nullptr,               /* hasInstance */
586
  nullptr,               /* construct */
587
  nullptr, /* trace */
588
};
589
590
static const js::ClassExtension sClassExtension = {
591
  nullptr, /* weakmapKeyDelegateOp */
592
  _objectMoved /* objectMovedOp */
593
};
594
595
static const DOMJSClass sClass = {
596
  { "SVGMarkerElement",
597
    JSCLASS_IS_DOMJSCLASS | JSCLASS_FOREGROUND_FINALIZE | JSCLASS_HAS_RESERVED_SLOTS(1),
598
    &sClassOps,
599
    JS_NULL_CLASS_SPEC,
600
    &sClassExtension,
601
    JS_NULL_OBJECT_OPS
602
  },
603
  { prototypes::id::EventTarget, prototypes::id::Node, prototypes::id::Element, prototypes::id::SVGElement, prototypes::id::SVGMarkerElement, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count },
604
  IsBaseOf<nsISupports, mozilla::dom::SVGMarkerElement >::value,
605
  sNativePropertyHooks,
606
  FindAssociatedGlobalForNative<mozilla::dom::SVGMarkerElement>::Get,
607
  GetProtoObjectHandle,
608
  GetCCParticipant<mozilla::dom::SVGMarkerElement>::Get()
609
};
610
static_assert(1 == DOM_INSTANCE_RESERVED_SLOTS,
611
              "Must have the right minimal number of reserved slots.");
612
static_assert(1 >= 1,
613
              "Must have enough reserved slots.");
614
615
const JSClass*
616
GetJSClass()
617
0
{
618
0
  return sClass.ToJSClass();
619
0
}
620
621
bool
622
Wrap(JSContext* aCx, mozilla::dom::SVGMarkerElement* aObject, nsWrapperCache* aCache, JS::Handle<JSObject*> aGivenProto, JS::MutableHandle<JSObject*> aReflector)
623
0
{
624
0
  static_assert(!IsBaseOf<NonRefcountedDOMObject, mozilla::dom::SVGMarkerElement>::value,
625
0
                "Shouldn't have wrappercached things that are not refcounted.");
626
0
  MOZ_ASSERT(static_cast<mozilla::dom::SVGMarkerElement*>(aObject) ==
627
0
             reinterpret_cast<mozilla::dom::SVGMarkerElement*>(aObject),
628
0
             "Multiple inheritance for mozilla::dom::SVGMarkerElement is broken.");
629
0
  MOZ_ASSERT(static_cast<nsSVGElement*>(aObject) ==
630
0
             reinterpret_cast<nsSVGElement*>(aObject),
631
0
             "Multiple inheritance for nsSVGElement is broken.");
632
0
  MOZ_ASSERT(static_cast<mozilla::dom::Element*>(aObject) ==
633
0
             reinterpret_cast<mozilla::dom::Element*>(aObject),
634
0
             "Multiple inheritance for mozilla::dom::Element is broken.");
635
0
  MOZ_ASSERT(static_cast<nsINode*>(aObject) ==
636
0
             reinterpret_cast<nsINode*>(aObject),
637
0
             "Multiple inheritance for nsINode is broken.");
638
0
  MOZ_ASSERT(static_cast<mozilla::dom::EventTarget*>(aObject) ==
639
0
             reinterpret_cast<mozilla::dom::EventTarget*>(aObject),
640
0
             "Multiple inheritance for mozilla::dom::EventTarget is broken.");
641
0
  MOZ_ASSERT(ToSupportsIsCorrect(aObject));
642
0
  MOZ_ASSERT_IF(aGivenProto, js::IsObjectInContextCompartment(aGivenProto, aCx));
643
0
  MOZ_ASSERT(!aCache->GetWrapper(),
644
0
             "You should probably not be using Wrap() directly; use "
645
0
             "GetOrCreateDOMReflector instead");
646
0
647
0
  MOZ_ASSERT(ToSupportsIsOnPrimaryInheritanceChain(aObject, aCache),
648
0
             "nsISupports must be on our primary inheritance chain");
649
0
650
0
  JS::Rooted<JSObject*> global(aCx, FindAssociatedGlobal(aCx, aObject->GetParentObject()));
651
0
  if (!global) {
652
0
    return false;
653
0
  }
654
0
  MOZ_ASSERT(JS_IsGlobalObject(global));
655
0
  MOZ_ASSERT(JS::ObjectIsNotGray(global));
656
0
657
0
  // That might have ended up wrapping us already, due to the wonders
658
0
  // of XBL.  Check for that, and bail out as needed.
659
0
  aReflector.set(aCache->GetWrapper());
660
0
  if (aReflector) {
661
#ifdef DEBUG
662
    AssertReflectorHasGivenProto(aCx, aReflector, aGivenProto);
663
#endif // DEBUG
664
    return true;
665
0
  }
666
0
667
0
  JSAutoRealm ar(aCx, global);
668
0
  JS::Handle<JSObject*> canonicalProto = GetProtoObjectHandle(aCx);
669
0
  if (!canonicalProto) {
670
0
    return false;
671
0
  }
672
0
  JS::Rooted<JSObject*> proto(aCx);
673
0
  if (aGivenProto) {
674
0
    proto = aGivenProto;
675
0
    // Unfortunately, while aGivenProto was in the compartment of aCx
676
0
    // coming in, we changed compartments to that of "parent" so may need
677
0
    // to wrap the proto here.
678
0
    if (js::GetContextCompartment(aCx) != js::GetObjectCompartment(proto)) {
679
0
      if (!JS_WrapObject(aCx, &proto)) {
680
0
        return false;
681
0
      }
682
0
    }
683
0
  } else {
684
0
    proto = canonicalProto;
685
0
  }
686
0
687
0
  BindingJSObjectCreator<mozilla::dom::SVGMarkerElement> creator(aCx);
688
0
  creator.CreateObject(aCx, sClass.ToJSClass(), proto, aObject, aReflector);
689
0
  if (!aReflector) {
690
0
    return false;
691
0
  }
692
0
693
0
  aCache->SetWrapper(aReflector);
694
0
  creator.InitializationSucceeded();
695
0
696
0
  MOZ_ASSERT(aCache->GetWrapperPreserveColor() &&
697
0
             aCache->GetWrapperPreserveColor() == aReflector);
698
0
  // If proto != canonicalProto, we have to preserve our wrapper;
699
0
  // otherwise we won't be able to properly recreate it later, since
700
0
  // we won't know what proto to use.  Note that we don't check
701
0
  // aGivenProto here, since it's entirely possible (and even
702
0
  // somewhat common) to have a non-null aGivenProto which is the
703
0
  // same as canonicalProto.
704
0
  if (proto != canonicalProto) {
705
0
    PreserveWrapper(aObject);
706
0
  }
707
0
708
0
  return true;
709
0
}
710
711
const NativePropertyHooks sNativePropertyHooks[] = { {
712
  nullptr,
713
  nullptr,
714
  nullptr,
715
  { sNativeProperties.Upcast(), nullptr },
716
  prototypes::id::SVGMarkerElement,
717
  constructors::id::SVGMarkerElement,
718
  SVGElement_Binding::sNativePropertyHooks,
719
  &DefaultXrayExpandoObjectClass
720
} };
721
722
void
723
CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, bool aDefineOnGlobal)
724
0
{
725
0
  JS::Handle<JSObject*> parentProto(SVGElement_Binding::GetProtoObjectHandle(aCx));
726
0
  if (!parentProto) {
727
0
    return;
728
0
  }
729
0
730
0
  JS::Handle<JSObject*> constructorProto(SVGElement_Binding::GetConstructorObjectHandle(aCx));
731
0
  if (!constructorProto) {
732
0
    return;
733
0
  }
734
0
735
0
  static bool sIdsInited = false;
736
0
  if (!sIdsInited && NS_IsMainThread()) {
737
0
    if (!InitIds(aCx, sNativeProperties.Upcast())) {
738
0
      return;
739
0
    }
740
0
    sIdsInited = true;
741
0
  }
742
0
743
0
  JS::Heap<JSObject*>* protoCache = &aProtoAndIfaceCache.EntrySlotOrCreate(prototypes::id::SVGMarkerElement);
744
0
  JS::Heap<JSObject*>* interfaceCache = &aProtoAndIfaceCache.EntrySlotOrCreate(constructors::id::SVGMarkerElement);
745
0
  dom::CreateInterfaceObjects(aCx, aGlobal, parentProto,
746
0
                              &sPrototypeClass.mBase, protoCache,
747
0
                              nullptr,
748
0
                              constructorProto, &sInterfaceObjectClass.mBase, 0, nullptr,
749
0
                              interfaceCache,
750
0
                              sNativeProperties.Upcast(),
751
0
                              nullptr,
752
0
                              "SVGMarkerElement", aDefineOnGlobal,
753
0
                              nullptr,
754
0
                              false);
755
0
}
756
757
JSObject*
758
GetConstructorObject(JSContext* aCx)
759
0
{
760
0
  return GetConstructorObjectHandle(aCx);
761
0
}
762
763
} // namespace SVGMarkerElement_Binding
764
765
766
767
} // namespace dom
768
} // namespace mozilla