Line data Source code
1 : /* THIS FILE IS AUTOGENERATED FROM SVGAnimationElement.webidl BY Codegen.py - DO NOT EDIT */
2 :
3 : #include "DOMSVGStringList.h"
4 : #include "SVGAnimationElementBinding.h"
5 : #include "SVGElementBinding.h"
6 : #include "WrapperFactory.h"
7 : #include "mozilla/FloatingPoint.h"
8 : #include "mozilla/OwningNonNull.h"
9 : #include "mozilla/dom/BindingUtils.h"
10 : #include "mozilla/dom/DOMJSClass.h"
11 : #include "mozilla/dom/NonRefcountedDOMObject.h"
12 : #include "mozilla/dom/Nullable.h"
13 : #include "mozilla/dom/PrimitiveConversions.h"
14 : #include "mozilla/dom/SVGAnimationElement.h"
15 : #include "mozilla/dom/XrayExpandoClass.h"
16 : #include "nsSVGElement.h"
17 :
18 : namespace mozilla {
19 : namespace dom {
20 :
21 : namespace SVGAnimationElementBinding {
22 :
23 : static_assert(IsRefcounted<NativeType>::value == IsRefcounted<SVGElementBinding::NativeType>::value,
24 : "Can't inherit from an interface with a different ownership model.");
25 :
26 : static bool
27 0 : get_targetElement(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SVGAnimationElement* self, JSJitGetterCallArgs args)
28 : {
29 0 : auto result(StrongOrRawPtr<nsSVGElement>(self->GetTargetElement()));
30 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
31 0 : if (!result) {
32 0 : args.rval().setNull();
33 0 : return true;
34 : }
35 0 : if (!GetOrCreateDOMReflector(cx, result, args.rval())) {
36 0 : MOZ_ASSERT(true || JS_IsExceptionPending(cx));
37 0 : return false;
38 : }
39 0 : return true;
40 : }
41 :
42 : static const JSJitInfo targetElement_getterinfo = {
43 : { (JSJitGetterOp)get_targetElement },
44 : { prototypes::id::SVGAnimationElement },
45 : { PrototypeTraits<prototypes::id::SVGAnimationElement>::Depth },
46 : JSJitInfo::Getter,
47 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
48 : JSVAL_TYPE_UNKNOWN, /* returnType. Not relevant for setters. */
49 : false, /* isInfallible. False in setters. */
50 : false, /* isMovable. Not relevant for setters. */
51 : false, /* isEliminatable. Not relevant for setters. */
52 : false, /* isAlwaysInSlot. Only relevant for getters. */
53 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
54 : false, /* isTypedMethod. Only relevant for methods. */
55 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
56 : };
57 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
58 : static_assert(0 < 1, "There is no slot for us");
59 :
60 : static bool
61 0 : getStartTime(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SVGAnimationElement* self, const JSJitMethodCallArgs& args)
62 : {
63 0 : binding_detail::FastErrorResult rv;
64 0 : float result(self->GetStartTime(rv));
65 0 : if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
66 0 : return false;
67 : }
68 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
69 0 : args.rval().set(JS_NumberValue(double(result)));
70 0 : return true;
71 : }
72 :
73 : static const JSJitInfo getStartTime_methodinfo = {
74 : { (JSJitGetterOp)getStartTime },
75 : { prototypes::id::SVGAnimationElement },
76 : { PrototypeTraits<prototypes::id::SVGAnimationElement>::Depth },
77 : JSJitInfo::Method,
78 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
79 : JSVAL_TYPE_DOUBLE, /* returnType. Not relevant for setters. */
80 : false, /* isInfallible. False in setters. */
81 : false, /* isMovable. Not relevant for setters. */
82 : false, /* isEliminatable. Not relevant for setters. */
83 : false, /* isAlwaysInSlot. Only relevant for getters. */
84 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
85 : false, /* isTypedMethod. Only relevant for methods. */
86 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
87 : };
88 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
89 : static_assert(0 < 1, "There is no slot for us");
90 :
91 : static bool
92 0 : getCurrentTime(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SVGAnimationElement* self, const JSJitMethodCallArgs& args)
93 : {
94 0 : float result(self->GetCurrentTime());
95 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
96 0 : args.rval().set(JS_NumberValue(double(result)));
97 0 : return true;
98 : }
99 :
100 : static const JSJitInfo getCurrentTime_methodinfo = {
101 : { (JSJitGetterOp)getCurrentTime },
102 : { prototypes::id::SVGAnimationElement },
103 : { PrototypeTraits<prototypes::id::SVGAnimationElement>::Depth },
104 : JSJitInfo::Method,
105 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
106 : JSVAL_TYPE_DOUBLE, /* returnType. Not relevant for setters. */
107 : true, /* isInfallible. False in setters. */
108 : false, /* isMovable. Not relevant for setters. */
109 : false, /* isEliminatable. Not relevant for setters. */
110 : false, /* isAlwaysInSlot. Only relevant for getters. */
111 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
112 : false, /* isTypedMethod. Only relevant for methods. */
113 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
114 : };
115 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
116 : static_assert(0 < 1, "There is no slot for us");
117 :
118 : static bool
119 0 : getSimpleDuration(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SVGAnimationElement* self, const JSJitMethodCallArgs& args)
120 : {
121 0 : binding_detail::FastErrorResult rv;
122 0 : float result(self->GetSimpleDuration(rv));
123 0 : if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
124 0 : return false;
125 : }
126 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
127 0 : args.rval().set(JS_NumberValue(double(result)));
128 0 : return true;
129 : }
130 :
131 : static const JSJitInfo getSimpleDuration_methodinfo = {
132 : { (JSJitGetterOp)getSimpleDuration },
133 : { prototypes::id::SVGAnimationElement },
134 : { PrototypeTraits<prototypes::id::SVGAnimationElement>::Depth },
135 : JSJitInfo::Method,
136 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
137 : JSVAL_TYPE_DOUBLE, /* returnType. Not relevant for setters. */
138 : false, /* isInfallible. False in setters. */
139 : false, /* isMovable. Not relevant for setters. */
140 : false, /* isEliminatable. Not relevant for setters. */
141 : false, /* isAlwaysInSlot. Only relevant for getters. */
142 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
143 : false, /* isTypedMethod. Only relevant for methods. */
144 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
145 : };
146 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
147 : static_assert(0 < 1, "There is no slot for us");
148 :
149 : static bool
150 0 : beginElement(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SVGAnimationElement* self, const JSJitMethodCallArgs& args)
151 : {
152 0 : binding_detail::FastErrorResult rv;
153 0 : self->BeginElement(rv);
154 0 : if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
155 0 : return false;
156 : }
157 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
158 0 : args.rval().setUndefined();
159 0 : return true;
160 : }
161 :
162 : static const JSJitInfo beginElement_methodinfo = {
163 : { (JSJitGetterOp)beginElement },
164 : { prototypes::id::SVGAnimationElement },
165 : { PrototypeTraits<prototypes::id::SVGAnimationElement>::Depth },
166 : JSJitInfo::Method,
167 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
168 : JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */
169 : false, /* isInfallible. False in setters. */
170 : false, /* isMovable. Not relevant for setters. */
171 : false, /* isEliminatable. Not relevant for setters. */
172 : false, /* isAlwaysInSlot. Only relevant for getters. */
173 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
174 : false, /* isTypedMethod. Only relevant for methods. */
175 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
176 : };
177 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
178 : static_assert(0 < 1, "There is no slot for us");
179 :
180 : static bool
181 0 : beginElementAt(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SVGAnimationElement* self, const JSJitMethodCallArgs& args)
182 : {
183 0 : if (MOZ_UNLIKELY(args.length() < 1)) {
184 0 : return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "SVGAnimationElement.beginElementAt");
185 : }
186 : float arg0;
187 0 : if (!ValueToPrimitive<float, eDefault>(cx, args[0], &arg0)) {
188 0 : return false;
189 0 : } else if (!mozilla::IsFinite(arg0)) {
190 0 : ThrowErrorMessage(cx, MSG_NOT_FINITE, "Argument 1 of SVGAnimationElement.beginElementAt");
191 0 : return false;
192 : }
193 0 : binding_detail::FastErrorResult rv;
194 0 : self->BeginElementAt(arg0, rv);
195 0 : if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
196 0 : return false;
197 : }
198 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
199 0 : args.rval().setUndefined();
200 0 : return true;
201 : }
202 :
203 : static const JSJitInfo beginElementAt_methodinfo = {
204 : { (JSJitGetterOp)beginElementAt },
205 : { prototypes::id::SVGAnimationElement },
206 : { PrototypeTraits<prototypes::id::SVGAnimationElement>::Depth },
207 : JSJitInfo::Method,
208 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
209 : JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */
210 : false, /* isInfallible. False in setters. */
211 : false, /* isMovable. Not relevant for setters. */
212 : false, /* isEliminatable. Not relevant for setters. */
213 : false, /* isAlwaysInSlot. Only relevant for getters. */
214 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
215 : false, /* isTypedMethod. Only relevant for methods. */
216 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
217 : };
218 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
219 : static_assert(0 < 1, "There is no slot for us");
220 :
221 : static bool
222 0 : endElement(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SVGAnimationElement* self, const JSJitMethodCallArgs& args)
223 : {
224 0 : binding_detail::FastErrorResult rv;
225 0 : self->EndElement(rv);
226 0 : if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
227 0 : return false;
228 : }
229 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
230 0 : args.rval().setUndefined();
231 0 : return true;
232 : }
233 :
234 : static const JSJitInfo endElement_methodinfo = {
235 : { (JSJitGetterOp)endElement },
236 : { prototypes::id::SVGAnimationElement },
237 : { PrototypeTraits<prototypes::id::SVGAnimationElement>::Depth },
238 : JSJitInfo::Method,
239 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
240 : JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */
241 : false, /* isInfallible. False in setters. */
242 : false, /* isMovable. Not relevant for setters. */
243 : false, /* isEliminatable. Not relevant for setters. */
244 : false, /* isAlwaysInSlot. Only relevant for getters. */
245 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
246 : false, /* isTypedMethod. Only relevant for methods. */
247 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
248 : };
249 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
250 : static_assert(0 < 1, "There is no slot for us");
251 :
252 : static bool
253 0 : endElementAt(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SVGAnimationElement* self, const JSJitMethodCallArgs& args)
254 : {
255 0 : if (MOZ_UNLIKELY(args.length() < 1)) {
256 0 : return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "SVGAnimationElement.endElementAt");
257 : }
258 : float arg0;
259 0 : if (!ValueToPrimitive<float, eDefault>(cx, args[0], &arg0)) {
260 0 : return false;
261 0 : } else if (!mozilla::IsFinite(arg0)) {
262 0 : ThrowErrorMessage(cx, MSG_NOT_FINITE, "Argument 1 of SVGAnimationElement.endElementAt");
263 0 : return false;
264 : }
265 0 : binding_detail::FastErrorResult rv;
266 0 : self->EndElementAt(arg0, rv);
267 0 : if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
268 0 : return false;
269 : }
270 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
271 0 : args.rval().setUndefined();
272 0 : return true;
273 : }
274 :
275 : static const JSJitInfo endElementAt_methodinfo = {
276 : { (JSJitGetterOp)endElementAt },
277 : { prototypes::id::SVGAnimationElement },
278 : { PrototypeTraits<prototypes::id::SVGAnimationElement>::Depth },
279 : JSJitInfo::Method,
280 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
281 : JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */
282 : false, /* isInfallible. False in setters. */
283 : false, /* isMovable. Not relevant for setters. */
284 : false, /* isEliminatable. Not relevant for setters. */
285 : false, /* isAlwaysInSlot. Only relevant for getters. */
286 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
287 : false, /* isTypedMethod. Only relevant for methods. */
288 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
289 : };
290 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
291 : static_assert(0 < 1, "There is no slot for us");
292 :
293 : static bool
294 0 : get_requiredFeatures(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SVGAnimationElement* self, JSJitGetterCallArgs args)
295 : {
296 0 : auto result(StrongOrRawPtr<mozilla::DOMSVGStringList>(self->RequiredFeatures()));
297 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
298 0 : if (!GetOrCreateDOMReflector(cx, result, args.rval())) {
299 0 : MOZ_ASSERT(true || JS_IsExceptionPending(cx));
300 0 : return false;
301 : }
302 0 : return true;
303 : }
304 :
305 : static const JSJitInfo requiredFeatures_getterinfo = {
306 : { (JSJitGetterOp)get_requiredFeatures },
307 : { prototypes::id::SVGAnimationElement },
308 : { PrototypeTraits<prototypes::id::SVGAnimationElement>::Depth },
309 : JSJitInfo::Getter,
310 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
311 : JSVAL_TYPE_OBJECT, /* returnType. Not relevant for setters. */
312 : false, /* isInfallible. False in setters. */
313 : false, /* isMovable. Not relevant for setters. */
314 : false, /* isEliminatable. Not relevant for setters. */
315 : false, /* isAlwaysInSlot. Only relevant for getters. */
316 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
317 : false, /* isTypedMethod. Only relevant for methods. */
318 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
319 : };
320 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
321 : static_assert(0 < 1, "There is no slot for us");
322 :
323 : static bool
324 0 : get_requiredExtensions(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SVGAnimationElement* self, JSJitGetterCallArgs args)
325 : {
326 0 : auto result(StrongOrRawPtr<mozilla::DOMSVGStringList>(self->RequiredExtensions()));
327 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
328 0 : if (!GetOrCreateDOMReflector(cx, result, args.rval())) {
329 0 : MOZ_ASSERT(true || JS_IsExceptionPending(cx));
330 0 : return false;
331 : }
332 0 : return true;
333 : }
334 :
335 : static const JSJitInfo requiredExtensions_getterinfo = {
336 : { (JSJitGetterOp)get_requiredExtensions },
337 : { prototypes::id::SVGAnimationElement },
338 : { PrototypeTraits<prototypes::id::SVGAnimationElement>::Depth },
339 : JSJitInfo::Getter,
340 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
341 : JSVAL_TYPE_OBJECT, /* returnType. Not relevant for setters. */
342 : false, /* isInfallible. False in setters. */
343 : false, /* isMovable. Not relevant for setters. */
344 : false, /* isEliminatable. Not relevant for setters. */
345 : false, /* isAlwaysInSlot. Only relevant for getters. */
346 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
347 : false, /* isTypedMethod. Only relevant for methods. */
348 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
349 : };
350 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
351 : static_assert(0 < 1, "There is no slot for us");
352 :
353 : static bool
354 0 : get_systemLanguage(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SVGAnimationElement* self, JSJitGetterCallArgs args)
355 : {
356 0 : auto result(StrongOrRawPtr<mozilla::DOMSVGStringList>(self->SystemLanguage()));
357 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
358 0 : if (!GetOrCreateDOMReflector(cx, result, args.rval())) {
359 0 : MOZ_ASSERT(true || JS_IsExceptionPending(cx));
360 0 : return false;
361 : }
362 0 : return true;
363 : }
364 :
365 : static const JSJitInfo systemLanguage_getterinfo = {
366 : { (JSJitGetterOp)get_systemLanguage },
367 : { prototypes::id::SVGAnimationElement },
368 : { PrototypeTraits<prototypes::id::SVGAnimationElement>::Depth },
369 : JSJitInfo::Getter,
370 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
371 : JSVAL_TYPE_OBJECT, /* returnType. Not relevant for setters. */
372 : false, /* isInfallible. False in setters. */
373 : false, /* isMovable. Not relevant for setters. */
374 : false, /* isEliminatable. Not relevant for setters. */
375 : false, /* isAlwaysInSlot. Only relevant for getters. */
376 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
377 : false, /* isTypedMethod. Only relevant for methods. */
378 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
379 : };
380 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
381 : static_assert(0 < 1, "There is no slot for us");
382 :
383 : static bool
384 0 : hasExtension(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SVGAnimationElement* self, const JSJitMethodCallArgs& args)
385 : {
386 0 : if (MOZ_UNLIKELY(args.length() < 1)) {
387 0 : return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "SVGAnimationElement.hasExtension");
388 : }
389 0 : binding_detail::FakeString arg0;
390 0 : if (!ConvertJSValueToString(cx, args[0], eStringify, eStringify, arg0)) {
391 0 : return false;
392 : }
393 0 : bool result(self->HasExtension(NonNullHelper(Constify(arg0))));
394 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
395 0 : args.rval().setBoolean(result);
396 0 : return true;
397 : }
398 :
399 : static const JSJitInfo hasExtension_methodinfo = {
400 : { (JSJitGetterOp)hasExtension },
401 : { prototypes::id::SVGAnimationElement },
402 : { PrototypeTraits<prototypes::id::SVGAnimationElement>::Depth },
403 : JSJitInfo::Method,
404 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
405 : JSVAL_TYPE_BOOLEAN, /* returnType. Not relevant for setters. */
406 : false, /* isInfallible. False in setters. */
407 : false, /* isMovable. Not relevant for setters. */
408 : false, /* isEliminatable. Not relevant for setters. */
409 : false, /* isAlwaysInSlot. Only relevant for getters. */
410 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
411 : false, /* isTypedMethod. Only relevant for methods. */
412 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
413 : };
414 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
415 : static_assert(0 < 1, "There is no slot for us");
416 :
417 : // We deliberately use brace-elision to make Visual Studio produce better initalization code.
418 : #if defined(__clang__)
419 : #pragma clang diagnostic push
420 : #pragma clang diagnostic ignored "-Wmissing-braces"
421 : #endif
422 : static const JSFunctionSpec sMethods_specs[] = {
423 : JS_FNSPEC("getStartTime", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&getStartTime_methodinfo), 0, JSPROP_ENUMERATE, nullptr),
424 : JS_FNSPEC("getCurrentTime", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&getCurrentTime_methodinfo), 0, JSPROP_ENUMERATE, nullptr),
425 : JS_FNSPEC("getSimpleDuration", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&getSimpleDuration_methodinfo), 0, JSPROP_ENUMERATE, nullptr),
426 : JS_FNSPEC("beginElement", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&beginElement_methodinfo), 0, JSPROP_ENUMERATE, nullptr),
427 : JS_FNSPEC("beginElementAt", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&beginElementAt_methodinfo), 1, JSPROP_ENUMERATE, nullptr),
428 : JS_FNSPEC("endElement", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&endElement_methodinfo), 0, JSPROP_ENUMERATE, nullptr),
429 : JS_FNSPEC("endElementAt", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&endElementAt_methodinfo), 1, JSPROP_ENUMERATE, nullptr),
430 : JS_FNSPEC("hasExtension", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&hasExtension_methodinfo), 1, JSPROP_ENUMERATE, nullptr),
431 : JS_FS_END
432 : };
433 : #if defined(__clang__)
434 : #pragma clang diagnostic pop
435 : #endif
436 :
437 :
438 : // Can't be const because the pref-enabled boolean needs to be writable
439 : static Prefable<const JSFunctionSpec> sMethods[] = {
440 : { nullptr, &sMethods_specs[0] },
441 : { nullptr, nullptr }
442 : };
443 :
444 : static_assert(1 <= 1ull << NUM_BITS_PROPERTY_INFO_PREF_INDEX,
445 : "We have a prefable index that is >= (1 << NUM_BITS_PROPERTY_INFO_PREF_INDEX)");
446 : static_assert(8 <= 1ull << NUM_BITS_PROPERTY_INFO_SPEC_INDEX,
447 : "We have a spec index that is >= (1 << NUM_BITS_PROPERTY_INFO_SPEC_INDEX)");
448 :
449 : // We deliberately use brace-elision to make Visual Studio produce better initalization code.
450 : #if defined(__clang__)
451 : #pragma clang diagnostic push
452 : #pragma clang diagnostic ignored "-Wmissing-braces"
453 : #endif
454 : static const JSPropertySpec sAttributes_specs[] = {
455 : { "targetElement", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &targetElement_getterinfo, nullptr, nullptr },
456 : { "requiredFeatures", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &requiredFeatures_getterinfo, nullptr, nullptr },
457 : { "requiredExtensions", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &requiredExtensions_getterinfo, nullptr, nullptr },
458 : { "systemLanguage", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &systemLanguage_getterinfo, nullptr, nullptr },
459 : { nullptr, 0, nullptr, nullptr, nullptr, nullptr }
460 : };
461 : #if defined(__clang__)
462 : #pragma clang diagnostic pop
463 : #endif
464 :
465 :
466 : // Can't be const because the pref-enabled boolean needs to be writable
467 : static Prefable<const JSPropertySpec> sAttributes[] = {
468 : { nullptr, &sAttributes_specs[0] },
469 : { nullptr, nullptr }
470 : };
471 :
472 : static_assert(1 <= 1ull << NUM_BITS_PROPERTY_INFO_PREF_INDEX,
473 : "We have a prefable index that is >= (1 << NUM_BITS_PROPERTY_INFO_PREF_INDEX)");
474 : static_assert(4 <= 1ull << NUM_BITS_PROPERTY_INFO_SPEC_INDEX,
475 : "We have a spec index that is >= (1 << NUM_BITS_PROPERTY_INFO_SPEC_INDEX)");
476 :
477 :
478 : static uint16_t sNativeProperties_sortedPropertyIndices[12];
479 : static PropertyInfo sNativeProperties_propertyInfos[12];
480 :
481 : static const NativePropertiesN<2> sNativeProperties = {
482 : false, 0,
483 : false, 0,
484 : true, 0 /* sMethods */,
485 : true, 1 /* sAttributes */,
486 : false, 0,
487 : false, 0,
488 : false, 0,
489 : -1,
490 : 12,
491 : sNativeProperties_sortedPropertyIndices,
492 : {
493 : { sMethods, &sNativeProperties_propertyInfos[0] },
494 : { sAttributes, &sNativeProperties_propertyInfos[8] }
495 : }
496 : };
497 : static_assert(12 < 1ull << CHAR_BIT * sizeof(sNativeProperties.propertyInfoCount),
498 : "We have a property info count that is oversized");
499 :
500 : static const DOMIfaceAndProtoJSClass sInterfaceObjectClass = {
501 : {
502 : "Function",
503 : JSCLASS_IS_DOMIFACEANDPROTOJSCLASS | JSCLASS_HAS_RESERVED_SLOTS(DOM_INTERFACE_SLOTS_BASE),
504 : &sBoringInterfaceObjectClassClassOps,
505 : JS_NULL_CLASS_SPEC,
506 : JS_NULL_CLASS_EXT,
507 : &sInterfaceObjectClassObjectOps
508 : },
509 : eInterface,
510 : true,
511 : prototypes::id::SVGAnimationElement,
512 : PrototypeTraits<prototypes::id::SVGAnimationElement>::Depth,
513 : sNativePropertyHooks,
514 : "function SVGAnimationElement() {\n [native code]\n}",
515 : SVGElementBinding::GetConstructorObject
516 : };
517 :
518 : static const DOMIfaceAndProtoJSClass sPrototypeClass = {
519 : {
520 : "SVGAnimationElementPrototype",
521 : JSCLASS_IS_DOMIFACEANDPROTOJSCLASS | JSCLASS_HAS_RESERVED_SLOTS(DOM_INTERFACE_PROTO_SLOTS_BASE),
522 : JS_NULL_CLASS_OPS,
523 : JS_NULL_CLASS_SPEC,
524 : JS_NULL_CLASS_EXT,
525 : JS_NULL_OBJECT_OPS
526 : },
527 : eInterfacePrototype,
528 : false,
529 : prototypes::id::SVGAnimationElement,
530 : PrototypeTraits<prototypes::id::SVGAnimationElement>::Depth,
531 : sNativePropertyHooks,
532 : "[object SVGAnimationElementPrototype]",
533 : SVGElementBinding::GetProtoObject
534 : };
535 :
536 : JSObject*
537 0 : DefineDOMInterface(JSContext* aCx, JS::Handle<JSObject*> aGlobal, JS::Handle<jsid> id, bool aDefineOnGlobal)
538 : {
539 0 : return GetConstructorObjectHandle(aCx, aDefineOnGlobal);
540 : }
541 :
542 : const NativePropertyHooks sNativePropertyHooks[] = { {
543 : nullptr,
544 : nullptr,
545 : nullptr,
546 : { sNativeProperties.Upcast(), nullptr },
547 : prototypes::id::SVGAnimationElement,
548 : constructors::id::SVGAnimationElement,
549 : SVGElementBinding::sNativePropertyHooks,
550 : &DefaultXrayExpandoObjectClass
551 : } };
552 :
553 : void
554 0 : CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, bool aDefineOnGlobal)
555 : {
556 0 : JS::Handle<JSObject*> parentProto(SVGElementBinding::GetProtoObjectHandle(aCx));
557 0 : if (!parentProto) {
558 0 : return;
559 : }
560 :
561 0 : JS::Handle<JSObject*> constructorProto(SVGElementBinding::GetConstructorObjectHandle(aCx));
562 0 : if (!constructorProto) {
563 0 : return;
564 : }
565 :
566 : static bool sIdsInited = false;
567 0 : if (!sIdsInited && NS_IsMainThread()) {
568 0 : if (!InitIds(aCx, sNativeProperties.Upcast())) {
569 0 : return;
570 : }
571 0 : sIdsInited = true;
572 : }
573 :
574 0 : JS::Heap<JSObject*>* protoCache = &aProtoAndIfaceCache.EntrySlotOrCreate(prototypes::id::SVGAnimationElement);
575 0 : JS::Heap<JSObject*>* interfaceCache = &aProtoAndIfaceCache.EntrySlotOrCreate(constructors::id::SVGAnimationElement);
576 0 : dom::CreateInterfaceObjects(aCx, aGlobal, parentProto,
577 : &sPrototypeClass.mBase, protoCache,
578 : constructorProto, &sInterfaceObjectClass.mBase, 0, nullptr,
579 : interfaceCache,
580 : sNativeProperties.Upcast(),
581 : nullptr,
582 : "SVGAnimationElement", aDefineOnGlobal,
583 : nullptr,
584 0 : false);
585 : }
586 :
587 : JS::Handle<JSObject*>
588 0 : GetProtoObjectHandle(JSContext* aCx)
589 : {
590 : /* Get the interface prototype object for this class. This will create the
591 : object as needed. */
592 0 : bool aDefineOnGlobal = true;
593 :
594 : /* Make sure our global is sane. Hopefully we can remove this sometime */
595 0 : JSObject* global = JS::CurrentGlobalOrNull(aCx);
596 0 : if (!(js::GetObjectClass(global)->flags & JSCLASS_DOM_GLOBAL)) {
597 0 : return nullptr;
598 : }
599 :
600 : /* Check to see whether the interface objects are already installed */
601 0 : ProtoAndIfaceCache& protoAndIfaceCache = *GetProtoAndIfaceCache(global);
602 0 : if (!protoAndIfaceCache.HasEntryInSlot(prototypes::id::SVGAnimationElement)) {
603 0 : JS::Rooted<JSObject*> rootedGlobal(aCx, global);
604 0 : CreateInterfaceObjects(aCx, rootedGlobal, protoAndIfaceCache, aDefineOnGlobal);
605 : }
606 :
607 : /*
608 : * The object might _still_ be null, but that's OK.
609 : *
610 : * Calling fromMarkedLocation() is safe because protoAndIfaceCache is
611 : * traced by TraceProtoAndIfaceCache() and its contents are never
612 : * changed after they have been set.
613 : *
614 : * Calling address() avoids the read read barrier that does gray
615 : * unmarking, but it's not possible for the object to be gray here.
616 : */
617 :
618 0 : const JS::Heap<JSObject*>& entrySlot = protoAndIfaceCache.EntrySlotMustExist(prototypes::id::SVGAnimationElement);
619 0 : MOZ_ASSERT(JS::ObjectIsNotGray(entrySlot));
620 0 : return JS::Handle<JSObject*>::fromMarkedLocation(entrySlot.address());
621 : }
622 :
623 : JSObject*
624 0 : GetProtoObject(JSContext* aCx)
625 : {
626 0 : return GetProtoObjectHandle(aCx);
627 : }
628 :
629 : JS::Handle<JSObject*>
630 0 : GetConstructorObjectHandle(JSContext* aCx, bool aDefineOnGlobal)
631 : {
632 : /* Get the interface object for this class. This will create the object as
633 : needed. */
634 :
635 : /* Make sure our global is sane. Hopefully we can remove this sometime */
636 0 : JSObject* global = JS::CurrentGlobalOrNull(aCx);
637 0 : if (!(js::GetObjectClass(global)->flags & JSCLASS_DOM_GLOBAL)) {
638 0 : return nullptr;
639 : }
640 :
641 : /* Check to see whether the interface objects are already installed */
642 0 : ProtoAndIfaceCache& protoAndIfaceCache = *GetProtoAndIfaceCache(global);
643 0 : if (!protoAndIfaceCache.HasEntryInSlot(constructors::id::SVGAnimationElement)) {
644 0 : JS::Rooted<JSObject*> rootedGlobal(aCx, global);
645 0 : CreateInterfaceObjects(aCx, rootedGlobal, protoAndIfaceCache, aDefineOnGlobal);
646 : }
647 :
648 : /*
649 : * The object might _still_ be null, but that's OK.
650 : *
651 : * Calling fromMarkedLocation() is safe because protoAndIfaceCache is
652 : * traced by TraceProtoAndIfaceCache() and its contents are never
653 : * changed after they have been set.
654 : *
655 : * Calling address() avoids the read read barrier that does gray
656 : * unmarking, but it's not possible for the object to be gray here.
657 : */
658 :
659 0 : const JS::Heap<JSObject*>& entrySlot = protoAndIfaceCache.EntrySlotMustExist(constructors::id::SVGAnimationElement);
660 0 : MOZ_ASSERT(JS::ObjectIsNotGray(entrySlot));
661 0 : return JS::Handle<JSObject*>::fromMarkedLocation(entrySlot.address());
662 : }
663 :
664 : JSObject*
665 0 : GetConstructorObject(JSContext* aCx)
666 : {
667 0 : return GetConstructorObjectHandle(aCx);
668 : }
669 :
670 : } // namespace SVGAnimationElementBinding
671 :
672 :
673 :
674 : } // namespace dom
675 : } // namespace mozilla
|