/work/obj-fuzz/dom/bindings/SVGLinearGradientElementBinding.cpp
Line | Count | Source (jump to first uncovered line) |
1 | | /* THIS FILE IS AUTOGENERATED FROM SVGLinearGradientElement.webidl BY Codegen.py - DO NOT EDIT */ |
2 | | |
3 | | #include "SVGGradientElementBinding.h" |
4 | | #include "SVGLinearGradientElementBinding.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 SVGLinearGradientElement_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_x1(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SVGLinearGradientElement* self, JSJitGetterCallArgs args) |
28 | 0 | { |
29 | 0 | AUTO_PROFILER_LABEL_FAST("get SVGLinearGradientElement.x1", DOM, cx); |
30 | 0 |
|
31 | 0 | auto result(StrongOrRawPtr<mozilla::dom::SVGAnimatedLength>(self->X1())); |
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 x1_getterinfo = { |
41 | | { (JSJitGetterOp)get_x1 }, |
42 | | { prototypes::id::SVGLinearGradientElement }, |
43 | | { PrototypeTraits<prototypes::id::SVGLinearGradientElement>::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_y1(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SVGLinearGradientElement* self, JSJitGetterCallArgs args) |
60 | 0 | { |
61 | 0 | AUTO_PROFILER_LABEL_FAST("get SVGLinearGradientElement.y1", DOM, cx); |
62 | 0 |
|
63 | 0 | auto result(StrongOrRawPtr<mozilla::dom::SVGAnimatedLength>(self->Y1())); |
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 y1_getterinfo = { |
73 | | { (JSJitGetterOp)get_y1 }, |
74 | | { prototypes::id::SVGLinearGradientElement }, |
75 | | { PrototypeTraits<prototypes::id::SVGLinearGradientElement>::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_x2(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SVGLinearGradientElement* self, JSJitGetterCallArgs args) |
92 | 0 | { |
93 | 0 | AUTO_PROFILER_LABEL_FAST("get SVGLinearGradientElement.x2", DOM, cx); |
94 | 0 |
|
95 | 0 | auto result(StrongOrRawPtr<mozilla::dom::SVGAnimatedLength>(self->X2())); |
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 x2_getterinfo = { |
105 | | { (JSJitGetterOp)get_x2 }, |
106 | | { prototypes::id::SVGLinearGradientElement }, |
107 | | { PrototypeTraits<prototypes::id::SVGLinearGradientElement>::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_y2(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SVGLinearGradientElement* self, JSJitGetterCallArgs args) |
124 | 0 | { |
125 | 0 | AUTO_PROFILER_LABEL_FAST("get SVGLinearGradientElement.y2", DOM, cx); |
126 | 0 |
|
127 | 0 | auto result(StrongOrRawPtr<mozilla::dom::SVGAnimatedLength>(self->Y2())); |
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 y2_getterinfo = { |
137 | | { (JSJitGetterOp)get_y2 }, |
138 | | { prototypes::id::SVGLinearGradientElement }, |
139 | | { PrototypeTraits<prototypes::id::SVGLinearGradientElement>::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 | | static bool |
155 | | _addProperty(JSContext* cx, JS::Handle<JSObject*> obj, JS::Handle<jsid> id, JS::Handle<JS::Value> val) |
156 | 0 | { |
157 | 0 | mozilla::dom::SVGLinearGradientElement* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::dom::SVGLinearGradientElement>(obj); |
158 | 0 | // We don't want to preserve if we don't have a wrapper, and we |
159 | 0 | // obviously can't preserve if we're not initialized. |
160 | 0 | if (self && self->GetWrapperPreserveColor()) { |
161 | 0 | PreserveWrapper(self); |
162 | 0 | } |
163 | 0 | return true; |
164 | 0 | } |
165 | | |
166 | | static void |
167 | | _finalize(js::FreeOp* fop, JSObject* obj) |
168 | 0 | { |
169 | 0 | mozilla::dom::SVGLinearGradientElement* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::dom::SVGLinearGradientElement>(obj); |
170 | 0 | if (self) { |
171 | 0 | ClearWrapper(self, self, obj); |
172 | 0 | AddForDeferredFinalization<mozilla::dom::SVGLinearGradientElement>(self); |
173 | 0 | } |
174 | 0 | } |
175 | | |
176 | | static size_t |
177 | | _objectMoved(JSObject* obj, JSObject* old) |
178 | 0 | { |
179 | 0 | mozilla::dom::SVGLinearGradientElement* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::dom::SVGLinearGradientElement>(obj); |
180 | 0 | if (self) { |
181 | 0 | UpdateWrapper(self, self, obj, old); |
182 | 0 | } |
183 | 0 |
|
184 | 0 | return 0; |
185 | 0 | } |
186 | | |
187 | | // We deliberately use brace-elision to make Visual Studio produce better initalization code. |
188 | | #if defined(__clang__) |
189 | | #pragma clang diagnostic push |
190 | | #pragma clang diagnostic ignored "-Wmissing-braces" |
191 | | #endif |
192 | | static const JSPropertySpec sAttributes_specs[] = { |
193 | | { "x1", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &x1_getterinfo, nullptr, nullptr }, |
194 | | { "y1", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &y1_getterinfo, nullptr, nullptr }, |
195 | | { "x2", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &x2_getterinfo, nullptr, nullptr }, |
196 | | { "y2", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &y2_getterinfo, nullptr, nullptr }, |
197 | | { nullptr, 0, nullptr, nullptr, nullptr, nullptr } |
198 | | }; |
199 | | #if defined(__clang__) |
200 | | #pragma clang diagnostic pop |
201 | | #endif |
202 | | |
203 | | |
204 | | static const Prefable<const JSPropertySpec> sAttributes[] = { |
205 | | { nullptr, &sAttributes_specs[0] }, |
206 | | { nullptr, nullptr } |
207 | | }; |
208 | | |
209 | | static_assert(1 <= 1ull << NUM_BITS_PROPERTY_INFO_PREF_INDEX, |
210 | | "We have a prefable index that is >= (1 << NUM_BITS_PROPERTY_INFO_PREF_INDEX)"); |
211 | | static_assert(4 <= 1ull << NUM_BITS_PROPERTY_INFO_SPEC_INDEX, |
212 | | "We have a spec index that is >= (1 << NUM_BITS_PROPERTY_INFO_SPEC_INDEX)"); |
213 | | |
214 | | |
215 | | static uint16_t sNativeProperties_sortedPropertyIndices[4]; |
216 | | static PropertyInfo sNativeProperties_propertyInfos[4]; |
217 | | |
218 | | static const NativePropertiesN<1> sNativeProperties = { |
219 | | false, 0, |
220 | | false, 0, |
221 | | false, 0, |
222 | | true, 0 /* sAttributes */, |
223 | | false, 0, |
224 | | false, 0, |
225 | | false, 0, |
226 | | -1, |
227 | | 4, |
228 | | sNativeProperties_sortedPropertyIndices, |
229 | | { |
230 | | { sAttributes, &sNativeProperties_propertyInfos[0] } |
231 | | } |
232 | | }; |
233 | | static_assert(4 < 1ull << CHAR_BIT * sizeof(sNativeProperties.propertyInfoCount), |
234 | | "We have a property info count that is oversized"); |
235 | | |
236 | | static const DOMIfaceAndProtoJSClass sInterfaceObjectClass = { |
237 | | { |
238 | | "Function", |
239 | | JSCLASS_IS_DOMIFACEANDPROTOJSCLASS | JSCLASS_HAS_RESERVED_SLOTS(DOM_INTERFACE_SLOTS_BASE), |
240 | | &sBoringInterfaceObjectClassClassOps, |
241 | | JS_NULL_CLASS_SPEC, |
242 | | JS_NULL_CLASS_EXT, |
243 | | &sInterfaceObjectClassObjectOps |
244 | | }, |
245 | | eInterface, |
246 | | true, |
247 | | prototypes::id::SVGLinearGradientElement, |
248 | | PrototypeTraits<prototypes::id::SVGLinearGradientElement>::Depth, |
249 | | sNativePropertyHooks, |
250 | | "function SVGLinearGradientElement() {\n [native code]\n}", |
251 | | SVGGradientElement_Binding::GetConstructorObject |
252 | | }; |
253 | | |
254 | | static const DOMIfaceAndProtoJSClass sPrototypeClass = { |
255 | | { |
256 | | "SVGLinearGradientElementPrototype", |
257 | | JSCLASS_IS_DOMIFACEANDPROTOJSCLASS | JSCLASS_HAS_RESERVED_SLOTS(DOM_INTERFACE_PROTO_SLOTS_BASE), |
258 | | JS_NULL_CLASS_OPS, |
259 | | JS_NULL_CLASS_SPEC, |
260 | | JS_NULL_CLASS_EXT, |
261 | | JS_NULL_OBJECT_OPS |
262 | | }, |
263 | | eInterfacePrototype, |
264 | | false, |
265 | | prototypes::id::SVGLinearGradientElement, |
266 | | PrototypeTraits<prototypes::id::SVGLinearGradientElement>::Depth, |
267 | | sNativePropertyHooks, |
268 | | "[object SVGLinearGradientElementPrototype]", |
269 | | SVGGradientElement_Binding::GetProtoObject |
270 | | }; |
271 | | |
272 | | static const js::ClassOps sClassOps = { |
273 | | _addProperty, /* addProperty */ |
274 | | nullptr, /* delProperty */ |
275 | | nullptr, /* enumerate */ |
276 | | nullptr, /* newEnumerate */ |
277 | | nullptr, /* resolve */ |
278 | | nullptr, /* mayResolve */ |
279 | | _finalize, /* finalize */ |
280 | | nullptr, /* call */ |
281 | | nullptr, /* hasInstance */ |
282 | | nullptr, /* construct */ |
283 | | nullptr, /* trace */ |
284 | | }; |
285 | | |
286 | | static const js::ClassExtension sClassExtension = { |
287 | | nullptr, /* weakmapKeyDelegateOp */ |
288 | | _objectMoved /* objectMovedOp */ |
289 | | }; |
290 | | |
291 | | static const DOMJSClass sClass = { |
292 | | { "SVGLinearGradientElement", |
293 | | JSCLASS_IS_DOMJSCLASS | JSCLASS_FOREGROUND_FINALIZE | JSCLASS_HAS_RESERVED_SLOTS(1), |
294 | | &sClassOps, |
295 | | JS_NULL_CLASS_SPEC, |
296 | | &sClassExtension, |
297 | | JS_NULL_OBJECT_OPS |
298 | | }, |
299 | | { prototypes::id::EventTarget, prototypes::id::Node, prototypes::id::Element, prototypes::id::SVGElement, prototypes::id::SVGGradientElement, prototypes::id::SVGLinearGradientElement, prototypes::id::_ID_Count, prototypes::id::_ID_Count }, |
300 | | IsBaseOf<nsISupports, mozilla::dom::SVGLinearGradientElement >::value, |
301 | | sNativePropertyHooks, |
302 | | FindAssociatedGlobalForNative<mozilla::dom::SVGLinearGradientElement>::Get, |
303 | | GetProtoObjectHandle, |
304 | | GetCCParticipant<mozilla::dom::SVGLinearGradientElement>::Get() |
305 | | }; |
306 | | static_assert(1 == DOM_INSTANCE_RESERVED_SLOTS, |
307 | | "Must have the right minimal number of reserved slots."); |
308 | | static_assert(1 >= 1, |
309 | | "Must have enough reserved slots."); |
310 | | |
311 | | const JSClass* |
312 | | GetJSClass() |
313 | 0 | { |
314 | 0 | return sClass.ToJSClass(); |
315 | 0 | } |
316 | | |
317 | | bool |
318 | | Wrap(JSContext* aCx, mozilla::dom::SVGLinearGradientElement* aObject, nsWrapperCache* aCache, JS::Handle<JSObject*> aGivenProto, JS::MutableHandle<JSObject*> aReflector) |
319 | 0 | { |
320 | 0 | static_assert(!IsBaseOf<NonRefcountedDOMObject, mozilla::dom::SVGLinearGradientElement>::value, |
321 | 0 | "Shouldn't have wrappercached things that are not refcounted."); |
322 | 0 | MOZ_ASSERT(static_cast<mozilla::dom::SVGLinearGradientElement*>(aObject) == |
323 | 0 | reinterpret_cast<mozilla::dom::SVGLinearGradientElement*>(aObject), |
324 | 0 | "Multiple inheritance for mozilla::dom::SVGLinearGradientElement is broken."); |
325 | 0 | MOZ_ASSERT(static_cast<mozilla::dom::SVGGradientElement*>(aObject) == |
326 | 0 | reinterpret_cast<mozilla::dom::SVGGradientElement*>(aObject), |
327 | 0 | "Multiple inheritance for mozilla::dom::SVGGradientElement is broken."); |
328 | 0 | MOZ_ASSERT(static_cast<nsSVGElement*>(aObject) == |
329 | 0 | reinterpret_cast<nsSVGElement*>(aObject), |
330 | 0 | "Multiple inheritance for nsSVGElement is broken."); |
331 | 0 | MOZ_ASSERT(static_cast<mozilla::dom::Element*>(aObject) == |
332 | 0 | reinterpret_cast<mozilla::dom::Element*>(aObject), |
333 | 0 | "Multiple inheritance for mozilla::dom::Element is broken."); |
334 | 0 | MOZ_ASSERT(static_cast<nsINode*>(aObject) == |
335 | 0 | reinterpret_cast<nsINode*>(aObject), |
336 | 0 | "Multiple inheritance for nsINode is broken."); |
337 | 0 | MOZ_ASSERT(static_cast<mozilla::dom::EventTarget*>(aObject) == |
338 | 0 | reinterpret_cast<mozilla::dom::EventTarget*>(aObject), |
339 | 0 | "Multiple inheritance for mozilla::dom::EventTarget is broken."); |
340 | 0 | MOZ_ASSERT(ToSupportsIsCorrect(aObject)); |
341 | 0 | MOZ_ASSERT_IF(aGivenProto, js::IsObjectInContextCompartment(aGivenProto, aCx)); |
342 | 0 | MOZ_ASSERT(!aCache->GetWrapper(), |
343 | 0 | "You should probably not be using Wrap() directly; use " |
344 | 0 | "GetOrCreateDOMReflector instead"); |
345 | 0 |
|
346 | 0 | MOZ_ASSERT(ToSupportsIsOnPrimaryInheritanceChain(aObject, aCache), |
347 | 0 | "nsISupports must be on our primary inheritance chain"); |
348 | 0 |
|
349 | 0 | JS::Rooted<JSObject*> global(aCx, FindAssociatedGlobal(aCx, aObject->GetParentObject())); |
350 | 0 | if (!global) { |
351 | 0 | return false; |
352 | 0 | } |
353 | 0 | MOZ_ASSERT(JS_IsGlobalObject(global)); |
354 | 0 | MOZ_ASSERT(JS::ObjectIsNotGray(global)); |
355 | 0 |
|
356 | 0 | // That might have ended up wrapping us already, due to the wonders |
357 | 0 | // of XBL. Check for that, and bail out as needed. |
358 | 0 | aReflector.set(aCache->GetWrapper()); |
359 | 0 | if (aReflector) { |
360 | | #ifdef DEBUG |
361 | | AssertReflectorHasGivenProto(aCx, aReflector, aGivenProto); |
362 | | #endif // DEBUG |
363 | | return true; |
364 | 0 | } |
365 | 0 |
|
366 | 0 | JSAutoRealm ar(aCx, global); |
367 | 0 | JS::Handle<JSObject*> canonicalProto = GetProtoObjectHandle(aCx); |
368 | 0 | if (!canonicalProto) { |
369 | 0 | return false; |
370 | 0 | } |
371 | 0 | JS::Rooted<JSObject*> proto(aCx); |
372 | 0 | if (aGivenProto) { |
373 | 0 | proto = aGivenProto; |
374 | 0 | // Unfortunately, while aGivenProto was in the compartment of aCx |
375 | 0 | // coming in, we changed compartments to that of "parent" so may need |
376 | 0 | // to wrap the proto here. |
377 | 0 | if (js::GetContextCompartment(aCx) != js::GetObjectCompartment(proto)) { |
378 | 0 | if (!JS_WrapObject(aCx, &proto)) { |
379 | 0 | return false; |
380 | 0 | } |
381 | 0 | } |
382 | 0 | } else { |
383 | 0 | proto = canonicalProto; |
384 | 0 | } |
385 | 0 |
|
386 | 0 | BindingJSObjectCreator<mozilla::dom::SVGLinearGradientElement> creator(aCx); |
387 | 0 | creator.CreateObject(aCx, sClass.ToJSClass(), proto, aObject, aReflector); |
388 | 0 | if (!aReflector) { |
389 | 0 | return false; |
390 | 0 | } |
391 | 0 | |
392 | 0 | aCache->SetWrapper(aReflector); |
393 | 0 | creator.InitializationSucceeded(); |
394 | 0 |
|
395 | 0 | MOZ_ASSERT(aCache->GetWrapperPreserveColor() && |
396 | 0 | aCache->GetWrapperPreserveColor() == aReflector); |
397 | 0 | // If proto != canonicalProto, we have to preserve our wrapper; |
398 | 0 | // otherwise we won't be able to properly recreate it later, since |
399 | 0 | // we won't know what proto to use. Note that we don't check |
400 | 0 | // aGivenProto here, since it's entirely possible (and even |
401 | 0 | // somewhat common) to have a non-null aGivenProto which is the |
402 | 0 | // same as canonicalProto. |
403 | 0 | if (proto != canonicalProto) { |
404 | 0 | PreserveWrapper(aObject); |
405 | 0 | } |
406 | 0 |
|
407 | 0 | return true; |
408 | 0 | } |
409 | | |
410 | | const NativePropertyHooks sNativePropertyHooks[] = { { |
411 | | nullptr, |
412 | | nullptr, |
413 | | nullptr, |
414 | | { sNativeProperties.Upcast(), nullptr }, |
415 | | prototypes::id::SVGLinearGradientElement, |
416 | | constructors::id::SVGLinearGradientElement, |
417 | | SVGGradientElement_Binding::sNativePropertyHooks, |
418 | | &DefaultXrayExpandoObjectClass |
419 | | } }; |
420 | | |
421 | | void |
422 | | CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, bool aDefineOnGlobal) |
423 | 0 | { |
424 | 0 | JS::Handle<JSObject*> parentProto(SVGGradientElement_Binding::GetProtoObjectHandle(aCx)); |
425 | 0 | if (!parentProto) { |
426 | 0 | return; |
427 | 0 | } |
428 | 0 | |
429 | 0 | JS::Handle<JSObject*> constructorProto(SVGGradientElement_Binding::GetConstructorObjectHandle(aCx)); |
430 | 0 | if (!constructorProto) { |
431 | 0 | return; |
432 | 0 | } |
433 | 0 | |
434 | 0 | static bool sIdsInited = false; |
435 | 0 | if (!sIdsInited && NS_IsMainThread()) { |
436 | 0 | if (!InitIds(aCx, sNativeProperties.Upcast())) { |
437 | 0 | return; |
438 | 0 | } |
439 | 0 | sIdsInited = true; |
440 | 0 | } |
441 | 0 |
|
442 | 0 | JS::Heap<JSObject*>* protoCache = &aProtoAndIfaceCache.EntrySlotOrCreate(prototypes::id::SVGLinearGradientElement); |
443 | 0 | JS::Heap<JSObject*>* interfaceCache = &aProtoAndIfaceCache.EntrySlotOrCreate(constructors::id::SVGLinearGradientElement); |
444 | 0 | dom::CreateInterfaceObjects(aCx, aGlobal, parentProto, |
445 | 0 | &sPrototypeClass.mBase, protoCache, |
446 | 0 | nullptr, |
447 | 0 | constructorProto, &sInterfaceObjectClass.mBase, 0, nullptr, |
448 | 0 | interfaceCache, |
449 | 0 | sNativeProperties.Upcast(), |
450 | 0 | nullptr, |
451 | 0 | "SVGLinearGradientElement", aDefineOnGlobal, |
452 | 0 | nullptr, |
453 | 0 | false); |
454 | 0 | } |
455 | | |
456 | | JSObject* |
457 | | GetConstructorObject(JSContext* aCx) |
458 | 0 | { |
459 | 0 | return GetConstructorObjectHandle(aCx); |
460 | 0 | } |
461 | | |
462 | | } // namespace SVGLinearGradientElement_Binding |
463 | | |
464 | | |
465 | | |
466 | | } // namespace dom |
467 | | } // namespace mozilla |