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