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