Coverage Report

Created: 2018-09-25 14:53

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