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