Line data Source code
1 : /* THIS FILE IS AUTOGENERATED FROM SVGEllipseElement.webidl BY Codegen.py - DO NOT EDIT */
2 :
3 : #include "SVGEllipseElementBinding.h"
4 : #include "SVGGraphicsElementBinding.h"
5 : #include "WrapperFactory.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/SVGAnimatedLength.h"
11 : #include "mozilla/dom/SVGEllipseElement.h"
12 : #include "mozilla/dom/XrayExpandoClass.h"
13 :
14 : namespace mozilla {
15 : namespace dom {
16 :
17 : namespace SVGEllipseElementBinding {
18 :
19 : static_assert(IsRefcounted<NativeType>::value == IsRefcounted<SVGGraphicsElementBinding::NativeType>::value,
20 : "Can't inherit from an interface with a different ownership model.");
21 :
22 : static bool
23 0 : get_cx(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SVGEllipseElement* self, JSJitGetterCallArgs args)
24 : {
25 0 : auto result(StrongOrRawPtr<mozilla::dom::SVGAnimatedLength>(self->Cx()));
26 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
27 0 : if (!GetOrCreateDOMReflector(cx, result, args.rval())) {
28 0 : MOZ_ASSERT(true || JS_IsExceptionPending(cx));
29 0 : return false;
30 : }
31 0 : return true;
32 : }
33 :
34 : static const JSJitInfo cx_getterinfo = {
35 : { (JSJitGetterOp)get_cx },
36 : { prototypes::id::SVGEllipseElement },
37 : { PrototypeTraits<prototypes::id::SVGEllipseElement>::Depth },
38 : JSJitInfo::Getter,
39 : JSJitInfo::AliasNone, /* aliasSet. Not relevant for setters. */
40 : JSVAL_TYPE_OBJECT, /* returnType. Not relevant for setters. */
41 : false, /* isInfallible. False in setters. */
42 : true, /* isMovable. Not relevant for setters. */
43 : true, /* 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 : static bool
53 0 : get_cy(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SVGEllipseElement* self, JSJitGetterCallArgs args)
54 : {
55 0 : auto result(StrongOrRawPtr<mozilla::dom::SVGAnimatedLength>(self->Cy()));
56 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
57 0 : if (!GetOrCreateDOMReflector(cx, result, args.rval())) {
58 0 : MOZ_ASSERT(true || JS_IsExceptionPending(cx));
59 0 : return false;
60 : }
61 0 : return true;
62 : }
63 :
64 : static const JSJitInfo cy_getterinfo = {
65 : { (JSJitGetterOp)get_cy },
66 : { prototypes::id::SVGEllipseElement },
67 : { PrototypeTraits<prototypes::id::SVGEllipseElement>::Depth },
68 : JSJitInfo::Getter,
69 : JSJitInfo::AliasNone, /* aliasSet. Not relevant for setters. */
70 : JSVAL_TYPE_OBJECT, /* returnType. Not relevant for setters. */
71 : false, /* isInfallible. False in setters. */
72 : true, /* isMovable. Not relevant for setters. */
73 : true, /* isEliminatable. Not relevant for setters. */
74 : false, /* isAlwaysInSlot. Only relevant for getters. */
75 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
76 : false, /* isTypedMethod. Only relevant for methods. */
77 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
78 : };
79 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
80 : static_assert(0 < 1, "There is no slot for us");
81 :
82 : static bool
83 0 : get_rx(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SVGEllipseElement* self, JSJitGetterCallArgs args)
84 : {
85 0 : auto result(StrongOrRawPtr<mozilla::dom::SVGAnimatedLength>(self->Rx()));
86 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
87 0 : if (!GetOrCreateDOMReflector(cx, result, args.rval())) {
88 0 : MOZ_ASSERT(true || JS_IsExceptionPending(cx));
89 0 : return false;
90 : }
91 0 : return true;
92 : }
93 :
94 : static const JSJitInfo rx_getterinfo = {
95 : { (JSJitGetterOp)get_rx },
96 : { prototypes::id::SVGEllipseElement },
97 : { PrototypeTraits<prototypes::id::SVGEllipseElement>::Depth },
98 : JSJitInfo::Getter,
99 : JSJitInfo::AliasNone, /* aliasSet. Not relevant for setters. */
100 : JSVAL_TYPE_OBJECT, /* returnType. Not relevant for setters. */
101 : false, /* isInfallible. False in setters. */
102 : true, /* isMovable. Not relevant for setters. */
103 : true, /* isEliminatable. Not relevant for setters. */
104 : false, /* isAlwaysInSlot. Only relevant for getters. */
105 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
106 : false, /* isTypedMethod. Only relevant for methods. */
107 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
108 : };
109 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
110 : static_assert(0 < 1, "There is no slot for us");
111 :
112 : static bool
113 0 : get_ry(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SVGEllipseElement* self, JSJitGetterCallArgs args)
114 : {
115 0 : auto result(StrongOrRawPtr<mozilla::dom::SVGAnimatedLength>(self->Ry()));
116 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
117 0 : if (!GetOrCreateDOMReflector(cx, result, args.rval())) {
118 0 : MOZ_ASSERT(true || JS_IsExceptionPending(cx));
119 0 : return false;
120 : }
121 0 : return true;
122 : }
123 :
124 : static const JSJitInfo ry_getterinfo = {
125 : { (JSJitGetterOp)get_ry },
126 : { prototypes::id::SVGEllipseElement },
127 : { PrototypeTraits<prototypes::id::SVGEllipseElement>::Depth },
128 : JSJitInfo::Getter,
129 : JSJitInfo::AliasNone, /* aliasSet. Not relevant for setters. */
130 : JSVAL_TYPE_OBJECT, /* returnType. Not relevant for setters. */
131 : false, /* isInfallible. False in setters. */
132 : true, /* isMovable. Not relevant for setters. */
133 : true, /* isEliminatable. Not relevant for setters. */
134 : false, /* isAlwaysInSlot. Only relevant for getters. */
135 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
136 : false, /* isTypedMethod. Only relevant for methods. */
137 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
138 : };
139 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
140 : static_assert(0 < 1, "There is no slot for us");
141 :
142 : static bool
143 0 : _addProperty(JSContext* cx, JS::Handle<JSObject*> obj, JS::Handle<jsid> id, JS::Handle<JS::Value> val)
144 : {
145 0 : mozilla::dom::SVGEllipseElement* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::dom::SVGEllipseElement>(obj);
146 : // We don't want to preserve if we don't have a wrapper, and we
147 : // obviously can't preserve if we're not initialized.
148 0 : if (self && self->GetWrapperPreserveColor()) {
149 0 : PreserveWrapper(self);
150 : }
151 0 : return true;
152 : }
153 :
154 : static void
155 0 : _finalize(js::FreeOp* fop, JSObject* obj)
156 : {
157 0 : mozilla::dom::SVGEllipseElement* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::dom::SVGEllipseElement>(obj);
158 0 : if (self) {
159 0 : ClearWrapper(self, self, obj);
160 0 : AddForDeferredFinalization<mozilla::dom::SVGEllipseElement>(self);
161 : }
162 0 : }
163 :
164 : static void
165 0 : _objectMoved(JSObject* obj, const JSObject* old)
166 : {
167 0 : mozilla::dom::SVGEllipseElement* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::dom::SVGEllipseElement>(obj);
168 0 : if (self) {
169 0 : UpdateWrapper(self, self, obj, old);
170 : }
171 0 : }
172 :
173 : // We deliberately use brace-elision to make Visual Studio produce better initalization code.
174 : #if defined(__clang__)
175 : #pragma clang diagnostic push
176 : #pragma clang diagnostic ignored "-Wmissing-braces"
177 : #endif
178 : static const JSPropertySpec sAttributes_specs[] = {
179 : { "cx", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &cx_getterinfo, nullptr, nullptr },
180 : { "cy", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &cy_getterinfo, nullptr, nullptr },
181 : { "rx", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &rx_getterinfo, nullptr, nullptr },
182 : { "ry", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &ry_getterinfo, nullptr, nullptr },
183 : { nullptr, 0, nullptr, nullptr, nullptr, nullptr }
184 : };
185 : #if defined(__clang__)
186 : #pragma clang diagnostic pop
187 : #endif
188 :
189 :
190 : // Can't be const because the pref-enabled boolean needs to be writable
191 : static Prefable<const JSPropertySpec> sAttributes[] = {
192 : { nullptr, &sAttributes_specs[0] },
193 : { nullptr, nullptr }
194 : };
195 :
196 : static_assert(1 <= 1ull << NUM_BITS_PROPERTY_INFO_PREF_INDEX,
197 : "We have a prefable index that is >= (1 << NUM_BITS_PROPERTY_INFO_PREF_INDEX)");
198 : static_assert(4 <= 1ull << NUM_BITS_PROPERTY_INFO_SPEC_INDEX,
199 : "We have a spec index that is >= (1 << NUM_BITS_PROPERTY_INFO_SPEC_INDEX)");
200 :
201 :
202 : static uint16_t sNativeProperties_sortedPropertyIndices[4];
203 : static PropertyInfo sNativeProperties_propertyInfos[4];
204 :
205 : static const NativePropertiesN<1> sNativeProperties = {
206 : false, 0,
207 : false, 0,
208 : false, 0,
209 : true, 0 /* sAttributes */,
210 : false, 0,
211 : false, 0,
212 : false, 0,
213 : -1,
214 : 4,
215 : sNativeProperties_sortedPropertyIndices,
216 : {
217 : { sAttributes, &sNativeProperties_propertyInfos[0] }
218 : }
219 : };
220 : static_assert(4 < 1ull << CHAR_BIT * sizeof(sNativeProperties.propertyInfoCount),
221 : "We have a property info count that is oversized");
222 :
223 : static const DOMIfaceAndProtoJSClass sInterfaceObjectClass = {
224 : {
225 : "Function",
226 : JSCLASS_IS_DOMIFACEANDPROTOJSCLASS | JSCLASS_HAS_RESERVED_SLOTS(DOM_INTERFACE_SLOTS_BASE),
227 : &sBoringInterfaceObjectClassClassOps,
228 : JS_NULL_CLASS_SPEC,
229 : JS_NULL_CLASS_EXT,
230 : &sInterfaceObjectClassObjectOps
231 : },
232 : eInterface,
233 : true,
234 : prototypes::id::SVGEllipseElement,
235 : PrototypeTraits<prototypes::id::SVGEllipseElement>::Depth,
236 : sNativePropertyHooks,
237 : "function SVGEllipseElement() {\n [native code]\n}",
238 : SVGGraphicsElementBinding::GetConstructorObject
239 : };
240 :
241 : static const DOMIfaceAndProtoJSClass sPrototypeClass = {
242 : {
243 : "SVGEllipseElementPrototype",
244 : JSCLASS_IS_DOMIFACEANDPROTOJSCLASS | JSCLASS_HAS_RESERVED_SLOTS(DOM_INTERFACE_PROTO_SLOTS_BASE),
245 : JS_NULL_CLASS_OPS,
246 : JS_NULL_CLASS_SPEC,
247 : JS_NULL_CLASS_EXT,
248 : JS_NULL_OBJECT_OPS
249 : },
250 : eInterfacePrototype,
251 : false,
252 : prototypes::id::SVGEllipseElement,
253 : PrototypeTraits<prototypes::id::SVGEllipseElement>::Depth,
254 : sNativePropertyHooks,
255 : "[object SVGEllipseElementPrototype]",
256 : SVGGraphicsElementBinding::GetProtoObject
257 : };
258 :
259 : JSObject*
260 0 : DefineDOMInterface(JSContext* aCx, JS::Handle<JSObject*> aGlobal, JS::Handle<jsid> id, bool aDefineOnGlobal)
261 : {
262 0 : return GetConstructorObjectHandle(aCx, aDefineOnGlobal);
263 : }
264 :
265 : static const js::ClassOps sClassOps = {
266 : _addProperty, /* addProperty */
267 : nullptr, /* delProperty */
268 : nullptr, /* getProperty */
269 : nullptr, /* setProperty */
270 : nullptr, /* enumerate */
271 : nullptr, /* newEnumerate */
272 : nullptr, /* resolve */
273 : nullptr, /* mayResolve */
274 : _finalize, /* finalize */
275 : nullptr, /* call */
276 : nullptr, /* hasInstance */
277 : nullptr, /* construct */
278 : nullptr, /* trace */
279 : };
280 :
281 : static const js::ClassExtension sClassExtension = {
282 : nullptr, /* weakmapKeyDelegateOp */
283 : _objectMoved /* objectMovedOp */
284 : };
285 :
286 : static const DOMJSClass sClass = {
287 : { "SVGEllipseElement",
288 : JSCLASS_IS_DOMJSCLASS | JSCLASS_FOREGROUND_FINALIZE | JSCLASS_HAS_RESERVED_SLOTS(1),
289 : &sClassOps,
290 : JS_NULL_CLASS_SPEC,
291 : &sClassExtension,
292 : JS_NULL_OBJECT_OPS
293 : },
294 : { prototypes::id::EventTarget, prototypes::id::Node, prototypes::id::Element, prototypes::id::SVGElement, prototypes::id::SVGGraphicsElement, prototypes::id::SVGEllipseElement, prototypes::id::_ID_Count, prototypes::id::_ID_Count },
295 : IsBaseOf<nsISupports, mozilla::dom::SVGEllipseElement >::value,
296 : sNativePropertyHooks,
297 : FindAssociatedGlobalForNative<mozilla::dom::SVGEllipseElement>::Get,
298 : GetProtoObjectHandle,
299 : GetCCParticipant<mozilla::dom::SVGEllipseElement>::Get()
300 : };
301 : static_assert(1 == DOM_INSTANCE_RESERVED_SLOTS,
302 : "Must have the right minimal number of reserved slots.");
303 : static_assert(1 >= 1,
304 : "Must have enough reserved slots.");
305 :
306 : const JSClass*
307 0 : GetJSClass()
308 : {
309 0 : return sClass.ToJSClass();
310 : }
311 :
312 : bool
313 0 : Wrap(JSContext* aCx, mozilla::dom::SVGEllipseElement* aObject, nsWrapperCache* aCache, JS::Handle<JSObject*> aGivenProto, JS::MutableHandle<JSObject*> aReflector)
314 : {
315 : MOZ_ASSERT(static_cast<mozilla::dom::SVGEllipseElement*>(aObject) ==
316 : reinterpret_cast<mozilla::dom::SVGEllipseElement*>(aObject),
317 : "Multiple inheritance for mozilla::dom::SVGEllipseElement is broken.");
318 : MOZ_ASSERT(static_cast<mozilla::dom::SVGGraphicsElement*>(aObject) ==
319 : reinterpret_cast<mozilla::dom::SVGGraphicsElement*>(aObject),
320 : "Multiple inheritance for mozilla::dom::SVGGraphicsElement is broken.");
321 : MOZ_ASSERT(static_cast<nsSVGElement*>(aObject) ==
322 : reinterpret_cast<nsSVGElement*>(aObject),
323 : "Multiple inheritance for nsSVGElement is broken.");
324 : MOZ_ASSERT(static_cast<mozilla::dom::Element*>(aObject) ==
325 : reinterpret_cast<mozilla::dom::Element*>(aObject),
326 : "Multiple inheritance for mozilla::dom::Element is broken.");
327 : MOZ_ASSERT(static_cast<nsINode*>(aObject) ==
328 : reinterpret_cast<nsINode*>(aObject),
329 : "Multiple inheritance for nsINode is broken.");
330 : MOZ_ASSERT(static_cast<mozilla::dom::EventTarget*>(aObject) ==
331 : reinterpret_cast<mozilla::dom::EventTarget*>(aObject),
332 : "Multiple inheritance for mozilla::dom::EventTarget is broken.");
333 0 : MOZ_ASSERT(ToSupportsIsCorrect(aObject));
334 0 : MOZ_ASSERT_IF(aGivenProto, js::IsObjectInContextCompartment(aGivenProto, aCx));
335 0 : MOZ_ASSERT(!aCache->GetWrapper(),
336 : "You should probably not be using Wrap() directly; use "
337 : "GetOrCreateDOMReflector instead");
338 :
339 0 : MOZ_ASSERT(ToSupportsIsOnPrimaryInheritanceChain(aObject, aCache),
340 : "nsISupports must be on our primary inheritance chain");
341 :
342 0 : JS::Rooted<JSObject*> global(aCx, FindAssociatedGlobal(aCx, aObject->GetParentObject()));
343 0 : if (!global) {
344 0 : return false;
345 : }
346 0 : MOZ_ASSERT(JS_IsGlobalObject(global));
347 0 : MOZ_ASSERT(JS::ObjectIsNotGray(global));
348 :
349 : // That might have ended up wrapping us already, due to the wonders
350 : // of XBL. Check for that, and bail out as needed.
351 0 : aReflector.set(aCache->GetWrapper());
352 0 : if (aReflector) {
353 : #ifdef DEBUG
354 0 : binding_detail::AssertReflectorHasGivenProto(aCx, aReflector, aGivenProto);
355 : #endif // DEBUG
356 0 : return true;
357 : }
358 :
359 0 : JSAutoCompartment ac(aCx, global);
360 0 : JS::Handle<JSObject*> canonicalProto = GetProtoObjectHandle(aCx);
361 0 : if (!canonicalProto) {
362 0 : return false;
363 : }
364 0 : JS::Rooted<JSObject*> proto(aCx);
365 0 : if (aGivenProto) {
366 0 : proto = aGivenProto;
367 : // Unfortunately, while aGivenProto was in the compartment of aCx
368 : // coming in, we changed compartments to that of "parent" so may need
369 : // to wrap the proto here.
370 0 : if (js::GetContextCompartment(aCx) != js::GetObjectCompartment(proto)) {
371 0 : if (!JS_WrapObject(aCx, &proto)) {
372 0 : return false;
373 : }
374 : }
375 : } else {
376 0 : proto = canonicalProto;
377 : }
378 :
379 0 : BindingJSObjectCreator<mozilla::dom::SVGEllipseElement> creator(aCx);
380 0 : creator.CreateObject(aCx, sClass.ToJSClass(), proto, aObject, aReflector);
381 0 : if (!aReflector) {
382 0 : return false;
383 : }
384 :
385 0 : aCache->SetWrapper(aReflector);
386 0 : creator.InitializationSucceeded();
387 :
388 0 : MOZ_ASSERT(aCache->GetWrapperPreserveColor() &&
389 : aCache->GetWrapperPreserveColor() == aReflector);
390 : // If proto != canonicalProto, we have to preserve our wrapper;
391 : // otherwise we won't be able to properly recreate it later, since
392 : // we won't know what proto to use. Note that we don't check
393 : // aGivenProto here, since it's entirely possible (and even
394 : // somewhat common) to have a non-null aGivenProto which is the
395 : // same as canonicalProto.
396 0 : if (proto != canonicalProto) {
397 0 : PreserveWrapper(aObject);
398 : }
399 :
400 0 : return true;
401 : }
402 :
403 : const NativePropertyHooks sNativePropertyHooks[] = { {
404 : nullptr,
405 : nullptr,
406 : nullptr,
407 : { sNativeProperties.Upcast(), nullptr },
408 : prototypes::id::SVGEllipseElement,
409 : constructors::id::SVGEllipseElement,
410 : SVGGraphicsElementBinding::sNativePropertyHooks,
411 : &DefaultXrayExpandoObjectClass
412 : } };
413 :
414 : void
415 0 : CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, bool aDefineOnGlobal)
416 : {
417 0 : JS::Handle<JSObject*> parentProto(SVGGraphicsElementBinding::GetProtoObjectHandle(aCx));
418 0 : if (!parentProto) {
419 0 : return;
420 : }
421 :
422 0 : JS::Handle<JSObject*> constructorProto(SVGGraphicsElementBinding::GetConstructorObjectHandle(aCx));
423 0 : if (!constructorProto) {
424 0 : return;
425 : }
426 :
427 : static bool sIdsInited = false;
428 0 : if (!sIdsInited && NS_IsMainThread()) {
429 0 : if (!InitIds(aCx, sNativeProperties.Upcast())) {
430 0 : return;
431 : }
432 0 : sIdsInited = true;
433 : }
434 :
435 0 : JS::Heap<JSObject*>* protoCache = &aProtoAndIfaceCache.EntrySlotOrCreate(prototypes::id::SVGEllipseElement);
436 0 : JS::Heap<JSObject*>* interfaceCache = &aProtoAndIfaceCache.EntrySlotOrCreate(constructors::id::SVGEllipseElement);
437 0 : dom::CreateInterfaceObjects(aCx, aGlobal, parentProto,
438 : &sPrototypeClass.mBase, protoCache,
439 : constructorProto, &sInterfaceObjectClass.mBase, 0, nullptr,
440 : interfaceCache,
441 : sNativeProperties.Upcast(),
442 : nullptr,
443 : "SVGEllipseElement", aDefineOnGlobal,
444 : nullptr,
445 0 : false);
446 : }
447 :
448 : JS::Handle<JSObject*>
449 0 : GetProtoObjectHandle(JSContext* aCx)
450 : {
451 : /* Get the interface prototype object for this class. This will create the
452 : object as needed. */
453 0 : bool aDefineOnGlobal = true;
454 :
455 : /* Make sure our global is sane. Hopefully we can remove this sometime */
456 0 : JSObject* global = JS::CurrentGlobalOrNull(aCx);
457 0 : if (!(js::GetObjectClass(global)->flags & JSCLASS_DOM_GLOBAL)) {
458 0 : return nullptr;
459 : }
460 :
461 : /* Check to see whether the interface objects are already installed */
462 0 : ProtoAndIfaceCache& protoAndIfaceCache = *GetProtoAndIfaceCache(global);
463 0 : if (!protoAndIfaceCache.HasEntryInSlot(prototypes::id::SVGEllipseElement)) {
464 0 : JS::Rooted<JSObject*> rootedGlobal(aCx, global);
465 0 : CreateInterfaceObjects(aCx, rootedGlobal, protoAndIfaceCache, aDefineOnGlobal);
466 : }
467 :
468 : /*
469 : * The object might _still_ be null, but that's OK.
470 : *
471 : * Calling fromMarkedLocation() is safe because protoAndIfaceCache is
472 : * traced by TraceProtoAndIfaceCache() and its contents are never
473 : * changed after they have been set.
474 : *
475 : * Calling address() avoids the read read barrier that does gray
476 : * unmarking, but it's not possible for the object to be gray here.
477 : */
478 :
479 0 : const JS::Heap<JSObject*>& entrySlot = protoAndIfaceCache.EntrySlotMustExist(prototypes::id::SVGEllipseElement);
480 0 : MOZ_ASSERT(JS::ObjectIsNotGray(entrySlot));
481 0 : return JS::Handle<JSObject*>::fromMarkedLocation(entrySlot.address());
482 : }
483 :
484 : JS::Handle<JSObject*>
485 0 : GetConstructorObjectHandle(JSContext* aCx, bool aDefineOnGlobal)
486 : {
487 : /* Get the interface object for this class. This will create the object as
488 : needed. */
489 :
490 : /* Make sure our global is sane. Hopefully we can remove this sometime */
491 0 : JSObject* global = JS::CurrentGlobalOrNull(aCx);
492 0 : if (!(js::GetObjectClass(global)->flags & JSCLASS_DOM_GLOBAL)) {
493 0 : return nullptr;
494 : }
495 :
496 : /* Check to see whether the interface objects are already installed */
497 0 : ProtoAndIfaceCache& protoAndIfaceCache = *GetProtoAndIfaceCache(global);
498 0 : if (!protoAndIfaceCache.HasEntryInSlot(constructors::id::SVGEllipseElement)) {
499 0 : JS::Rooted<JSObject*> rootedGlobal(aCx, global);
500 0 : CreateInterfaceObjects(aCx, rootedGlobal, protoAndIfaceCache, aDefineOnGlobal);
501 : }
502 :
503 : /*
504 : * The object might _still_ be null, but that's OK.
505 : *
506 : * Calling fromMarkedLocation() is safe because protoAndIfaceCache is
507 : * traced by TraceProtoAndIfaceCache() and its contents are never
508 : * changed after they have been set.
509 : *
510 : * Calling address() avoids the read read barrier that does gray
511 : * unmarking, but it's not possible for the object to be gray here.
512 : */
513 :
514 0 : const JS::Heap<JSObject*>& entrySlot = protoAndIfaceCache.EntrySlotMustExist(constructors::id::SVGEllipseElement);
515 0 : MOZ_ASSERT(JS::ObjectIsNotGray(entrySlot));
516 0 : return JS::Handle<JSObject*>::fromMarkedLocation(entrySlot.address());
517 : }
518 :
519 : JSObject*
520 0 : GetConstructorObject(JSContext* aCx)
521 : {
522 0 : return GetConstructorObjectHandle(aCx);
523 : }
524 :
525 : } // namespace SVGEllipseElementBinding
526 :
527 :
528 :
529 : } // namespace dom
530 : } // namespace mozilla
|