/work/obj-fuzz/dom/bindings/SVGPathElementBinding.cpp
Line | Count | Source (jump to first uncovered line) |
1 | | /* THIS FILE IS AUTOGENERATED FROM SVGPathElement.webidl BY Codegen.py - DO NOT EDIT */ |
2 | | |
3 | | #include "DOMSVGPathSegList.h" |
4 | | #include "SVGGeometryElementBinding.h" |
5 | | #include "SVGPathElementBinding.h" |
6 | | #include "WrapperFactory.h" |
7 | | #include "mozilla/FloatingPoint.h" |
8 | | #include "mozilla/OwningNonNull.h" |
9 | | #include "mozilla/dom/BindingUtils.h" |
10 | | #include "mozilla/dom/DOMJSClass.h" |
11 | | #include "mozilla/dom/NonRefcountedDOMObject.h" |
12 | | #include "mozilla/dom/PrimitiveConversions.h" |
13 | | #include "mozilla/dom/SVGPathElement.h" |
14 | | #include "mozilla/dom/XrayExpandoClass.h" |
15 | | |
16 | | namespace mozilla { |
17 | | namespace dom { |
18 | | |
19 | | namespace binding_detail {}; // Just to make sure it's known as a namespace |
20 | | using namespace mozilla::dom::binding_detail; |
21 | | |
22 | | |
23 | | namespace SVGPathElement_Binding { |
24 | | |
25 | | static_assert(IsRefcounted<NativeType>::value == IsRefcounted<SVGGeometryElement_Binding::NativeType>::value, |
26 | | "Can't inherit from an interface with a different ownership model."); |
27 | | |
28 | | MOZ_CAN_RUN_SCRIPT static bool |
29 | | getPathSegAtLength(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SVGPathElement* self, const JSJitMethodCallArgs& args) |
30 | 0 | { |
31 | 0 | AUTO_PROFILER_LABEL_FAST("SVGPathElement.getPathSegAtLength", DOM, cx); |
32 | 0 |
|
33 | 0 | if (MOZ_UNLIKELY(args.length() < 1)) { |
34 | 0 | return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "SVGPathElement.getPathSegAtLength"); |
35 | 0 | } |
36 | 0 | float arg0; |
37 | 0 | if (!ValueToPrimitive<float, eDefault>(cx, args[0], &arg0)) { |
38 | 0 | return false; |
39 | 0 | } else if (!mozilla::IsFinite(arg0)) { |
40 | 0 | ThrowErrorMessage(cx, MSG_NOT_FINITE, "Argument 1 of SVGPathElement.getPathSegAtLength"); |
41 | 0 | return false; |
42 | 0 | } |
43 | 0 | uint32_t result(self->GetPathSegAtLength(arg0)); |
44 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
45 | 0 | args.rval().setNumber(result); |
46 | 0 | return true; |
47 | 0 | } |
48 | | |
49 | | static const JSJitInfo getPathSegAtLength_methodinfo = { |
50 | | { (JSJitGetterOp)getPathSegAtLength }, |
51 | | { prototypes::id::SVGPathElement }, |
52 | | { PrototypeTraits<prototypes::id::SVGPathElement>::Depth }, |
53 | | JSJitInfo::Method, |
54 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
55 | | JSVAL_TYPE_DOUBLE, /* returnType. Not relevant for setters. */ |
56 | | false, /* isInfallible. False in setters. */ |
57 | | false, /* isMovable. Not relevant for setters. */ |
58 | | false, /* isEliminatable. Not relevant for setters. */ |
59 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
60 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
61 | | false, /* isTypedMethod. Only relevant for methods. */ |
62 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
63 | | }; |
64 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
65 | | static_assert(0 < 1, "There is no slot for us"); |
66 | | |
67 | | MOZ_CAN_RUN_SCRIPT static bool |
68 | | get_pathSegList(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SVGPathElement* self, JSJitGetterCallArgs args) |
69 | 0 | { |
70 | 0 | AUTO_PROFILER_LABEL_FAST("get SVGPathElement.pathSegList", DOM, cx); |
71 | 0 |
|
72 | 0 | auto result(StrongOrRawPtr<mozilla::DOMSVGPathSegList>(self->PathSegList())); |
73 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
74 | 0 | if (!GetOrCreateDOMReflector(cx, result, args.rval())) { |
75 | 0 | MOZ_ASSERT(JS_IsExceptionPending(cx)); |
76 | 0 | return false; |
77 | 0 | } |
78 | 0 | return true; |
79 | 0 | } |
80 | | |
81 | | static const JSJitInfo pathSegList_getterinfo = { |
82 | | { (JSJitGetterOp)get_pathSegList }, |
83 | | { prototypes::id::SVGPathElement }, |
84 | | { PrototypeTraits<prototypes::id::SVGPathElement>::Depth }, |
85 | | JSJitInfo::Getter, |
86 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
87 | | JSVAL_TYPE_OBJECT, /* returnType. Not relevant for setters. */ |
88 | | false, /* isInfallible. False in setters. */ |
89 | | false, /* isMovable. Not relevant for setters. */ |
90 | | false, /* isEliminatable. Not relevant for setters. */ |
91 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
92 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
93 | | false, /* isTypedMethod. Only relevant for methods. */ |
94 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
95 | | }; |
96 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
97 | | static_assert(0 < 1, "There is no slot for us"); |
98 | | |
99 | | MOZ_CAN_RUN_SCRIPT static bool |
100 | | get_animatedPathSegList(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SVGPathElement* self, JSJitGetterCallArgs args) |
101 | 0 | { |
102 | 0 | AUTO_PROFILER_LABEL_FAST("get SVGPathElement.animatedPathSegList", DOM, cx); |
103 | 0 |
|
104 | 0 | auto result(StrongOrRawPtr<mozilla::DOMSVGPathSegList>(self->AnimatedPathSegList())); |
105 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
106 | 0 | if (!GetOrCreateDOMReflector(cx, result, args.rval())) { |
107 | 0 | MOZ_ASSERT(JS_IsExceptionPending(cx)); |
108 | 0 | return false; |
109 | 0 | } |
110 | 0 | return true; |
111 | 0 | } |
112 | | |
113 | | static const JSJitInfo animatedPathSegList_getterinfo = { |
114 | | { (JSJitGetterOp)get_animatedPathSegList }, |
115 | | { prototypes::id::SVGPathElement }, |
116 | | { PrototypeTraits<prototypes::id::SVGPathElement>::Depth }, |
117 | | JSJitInfo::Getter, |
118 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
119 | | JSVAL_TYPE_OBJECT, /* returnType. Not relevant for setters. */ |
120 | | false, /* isInfallible. False in setters. */ |
121 | | false, /* isMovable. Not relevant for setters. */ |
122 | | false, /* isEliminatable. Not relevant for setters. */ |
123 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
124 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
125 | | false, /* isTypedMethod. Only relevant for methods. */ |
126 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
127 | | }; |
128 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
129 | | static_assert(0 < 1, "There is no slot for us"); |
130 | | |
131 | | static bool |
132 | | _addProperty(JSContext* cx, JS::Handle<JSObject*> obj, JS::Handle<jsid> id, JS::Handle<JS::Value> val) |
133 | 0 | { |
134 | 0 | mozilla::dom::SVGPathElement* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::dom::SVGPathElement>(obj); |
135 | 0 | // We don't want to preserve if we don't have a wrapper, and we |
136 | 0 | // obviously can't preserve if we're not initialized. |
137 | 0 | if (self && self->GetWrapperPreserveColor()) { |
138 | 0 | PreserveWrapper(self); |
139 | 0 | } |
140 | 0 | return true; |
141 | 0 | } |
142 | | |
143 | | static void |
144 | | _finalize(js::FreeOp* fop, JSObject* obj) |
145 | 0 | { |
146 | 0 | mozilla::dom::SVGPathElement* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::dom::SVGPathElement>(obj); |
147 | 0 | if (self) { |
148 | 0 | ClearWrapper(self, self, obj); |
149 | 0 | AddForDeferredFinalization<mozilla::dom::SVGPathElement>(self); |
150 | 0 | } |
151 | 0 | } |
152 | | |
153 | | static size_t |
154 | | _objectMoved(JSObject* obj, JSObject* old) |
155 | 0 | { |
156 | 0 | mozilla::dom::SVGPathElement* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::dom::SVGPathElement>(obj); |
157 | 0 | if (self) { |
158 | 0 | UpdateWrapper(self, self, obj, old); |
159 | 0 | } |
160 | 0 |
|
161 | 0 | return 0; |
162 | 0 | } |
163 | | |
164 | | // We deliberately use brace-elision to make Visual Studio produce better initalization code. |
165 | | #if defined(__clang__) |
166 | | #pragma clang diagnostic push |
167 | | #pragma clang diagnostic ignored "-Wmissing-braces" |
168 | | #endif |
169 | | static const JSFunctionSpec sMethods_specs[] = { |
170 | | JS_FNSPEC("getPathSegAtLength", (GenericMethod<NormalThisPolicy, ThrowExceptions>), reinterpret_cast<const JSJitInfo*>(&getPathSegAtLength_methodinfo), 1, JSPROP_ENUMERATE, nullptr), |
171 | | JS_FS_END |
172 | | }; |
173 | | #if defined(__clang__) |
174 | | #pragma clang diagnostic pop |
175 | | #endif |
176 | | |
177 | | |
178 | | static const Prefable<const JSFunctionSpec> sMethods[] = { |
179 | | { nullptr, &sMethods_specs[0] }, |
180 | | { nullptr, nullptr } |
181 | | }; |
182 | | |
183 | | static_assert(1 <= 1ull << NUM_BITS_PROPERTY_INFO_PREF_INDEX, |
184 | | "We have a prefable index that is >= (1 << NUM_BITS_PROPERTY_INFO_PREF_INDEX)"); |
185 | | static_assert(1 <= 1ull << NUM_BITS_PROPERTY_INFO_SPEC_INDEX, |
186 | | "We have a spec index that is >= (1 << NUM_BITS_PROPERTY_INFO_SPEC_INDEX)"); |
187 | | |
188 | | // We deliberately use brace-elision to make Visual Studio produce better initalization code. |
189 | | #if defined(__clang__) |
190 | | #pragma clang diagnostic push |
191 | | #pragma clang diagnostic ignored "-Wmissing-braces" |
192 | | #endif |
193 | | static const JSPropertySpec sAttributes_specs[] = { |
194 | | { "pathSegList", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &pathSegList_getterinfo, nullptr, nullptr }, |
195 | | { "animatedPathSegList", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &animatedPathSegList_getterinfo, nullptr, nullptr }, |
196 | | { nullptr, 0, nullptr, nullptr, nullptr, nullptr } |
197 | | }; |
198 | | #if defined(__clang__) |
199 | | #pragma clang diagnostic pop |
200 | | #endif |
201 | | |
202 | | |
203 | | static const Prefable<const JSPropertySpec> sAttributes[] = { |
204 | | { nullptr, &sAttributes_specs[0] }, |
205 | | { nullptr, nullptr } |
206 | | }; |
207 | | |
208 | | static_assert(1 <= 1ull << NUM_BITS_PROPERTY_INFO_PREF_INDEX, |
209 | | "We have a prefable index that is >= (1 << NUM_BITS_PROPERTY_INFO_PREF_INDEX)"); |
210 | | static_assert(2 <= 1ull << NUM_BITS_PROPERTY_INFO_SPEC_INDEX, |
211 | | "We have a spec index that is >= (1 << NUM_BITS_PROPERTY_INFO_SPEC_INDEX)"); |
212 | | |
213 | | |
214 | | static uint16_t sNativeProperties_sortedPropertyIndices[3]; |
215 | | static PropertyInfo sNativeProperties_propertyInfos[3]; |
216 | | |
217 | | static const NativePropertiesN<2> sNativeProperties = { |
218 | | false, 0, |
219 | | false, 0, |
220 | | true, 0 /* sMethods */, |
221 | | true, 1 /* sAttributes */, |
222 | | false, 0, |
223 | | false, 0, |
224 | | false, 0, |
225 | | -1, |
226 | | 3, |
227 | | sNativeProperties_sortedPropertyIndices, |
228 | | { |
229 | | { sMethods, &sNativeProperties_propertyInfos[0] }, |
230 | | { sAttributes, &sNativeProperties_propertyInfos[1] } |
231 | | } |
232 | | }; |
233 | | static_assert(3 < 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::SVGPathElement, |
248 | | PrototypeTraits<prototypes::id::SVGPathElement>::Depth, |
249 | | sNativePropertyHooks, |
250 | | "function SVGPathElement() {\n [native code]\n}", |
251 | | SVGGeometryElement_Binding::GetConstructorObject |
252 | | }; |
253 | | |
254 | | static const DOMIfaceAndProtoJSClass sPrototypeClass = { |
255 | | { |
256 | | "SVGPathElementPrototype", |
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::SVGPathElement, |
266 | | PrototypeTraits<prototypes::id::SVGPathElement>::Depth, |
267 | | sNativePropertyHooks, |
268 | | "[object SVGPathElementPrototype]", |
269 | | SVGGeometryElement_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 | | { "SVGPathElement", |
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::SVGGraphicsElement, prototypes::id::SVGGeometryElement, prototypes::id::SVGPathElement, prototypes::id::_ID_Count }, |
300 | | IsBaseOf<nsISupports, mozilla::dom::SVGPathElement >::value, |
301 | | sNativePropertyHooks, |
302 | | FindAssociatedGlobalForNative<mozilla::dom::SVGPathElement>::Get, |
303 | | GetProtoObjectHandle, |
304 | | GetCCParticipant<mozilla::dom::SVGPathElement>::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::SVGPathElement* aObject, nsWrapperCache* aCache, JS::Handle<JSObject*> aGivenProto, JS::MutableHandle<JSObject*> aReflector) |
319 | 0 | { |
320 | 0 | static_assert(!IsBaseOf<NonRefcountedDOMObject, mozilla::dom::SVGPathElement>::value, |
321 | 0 | "Shouldn't have wrappercached things that are not refcounted."); |
322 | 0 | MOZ_ASSERT(static_cast<mozilla::dom::SVGPathElement*>(aObject) == |
323 | 0 | reinterpret_cast<mozilla::dom::SVGPathElement*>(aObject), |
324 | 0 | "Multiple inheritance for mozilla::dom::SVGPathElement is broken."); |
325 | 0 | MOZ_ASSERT(static_cast<mozilla::dom::SVGGeometryElement*>(aObject) == |
326 | 0 | reinterpret_cast<mozilla::dom::SVGGeometryElement*>(aObject), |
327 | 0 | "Multiple inheritance for mozilla::dom::SVGGeometryElement is broken."); |
328 | 0 | MOZ_ASSERT(static_cast<mozilla::dom::SVGGraphicsElement*>(aObject) == |
329 | 0 | reinterpret_cast<mozilla::dom::SVGGraphicsElement*>(aObject), |
330 | 0 | "Multiple inheritance for mozilla::dom::SVGGraphicsElement is broken."); |
331 | 0 | MOZ_ASSERT(static_cast<nsSVGElement*>(aObject) == |
332 | 0 | reinterpret_cast<nsSVGElement*>(aObject), |
333 | 0 | "Multiple inheritance for nsSVGElement is broken."); |
334 | 0 | MOZ_ASSERT(static_cast<mozilla::dom::Element*>(aObject) == |
335 | 0 | reinterpret_cast<mozilla::dom::Element*>(aObject), |
336 | 0 | "Multiple inheritance for mozilla::dom::Element is broken."); |
337 | 0 | MOZ_ASSERT(static_cast<nsINode*>(aObject) == |
338 | 0 | reinterpret_cast<nsINode*>(aObject), |
339 | 0 | "Multiple inheritance for nsINode is broken."); |
340 | 0 | MOZ_ASSERT(static_cast<mozilla::dom::EventTarget*>(aObject) == |
341 | 0 | reinterpret_cast<mozilla::dom::EventTarget*>(aObject), |
342 | 0 | "Multiple inheritance for mozilla::dom::EventTarget is broken."); |
343 | 0 | MOZ_ASSERT(ToSupportsIsCorrect(aObject)); |
344 | 0 | MOZ_ASSERT_IF(aGivenProto, js::IsObjectInContextCompartment(aGivenProto, aCx)); |
345 | 0 | MOZ_ASSERT(!aCache->GetWrapper(), |
346 | 0 | "You should probably not be using Wrap() directly; use " |
347 | 0 | "GetOrCreateDOMReflector instead"); |
348 | 0 |
|
349 | 0 | MOZ_ASSERT(ToSupportsIsOnPrimaryInheritanceChain(aObject, aCache), |
350 | 0 | "nsISupports must be on our primary inheritance chain"); |
351 | 0 |
|
352 | 0 | JS::Rooted<JSObject*> global(aCx, FindAssociatedGlobal(aCx, aObject->GetParentObject())); |
353 | 0 | if (!global) { |
354 | 0 | return false; |
355 | 0 | } |
356 | 0 | MOZ_ASSERT(JS_IsGlobalObject(global)); |
357 | 0 | MOZ_ASSERT(JS::ObjectIsNotGray(global)); |
358 | 0 |
|
359 | 0 | // That might have ended up wrapping us already, due to the wonders |
360 | 0 | // of XBL. Check for that, and bail out as needed. |
361 | 0 | aReflector.set(aCache->GetWrapper()); |
362 | 0 | if (aReflector) { |
363 | | #ifdef DEBUG |
364 | | AssertReflectorHasGivenProto(aCx, aReflector, aGivenProto); |
365 | | #endif // DEBUG |
366 | | return true; |
367 | 0 | } |
368 | 0 |
|
369 | 0 | JSAutoRealm ar(aCx, global); |
370 | 0 | JS::Handle<JSObject*> canonicalProto = GetProtoObjectHandle(aCx); |
371 | 0 | if (!canonicalProto) { |
372 | 0 | return false; |
373 | 0 | } |
374 | 0 | JS::Rooted<JSObject*> proto(aCx); |
375 | 0 | if (aGivenProto) { |
376 | 0 | proto = aGivenProto; |
377 | 0 | // Unfortunately, while aGivenProto was in the compartment of aCx |
378 | 0 | // coming in, we changed compartments to that of "parent" so may need |
379 | 0 | // to wrap the proto here. |
380 | 0 | if (js::GetContextCompartment(aCx) != js::GetObjectCompartment(proto)) { |
381 | 0 | if (!JS_WrapObject(aCx, &proto)) { |
382 | 0 | return false; |
383 | 0 | } |
384 | 0 | } |
385 | 0 | } else { |
386 | 0 | proto = canonicalProto; |
387 | 0 | } |
388 | 0 |
|
389 | 0 | BindingJSObjectCreator<mozilla::dom::SVGPathElement> creator(aCx); |
390 | 0 | creator.CreateObject(aCx, sClass.ToJSClass(), proto, aObject, aReflector); |
391 | 0 | if (!aReflector) { |
392 | 0 | return false; |
393 | 0 | } |
394 | 0 | |
395 | 0 | aCache->SetWrapper(aReflector); |
396 | 0 | creator.InitializationSucceeded(); |
397 | 0 |
|
398 | 0 | MOZ_ASSERT(aCache->GetWrapperPreserveColor() && |
399 | 0 | aCache->GetWrapperPreserveColor() == aReflector); |
400 | 0 | // If proto != canonicalProto, we have to preserve our wrapper; |
401 | 0 | // otherwise we won't be able to properly recreate it later, since |
402 | 0 | // we won't know what proto to use. Note that we don't check |
403 | 0 | // aGivenProto here, since it's entirely possible (and even |
404 | 0 | // somewhat common) to have a non-null aGivenProto which is the |
405 | 0 | // same as canonicalProto. |
406 | 0 | if (proto != canonicalProto) { |
407 | 0 | PreserveWrapper(aObject); |
408 | 0 | } |
409 | 0 |
|
410 | 0 | return true; |
411 | 0 | } |
412 | | |
413 | | const NativePropertyHooks sNativePropertyHooks[] = { { |
414 | | nullptr, |
415 | | nullptr, |
416 | | nullptr, |
417 | | { sNativeProperties.Upcast(), nullptr }, |
418 | | prototypes::id::SVGPathElement, |
419 | | constructors::id::SVGPathElement, |
420 | | SVGGeometryElement_Binding::sNativePropertyHooks, |
421 | | &DefaultXrayExpandoObjectClass |
422 | | } }; |
423 | | |
424 | | void |
425 | | CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, bool aDefineOnGlobal) |
426 | 0 | { |
427 | 0 | JS::Handle<JSObject*> parentProto(SVGGeometryElement_Binding::GetProtoObjectHandle(aCx)); |
428 | 0 | if (!parentProto) { |
429 | 0 | return; |
430 | 0 | } |
431 | 0 | |
432 | 0 | JS::Handle<JSObject*> constructorProto(SVGGeometryElement_Binding::GetConstructorObjectHandle(aCx)); |
433 | 0 | if (!constructorProto) { |
434 | 0 | return; |
435 | 0 | } |
436 | 0 | |
437 | 0 | static bool sIdsInited = false; |
438 | 0 | if (!sIdsInited && NS_IsMainThread()) { |
439 | 0 | if (!InitIds(aCx, sNativeProperties.Upcast())) { |
440 | 0 | return; |
441 | 0 | } |
442 | 0 | sIdsInited = true; |
443 | 0 | } |
444 | 0 |
|
445 | 0 | JS::Heap<JSObject*>* protoCache = &aProtoAndIfaceCache.EntrySlotOrCreate(prototypes::id::SVGPathElement); |
446 | 0 | JS::Heap<JSObject*>* interfaceCache = &aProtoAndIfaceCache.EntrySlotOrCreate(constructors::id::SVGPathElement); |
447 | 0 | dom::CreateInterfaceObjects(aCx, aGlobal, parentProto, |
448 | 0 | &sPrototypeClass.mBase, protoCache, |
449 | 0 | nullptr, |
450 | 0 | constructorProto, &sInterfaceObjectClass.mBase, 0, nullptr, |
451 | 0 | interfaceCache, |
452 | 0 | sNativeProperties.Upcast(), |
453 | 0 | nullptr, |
454 | 0 | "SVGPathElement", aDefineOnGlobal, |
455 | 0 | nullptr, |
456 | 0 | false); |
457 | 0 | } |
458 | | |
459 | | JSObject* |
460 | | GetConstructorObject(JSContext* aCx) |
461 | 0 | { |
462 | 0 | return GetConstructorObjectHandle(aCx); |
463 | 0 | } |
464 | | |
465 | | } // namespace SVGPathElement_Binding |
466 | | |
467 | | |
468 | | |
469 | | } // namespace dom |
470 | | } // namespace mozilla |