Coverage Report

Created: 2018-09-25 14:53

/work/obj-fuzz/dom/bindings/AnimationTimelineBinding.cpp
Line
Count
Source (jump to first uncovered line)
1
/* THIS FILE IS AUTOGENERATED FROM AnimationTimeline.webidl BY Codegen.py - DO NOT EDIT */
2
3
#include "AnimationTimelineBinding.h"
4
#include "WrapperFactory.h"
5
#include "mozilla/FloatingPoint.h"
6
#include "mozilla/OwningNonNull.h"
7
#include "mozilla/dom/AnimationTimeline.h"
8
#include "mozilla/dom/BindingUtils.h"
9
#include "mozilla/dom/DOMJSClass.h"
10
#include "mozilla/dom/NonRefcountedDOMObject.h"
11
#include "mozilla/dom/Nullable.h"
12
#include "mozilla/dom/PrimitiveConversions.h"
13
#include "mozilla/dom/XrayExpandoClass.h"
14
#include "nsDocument.h"
15
16
namespace mozilla {
17
namespace dom {
18
19
namespace binding_detail {}; // Just to make sure it's known as a namespace
20
using namespace mozilla::dom::binding_detail;
21
22
23
namespace AnimationTimeline_Binding {
24
25
MOZ_CAN_RUN_SCRIPT static bool
26
get_currentTime(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::AnimationTimeline* self, JSJitGetterCallArgs args)
27
0
{
28
0
  AUTO_PROFILER_LABEL_FAST("get AnimationTimeline.currentTime", DOM, cx);
29
0
30
0
  Nullable<double> result(self->GetCurrentTimeAsDouble());
31
0
  MOZ_ASSERT(!JS_IsExceptionPending(cx));
32
0
  if (result.IsNull()) {
33
0
    args.rval().setNull();
34
0
    return true;
35
0
  }
36
0
  args.rval().set(JS_NumberValue(double(result.Value())));
37
0
  return true;
38
0
}
39
40
static const JSJitInfo currentTime_getterinfo = {
41
  { (JSJitGetterOp)get_currentTime },
42
  { prototypes::id::AnimationTimeline },
43
  { PrototypeTraits<prototypes::id::AnimationTimeline>::Depth },
44
  JSJitInfo::Getter,
45
  JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
46
  JSVAL_TYPE_UNKNOWN,  /* returnType.  Not relevant for setters. */
47
  true,  /* isInfallible. False in setters. */
48
  false,  /* isMovable.  Not relevant for setters. */
49
  false, /* isEliminatable.  Not relevant for setters. */
50
  false, /* isAlwaysInSlot.  Only relevant for getters. */
51
  false, /* isLazilyCachedInSlot.  Only relevant for getters. */
52
  false,  /* isTypedMethod.  Only relevant for methods. */
53
  0   /* Reserved slot index, if we're stored in a slot, else 0. */
54
};
55
static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
56
static_assert(0 < 1, "There is no slot for us");
57
58
// We deliberately use brace-elision to make Visual Studio produce better initalization code.
59
#if defined(__clang__)
60
#pragma clang diagnostic push
61
#pragma clang diagnostic ignored "-Wmissing-braces"
62
#endif
63
static const JSPropertySpec sAttributes_specs[] = {
64
  { "currentTime", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &currentTime_getterinfo, nullptr, nullptr },
65
  { nullptr, 0, nullptr, nullptr, nullptr, nullptr }
66
};
67
#if defined(__clang__)
68
#pragma clang diagnostic pop
69
#endif
70
71
72
static const Prefable<const JSPropertySpec> sAttributes[] = {
73
  { nullptr, &sAttributes_specs[0] },
74
  { nullptr, nullptr }
75
};
76
77
static_assert(1 <= 1ull << NUM_BITS_PROPERTY_INFO_PREF_INDEX,
78
    "We have a prefable index that is >= (1 << NUM_BITS_PROPERTY_INFO_PREF_INDEX)");
79
static_assert(1 <= 1ull << NUM_BITS_PROPERTY_INFO_SPEC_INDEX,
80
    "We have a spec index that is >= (1 << NUM_BITS_PROPERTY_INFO_SPEC_INDEX)");
81
82
83
static uint16_t sNativeProperties_sortedPropertyIndices[1];
84
static PropertyInfo sNativeProperties_propertyInfos[1];
85
86
static const NativePropertiesN<1> sNativeProperties = {
87
  false, 0,
88
  false, 0,
89
  false, 0,
90
  true,  0 /* sAttributes */,
91
  false, 0,
92
  false, 0,
93
  false, 0,
94
  -1,
95
  1,
96
  sNativeProperties_sortedPropertyIndices,
97
  {
98
    { sAttributes, &sNativeProperties_propertyInfos[0] }
99
  }
100
};
101
static_assert(1 < 1ull << CHAR_BIT * sizeof(sNativeProperties.propertyInfoCount),
102
    "We have a property info count that is oversized");
103
104
static const DOMIfaceAndProtoJSClass sInterfaceObjectClass = {
105
  {
106
    "Function",
107
    JSCLASS_IS_DOMIFACEANDPROTOJSCLASS | JSCLASS_HAS_RESERVED_SLOTS(DOM_INTERFACE_SLOTS_BASE),
108
    &sBoringInterfaceObjectClassClassOps,
109
    JS_NULL_CLASS_SPEC,
110
    JS_NULL_CLASS_EXT,
111
    &sInterfaceObjectClassObjectOps
112
  },
113
  eInterface,
114
  true,
115
  prototypes::id::AnimationTimeline,
116
  PrototypeTraits<prototypes::id::AnimationTimeline>::Depth,
117
  sNativePropertyHooks,
118
  "function AnimationTimeline() {\n    [native code]\n}",
119
  JS::GetRealmFunctionPrototype
120
};
121
122
static const DOMIfaceAndProtoJSClass sPrototypeClass = {
123
  {
124
    "AnimationTimelinePrototype",
125
    JSCLASS_IS_DOMIFACEANDPROTOJSCLASS | JSCLASS_HAS_RESERVED_SLOTS(DOM_INTERFACE_PROTO_SLOTS_BASE),
126
    JS_NULL_CLASS_OPS,
127
    JS_NULL_CLASS_SPEC,
128
    JS_NULL_CLASS_EXT,
129
    JS_NULL_OBJECT_OPS
130
  },
131
  eInterfacePrototype,
132
  false,
133
  prototypes::id::AnimationTimeline,
134
  PrototypeTraits<prototypes::id::AnimationTimeline>::Depth,
135
  sNativePropertyHooks,
136
  "[object AnimationTimelinePrototype]",
137
  JS::GetRealmObjectPrototype
138
};
139
140
bool
141
ConstructorEnabled(JSContext* aCx, JS::Handle<JSObject*> aObj)
142
0
{
143
0
  return nsDocument::AreWebAnimationsTimelinesEnabled(aCx, aObj);
144
0
}
145
146
const NativePropertyHooks sNativePropertyHooks[] = { {
147
  nullptr,
148
  nullptr,
149
  nullptr,
150
  { sNativeProperties.Upcast(), nullptr },
151
  prototypes::id::AnimationTimeline,
152
  constructors::id::AnimationTimeline,
153
  nullptr,
154
  &DefaultXrayExpandoObjectClass
155
} };
156
157
void
158
CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, bool aDefineOnGlobal)
159
0
{
160
0
  JS::Rooted<JSObject*> parentProto(aCx, JS::GetRealmObjectPrototype(aCx));
161
0
  if (!parentProto) {
162
0
    return;
163
0
  }
164
0
165
0
  JS::Rooted<JSObject*> constructorProto(aCx, JS::GetRealmFunctionPrototype(aCx));
166
0
  if (!constructorProto) {
167
0
    return;
168
0
  }
169
0
170
0
  static bool sIdsInited = false;
171
0
  if (!sIdsInited && NS_IsMainThread()) {
172
0
    if (!InitIds(aCx, sNativeProperties.Upcast())) {
173
0
      return;
174
0
    }
175
0
    sIdsInited = true;
176
0
  }
177
0
178
0
  JS::Heap<JSObject*>* protoCache = &aProtoAndIfaceCache.EntrySlotOrCreate(prototypes::id::AnimationTimeline);
179
0
  JS::Heap<JSObject*>* interfaceCache = &aProtoAndIfaceCache.EntrySlotOrCreate(constructors::id::AnimationTimeline);
180
0
  dom::CreateInterfaceObjects(aCx, aGlobal, parentProto,
181
0
                              &sPrototypeClass.mBase, protoCache,
182
0
                              nullptr,
183
0
                              constructorProto, &sInterfaceObjectClass.mBase, 0, nullptr,
184
0
                              interfaceCache,
185
0
                              sNativeProperties.Upcast(),
186
0
                              nullptr,
187
0
                              "AnimationTimeline", aDefineOnGlobal,
188
0
                              nullptr,
189
0
                              false);
190
0
}
191
192
JSObject*
193
GetProtoObject(JSContext* aCx)
194
0
{
195
0
  return GetProtoObjectHandle(aCx);
196
0
}
197
198
JSObject*
199
GetConstructorObject(JSContext* aCx)
200
0
{
201
0
  return GetConstructorObjectHandle(aCx);
202
0
}
203
204
} // namespace AnimationTimeline_Binding
205
206
207
208
} // namespace dom
209
} // namespace mozilla