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