/work/obj-fuzz/dom/bindings/SVGPathSegBinding.cpp
Line | Count | Source (jump to first uncovered line) |
1 | | /* THIS FILE IS AUTOGENERATED FROM SVGPathSeg.webidl BY Codegen.py - DO NOT EDIT */ |
2 | | |
3 | | #include "DOMSVGPathSeg.h" |
4 | | #include "SVGPathSegBinding.h" |
5 | | #include "WrapperFactory.h" |
6 | | #include "mozilla/FloatingPoint.h" |
7 | | #include "mozilla/OwningNonNull.h" |
8 | | #include "mozilla/dom/BindingUtils.h" |
9 | | #include "mozilla/dom/DOMJSClass.h" |
10 | | #include "mozilla/dom/NonRefcountedDOMObject.h" |
11 | | #include "mozilla/dom/PrimitiveConversions.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 SVGPathSeg_Binding { |
22 | | |
23 | | MOZ_CAN_RUN_SCRIPT static bool |
24 | | get_pathSegType(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::DOMSVGPathSeg* self, JSJitGetterCallArgs args) |
25 | 0 | { |
26 | 0 | AUTO_PROFILER_LABEL_FAST("get SVGPathSeg.pathSegType", DOM, cx); |
27 | 0 |
|
28 | 0 | uint16_t result(self->PathSegType()); |
29 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
30 | 0 | args.rval().setInt32(int32_t(result)); |
31 | 0 | return true; |
32 | 0 | } |
33 | | |
34 | | static const JSJitInfo pathSegType_getterinfo = { |
35 | | { (JSJitGetterOp)get_pathSegType }, |
36 | | { prototypes::id::SVGPathSeg }, |
37 | | { PrototypeTraits<prototypes::id::SVGPathSeg>::Depth }, |
38 | | JSJitInfo::Getter, |
39 | | JSJitInfo::AliasDOMSets, /* aliasSet. Not relevant for setters. */ |
40 | | JSVAL_TYPE_INT32, /* returnType. Not relevant for setters. */ |
41 | | true, /* isInfallible. False in setters. */ |
42 | | true, /* isMovable. Not relevant for setters. */ |
43 | | true, /* isEliminatable. Not relevant for setters. */ |
44 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
45 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
46 | | false, /* isTypedMethod. Only relevant for methods. */ |
47 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
48 | | }; |
49 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
50 | | static_assert(0 < 1, "There is no slot for us"); |
51 | | |
52 | | MOZ_CAN_RUN_SCRIPT static bool |
53 | | get_pathSegTypeAsLetter(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::DOMSVGPathSeg* self, JSJitGetterCallArgs args) |
54 | 0 | { |
55 | 0 | AUTO_PROFILER_LABEL_FAST("get SVGPathSeg.pathSegTypeAsLetter", DOM, cx); |
56 | 0 |
|
57 | 0 | DOMString result; |
58 | 0 | self->GetPathSegTypeAsLetter(result); |
59 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
60 | 0 | if (!xpc::NonVoidStringToJsval(cx, result, args.rval())) { |
61 | 0 | return false; |
62 | 0 | } |
63 | 0 | return true; |
64 | 0 | } |
65 | | |
66 | | static const JSJitInfo pathSegTypeAsLetter_getterinfo = { |
67 | | { (JSJitGetterOp)get_pathSegTypeAsLetter }, |
68 | | { prototypes::id::SVGPathSeg }, |
69 | | { PrototypeTraits<prototypes::id::SVGPathSeg>::Depth }, |
70 | | JSJitInfo::Getter, |
71 | | JSJitInfo::AliasDOMSets, /* aliasSet. Not relevant for setters. */ |
72 | | JSVAL_TYPE_STRING, /* returnType. Not relevant for setters. */ |
73 | | false, /* isInfallible. False in setters. */ |
74 | | true, /* isMovable. Not relevant for setters. */ |
75 | | true, /* isEliminatable. Not relevant for setters. */ |
76 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
77 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
78 | | false, /* isTypedMethod. Only relevant for methods. */ |
79 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
80 | | }; |
81 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
82 | | static_assert(0 < 1, "There is no slot for us"); |
83 | | |
84 | | // We deliberately use brace-elision to make Visual Studio produce better initalization code. |
85 | | #if defined(__clang__) |
86 | | #pragma clang diagnostic push |
87 | | #pragma clang diagnostic ignored "-Wmissing-braces" |
88 | | #endif |
89 | | static const JSPropertySpec sAttributes_specs[] = { |
90 | | { "pathSegType", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &pathSegType_getterinfo, nullptr, nullptr }, |
91 | | { "pathSegTypeAsLetter", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &pathSegTypeAsLetter_getterinfo, nullptr, nullptr }, |
92 | | { nullptr, 0, nullptr, nullptr, nullptr, nullptr } |
93 | | }; |
94 | | #if defined(__clang__) |
95 | | #pragma clang diagnostic pop |
96 | | #endif |
97 | | |
98 | | |
99 | | static const Prefable<const JSPropertySpec> sAttributes[] = { |
100 | | { nullptr, &sAttributes_specs[0] }, |
101 | | { nullptr, nullptr } |
102 | | }; |
103 | | |
104 | | static_assert(1 <= 1ull << NUM_BITS_PROPERTY_INFO_PREF_INDEX, |
105 | | "We have a prefable index that is >= (1 << NUM_BITS_PROPERTY_INFO_PREF_INDEX)"); |
106 | | static_assert(2 <= 1ull << NUM_BITS_PROPERTY_INFO_SPEC_INDEX, |
107 | | "We have a spec index that is >= (1 << NUM_BITS_PROPERTY_INFO_SPEC_INDEX)"); |
108 | | |
109 | | // We deliberately use brace-elision to make Visual Studio produce better initalization code. |
110 | | #if defined(__clang__) |
111 | | #pragma clang diagnostic push |
112 | | #pragma clang diagnostic ignored "-Wmissing-braces" |
113 | | #endif |
114 | | static const ConstantSpec sConstants_specs[] = { |
115 | | { "PATHSEG_UNKNOWN", JS::Int32Value(0) }, |
116 | | { "PATHSEG_CLOSEPATH", JS::Int32Value(1) }, |
117 | | { "PATHSEG_MOVETO_ABS", JS::Int32Value(2) }, |
118 | | { "PATHSEG_MOVETO_REL", JS::Int32Value(3) }, |
119 | | { "PATHSEG_LINETO_ABS", JS::Int32Value(4) }, |
120 | | { "PATHSEG_LINETO_REL", JS::Int32Value(5) }, |
121 | | { "PATHSEG_CURVETO_CUBIC_ABS", JS::Int32Value(6) }, |
122 | | { "PATHSEG_CURVETO_CUBIC_REL", JS::Int32Value(7) }, |
123 | | { "PATHSEG_CURVETO_QUADRATIC_ABS", JS::Int32Value(8) }, |
124 | | { "PATHSEG_CURVETO_QUADRATIC_REL", JS::Int32Value(9) }, |
125 | | { "PATHSEG_ARC_ABS", JS::Int32Value(10) }, |
126 | | { "PATHSEG_ARC_REL", JS::Int32Value(11) }, |
127 | | { "PATHSEG_LINETO_HORIZONTAL_ABS", JS::Int32Value(12) }, |
128 | | { "PATHSEG_LINETO_HORIZONTAL_REL", JS::Int32Value(13) }, |
129 | | { "PATHSEG_LINETO_VERTICAL_ABS", JS::Int32Value(14) }, |
130 | | { "PATHSEG_LINETO_VERTICAL_REL", JS::Int32Value(15) }, |
131 | | { "PATHSEG_CURVETO_CUBIC_SMOOTH_ABS", JS::Int32Value(16) }, |
132 | | { "PATHSEG_CURVETO_CUBIC_SMOOTH_REL", JS::Int32Value(17) }, |
133 | | { "PATHSEG_CURVETO_QUADRATIC_SMOOTH_ABS", JS::Int32Value(18) }, |
134 | | { "PATHSEG_CURVETO_QUADRATIC_SMOOTH_REL", JS::Int32Value(19) }, |
135 | | { 0, JS::UndefinedValue() } |
136 | | }; |
137 | | #if defined(__clang__) |
138 | | #pragma clang diagnostic pop |
139 | | #endif |
140 | | |
141 | | |
142 | | static const Prefable<const ConstantSpec> sConstants[] = { |
143 | | { nullptr, &sConstants_specs[0] }, |
144 | | { nullptr, nullptr } |
145 | | }; |
146 | | |
147 | | static_assert(1 <= 1ull << NUM_BITS_PROPERTY_INFO_PREF_INDEX, |
148 | | "We have a prefable index that is >= (1 << NUM_BITS_PROPERTY_INFO_PREF_INDEX)"); |
149 | | static_assert(20 <= 1ull << NUM_BITS_PROPERTY_INFO_SPEC_INDEX, |
150 | | "We have a spec index that is >= (1 << NUM_BITS_PROPERTY_INFO_SPEC_INDEX)"); |
151 | | |
152 | | |
153 | | static uint16_t sNativeProperties_sortedPropertyIndices[22]; |
154 | | static PropertyInfo sNativeProperties_propertyInfos[22]; |
155 | | |
156 | | static const NativePropertiesN<2> sNativeProperties = { |
157 | | false, 0, |
158 | | false, 0, |
159 | | false, 0, |
160 | | true, 0 /* sAttributes */, |
161 | | false, 0, |
162 | | false, 0, |
163 | | true, 1 /* sConstants */, |
164 | | -1, |
165 | | 22, |
166 | | sNativeProperties_sortedPropertyIndices, |
167 | | { |
168 | | { sAttributes, &sNativeProperties_propertyInfos[0] }, |
169 | | { sConstants, &sNativeProperties_propertyInfos[2] } |
170 | | } |
171 | | }; |
172 | | static_assert(22 < 1ull << CHAR_BIT * sizeof(sNativeProperties.propertyInfoCount), |
173 | | "We have a property info count that is oversized"); |
174 | | |
175 | | static const DOMIfaceAndProtoJSClass sPrototypeClass = { |
176 | | { |
177 | | "SVGPathSegPrototype", |
178 | | JSCLASS_IS_DOMIFACEANDPROTOJSCLASS | JSCLASS_HAS_RESERVED_SLOTS(DOM_INTERFACE_PROTO_SLOTS_BASE), |
179 | | JS_NULL_CLASS_OPS, |
180 | | JS_NULL_CLASS_SPEC, |
181 | | JS_NULL_CLASS_EXT, |
182 | | JS_NULL_OBJECT_OPS |
183 | | }, |
184 | | eInterfacePrototype, |
185 | | false, |
186 | | prototypes::id::SVGPathSeg, |
187 | | PrototypeTraits<prototypes::id::SVGPathSeg>::Depth, |
188 | | sNativePropertyHooks, |
189 | | "[object SVGPathSegPrototype]", |
190 | | JS::GetRealmObjectPrototype |
191 | | }; |
192 | | |
193 | | const NativePropertyHooks sNativePropertyHooks[] = { { |
194 | | nullptr, |
195 | | nullptr, |
196 | | nullptr, |
197 | | { sNativeProperties.Upcast(), nullptr }, |
198 | | prototypes::id::SVGPathSeg, |
199 | | constructors::id::_ID_Count, |
200 | | nullptr, |
201 | | &DefaultXrayExpandoObjectClass |
202 | | } }; |
203 | | |
204 | | void |
205 | | CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, bool aDefineOnGlobal) |
206 | 0 | { |
207 | 0 | JS::Rooted<JSObject*> parentProto(aCx, JS::GetRealmObjectPrototype(aCx)); |
208 | 0 | if (!parentProto) { |
209 | 0 | return; |
210 | 0 | } |
211 | 0 | |
212 | 0 | static bool sIdsInited = false; |
213 | 0 | if (!sIdsInited && NS_IsMainThread()) { |
214 | 0 | if (!InitIds(aCx, sNativeProperties.Upcast())) { |
215 | 0 | return; |
216 | 0 | } |
217 | 0 | sIdsInited = true; |
218 | 0 | } |
219 | 0 |
|
220 | 0 | JS::Heap<JSObject*>* protoCache = &aProtoAndIfaceCache.EntrySlotOrCreate(prototypes::id::SVGPathSeg); |
221 | 0 | JS::Heap<JSObject*>* interfaceCache = nullptr; |
222 | 0 | dom::CreateInterfaceObjects(aCx, aGlobal, parentProto, |
223 | 0 | &sPrototypeClass.mBase, protoCache, |
224 | 0 | nullptr, |
225 | 0 | nullptr, nullptr, 0, nullptr, |
226 | 0 | interfaceCache, |
227 | 0 | sNativeProperties.Upcast(), |
228 | 0 | nullptr, |
229 | 0 | nullptr, aDefineOnGlobal, |
230 | 0 | nullptr, |
231 | 0 | false); |
232 | 0 | } |
233 | | |
234 | | JSObject* |
235 | | GetProtoObject(JSContext* aCx) |
236 | 0 | { |
237 | 0 | return GetProtoObjectHandle(aCx); |
238 | 0 | } |
239 | | |
240 | | } // namespace SVGPathSeg_Binding |
241 | | |
242 | | |
243 | | |
244 | | namespace SVGPathSegArcAbs_Binding { |
245 | | |
246 | | static_assert(IsRefcounted<NativeType>::value == IsRefcounted<SVGPathSeg_Binding::NativeType>::value, |
247 | | "Can't inherit from an interface with a different ownership model."); |
248 | | |
249 | | MOZ_CAN_RUN_SCRIPT static bool |
250 | | get_x(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::DOMSVGPathSegArcAbs* self, JSJitGetterCallArgs args) |
251 | 0 | { |
252 | 0 | AUTO_PROFILER_LABEL_FAST("get SVGPathSegArcAbs.x", DOM, cx); |
253 | 0 |
|
254 | 0 | float result(self->X()); |
255 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
256 | 0 | args.rval().set(JS_NumberValue(double(result))); |
257 | 0 | return true; |
258 | 0 | } |
259 | | |
260 | | MOZ_CAN_RUN_SCRIPT static bool |
261 | | set_x(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::DOMSVGPathSegArcAbs* self, JSJitSetterCallArgs args) |
262 | 0 | { |
263 | 0 | AUTO_PROFILER_LABEL_FAST("set SVGPathSegArcAbs.x", DOM, cx); |
264 | 0 |
|
265 | 0 | float arg0; |
266 | 0 | if (!ValueToPrimitive<float, eDefault>(cx, args[0], &arg0)) { |
267 | 0 | return false; |
268 | 0 | } else if (!mozilla::IsFinite(arg0)) { |
269 | 0 | ThrowErrorMessage(cx, MSG_NOT_FINITE, "Value being assigned to SVGPathSegArcAbs.x"); |
270 | 0 | return false; |
271 | 0 | } |
272 | 0 | FastErrorResult rv; |
273 | 0 | self->SetX(arg0, rv); |
274 | 0 | if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) { |
275 | 0 | return false; |
276 | 0 | } |
277 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
278 | 0 |
|
279 | 0 | return true; |
280 | 0 | } |
281 | | |
282 | | static const JSJitInfo x_getterinfo = { |
283 | | { (JSJitGetterOp)get_x }, |
284 | | { prototypes::id::SVGPathSegArcAbs }, |
285 | | { PrototypeTraits<prototypes::id::SVGPathSegArcAbs>::Depth }, |
286 | | JSJitInfo::Getter, |
287 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
288 | | JSVAL_TYPE_DOUBLE, /* returnType. Not relevant for setters. */ |
289 | | true, /* isInfallible. False in setters. */ |
290 | | false, /* isMovable. Not relevant for setters. */ |
291 | | false, /* isEliminatable. Not relevant for setters. */ |
292 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
293 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
294 | | false, /* isTypedMethod. Only relevant for methods. */ |
295 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
296 | | }; |
297 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
298 | | static_assert(0 < 1, "There is no slot for us"); |
299 | | static const JSJitInfo x_setterinfo = { |
300 | | { (JSJitGetterOp)set_x }, |
301 | | { prototypes::id::SVGPathSegArcAbs }, |
302 | | { PrototypeTraits<prototypes::id::SVGPathSegArcAbs>::Depth }, |
303 | | JSJitInfo::Setter, |
304 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
305 | | JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */ |
306 | | false, /* isInfallible. False in setters. */ |
307 | | false, /* isMovable. Not relevant for setters. */ |
308 | | false, /* isEliminatable. Not relevant for setters. */ |
309 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
310 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
311 | | false, /* isTypedMethod. Only relevant for methods. */ |
312 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
313 | | }; |
314 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
315 | | static_assert(0 < 1, "There is no slot for us"); |
316 | | |
317 | | MOZ_CAN_RUN_SCRIPT static bool |
318 | | get_y(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::DOMSVGPathSegArcAbs* self, JSJitGetterCallArgs args) |
319 | 0 | { |
320 | 0 | AUTO_PROFILER_LABEL_FAST("get SVGPathSegArcAbs.y", DOM, cx); |
321 | 0 |
|
322 | 0 | float result(self->Y()); |
323 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
324 | 0 | args.rval().set(JS_NumberValue(double(result))); |
325 | 0 | return true; |
326 | 0 | } |
327 | | |
328 | | MOZ_CAN_RUN_SCRIPT static bool |
329 | | set_y(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::DOMSVGPathSegArcAbs* self, JSJitSetterCallArgs args) |
330 | 0 | { |
331 | 0 | AUTO_PROFILER_LABEL_FAST("set SVGPathSegArcAbs.y", DOM, cx); |
332 | 0 |
|
333 | 0 | float arg0; |
334 | 0 | if (!ValueToPrimitive<float, eDefault>(cx, args[0], &arg0)) { |
335 | 0 | return false; |
336 | 0 | } else if (!mozilla::IsFinite(arg0)) { |
337 | 0 | ThrowErrorMessage(cx, MSG_NOT_FINITE, "Value being assigned to SVGPathSegArcAbs.y"); |
338 | 0 | return false; |
339 | 0 | } |
340 | 0 | FastErrorResult rv; |
341 | 0 | self->SetY(arg0, rv); |
342 | 0 | if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) { |
343 | 0 | return false; |
344 | 0 | } |
345 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
346 | 0 |
|
347 | 0 | return true; |
348 | 0 | } |
349 | | |
350 | | static const JSJitInfo y_getterinfo = { |
351 | | { (JSJitGetterOp)get_y }, |
352 | | { prototypes::id::SVGPathSegArcAbs }, |
353 | | { PrototypeTraits<prototypes::id::SVGPathSegArcAbs>::Depth }, |
354 | | JSJitInfo::Getter, |
355 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
356 | | JSVAL_TYPE_DOUBLE, /* returnType. Not relevant for setters. */ |
357 | | true, /* isInfallible. False in setters. */ |
358 | | false, /* isMovable. Not relevant for setters. */ |
359 | | false, /* isEliminatable. Not relevant for setters. */ |
360 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
361 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
362 | | false, /* isTypedMethod. Only relevant for methods. */ |
363 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
364 | | }; |
365 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
366 | | static_assert(0 < 1, "There is no slot for us"); |
367 | | static const JSJitInfo y_setterinfo = { |
368 | | { (JSJitGetterOp)set_y }, |
369 | | { prototypes::id::SVGPathSegArcAbs }, |
370 | | { PrototypeTraits<prototypes::id::SVGPathSegArcAbs>::Depth }, |
371 | | JSJitInfo::Setter, |
372 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
373 | | JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */ |
374 | | false, /* isInfallible. False in setters. */ |
375 | | false, /* isMovable. Not relevant for setters. */ |
376 | | false, /* isEliminatable. Not relevant for setters. */ |
377 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
378 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
379 | | false, /* isTypedMethod. Only relevant for methods. */ |
380 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
381 | | }; |
382 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
383 | | static_assert(0 < 1, "There is no slot for us"); |
384 | | |
385 | | MOZ_CAN_RUN_SCRIPT static bool |
386 | | get_r1(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::DOMSVGPathSegArcAbs* self, JSJitGetterCallArgs args) |
387 | 0 | { |
388 | 0 | AUTO_PROFILER_LABEL_FAST("get SVGPathSegArcAbs.r1", DOM, cx); |
389 | 0 |
|
390 | 0 | float result(self->R1()); |
391 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
392 | 0 | args.rval().set(JS_NumberValue(double(result))); |
393 | 0 | return true; |
394 | 0 | } |
395 | | |
396 | | MOZ_CAN_RUN_SCRIPT static bool |
397 | | set_r1(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::DOMSVGPathSegArcAbs* self, JSJitSetterCallArgs args) |
398 | 0 | { |
399 | 0 | AUTO_PROFILER_LABEL_FAST("set SVGPathSegArcAbs.r1", DOM, cx); |
400 | 0 |
|
401 | 0 | float arg0; |
402 | 0 | if (!ValueToPrimitive<float, eDefault>(cx, args[0], &arg0)) { |
403 | 0 | return false; |
404 | 0 | } else if (!mozilla::IsFinite(arg0)) { |
405 | 0 | ThrowErrorMessage(cx, MSG_NOT_FINITE, "Value being assigned to SVGPathSegArcAbs.r1"); |
406 | 0 | return false; |
407 | 0 | } |
408 | 0 | FastErrorResult rv; |
409 | 0 | self->SetR1(arg0, rv); |
410 | 0 | if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) { |
411 | 0 | return false; |
412 | 0 | } |
413 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
414 | 0 |
|
415 | 0 | return true; |
416 | 0 | } |
417 | | |
418 | | static const JSJitInfo r1_getterinfo = { |
419 | | { (JSJitGetterOp)get_r1 }, |
420 | | { prototypes::id::SVGPathSegArcAbs }, |
421 | | { PrototypeTraits<prototypes::id::SVGPathSegArcAbs>::Depth }, |
422 | | JSJitInfo::Getter, |
423 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
424 | | JSVAL_TYPE_DOUBLE, /* returnType. Not relevant for setters. */ |
425 | | true, /* isInfallible. False in setters. */ |
426 | | false, /* isMovable. Not relevant for setters. */ |
427 | | false, /* isEliminatable. Not relevant for setters. */ |
428 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
429 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
430 | | false, /* isTypedMethod. Only relevant for methods. */ |
431 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
432 | | }; |
433 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
434 | | static_assert(0 < 1, "There is no slot for us"); |
435 | | static const JSJitInfo r1_setterinfo = { |
436 | | { (JSJitGetterOp)set_r1 }, |
437 | | { prototypes::id::SVGPathSegArcAbs }, |
438 | | { PrototypeTraits<prototypes::id::SVGPathSegArcAbs>::Depth }, |
439 | | JSJitInfo::Setter, |
440 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
441 | | JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */ |
442 | | false, /* isInfallible. False in setters. */ |
443 | | false, /* isMovable. Not relevant for setters. */ |
444 | | false, /* isEliminatable. Not relevant for setters. */ |
445 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
446 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
447 | | false, /* isTypedMethod. Only relevant for methods. */ |
448 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
449 | | }; |
450 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
451 | | static_assert(0 < 1, "There is no slot for us"); |
452 | | |
453 | | MOZ_CAN_RUN_SCRIPT static bool |
454 | | get_r2(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::DOMSVGPathSegArcAbs* self, JSJitGetterCallArgs args) |
455 | 0 | { |
456 | 0 | AUTO_PROFILER_LABEL_FAST("get SVGPathSegArcAbs.r2", DOM, cx); |
457 | 0 |
|
458 | 0 | float result(self->R2()); |
459 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
460 | 0 | args.rval().set(JS_NumberValue(double(result))); |
461 | 0 | return true; |
462 | 0 | } |
463 | | |
464 | | MOZ_CAN_RUN_SCRIPT static bool |
465 | | set_r2(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::DOMSVGPathSegArcAbs* self, JSJitSetterCallArgs args) |
466 | 0 | { |
467 | 0 | AUTO_PROFILER_LABEL_FAST("set SVGPathSegArcAbs.r2", DOM, cx); |
468 | 0 |
|
469 | 0 | float arg0; |
470 | 0 | if (!ValueToPrimitive<float, eDefault>(cx, args[0], &arg0)) { |
471 | 0 | return false; |
472 | 0 | } else if (!mozilla::IsFinite(arg0)) { |
473 | 0 | ThrowErrorMessage(cx, MSG_NOT_FINITE, "Value being assigned to SVGPathSegArcAbs.r2"); |
474 | 0 | return false; |
475 | 0 | } |
476 | 0 | FastErrorResult rv; |
477 | 0 | self->SetR2(arg0, rv); |
478 | 0 | if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) { |
479 | 0 | return false; |
480 | 0 | } |
481 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
482 | 0 |
|
483 | 0 | return true; |
484 | 0 | } |
485 | | |
486 | | static const JSJitInfo r2_getterinfo = { |
487 | | { (JSJitGetterOp)get_r2 }, |
488 | | { prototypes::id::SVGPathSegArcAbs }, |
489 | | { PrototypeTraits<prototypes::id::SVGPathSegArcAbs>::Depth }, |
490 | | JSJitInfo::Getter, |
491 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
492 | | JSVAL_TYPE_DOUBLE, /* returnType. Not relevant for setters. */ |
493 | | true, /* isInfallible. False in setters. */ |
494 | | false, /* isMovable. Not relevant for setters. */ |
495 | | false, /* isEliminatable. Not relevant for setters. */ |
496 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
497 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
498 | | false, /* isTypedMethod. Only relevant for methods. */ |
499 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
500 | | }; |
501 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
502 | | static_assert(0 < 1, "There is no slot for us"); |
503 | | static const JSJitInfo r2_setterinfo = { |
504 | | { (JSJitGetterOp)set_r2 }, |
505 | | { prototypes::id::SVGPathSegArcAbs }, |
506 | | { PrototypeTraits<prototypes::id::SVGPathSegArcAbs>::Depth }, |
507 | | JSJitInfo::Setter, |
508 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
509 | | JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */ |
510 | | false, /* isInfallible. False in setters. */ |
511 | | false, /* isMovable. Not relevant for setters. */ |
512 | | false, /* isEliminatable. Not relevant for setters. */ |
513 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
514 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
515 | | false, /* isTypedMethod. Only relevant for methods. */ |
516 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
517 | | }; |
518 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
519 | | static_assert(0 < 1, "There is no slot for us"); |
520 | | |
521 | | MOZ_CAN_RUN_SCRIPT static bool |
522 | | get_angle(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::DOMSVGPathSegArcAbs* self, JSJitGetterCallArgs args) |
523 | 0 | { |
524 | 0 | AUTO_PROFILER_LABEL_FAST("get SVGPathSegArcAbs.angle", DOM, cx); |
525 | 0 |
|
526 | 0 | float result(self->Angle()); |
527 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
528 | 0 | args.rval().set(JS_NumberValue(double(result))); |
529 | 0 | return true; |
530 | 0 | } |
531 | | |
532 | | MOZ_CAN_RUN_SCRIPT static bool |
533 | | set_angle(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::DOMSVGPathSegArcAbs* self, JSJitSetterCallArgs args) |
534 | 0 | { |
535 | 0 | AUTO_PROFILER_LABEL_FAST("set SVGPathSegArcAbs.angle", DOM, cx); |
536 | 0 |
|
537 | 0 | float arg0; |
538 | 0 | if (!ValueToPrimitive<float, eDefault>(cx, args[0], &arg0)) { |
539 | 0 | return false; |
540 | 0 | } else if (!mozilla::IsFinite(arg0)) { |
541 | 0 | ThrowErrorMessage(cx, MSG_NOT_FINITE, "Value being assigned to SVGPathSegArcAbs.angle"); |
542 | 0 | return false; |
543 | 0 | } |
544 | 0 | FastErrorResult rv; |
545 | 0 | self->SetAngle(arg0, rv); |
546 | 0 | if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) { |
547 | 0 | return false; |
548 | 0 | } |
549 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
550 | 0 |
|
551 | 0 | return true; |
552 | 0 | } |
553 | | |
554 | | static const JSJitInfo angle_getterinfo = { |
555 | | { (JSJitGetterOp)get_angle }, |
556 | | { prototypes::id::SVGPathSegArcAbs }, |
557 | | { PrototypeTraits<prototypes::id::SVGPathSegArcAbs>::Depth }, |
558 | | JSJitInfo::Getter, |
559 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
560 | | JSVAL_TYPE_DOUBLE, /* returnType. Not relevant for setters. */ |
561 | | true, /* isInfallible. False in setters. */ |
562 | | false, /* isMovable. Not relevant for setters. */ |
563 | | false, /* isEliminatable. Not relevant for setters. */ |
564 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
565 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
566 | | false, /* isTypedMethod. Only relevant for methods. */ |
567 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
568 | | }; |
569 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
570 | | static_assert(0 < 1, "There is no slot for us"); |
571 | | static const JSJitInfo angle_setterinfo = { |
572 | | { (JSJitGetterOp)set_angle }, |
573 | | { prototypes::id::SVGPathSegArcAbs }, |
574 | | { PrototypeTraits<prototypes::id::SVGPathSegArcAbs>::Depth }, |
575 | | JSJitInfo::Setter, |
576 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
577 | | JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */ |
578 | | false, /* isInfallible. False in setters. */ |
579 | | false, /* isMovable. Not relevant for setters. */ |
580 | | false, /* isEliminatable. Not relevant for setters. */ |
581 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
582 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
583 | | false, /* isTypedMethod. Only relevant for methods. */ |
584 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
585 | | }; |
586 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
587 | | static_assert(0 < 1, "There is no slot for us"); |
588 | | |
589 | | MOZ_CAN_RUN_SCRIPT static bool |
590 | | get_largeArcFlag(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::DOMSVGPathSegArcAbs* self, JSJitGetterCallArgs args) |
591 | 0 | { |
592 | 0 | AUTO_PROFILER_LABEL_FAST("get SVGPathSegArcAbs.largeArcFlag", DOM, cx); |
593 | 0 |
|
594 | 0 | bool result(self->LargeArcFlag()); |
595 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
596 | 0 | args.rval().setBoolean(result); |
597 | 0 | return true; |
598 | 0 | } |
599 | | |
600 | | MOZ_CAN_RUN_SCRIPT static bool |
601 | | set_largeArcFlag(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::DOMSVGPathSegArcAbs* self, JSJitSetterCallArgs args) |
602 | 0 | { |
603 | 0 | AUTO_PROFILER_LABEL_FAST("set SVGPathSegArcAbs.largeArcFlag", DOM, cx); |
604 | 0 |
|
605 | 0 | bool arg0; |
606 | 0 | if (!ValueToPrimitive<bool, eDefault>(cx, args[0], &arg0)) { |
607 | 0 | return false; |
608 | 0 | } |
609 | 0 | FastErrorResult rv; |
610 | 0 | self->SetLargeArcFlag(arg0, rv); |
611 | 0 | if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) { |
612 | 0 | return false; |
613 | 0 | } |
614 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
615 | 0 |
|
616 | 0 | return true; |
617 | 0 | } |
618 | | |
619 | | static const JSJitInfo largeArcFlag_getterinfo = { |
620 | | { (JSJitGetterOp)get_largeArcFlag }, |
621 | | { prototypes::id::SVGPathSegArcAbs }, |
622 | | { PrototypeTraits<prototypes::id::SVGPathSegArcAbs>::Depth }, |
623 | | JSJitInfo::Getter, |
624 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
625 | | JSVAL_TYPE_BOOLEAN, /* returnType. Not relevant for setters. */ |
626 | | true, /* isInfallible. False in setters. */ |
627 | | false, /* isMovable. Not relevant for setters. */ |
628 | | false, /* isEliminatable. Not relevant for setters. */ |
629 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
630 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
631 | | false, /* isTypedMethod. Only relevant for methods. */ |
632 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
633 | | }; |
634 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
635 | | static_assert(0 < 1, "There is no slot for us"); |
636 | | static const JSJitInfo largeArcFlag_setterinfo = { |
637 | | { (JSJitGetterOp)set_largeArcFlag }, |
638 | | { prototypes::id::SVGPathSegArcAbs }, |
639 | | { PrototypeTraits<prototypes::id::SVGPathSegArcAbs>::Depth }, |
640 | | JSJitInfo::Setter, |
641 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
642 | | JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */ |
643 | | false, /* isInfallible. False in setters. */ |
644 | | false, /* isMovable. Not relevant for setters. */ |
645 | | false, /* isEliminatable. Not relevant for setters. */ |
646 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
647 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
648 | | false, /* isTypedMethod. Only relevant for methods. */ |
649 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
650 | | }; |
651 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
652 | | static_assert(0 < 1, "There is no slot for us"); |
653 | | |
654 | | MOZ_CAN_RUN_SCRIPT static bool |
655 | | get_sweepFlag(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::DOMSVGPathSegArcAbs* self, JSJitGetterCallArgs args) |
656 | 0 | { |
657 | 0 | AUTO_PROFILER_LABEL_FAST("get SVGPathSegArcAbs.sweepFlag", DOM, cx); |
658 | 0 |
|
659 | 0 | bool result(self->SweepFlag()); |
660 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
661 | 0 | args.rval().setBoolean(result); |
662 | 0 | return true; |
663 | 0 | } |
664 | | |
665 | | MOZ_CAN_RUN_SCRIPT static bool |
666 | | set_sweepFlag(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::DOMSVGPathSegArcAbs* self, JSJitSetterCallArgs args) |
667 | 0 | { |
668 | 0 | AUTO_PROFILER_LABEL_FAST("set SVGPathSegArcAbs.sweepFlag", DOM, cx); |
669 | 0 |
|
670 | 0 | bool arg0; |
671 | 0 | if (!ValueToPrimitive<bool, eDefault>(cx, args[0], &arg0)) { |
672 | 0 | return false; |
673 | 0 | } |
674 | 0 | FastErrorResult rv; |
675 | 0 | self->SetSweepFlag(arg0, rv); |
676 | 0 | if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) { |
677 | 0 | return false; |
678 | 0 | } |
679 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
680 | 0 |
|
681 | 0 | return true; |
682 | 0 | } |
683 | | |
684 | | static const JSJitInfo sweepFlag_getterinfo = { |
685 | | { (JSJitGetterOp)get_sweepFlag }, |
686 | | { prototypes::id::SVGPathSegArcAbs }, |
687 | | { PrototypeTraits<prototypes::id::SVGPathSegArcAbs>::Depth }, |
688 | | JSJitInfo::Getter, |
689 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
690 | | JSVAL_TYPE_BOOLEAN, /* returnType. Not relevant for setters. */ |
691 | | true, /* isInfallible. False in setters. */ |
692 | | false, /* isMovable. Not relevant for setters. */ |
693 | | false, /* isEliminatable. Not relevant for setters. */ |
694 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
695 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
696 | | false, /* isTypedMethod. Only relevant for methods. */ |
697 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
698 | | }; |
699 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
700 | | static_assert(0 < 1, "There is no slot for us"); |
701 | | static const JSJitInfo sweepFlag_setterinfo = { |
702 | | { (JSJitGetterOp)set_sweepFlag }, |
703 | | { prototypes::id::SVGPathSegArcAbs }, |
704 | | { PrototypeTraits<prototypes::id::SVGPathSegArcAbs>::Depth }, |
705 | | JSJitInfo::Setter, |
706 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
707 | | JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */ |
708 | | false, /* isInfallible. False in setters. */ |
709 | | false, /* isMovable. Not relevant for setters. */ |
710 | | false, /* isEliminatable. Not relevant for setters. */ |
711 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
712 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
713 | | false, /* isTypedMethod. Only relevant for methods. */ |
714 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
715 | | }; |
716 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
717 | | static_assert(0 < 1, "There is no slot for us"); |
718 | | |
719 | | static bool |
720 | | _addProperty(JSContext* cx, JS::Handle<JSObject*> obj, JS::Handle<jsid> id, JS::Handle<JS::Value> val) |
721 | 0 | { |
722 | 0 | mozilla::DOMSVGPathSegArcAbs* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::DOMSVGPathSegArcAbs>(obj); |
723 | 0 | // We don't want to preserve if we don't have a wrapper, and we |
724 | 0 | // obviously can't preserve if we're not initialized. |
725 | 0 | if (self && self->GetWrapperPreserveColor()) { |
726 | 0 | PreserveWrapper(self); |
727 | 0 | } |
728 | 0 | return true; |
729 | 0 | } |
730 | | |
731 | | static void |
732 | | _finalize(js::FreeOp* fop, JSObject* obj) |
733 | 0 | { |
734 | 0 | mozilla::DOMSVGPathSegArcAbs* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::DOMSVGPathSegArcAbs>(obj); |
735 | 0 | if (self) { |
736 | 0 | ClearWrapper(self, self, obj); |
737 | 0 | AddForDeferredFinalization<mozilla::DOMSVGPathSegArcAbs>(self); |
738 | 0 | } |
739 | 0 | } |
740 | | |
741 | | static size_t |
742 | | _objectMoved(JSObject* obj, JSObject* old) |
743 | 0 | { |
744 | 0 | mozilla::DOMSVGPathSegArcAbs* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::DOMSVGPathSegArcAbs>(obj); |
745 | 0 | if (self) { |
746 | 0 | UpdateWrapper(self, self, obj, old); |
747 | 0 | } |
748 | 0 |
|
749 | 0 | return 0; |
750 | 0 | } |
751 | | |
752 | | // We deliberately use brace-elision to make Visual Studio produce better initalization code. |
753 | | #if defined(__clang__) |
754 | | #pragma clang diagnostic push |
755 | | #pragma clang diagnostic ignored "-Wmissing-braces" |
756 | | #endif |
757 | | static const JSPropertySpec sAttributes_specs[] = { |
758 | | { "x", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &x_getterinfo, GenericSetter<NormalThisPolicy>, &x_setterinfo }, |
759 | | { "y", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &y_getterinfo, GenericSetter<NormalThisPolicy>, &y_setterinfo }, |
760 | | { "r1", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &r1_getterinfo, GenericSetter<NormalThisPolicy>, &r1_setterinfo }, |
761 | | { "r2", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &r2_getterinfo, GenericSetter<NormalThisPolicy>, &r2_setterinfo }, |
762 | | { "angle", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &angle_getterinfo, GenericSetter<NormalThisPolicy>, &angle_setterinfo }, |
763 | | { "largeArcFlag", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &largeArcFlag_getterinfo, GenericSetter<NormalThisPolicy>, &largeArcFlag_setterinfo }, |
764 | | { "sweepFlag", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &sweepFlag_getterinfo, GenericSetter<NormalThisPolicy>, &sweepFlag_setterinfo }, |
765 | | { nullptr, 0, nullptr, nullptr, nullptr, nullptr } |
766 | | }; |
767 | | #if defined(__clang__) |
768 | | #pragma clang diagnostic pop |
769 | | #endif |
770 | | |
771 | | |
772 | | static const Prefable<const JSPropertySpec> sAttributes[] = { |
773 | | { nullptr, &sAttributes_specs[0] }, |
774 | | { nullptr, nullptr } |
775 | | }; |
776 | | |
777 | | static_assert(1 <= 1ull << NUM_BITS_PROPERTY_INFO_PREF_INDEX, |
778 | | "We have a prefable index that is >= (1 << NUM_BITS_PROPERTY_INFO_PREF_INDEX)"); |
779 | | static_assert(7 <= 1ull << NUM_BITS_PROPERTY_INFO_SPEC_INDEX, |
780 | | "We have a spec index that is >= (1 << NUM_BITS_PROPERTY_INFO_SPEC_INDEX)"); |
781 | | |
782 | | |
783 | | static uint16_t sNativeProperties_sortedPropertyIndices[7]; |
784 | | static PropertyInfo sNativeProperties_propertyInfos[7]; |
785 | | |
786 | | static const NativePropertiesN<1> sNativeProperties = { |
787 | | false, 0, |
788 | | false, 0, |
789 | | false, 0, |
790 | | true, 0 /* sAttributes */, |
791 | | false, 0, |
792 | | false, 0, |
793 | | false, 0, |
794 | | -1, |
795 | | 7, |
796 | | sNativeProperties_sortedPropertyIndices, |
797 | | { |
798 | | { sAttributes, &sNativeProperties_propertyInfos[0] } |
799 | | } |
800 | | }; |
801 | | static_assert(7 < 1ull << CHAR_BIT * sizeof(sNativeProperties.propertyInfoCount), |
802 | | "We have a property info count that is oversized"); |
803 | | |
804 | | static const DOMIfaceAndProtoJSClass sPrototypeClass = { |
805 | | { |
806 | | "SVGPathSegArcAbsPrototype", |
807 | | JSCLASS_IS_DOMIFACEANDPROTOJSCLASS | JSCLASS_HAS_RESERVED_SLOTS(DOM_INTERFACE_PROTO_SLOTS_BASE), |
808 | | JS_NULL_CLASS_OPS, |
809 | | JS_NULL_CLASS_SPEC, |
810 | | JS_NULL_CLASS_EXT, |
811 | | JS_NULL_OBJECT_OPS |
812 | | }, |
813 | | eInterfacePrototype, |
814 | | false, |
815 | | prototypes::id::SVGPathSegArcAbs, |
816 | | PrototypeTraits<prototypes::id::SVGPathSegArcAbs>::Depth, |
817 | | sNativePropertyHooks, |
818 | | "[object SVGPathSegArcAbsPrototype]", |
819 | | SVGPathSeg_Binding::GetProtoObject |
820 | | }; |
821 | | |
822 | | static const js::ClassOps sClassOps = { |
823 | | _addProperty, /* addProperty */ |
824 | | nullptr, /* delProperty */ |
825 | | nullptr, /* enumerate */ |
826 | | nullptr, /* newEnumerate */ |
827 | | nullptr, /* resolve */ |
828 | | nullptr, /* mayResolve */ |
829 | | _finalize, /* finalize */ |
830 | | nullptr, /* call */ |
831 | | nullptr, /* hasInstance */ |
832 | | nullptr, /* construct */ |
833 | | nullptr, /* trace */ |
834 | | }; |
835 | | |
836 | | static const js::ClassExtension sClassExtension = { |
837 | | nullptr, /* weakmapKeyDelegateOp */ |
838 | | _objectMoved /* objectMovedOp */ |
839 | | }; |
840 | | |
841 | | static const DOMJSClass sClass = { |
842 | | { "SVGPathSegArcAbs", |
843 | | JSCLASS_IS_DOMJSCLASS | JSCLASS_FOREGROUND_FINALIZE | JSCLASS_HAS_RESERVED_SLOTS(1), |
844 | | &sClassOps, |
845 | | JS_NULL_CLASS_SPEC, |
846 | | &sClassExtension, |
847 | | JS_NULL_OBJECT_OPS |
848 | | }, |
849 | | { prototypes::id::SVGPathSeg, prototypes::id::SVGPathSegArcAbs, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count }, |
850 | | IsBaseOf<nsISupports, mozilla::DOMSVGPathSegArcAbs >::value, |
851 | | sNativePropertyHooks, |
852 | | FindAssociatedGlobalForNative<mozilla::DOMSVGPathSegArcAbs>::Get, |
853 | | GetProtoObjectHandle, |
854 | | GetCCParticipant<mozilla::DOMSVGPathSegArcAbs>::Get() |
855 | | }; |
856 | | static_assert(1 == DOM_INSTANCE_RESERVED_SLOTS, |
857 | | "Must have the right minimal number of reserved slots."); |
858 | | static_assert(1 >= 1, |
859 | | "Must have enough reserved slots."); |
860 | | |
861 | | const JSClass* |
862 | | GetJSClass() |
863 | 0 | { |
864 | 0 | return sClass.ToJSClass(); |
865 | 0 | } |
866 | | |
867 | | bool |
868 | | Wrap(JSContext* aCx, mozilla::DOMSVGPathSegArcAbs* aObject, nsWrapperCache* aCache, JS::Handle<JSObject*> aGivenProto, JS::MutableHandle<JSObject*> aReflector) |
869 | 0 | { |
870 | 0 | static_assert(!IsBaseOf<NonRefcountedDOMObject, mozilla::DOMSVGPathSegArcAbs>::value, |
871 | 0 | "Shouldn't have wrappercached things that are not refcounted."); |
872 | 0 | MOZ_ASSERT(static_cast<mozilla::DOMSVGPathSegArcAbs*>(aObject) == |
873 | 0 | reinterpret_cast<mozilla::DOMSVGPathSegArcAbs*>(aObject), |
874 | 0 | "Multiple inheritance for mozilla::DOMSVGPathSegArcAbs is broken."); |
875 | 0 | MOZ_ASSERT(static_cast<mozilla::DOMSVGPathSeg*>(aObject) == |
876 | 0 | reinterpret_cast<mozilla::DOMSVGPathSeg*>(aObject), |
877 | 0 | "Multiple inheritance for mozilla::DOMSVGPathSeg is broken."); |
878 | 0 | MOZ_ASSERT(ToSupportsIsCorrect(aObject)); |
879 | 0 | MOZ_ASSERT_IF(aGivenProto, js::IsObjectInContextCompartment(aGivenProto, aCx)); |
880 | 0 | MOZ_ASSERT(!aCache->GetWrapper(), |
881 | 0 | "You should probably not be using Wrap() directly; use " |
882 | 0 | "GetOrCreateDOMReflector instead"); |
883 | 0 |
|
884 | 0 | MOZ_ASSERT(ToSupportsIsOnPrimaryInheritanceChain(aObject, aCache), |
885 | 0 | "nsISupports must be on our primary inheritance chain"); |
886 | 0 |
|
887 | 0 | JS::Rooted<JSObject*> global(aCx, FindAssociatedGlobal(aCx, aObject->GetParentObject())); |
888 | 0 | if (!global) { |
889 | 0 | return false; |
890 | 0 | } |
891 | 0 | MOZ_ASSERT(JS_IsGlobalObject(global)); |
892 | 0 | MOZ_ASSERT(JS::ObjectIsNotGray(global)); |
893 | 0 |
|
894 | 0 | // That might have ended up wrapping us already, due to the wonders |
895 | 0 | // of XBL. Check for that, and bail out as needed. |
896 | 0 | aReflector.set(aCache->GetWrapper()); |
897 | 0 | if (aReflector) { |
898 | | #ifdef DEBUG |
899 | | AssertReflectorHasGivenProto(aCx, aReflector, aGivenProto); |
900 | | #endif // DEBUG |
901 | | return true; |
902 | 0 | } |
903 | 0 |
|
904 | 0 | JSAutoRealm ar(aCx, global); |
905 | 0 | JS::Handle<JSObject*> canonicalProto = GetProtoObjectHandle(aCx); |
906 | 0 | if (!canonicalProto) { |
907 | 0 | return false; |
908 | 0 | } |
909 | 0 | JS::Rooted<JSObject*> proto(aCx); |
910 | 0 | if (aGivenProto) { |
911 | 0 | proto = aGivenProto; |
912 | 0 | // Unfortunately, while aGivenProto was in the compartment of aCx |
913 | 0 | // coming in, we changed compartments to that of "parent" so may need |
914 | 0 | // to wrap the proto here. |
915 | 0 | if (js::GetContextCompartment(aCx) != js::GetObjectCompartment(proto)) { |
916 | 0 | if (!JS_WrapObject(aCx, &proto)) { |
917 | 0 | return false; |
918 | 0 | } |
919 | 0 | } |
920 | 0 | } else { |
921 | 0 | proto = canonicalProto; |
922 | 0 | } |
923 | 0 |
|
924 | 0 | BindingJSObjectCreator<mozilla::DOMSVGPathSegArcAbs> creator(aCx); |
925 | 0 | creator.CreateObject(aCx, sClass.ToJSClass(), proto, aObject, aReflector); |
926 | 0 | if (!aReflector) { |
927 | 0 | return false; |
928 | 0 | } |
929 | 0 | |
930 | 0 | aCache->SetWrapper(aReflector); |
931 | 0 | creator.InitializationSucceeded(); |
932 | 0 |
|
933 | 0 | MOZ_ASSERT(aCache->GetWrapperPreserveColor() && |
934 | 0 | aCache->GetWrapperPreserveColor() == aReflector); |
935 | 0 | // If proto != canonicalProto, we have to preserve our wrapper; |
936 | 0 | // otherwise we won't be able to properly recreate it later, since |
937 | 0 | // we won't know what proto to use. Note that we don't check |
938 | 0 | // aGivenProto here, since it's entirely possible (and even |
939 | 0 | // somewhat common) to have a non-null aGivenProto which is the |
940 | 0 | // same as canonicalProto. |
941 | 0 | if (proto != canonicalProto) { |
942 | 0 | PreserveWrapper(aObject); |
943 | 0 | } |
944 | 0 |
|
945 | 0 | return true; |
946 | 0 | } |
947 | | |
948 | | const NativePropertyHooks sNativePropertyHooks[] = { { |
949 | | nullptr, |
950 | | nullptr, |
951 | | nullptr, |
952 | | { sNativeProperties.Upcast(), nullptr }, |
953 | | prototypes::id::SVGPathSegArcAbs, |
954 | | constructors::id::_ID_Count, |
955 | | SVGPathSeg_Binding::sNativePropertyHooks, |
956 | | &DefaultXrayExpandoObjectClass |
957 | | } }; |
958 | | |
959 | | void |
960 | | CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, bool aDefineOnGlobal) |
961 | 0 | { |
962 | 0 | JS::Handle<JSObject*> parentProto(SVGPathSeg_Binding::GetProtoObjectHandle(aCx)); |
963 | 0 | if (!parentProto) { |
964 | 0 | return; |
965 | 0 | } |
966 | 0 | |
967 | 0 | static bool sIdsInited = false; |
968 | 0 | if (!sIdsInited && NS_IsMainThread()) { |
969 | 0 | if (!InitIds(aCx, sNativeProperties.Upcast())) { |
970 | 0 | return; |
971 | 0 | } |
972 | 0 | sIdsInited = true; |
973 | 0 | } |
974 | 0 |
|
975 | 0 | JS::Heap<JSObject*>* protoCache = &aProtoAndIfaceCache.EntrySlotOrCreate(prototypes::id::SVGPathSegArcAbs); |
976 | 0 | JS::Heap<JSObject*>* interfaceCache = nullptr; |
977 | 0 | dom::CreateInterfaceObjects(aCx, aGlobal, parentProto, |
978 | 0 | &sPrototypeClass.mBase, protoCache, |
979 | 0 | nullptr, |
980 | 0 | nullptr, nullptr, 0, nullptr, |
981 | 0 | interfaceCache, |
982 | 0 | sNativeProperties.Upcast(), |
983 | 0 | nullptr, |
984 | 0 | nullptr, aDefineOnGlobal, |
985 | 0 | nullptr, |
986 | 0 | false); |
987 | 0 | } |
988 | | |
989 | | } // namespace SVGPathSegArcAbs_Binding |
990 | | |
991 | | |
992 | | |
993 | | namespace SVGPathSegArcRel_Binding { |
994 | | |
995 | | static_assert(IsRefcounted<NativeType>::value == IsRefcounted<SVGPathSeg_Binding::NativeType>::value, |
996 | | "Can't inherit from an interface with a different ownership model."); |
997 | | |
998 | | MOZ_CAN_RUN_SCRIPT static bool |
999 | | get_x(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::DOMSVGPathSegArcRel* self, JSJitGetterCallArgs args) |
1000 | 0 | { |
1001 | 0 | AUTO_PROFILER_LABEL_FAST("get SVGPathSegArcRel.x", DOM, cx); |
1002 | 0 |
|
1003 | 0 | float result(self->X()); |
1004 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
1005 | 0 | args.rval().set(JS_NumberValue(double(result))); |
1006 | 0 | return true; |
1007 | 0 | } |
1008 | | |
1009 | | MOZ_CAN_RUN_SCRIPT static bool |
1010 | | set_x(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::DOMSVGPathSegArcRel* self, JSJitSetterCallArgs args) |
1011 | 0 | { |
1012 | 0 | AUTO_PROFILER_LABEL_FAST("set SVGPathSegArcRel.x", DOM, cx); |
1013 | 0 |
|
1014 | 0 | float arg0; |
1015 | 0 | if (!ValueToPrimitive<float, eDefault>(cx, args[0], &arg0)) { |
1016 | 0 | return false; |
1017 | 0 | } else if (!mozilla::IsFinite(arg0)) { |
1018 | 0 | ThrowErrorMessage(cx, MSG_NOT_FINITE, "Value being assigned to SVGPathSegArcRel.x"); |
1019 | 0 | return false; |
1020 | 0 | } |
1021 | 0 | FastErrorResult rv; |
1022 | 0 | self->SetX(arg0, rv); |
1023 | 0 | if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) { |
1024 | 0 | return false; |
1025 | 0 | } |
1026 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
1027 | 0 |
|
1028 | 0 | return true; |
1029 | 0 | } |
1030 | | |
1031 | | static const JSJitInfo x_getterinfo = { |
1032 | | { (JSJitGetterOp)get_x }, |
1033 | | { prototypes::id::SVGPathSegArcRel }, |
1034 | | { PrototypeTraits<prototypes::id::SVGPathSegArcRel>::Depth }, |
1035 | | JSJitInfo::Getter, |
1036 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
1037 | | JSVAL_TYPE_DOUBLE, /* returnType. Not relevant for setters. */ |
1038 | | true, /* isInfallible. False in setters. */ |
1039 | | false, /* isMovable. Not relevant for setters. */ |
1040 | | false, /* isEliminatable. Not relevant for setters. */ |
1041 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
1042 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
1043 | | false, /* isTypedMethod. Only relevant for methods. */ |
1044 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
1045 | | }; |
1046 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
1047 | | static_assert(0 < 1, "There is no slot for us"); |
1048 | | static const JSJitInfo x_setterinfo = { |
1049 | | { (JSJitGetterOp)set_x }, |
1050 | | { prototypes::id::SVGPathSegArcRel }, |
1051 | | { PrototypeTraits<prototypes::id::SVGPathSegArcRel>::Depth }, |
1052 | | JSJitInfo::Setter, |
1053 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
1054 | | JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */ |
1055 | | false, /* isInfallible. False in setters. */ |
1056 | | false, /* isMovable. Not relevant for setters. */ |
1057 | | false, /* isEliminatable. Not relevant for setters. */ |
1058 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
1059 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
1060 | | false, /* isTypedMethod. Only relevant for methods. */ |
1061 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
1062 | | }; |
1063 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
1064 | | static_assert(0 < 1, "There is no slot for us"); |
1065 | | |
1066 | | MOZ_CAN_RUN_SCRIPT static bool |
1067 | | get_y(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::DOMSVGPathSegArcRel* self, JSJitGetterCallArgs args) |
1068 | 0 | { |
1069 | 0 | AUTO_PROFILER_LABEL_FAST("get SVGPathSegArcRel.y", DOM, cx); |
1070 | 0 |
|
1071 | 0 | float result(self->Y()); |
1072 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
1073 | 0 | args.rval().set(JS_NumberValue(double(result))); |
1074 | 0 | return true; |
1075 | 0 | } |
1076 | | |
1077 | | MOZ_CAN_RUN_SCRIPT static bool |
1078 | | set_y(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::DOMSVGPathSegArcRel* self, JSJitSetterCallArgs args) |
1079 | 0 | { |
1080 | 0 | AUTO_PROFILER_LABEL_FAST("set SVGPathSegArcRel.y", DOM, cx); |
1081 | 0 |
|
1082 | 0 | float arg0; |
1083 | 0 | if (!ValueToPrimitive<float, eDefault>(cx, args[0], &arg0)) { |
1084 | 0 | return false; |
1085 | 0 | } else if (!mozilla::IsFinite(arg0)) { |
1086 | 0 | ThrowErrorMessage(cx, MSG_NOT_FINITE, "Value being assigned to SVGPathSegArcRel.y"); |
1087 | 0 | return false; |
1088 | 0 | } |
1089 | 0 | FastErrorResult rv; |
1090 | 0 | self->SetY(arg0, rv); |
1091 | 0 | if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) { |
1092 | 0 | return false; |
1093 | 0 | } |
1094 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
1095 | 0 |
|
1096 | 0 | return true; |
1097 | 0 | } |
1098 | | |
1099 | | static const JSJitInfo y_getterinfo = { |
1100 | | { (JSJitGetterOp)get_y }, |
1101 | | { prototypes::id::SVGPathSegArcRel }, |
1102 | | { PrototypeTraits<prototypes::id::SVGPathSegArcRel>::Depth }, |
1103 | | JSJitInfo::Getter, |
1104 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
1105 | | JSVAL_TYPE_DOUBLE, /* returnType. Not relevant for setters. */ |
1106 | | true, /* isInfallible. False in setters. */ |
1107 | | false, /* isMovable. Not relevant for setters. */ |
1108 | | false, /* isEliminatable. Not relevant for setters. */ |
1109 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
1110 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
1111 | | false, /* isTypedMethod. Only relevant for methods. */ |
1112 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
1113 | | }; |
1114 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
1115 | | static_assert(0 < 1, "There is no slot for us"); |
1116 | | static const JSJitInfo y_setterinfo = { |
1117 | | { (JSJitGetterOp)set_y }, |
1118 | | { prototypes::id::SVGPathSegArcRel }, |
1119 | | { PrototypeTraits<prototypes::id::SVGPathSegArcRel>::Depth }, |
1120 | | JSJitInfo::Setter, |
1121 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
1122 | | JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */ |
1123 | | false, /* isInfallible. False in setters. */ |
1124 | | false, /* isMovable. Not relevant for setters. */ |
1125 | | false, /* isEliminatable. Not relevant for setters. */ |
1126 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
1127 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
1128 | | false, /* isTypedMethod. Only relevant for methods. */ |
1129 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
1130 | | }; |
1131 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
1132 | | static_assert(0 < 1, "There is no slot for us"); |
1133 | | |
1134 | | MOZ_CAN_RUN_SCRIPT static bool |
1135 | | get_r1(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::DOMSVGPathSegArcRel* self, JSJitGetterCallArgs args) |
1136 | 0 | { |
1137 | 0 | AUTO_PROFILER_LABEL_FAST("get SVGPathSegArcRel.r1", DOM, cx); |
1138 | 0 |
|
1139 | 0 | float result(self->R1()); |
1140 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
1141 | 0 | args.rval().set(JS_NumberValue(double(result))); |
1142 | 0 | return true; |
1143 | 0 | } |
1144 | | |
1145 | | MOZ_CAN_RUN_SCRIPT static bool |
1146 | | set_r1(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::DOMSVGPathSegArcRel* self, JSJitSetterCallArgs args) |
1147 | 0 | { |
1148 | 0 | AUTO_PROFILER_LABEL_FAST("set SVGPathSegArcRel.r1", DOM, cx); |
1149 | 0 |
|
1150 | 0 | float arg0; |
1151 | 0 | if (!ValueToPrimitive<float, eDefault>(cx, args[0], &arg0)) { |
1152 | 0 | return false; |
1153 | 0 | } else if (!mozilla::IsFinite(arg0)) { |
1154 | 0 | ThrowErrorMessage(cx, MSG_NOT_FINITE, "Value being assigned to SVGPathSegArcRel.r1"); |
1155 | 0 | return false; |
1156 | 0 | } |
1157 | 0 | FastErrorResult rv; |
1158 | 0 | self->SetR1(arg0, rv); |
1159 | 0 | if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) { |
1160 | 0 | return false; |
1161 | 0 | } |
1162 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
1163 | 0 |
|
1164 | 0 | return true; |
1165 | 0 | } |
1166 | | |
1167 | | static const JSJitInfo r1_getterinfo = { |
1168 | | { (JSJitGetterOp)get_r1 }, |
1169 | | { prototypes::id::SVGPathSegArcRel }, |
1170 | | { PrototypeTraits<prototypes::id::SVGPathSegArcRel>::Depth }, |
1171 | | JSJitInfo::Getter, |
1172 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
1173 | | JSVAL_TYPE_DOUBLE, /* returnType. Not relevant for setters. */ |
1174 | | true, /* isInfallible. False in setters. */ |
1175 | | false, /* isMovable. Not relevant for setters. */ |
1176 | | false, /* isEliminatable. Not relevant for setters. */ |
1177 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
1178 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
1179 | | false, /* isTypedMethod. Only relevant for methods. */ |
1180 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
1181 | | }; |
1182 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
1183 | | static_assert(0 < 1, "There is no slot for us"); |
1184 | | static const JSJitInfo r1_setterinfo = { |
1185 | | { (JSJitGetterOp)set_r1 }, |
1186 | | { prototypes::id::SVGPathSegArcRel }, |
1187 | | { PrototypeTraits<prototypes::id::SVGPathSegArcRel>::Depth }, |
1188 | | JSJitInfo::Setter, |
1189 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
1190 | | JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */ |
1191 | | false, /* isInfallible. False in setters. */ |
1192 | | false, /* isMovable. Not relevant for setters. */ |
1193 | | false, /* isEliminatable. Not relevant for setters. */ |
1194 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
1195 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
1196 | | false, /* isTypedMethod. Only relevant for methods. */ |
1197 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
1198 | | }; |
1199 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
1200 | | static_assert(0 < 1, "There is no slot for us"); |
1201 | | |
1202 | | MOZ_CAN_RUN_SCRIPT static bool |
1203 | | get_r2(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::DOMSVGPathSegArcRel* self, JSJitGetterCallArgs args) |
1204 | 0 | { |
1205 | 0 | AUTO_PROFILER_LABEL_FAST("get SVGPathSegArcRel.r2", DOM, cx); |
1206 | 0 |
|
1207 | 0 | float result(self->R2()); |
1208 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
1209 | 0 | args.rval().set(JS_NumberValue(double(result))); |
1210 | 0 | return true; |
1211 | 0 | } |
1212 | | |
1213 | | MOZ_CAN_RUN_SCRIPT static bool |
1214 | | set_r2(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::DOMSVGPathSegArcRel* self, JSJitSetterCallArgs args) |
1215 | 0 | { |
1216 | 0 | AUTO_PROFILER_LABEL_FAST("set SVGPathSegArcRel.r2", DOM, cx); |
1217 | 0 |
|
1218 | 0 | float arg0; |
1219 | 0 | if (!ValueToPrimitive<float, eDefault>(cx, args[0], &arg0)) { |
1220 | 0 | return false; |
1221 | 0 | } else if (!mozilla::IsFinite(arg0)) { |
1222 | 0 | ThrowErrorMessage(cx, MSG_NOT_FINITE, "Value being assigned to SVGPathSegArcRel.r2"); |
1223 | 0 | return false; |
1224 | 0 | } |
1225 | 0 | FastErrorResult rv; |
1226 | 0 | self->SetR2(arg0, rv); |
1227 | 0 | if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) { |
1228 | 0 | return false; |
1229 | 0 | } |
1230 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
1231 | 0 |
|
1232 | 0 | return true; |
1233 | 0 | } |
1234 | | |
1235 | | static const JSJitInfo r2_getterinfo = { |
1236 | | { (JSJitGetterOp)get_r2 }, |
1237 | | { prototypes::id::SVGPathSegArcRel }, |
1238 | | { PrototypeTraits<prototypes::id::SVGPathSegArcRel>::Depth }, |
1239 | | JSJitInfo::Getter, |
1240 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
1241 | | JSVAL_TYPE_DOUBLE, /* returnType. Not relevant for setters. */ |
1242 | | true, /* isInfallible. False in setters. */ |
1243 | | false, /* isMovable. Not relevant for setters. */ |
1244 | | false, /* isEliminatable. Not relevant for setters. */ |
1245 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
1246 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
1247 | | false, /* isTypedMethod. Only relevant for methods. */ |
1248 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
1249 | | }; |
1250 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
1251 | | static_assert(0 < 1, "There is no slot for us"); |
1252 | | static const JSJitInfo r2_setterinfo = { |
1253 | | { (JSJitGetterOp)set_r2 }, |
1254 | | { prototypes::id::SVGPathSegArcRel }, |
1255 | | { PrototypeTraits<prototypes::id::SVGPathSegArcRel>::Depth }, |
1256 | | JSJitInfo::Setter, |
1257 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
1258 | | JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */ |
1259 | | false, /* isInfallible. False in setters. */ |
1260 | | false, /* isMovable. Not relevant for setters. */ |
1261 | | false, /* isEliminatable. Not relevant for setters. */ |
1262 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
1263 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
1264 | | false, /* isTypedMethod. Only relevant for methods. */ |
1265 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
1266 | | }; |
1267 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
1268 | | static_assert(0 < 1, "There is no slot for us"); |
1269 | | |
1270 | | MOZ_CAN_RUN_SCRIPT static bool |
1271 | | get_angle(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::DOMSVGPathSegArcRel* self, JSJitGetterCallArgs args) |
1272 | 0 | { |
1273 | 0 | AUTO_PROFILER_LABEL_FAST("get SVGPathSegArcRel.angle", DOM, cx); |
1274 | 0 |
|
1275 | 0 | float result(self->Angle()); |
1276 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
1277 | 0 | args.rval().set(JS_NumberValue(double(result))); |
1278 | 0 | return true; |
1279 | 0 | } |
1280 | | |
1281 | | MOZ_CAN_RUN_SCRIPT static bool |
1282 | | set_angle(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::DOMSVGPathSegArcRel* self, JSJitSetterCallArgs args) |
1283 | 0 | { |
1284 | 0 | AUTO_PROFILER_LABEL_FAST("set SVGPathSegArcRel.angle", DOM, cx); |
1285 | 0 |
|
1286 | 0 | float arg0; |
1287 | 0 | if (!ValueToPrimitive<float, eDefault>(cx, args[0], &arg0)) { |
1288 | 0 | return false; |
1289 | 0 | } else if (!mozilla::IsFinite(arg0)) { |
1290 | 0 | ThrowErrorMessage(cx, MSG_NOT_FINITE, "Value being assigned to SVGPathSegArcRel.angle"); |
1291 | 0 | return false; |
1292 | 0 | } |
1293 | 0 | FastErrorResult rv; |
1294 | 0 | self->SetAngle(arg0, rv); |
1295 | 0 | if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) { |
1296 | 0 | return false; |
1297 | 0 | } |
1298 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
1299 | 0 |
|
1300 | 0 | return true; |
1301 | 0 | } |
1302 | | |
1303 | | static const JSJitInfo angle_getterinfo = { |
1304 | | { (JSJitGetterOp)get_angle }, |
1305 | | { prototypes::id::SVGPathSegArcRel }, |
1306 | | { PrototypeTraits<prototypes::id::SVGPathSegArcRel>::Depth }, |
1307 | | JSJitInfo::Getter, |
1308 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
1309 | | JSVAL_TYPE_DOUBLE, /* returnType. Not relevant for setters. */ |
1310 | | true, /* isInfallible. False in setters. */ |
1311 | | false, /* isMovable. Not relevant for setters. */ |
1312 | | false, /* isEliminatable. Not relevant for setters. */ |
1313 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
1314 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
1315 | | false, /* isTypedMethod. Only relevant for methods. */ |
1316 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
1317 | | }; |
1318 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
1319 | | static_assert(0 < 1, "There is no slot for us"); |
1320 | | static const JSJitInfo angle_setterinfo = { |
1321 | | { (JSJitGetterOp)set_angle }, |
1322 | | { prototypes::id::SVGPathSegArcRel }, |
1323 | | { PrototypeTraits<prototypes::id::SVGPathSegArcRel>::Depth }, |
1324 | | JSJitInfo::Setter, |
1325 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
1326 | | JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */ |
1327 | | false, /* isInfallible. False in setters. */ |
1328 | | false, /* isMovable. Not relevant for setters. */ |
1329 | | false, /* isEliminatable. Not relevant for setters. */ |
1330 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
1331 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
1332 | | false, /* isTypedMethod. Only relevant for methods. */ |
1333 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
1334 | | }; |
1335 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
1336 | | static_assert(0 < 1, "There is no slot for us"); |
1337 | | |
1338 | | MOZ_CAN_RUN_SCRIPT static bool |
1339 | | get_largeArcFlag(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::DOMSVGPathSegArcRel* self, JSJitGetterCallArgs args) |
1340 | 0 | { |
1341 | 0 | AUTO_PROFILER_LABEL_FAST("get SVGPathSegArcRel.largeArcFlag", DOM, cx); |
1342 | 0 |
|
1343 | 0 | bool result(self->LargeArcFlag()); |
1344 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
1345 | 0 | args.rval().setBoolean(result); |
1346 | 0 | return true; |
1347 | 0 | } |
1348 | | |
1349 | | MOZ_CAN_RUN_SCRIPT static bool |
1350 | | set_largeArcFlag(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::DOMSVGPathSegArcRel* self, JSJitSetterCallArgs args) |
1351 | 0 | { |
1352 | 0 | AUTO_PROFILER_LABEL_FAST("set SVGPathSegArcRel.largeArcFlag", DOM, cx); |
1353 | 0 |
|
1354 | 0 | bool arg0; |
1355 | 0 | if (!ValueToPrimitive<bool, eDefault>(cx, args[0], &arg0)) { |
1356 | 0 | return false; |
1357 | 0 | } |
1358 | 0 | FastErrorResult rv; |
1359 | 0 | self->SetLargeArcFlag(arg0, rv); |
1360 | 0 | if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) { |
1361 | 0 | return false; |
1362 | 0 | } |
1363 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
1364 | 0 |
|
1365 | 0 | return true; |
1366 | 0 | } |
1367 | | |
1368 | | static const JSJitInfo largeArcFlag_getterinfo = { |
1369 | | { (JSJitGetterOp)get_largeArcFlag }, |
1370 | | { prototypes::id::SVGPathSegArcRel }, |
1371 | | { PrototypeTraits<prototypes::id::SVGPathSegArcRel>::Depth }, |
1372 | | JSJitInfo::Getter, |
1373 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
1374 | | JSVAL_TYPE_BOOLEAN, /* returnType. Not relevant for setters. */ |
1375 | | true, /* isInfallible. False in setters. */ |
1376 | | false, /* isMovable. Not relevant for setters. */ |
1377 | | false, /* isEliminatable. Not relevant for setters. */ |
1378 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
1379 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
1380 | | false, /* isTypedMethod. Only relevant for methods. */ |
1381 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
1382 | | }; |
1383 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
1384 | | static_assert(0 < 1, "There is no slot for us"); |
1385 | | static const JSJitInfo largeArcFlag_setterinfo = { |
1386 | | { (JSJitGetterOp)set_largeArcFlag }, |
1387 | | { prototypes::id::SVGPathSegArcRel }, |
1388 | | { PrototypeTraits<prototypes::id::SVGPathSegArcRel>::Depth }, |
1389 | | JSJitInfo::Setter, |
1390 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
1391 | | JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */ |
1392 | | false, /* isInfallible. False in setters. */ |
1393 | | false, /* isMovable. Not relevant for setters. */ |
1394 | | false, /* isEliminatable. Not relevant for setters. */ |
1395 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
1396 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
1397 | | false, /* isTypedMethod. Only relevant for methods. */ |
1398 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
1399 | | }; |
1400 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
1401 | | static_assert(0 < 1, "There is no slot for us"); |
1402 | | |
1403 | | MOZ_CAN_RUN_SCRIPT static bool |
1404 | | get_sweepFlag(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::DOMSVGPathSegArcRel* self, JSJitGetterCallArgs args) |
1405 | 0 | { |
1406 | 0 | AUTO_PROFILER_LABEL_FAST("get SVGPathSegArcRel.sweepFlag", DOM, cx); |
1407 | 0 |
|
1408 | 0 | bool result(self->SweepFlag()); |
1409 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
1410 | 0 | args.rval().setBoolean(result); |
1411 | 0 | return true; |
1412 | 0 | } |
1413 | | |
1414 | | MOZ_CAN_RUN_SCRIPT static bool |
1415 | | set_sweepFlag(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::DOMSVGPathSegArcRel* self, JSJitSetterCallArgs args) |
1416 | 0 | { |
1417 | 0 | AUTO_PROFILER_LABEL_FAST("set SVGPathSegArcRel.sweepFlag", DOM, cx); |
1418 | 0 |
|
1419 | 0 | bool arg0; |
1420 | 0 | if (!ValueToPrimitive<bool, eDefault>(cx, args[0], &arg0)) { |
1421 | 0 | return false; |
1422 | 0 | } |
1423 | 0 | FastErrorResult rv; |
1424 | 0 | self->SetSweepFlag(arg0, rv); |
1425 | 0 | if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) { |
1426 | 0 | return false; |
1427 | 0 | } |
1428 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
1429 | 0 |
|
1430 | 0 | return true; |
1431 | 0 | } |
1432 | | |
1433 | | static const JSJitInfo sweepFlag_getterinfo = { |
1434 | | { (JSJitGetterOp)get_sweepFlag }, |
1435 | | { prototypes::id::SVGPathSegArcRel }, |
1436 | | { PrototypeTraits<prototypes::id::SVGPathSegArcRel>::Depth }, |
1437 | | JSJitInfo::Getter, |
1438 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
1439 | | JSVAL_TYPE_BOOLEAN, /* returnType. Not relevant for setters. */ |
1440 | | true, /* isInfallible. False in setters. */ |
1441 | | false, /* isMovable. Not relevant for setters. */ |
1442 | | false, /* isEliminatable. Not relevant for setters. */ |
1443 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
1444 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
1445 | | false, /* isTypedMethod. Only relevant for methods. */ |
1446 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
1447 | | }; |
1448 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
1449 | | static_assert(0 < 1, "There is no slot for us"); |
1450 | | static const JSJitInfo sweepFlag_setterinfo = { |
1451 | | { (JSJitGetterOp)set_sweepFlag }, |
1452 | | { prototypes::id::SVGPathSegArcRel }, |
1453 | | { PrototypeTraits<prototypes::id::SVGPathSegArcRel>::Depth }, |
1454 | | JSJitInfo::Setter, |
1455 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
1456 | | JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */ |
1457 | | false, /* isInfallible. False in setters. */ |
1458 | | false, /* isMovable. Not relevant for setters. */ |
1459 | | false, /* isEliminatable. Not relevant for setters. */ |
1460 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
1461 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
1462 | | false, /* isTypedMethod. Only relevant for methods. */ |
1463 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
1464 | | }; |
1465 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
1466 | | static_assert(0 < 1, "There is no slot for us"); |
1467 | | |
1468 | | static bool |
1469 | | _addProperty(JSContext* cx, JS::Handle<JSObject*> obj, JS::Handle<jsid> id, JS::Handle<JS::Value> val) |
1470 | 0 | { |
1471 | 0 | mozilla::DOMSVGPathSegArcRel* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::DOMSVGPathSegArcRel>(obj); |
1472 | 0 | // We don't want to preserve if we don't have a wrapper, and we |
1473 | 0 | // obviously can't preserve if we're not initialized. |
1474 | 0 | if (self && self->GetWrapperPreserveColor()) { |
1475 | 0 | PreserveWrapper(self); |
1476 | 0 | } |
1477 | 0 | return true; |
1478 | 0 | } |
1479 | | |
1480 | | static void |
1481 | | _finalize(js::FreeOp* fop, JSObject* obj) |
1482 | 0 | { |
1483 | 0 | mozilla::DOMSVGPathSegArcRel* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::DOMSVGPathSegArcRel>(obj); |
1484 | 0 | if (self) { |
1485 | 0 | ClearWrapper(self, self, obj); |
1486 | 0 | AddForDeferredFinalization<mozilla::DOMSVGPathSegArcRel>(self); |
1487 | 0 | } |
1488 | 0 | } |
1489 | | |
1490 | | static size_t |
1491 | | _objectMoved(JSObject* obj, JSObject* old) |
1492 | 0 | { |
1493 | 0 | mozilla::DOMSVGPathSegArcRel* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::DOMSVGPathSegArcRel>(obj); |
1494 | 0 | if (self) { |
1495 | 0 | UpdateWrapper(self, self, obj, old); |
1496 | 0 | } |
1497 | 0 |
|
1498 | 0 | return 0; |
1499 | 0 | } |
1500 | | |
1501 | | // We deliberately use brace-elision to make Visual Studio produce better initalization code. |
1502 | | #if defined(__clang__) |
1503 | | #pragma clang diagnostic push |
1504 | | #pragma clang diagnostic ignored "-Wmissing-braces" |
1505 | | #endif |
1506 | | static const JSPropertySpec sAttributes_specs[] = { |
1507 | | { "x", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &x_getterinfo, GenericSetter<NormalThisPolicy>, &x_setterinfo }, |
1508 | | { "y", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &y_getterinfo, GenericSetter<NormalThisPolicy>, &y_setterinfo }, |
1509 | | { "r1", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &r1_getterinfo, GenericSetter<NormalThisPolicy>, &r1_setterinfo }, |
1510 | | { "r2", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &r2_getterinfo, GenericSetter<NormalThisPolicy>, &r2_setterinfo }, |
1511 | | { "angle", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &angle_getterinfo, GenericSetter<NormalThisPolicy>, &angle_setterinfo }, |
1512 | | { "largeArcFlag", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &largeArcFlag_getterinfo, GenericSetter<NormalThisPolicy>, &largeArcFlag_setterinfo }, |
1513 | | { "sweepFlag", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &sweepFlag_getterinfo, GenericSetter<NormalThisPolicy>, &sweepFlag_setterinfo }, |
1514 | | { nullptr, 0, nullptr, nullptr, nullptr, nullptr } |
1515 | | }; |
1516 | | #if defined(__clang__) |
1517 | | #pragma clang diagnostic pop |
1518 | | #endif |
1519 | | |
1520 | | |
1521 | | static const Prefable<const JSPropertySpec> sAttributes[] = { |
1522 | | { nullptr, &sAttributes_specs[0] }, |
1523 | | { nullptr, nullptr } |
1524 | | }; |
1525 | | |
1526 | | static_assert(1 <= 1ull << NUM_BITS_PROPERTY_INFO_PREF_INDEX, |
1527 | | "We have a prefable index that is >= (1 << NUM_BITS_PROPERTY_INFO_PREF_INDEX)"); |
1528 | | static_assert(7 <= 1ull << NUM_BITS_PROPERTY_INFO_SPEC_INDEX, |
1529 | | "We have a spec index that is >= (1 << NUM_BITS_PROPERTY_INFO_SPEC_INDEX)"); |
1530 | | |
1531 | | |
1532 | | static uint16_t sNativeProperties_sortedPropertyIndices[7]; |
1533 | | static PropertyInfo sNativeProperties_propertyInfos[7]; |
1534 | | |
1535 | | static const NativePropertiesN<1> sNativeProperties = { |
1536 | | false, 0, |
1537 | | false, 0, |
1538 | | false, 0, |
1539 | | true, 0 /* sAttributes */, |
1540 | | false, 0, |
1541 | | false, 0, |
1542 | | false, 0, |
1543 | | -1, |
1544 | | 7, |
1545 | | sNativeProperties_sortedPropertyIndices, |
1546 | | { |
1547 | | { sAttributes, &sNativeProperties_propertyInfos[0] } |
1548 | | } |
1549 | | }; |
1550 | | static_assert(7 < 1ull << CHAR_BIT * sizeof(sNativeProperties.propertyInfoCount), |
1551 | | "We have a property info count that is oversized"); |
1552 | | |
1553 | | static const DOMIfaceAndProtoJSClass sPrototypeClass = { |
1554 | | { |
1555 | | "SVGPathSegArcRelPrototype", |
1556 | | JSCLASS_IS_DOMIFACEANDPROTOJSCLASS | JSCLASS_HAS_RESERVED_SLOTS(DOM_INTERFACE_PROTO_SLOTS_BASE), |
1557 | | JS_NULL_CLASS_OPS, |
1558 | | JS_NULL_CLASS_SPEC, |
1559 | | JS_NULL_CLASS_EXT, |
1560 | | JS_NULL_OBJECT_OPS |
1561 | | }, |
1562 | | eInterfacePrototype, |
1563 | | false, |
1564 | | prototypes::id::SVGPathSegArcRel, |
1565 | | PrototypeTraits<prototypes::id::SVGPathSegArcRel>::Depth, |
1566 | | sNativePropertyHooks, |
1567 | | "[object SVGPathSegArcRelPrototype]", |
1568 | | SVGPathSeg_Binding::GetProtoObject |
1569 | | }; |
1570 | | |
1571 | | static const js::ClassOps sClassOps = { |
1572 | | _addProperty, /* addProperty */ |
1573 | | nullptr, /* delProperty */ |
1574 | | nullptr, /* enumerate */ |
1575 | | nullptr, /* newEnumerate */ |
1576 | | nullptr, /* resolve */ |
1577 | | nullptr, /* mayResolve */ |
1578 | | _finalize, /* finalize */ |
1579 | | nullptr, /* call */ |
1580 | | nullptr, /* hasInstance */ |
1581 | | nullptr, /* construct */ |
1582 | | nullptr, /* trace */ |
1583 | | }; |
1584 | | |
1585 | | static const js::ClassExtension sClassExtension = { |
1586 | | nullptr, /* weakmapKeyDelegateOp */ |
1587 | | _objectMoved /* objectMovedOp */ |
1588 | | }; |
1589 | | |
1590 | | static const DOMJSClass sClass = { |
1591 | | { "SVGPathSegArcRel", |
1592 | | JSCLASS_IS_DOMJSCLASS | JSCLASS_FOREGROUND_FINALIZE | JSCLASS_HAS_RESERVED_SLOTS(1), |
1593 | | &sClassOps, |
1594 | | JS_NULL_CLASS_SPEC, |
1595 | | &sClassExtension, |
1596 | | JS_NULL_OBJECT_OPS |
1597 | | }, |
1598 | | { prototypes::id::SVGPathSeg, prototypes::id::SVGPathSegArcRel, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count }, |
1599 | | IsBaseOf<nsISupports, mozilla::DOMSVGPathSegArcRel >::value, |
1600 | | sNativePropertyHooks, |
1601 | | FindAssociatedGlobalForNative<mozilla::DOMSVGPathSegArcRel>::Get, |
1602 | | GetProtoObjectHandle, |
1603 | | GetCCParticipant<mozilla::DOMSVGPathSegArcRel>::Get() |
1604 | | }; |
1605 | | static_assert(1 == DOM_INSTANCE_RESERVED_SLOTS, |
1606 | | "Must have the right minimal number of reserved slots."); |
1607 | | static_assert(1 >= 1, |
1608 | | "Must have enough reserved slots."); |
1609 | | |
1610 | | const JSClass* |
1611 | | GetJSClass() |
1612 | 0 | { |
1613 | 0 | return sClass.ToJSClass(); |
1614 | 0 | } |
1615 | | |
1616 | | bool |
1617 | | Wrap(JSContext* aCx, mozilla::DOMSVGPathSegArcRel* aObject, nsWrapperCache* aCache, JS::Handle<JSObject*> aGivenProto, JS::MutableHandle<JSObject*> aReflector) |
1618 | 0 | { |
1619 | 0 | static_assert(!IsBaseOf<NonRefcountedDOMObject, mozilla::DOMSVGPathSegArcRel>::value, |
1620 | 0 | "Shouldn't have wrappercached things that are not refcounted."); |
1621 | 0 | MOZ_ASSERT(static_cast<mozilla::DOMSVGPathSegArcRel*>(aObject) == |
1622 | 0 | reinterpret_cast<mozilla::DOMSVGPathSegArcRel*>(aObject), |
1623 | 0 | "Multiple inheritance for mozilla::DOMSVGPathSegArcRel is broken."); |
1624 | 0 | MOZ_ASSERT(static_cast<mozilla::DOMSVGPathSeg*>(aObject) == |
1625 | 0 | reinterpret_cast<mozilla::DOMSVGPathSeg*>(aObject), |
1626 | 0 | "Multiple inheritance for mozilla::DOMSVGPathSeg is broken."); |
1627 | 0 | MOZ_ASSERT(ToSupportsIsCorrect(aObject)); |
1628 | 0 | MOZ_ASSERT_IF(aGivenProto, js::IsObjectInContextCompartment(aGivenProto, aCx)); |
1629 | 0 | MOZ_ASSERT(!aCache->GetWrapper(), |
1630 | 0 | "You should probably not be using Wrap() directly; use " |
1631 | 0 | "GetOrCreateDOMReflector instead"); |
1632 | 0 |
|
1633 | 0 | MOZ_ASSERT(ToSupportsIsOnPrimaryInheritanceChain(aObject, aCache), |
1634 | 0 | "nsISupports must be on our primary inheritance chain"); |
1635 | 0 |
|
1636 | 0 | JS::Rooted<JSObject*> global(aCx, FindAssociatedGlobal(aCx, aObject->GetParentObject())); |
1637 | 0 | if (!global) { |
1638 | 0 | return false; |
1639 | 0 | } |
1640 | 0 | MOZ_ASSERT(JS_IsGlobalObject(global)); |
1641 | 0 | MOZ_ASSERT(JS::ObjectIsNotGray(global)); |
1642 | 0 |
|
1643 | 0 | // That might have ended up wrapping us already, due to the wonders |
1644 | 0 | // of XBL. Check for that, and bail out as needed. |
1645 | 0 | aReflector.set(aCache->GetWrapper()); |
1646 | 0 | if (aReflector) { |
1647 | | #ifdef DEBUG |
1648 | | AssertReflectorHasGivenProto(aCx, aReflector, aGivenProto); |
1649 | | #endif // DEBUG |
1650 | | return true; |
1651 | 0 | } |
1652 | 0 |
|
1653 | 0 | JSAutoRealm ar(aCx, global); |
1654 | 0 | JS::Handle<JSObject*> canonicalProto = GetProtoObjectHandle(aCx); |
1655 | 0 | if (!canonicalProto) { |
1656 | 0 | return false; |
1657 | 0 | } |
1658 | 0 | JS::Rooted<JSObject*> proto(aCx); |
1659 | 0 | if (aGivenProto) { |
1660 | 0 | proto = aGivenProto; |
1661 | 0 | // Unfortunately, while aGivenProto was in the compartment of aCx |
1662 | 0 | // coming in, we changed compartments to that of "parent" so may need |
1663 | 0 | // to wrap the proto here. |
1664 | 0 | if (js::GetContextCompartment(aCx) != js::GetObjectCompartment(proto)) { |
1665 | 0 | if (!JS_WrapObject(aCx, &proto)) { |
1666 | 0 | return false; |
1667 | 0 | } |
1668 | 0 | } |
1669 | 0 | } else { |
1670 | 0 | proto = canonicalProto; |
1671 | 0 | } |
1672 | 0 |
|
1673 | 0 | BindingJSObjectCreator<mozilla::DOMSVGPathSegArcRel> creator(aCx); |
1674 | 0 | creator.CreateObject(aCx, sClass.ToJSClass(), proto, aObject, aReflector); |
1675 | 0 | if (!aReflector) { |
1676 | 0 | return false; |
1677 | 0 | } |
1678 | 0 | |
1679 | 0 | aCache->SetWrapper(aReflector); |
1680 | 0 | creator.InitializationSucceeded(); |
1681 | 0 |
|
1682 | 0 | MOZ_ASSERT(aCache->GetWrapperPreserveColor() && |
1683 | 0 | aCache->GetWrapperPreserveColor() == aReflector); |
1684 | 0 | // If proto != canonicalProto, we have to preserve our wrapper; |
1685 | 0 | // otherwise we won't be able to properly recreate it later, since |
1686 | 0 | // we won't know what proto to use. Note that we don't check |
1687 | 0 | // aGivenProto here, since it's entirely possible (and even |
1688 | 0 | // somewhat common) to have a non-null aGivenProto which is the |
1689 | 0 | // same as canonicalProto. |
1690 | 0 | if (proto != canonicalProto) { |
1691 | 0 | PreserveWrapper(aObject); |
1692 | 0 | } |
1693 | 0 |
|
1694 | 0 | return true; |
1695 | 0 | } |
1696 | | |
1697 | | const NativePropertyHooks sNativePropertyHooks[] = { { |
1698 | | nullptr, |
1699 | | nullptr, |
1700 | | nullptr, |
1701 | | { sNativeProperties.Upcast(), nullptr }, |
1702 | | prototypes::id::SVGPathSegArcRel, |
1703 | | constructors::id::_ID_Count, |
1704 | | SVGPathSeg_Binding::sNativePropertyHooks, |
1705 | | &DefaultXrayExpandoObjectClass |
1706 | | } }; |
1707 | | |
1708 | | void |
1709 | | CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, bool aDefineOnGlobal) |
1710 | 0 | { |
1711 | 0 | JS::Handle<JSObject*> parentProto(SVGPathSeg_Binding::GetProtoObjectHandle(aCx)); |
1712 | 0 | if (!parentProto) { |
1713 | 0 | return; |
1714 | 0 | } |
1715 | 0 | |
1716 | 0 | static bool sIdsInited = false; |
1717 | 0 | if (!sIdsInited && NS_IsMainThread()) { |
1718 | 0 | if (!InitIds(aCx, sNativeProperties.Upcast())) { |
1719 | 0 | return; |
1720 | 0 | } |
1721 | 0 | sIdsInited = true; |
1722 | 0 | } |
1723 | 0 |
|
1724 | 0 | JS::Heap<JSObject*>* protoCache = &aProtoAndIfaceCache.EntrySlotOrCreate(prototypes::id::SVGPathSegArcRel); |
1725 | 0 | JS::Heap<JSObject*>* interfaceCache = nullptr; |
1726 | 0 | dom::CreateInterfaceObjects(aCx, aGlobal, parentProto, |
1727 | 0 | &sPrototypeClass.mBase, protoCache, |
1728 | 0 | nullptr, |
1729 | 0 | nullptr, nullptr, 0, nullptr, |
1730 | 0 | interfaceCache, |
1731 | 0 | sNativeProperties.Upcast(), |
1732 | 0 | nullptr, |
1733 | 0 | nullptr, aDefineOnGlobal, |
1734 | 0 | nullptr, |
1735 | 0 | false); |
1736 | 0 | } |
1737 | | |
1738 | | } // namespace SVGPathSegArcRel_Binding |
1739 | | |
1740 | | |
1741 | | |
1742 | | namespace SVGPathSegClosePath_Binding { |
1743 | | |
1744 | | static_assert(IsRefcounted<NativeType>::value == IsRefcounted<SVGPathSeg_Binding::NativeType>::value, |
1745 | | "Can't inherit from an interface with a different ownership model."); |
1746 | | |
1747 | | static bool |
1748 | | _addProperty(JSContext* cx, JS::Handle<JSObject*> obj, JS::Handle<jsid> id, JS::Handle<JS::Value> val) |
1749 | 0 | { |
1750 | 0 | mozilla::DOMSVGPathSegClosePath* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::DOMSVGPathSegClosePath>(obj); |
1751 | 0 | // We don't want to preserve if we don't have a wrapper, and we |
1752 | 0 | // obviously can't preserve if we're not initialized. |
1753 | 0 | if (self && self->GetWrapperPreserveColor()) { |
1754 | 0 | PreserveWrapper(self); |
1755 | 0 | } |
1756 | 0 | return true; |
1757 | 0 | } |
1758 | | |
1759 | | static void |
1760 | | _finalize(js::FreeOp* fop, JSObject* obj) |
1761 | 0 | { |
1762 | 0 | mozilla::DOMSVGPathSegClosePath* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::DOMSVGPathSegClosePath>(obj); |
1763 | 0 | if (self) { |
1764 | 0 | ClearWrapper(self, self, obj); |
1765 | 0 | AddForDeferredFinalization<mozilla::DOMSVGPathSegClosePath>(self); |
1766 | 0 | } |
1767 | 0 | } |
1768 | | |
1769 | | static size_t |
1770 | | _objectMoved(JSObject* obj, JSObject* old) |
1771 | 0 | { |
1772 | 0 | mozilla::DOMSVGPathSegClosePath* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::DOMSVGPathSegClosePath>(obj); |
1773 | 0 | if (self) { |
1774 | 0 | UpdateWrapper(self, self, obj, old); |
1775 | 0 | } |
1776 | 0 |
|
1777 | 0 | return 0; |
1778 | 0 | } |
1779 | | |
1780 | | static const DOMIfaceAndProtoJSClass sPrototypeClass = { |
1781 | | { |
1782 | | "SVGPathSegClosePathPrototype", |
1783 | | JSCLASS_IS_DOMIFACEANDPROTOJSCLASS | JSCLASS_HAS_RESERVED_SLOTS(DOM_INTERFACE_PROTO_SLOTS_BASE), |
1784 | | JS_NULL_CLASS_OPS, |
1785 | | JS_NULL_CLASS_SPEC, |
1786 | | JS_NULL_CLASS_EXT, |
1787 | | JS_NULL_OBJECT_OPS |
1788 | | }, |
1789 | | eInterfacePrototype, |
1790 | | false, |
1791 | | prototypes::id::SVGPathSegClosePath, |
1792 | | PrototypeTraits<prototypes::id::SVGPathSegClosePath>::Depth, |
1793 | | sNativePropertyHooks, |
1794 | | "[object SVGPathSegClosePathPrototype]", |
1795 | | SVGPathSeg_Binding::GetProtoObject |
1796 | | }; |
1797 | | |
1798 | | static const js::ClassOps sClassOps = { |
1799 | | _addProperty, /* addProperty */ |
1800 | | nullptr, /* delProperty */ |
1801 | | nullptr, /* enumerate */ |
1802 | | nullptr, /* newEnumerate */ |
1803 | | nullptr, /* resolve */ |
1804 | | nullptr, /* mayResolve */ |
1805 | | _finalize, /* finalize */ |
1806 | | nullptr, /* call */ |
1807 | | nullptr, /* hasInstance */ |
1808 | | nullptr, /* construct */ |
1809 | | nullptr, /* trace */ |
1810 | | }; |
1811 | | |
1812 | | static const js::ClassExtension sClassExtension = { |
1813 | | nullptr, /* weakmapKeyDelegateOp */ |
1814 | | _objectMoved /* objectMovedOp */ |
1815 | | }; |
1816 | | |
1817 | | static const DOMJSClass sClass = { |
1818 | | { "SVGPathSegClosePath", |
1819 | | JSCLASS_IS_DOMJSCLASS | JSCLASS_FOREGROUND_FINALIZE | JSCLASS_HAS_RESERVED_SLOTS(1), |
1820 | | &sClassOps, |
1821 | | JS_NULL_CLASS_SPEC, |
1822 | | &sClassExtension, |
1823 | | JS_NULL_OBJECT_OPS |
1824 | | }, |
1825 | | { prototypes::id::SVGPathSeg, prototypes::id::SVGPathSegClosePath, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count }, |
1826 | | IsBaseOf<nsISupports, mozilla::DOMSVGPathSegClosePath >::value, |
1827 | | sNativePropertyHooks, |
1828 | | FindAssociatedGlobalForNative<mozilla::DOMSVGPathSegClosePath>::Get, |
1829 | | GetProtoObjectHandle, |
1830 | | GetCCParticipant<mozilla::DOMSVGPathSegClosePath>::Get() |
1831 | | }; |
1832 | | static_assert(1 == DOM_INSTANCE_RESERVED_SLOTS, |
1833 | | "Must have the right minimal number of reserved slots."); |
1834 | | static_assert(1 >= 1, |
1835 | | "Must have enough reserved slots."); |
1836 | | |
1837 | | const JSClass* |
1838 | | GetJSClass() |
1839 | 0 | { |
1840 | 0 | return sClass.ToJSClass(); |
1841 | 0 | } |
1842 | | |
1843 | | bool |
1844 | | Wrap(JSContext* aCx, mozilla::DOMSVGPathSegClosePath* aObject, nsWrapperCache* aCache, JS::Handle<JSObject*> aGivenProto, JS::MutableHandle<JSObject*> aReflector) |
1845 | 0 | { |
1846 | 0 | static_assert(!IsBaseOf<NonRefcountedDOMObject, mozilla::DOMSVGPathSegClosePath>::value, |
1847 | 0 | "Shouldn't have wrappercached things that are not refcounted."); |
1848 | 0 | MOZ_ASSERT(static_cast<mozilla::DOMSVGPathSegClosePath*>(aObject) == |
1849 | 0 | reinterpret_cast<mozilla::DOMSVGPathSegClosePath*>(aObject), |
1850 | 0 | "Multiple inheritance for mozilla::DOMSVGPathSegClosePath is broken."); |
1851 | 0 | MOZ_ASSERT(static_cast<mozilla::DOMSVGPathSeg*>(aObject) == |
1852 | 0 | reinterpret_cast<mozilla::DOMSVGPathSeg*>(aObject), |
1853 | 0 | "Multiple inheritance for mozilla::DOMSVGPathSeg is broken."); |
1854 | 0 | MOZ_ASSERT(ToSupportsIsCorrect(aObject)); |
1855 | 0 | MOZ_ASSERT_IF(aGivenProto, js::IsObjectInContextCompartment(aGivenProto, aCx)); |
1856 | 0 | MOZ_ASSERT(!aCache->GetWrapper(), |
1857 | 0 | "You should probably not be using Wrap() directly; use " |
1858 | 0 | "GetOrCreateDOMReflector instead"); |
1859 | 0 |
|
1860 | 0 | MOZ_ASSERT(ToSupportsIsOnPrimaryInheritanceChain(aObject, aCache), |
1861 | 0 | "nsISupports must be on our primary inheritance chain"); |
1862 | 0 |
|
1863 | 0 | JS::Rooted<JSObject*> global(aCx, FindAssociatedGlobal(aCx, aObject->GetParentObject())); |
1864 | 0 | if (!global) { |
1865 | 0 | return false; |
1866 | 0 | } |
1867 | 0 | MOZ_ASSERT(JS_IsGlobalObject(global)); |
1868 | 0 | MOZ_ASSERT(JS::ObjectIsNotGray(global)); |
1869 | 0 |
|
1870 | 0 | // That might have ended up wrapping us already, due to the wonders |
1871 | 0 | // of XBL. Check for that, and bail out as needed. |
1872 | 0 | aReflector.set(aCache->GetWrapper()); |
1873 | 0 | if (aReflector) { |
1874 | | #ifdef DEBUG |
1875 | | AssertReflectorHasGivenProto(aCx, aReflector, aGivenProto); |
1876 | | #endif // DEBUG |
1877 | | return true; |
1878 | 0 | } |
1879 | 0 |
|
1880 | 0 | JSAutoRealm ar(aCx, global); |
1881 | 0 | JS::Handle<JSObject*> canonicalProto = GetProtoObjectHandle(aCx); |
1882 | 0 | if (!canonicalProto) { |
1883 | 0 | return false; |
1884 | 0 | } |
1885 | 0 | JS::Rooted<JSObject*> proto(aCx); |
1886 | 0 | if (aGivenProto) { |
1887 | 0 | proto = aGivenProto; |
1888 | 0 | // Unfortunately, while aGivenProto was in the compartment of aCx |
1889 | 0 | // coming in, we changed compartments to that of "parent" so may need |
1890 | 0 | // to wrap the proto here. |
1891 | 0 | if (js::GetContextCompartment(aCx) != js::GetObjectCompartment(proto)) { |
1892 | 0 | if (!JS_WrapObject(aCx, &proto)) { |
1893 | 0 | return false; |
1894 | 0 | } |
1895 | 0 | } |
1896 | 0 | } else { |
1897 | 0 | proto = canonicalProto; |
1898 | 0 | } |
1899 | 0 |
|
1900 | 0 | BindingJSObjectCreator<mozilla::DOMSVGPathSegClosePath> creator(aCx); |
1901 | 0 | creator.CreateObject(aCx, sClass.ToJSClass(), proto, aObject, aReflector); |
1902 | 0 | if (!aReflector) { |
1903 | 0 | return false; |
1904 | 0 | } |
1905 | 0 | |
1906 | 0 | aCache->SetWrapper(aReflector); |
1907 | 0 | creator.InitializationSucceeded(); |
1908 | 0 |
|
1909 | 0 | MOZ_ASSERT(aCache->GetWrapperPreserveColor() && |
1910 | 0 | aCache->GetWrapperPreserveColor() == aReflector); |
1911 | 0 | // If proto != canonicalProto, we have to preserve our wrapper; |
1912 | 0 | // otherwise we won't be able to properly recreate it later, since |
1913 | 0 | // we won't know what proto to use. Note that we don't check |
1914 | 0 | // aGivenProto here, since it's entirely possible (and even |
1915 | 0 | // somewhat common) to have a non-null aGivenProto which is the |
1916 | 0 | // same as canonicalProto. |
1917 | 0 | if (proto != canonicalProto) { |
1918 | 0 | PreserveWrapper(aObject); |
1919 | 0 | } |
1920 | 0 |
|
1921 | 0 | return true; |
1922 | 0 | } |
1923 | | |
1924 | | const NativePropertyHooks sNativePropertyHooks[] = { { |
1925 | | nullptr, |
1926 | | nullptr, |
1927 | | nullptr, |
1928 | | { nullptr, nullptr }, |
1929 | | prototypes::id::SVGPathSegClosePath, |
1930 | | constructors::id::_ID_Count, |
1931 | | SVGPathSeg_Binding::sNativePropertyHooks, |
1932 | | &DefaultXrayExpandoObjectClass |
1933 | | } }; |
1934 | | |
1935 | | void |
1936 | | CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, bool aDefineOnGlobal) |
1937 | 0 | { |
1938 | 0 | JS::Handle<JSObject*> parentProto(SVGPathSeg_Binding::GetProtoObjectHandle(aCx)); |
1939 | 0 | if (!parentProto) { |
1940 | 0 | return; |
1941 | 0 | } |
1942 | 0 | |
1943 | 0 | JS::Heap<JSObject*>* protoCache = &aProtoAndIfaceCache.EntrySlotOrCreate(prototypes::id::SVGPathSegClosePath); |
1944 | 0 | JS::Heap<JSObject*>* interfaceCache = nullptr; |
1945 | 0 | dom::CreateInterfaceObjects(aCx, aGlobal, parentProto, |
1946 | 0 | &sPrototypeClass.mBase, protoCache, |
1947 | 0 | nullptr, |
1948 | 0 | nullptr, nullptr, 0, nullptr, |
1949 | 0 | interfaceCache, |
1950 | 0 | nullptr, |
1951 | 0 | nullptr, |
1952 | 0 | nullptr, aDefineOnGlobal, |
1953 | 0 | nullptr, |
1954 | 0 | false); |
1955 | 0 | } |
1956 | | |
1957 | | } // namespace SVGPathSegClosePath_Binding |
1958 | | |
1959 | | |
1960 | | |
1961 | | namespace SVGPathSegCurvetoCubicAbs_Binding { |
1962 | | |
1963 | | static_assert(IsRefcounted<NativeType>::value == IsRefcounted<SVGPathSeg_Binding::NativeType>::value, |
1964 | | "Can't inherit from an interface with a different ownership model."); |
1965 | | |
1966 | | MOZ_CAN_RUN_SCRIPT static bool |
1967 | | get_x(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::DOMSVGPathSegCurvetoCubicAbs* self, JSJitGetterCallArgs args) |
1968 | 0 | { |
1969 | 0 | AUTO_PROFILER_LABEL_FAST("get SVGPathSegCurvetoCubicAbs.x", DOM, cx); |
1970 | 0 |
|
1971 | 0 | float result(self->X()); |
1972 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
1973 | 0 | args.rval().set(JS_NumberValue(double(result))); |
1974 | 0 | return true; |
1975 | 0 | } |
1976 | | |
1977 | | MOZ_CAN_RUN_SCRIPT static bool |
1978 | | set_x(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::DOMSVGPathSegCurvetoCubicAbs* self, JSJitSetterCallArgs args) |
1979 | 0 | { |
1980 | 0 | AUTO_PROFILER_LABEL_FAST("set SVGPathSegCurvetoCubicAbs.x", DOM, cx); |
1981 | 0 |
|
1982 | 0 | float arg0; |
1983 | 0 | if (!ValueToPrimitive<float, eDefault>(cx, args[0], &arg0)) { |
1984 | 0 | return false; |
1985 | 0 | } else if (!mozilla::IsFinite(arg0)) { |
1986 | 0 | ThrowErrorMessage(cx, MSG_NOT_FINITE, "Value being assigned to SVGPathSegCurvetoCubicAbs.x"); |
1987 | 0 | return false; |
1988 | 0 | } |
1989 | 0 | FastErrorResult rv; |
1990 | 0 | self->SetX(arg0, rv); |
1991 | 0 | if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) { |
1992 | 0 | return false; |
1993 | 0 | } |
1994 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
1995 | 0 |
|
1996 | 0 | return true; |
1997 | 0 | } |
1998 | | |
1999 | | static const JSJitInfo x_getterinfo = { |
2000 | | { (JSJitGetterOp)get_x }, |
2001 | | { prototypes::id::SVGPathSegCurvetoCubicAbs }, |
2002 | | { PrototypeTraits<prototypes::id::SVGPathSegCurvetoCubicAbs>::Depth }, |
2003 | | JSJitInfo::Getter, |
2004 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
2005 | | JSVAL_TYPE_DOUBLE, /* returnType. Not relevant for setters. */ |
2006 | | true, /* isInfallible. False in setters. */ |
2007 | | false, /* isMovable. Not relevant for setters. */ |
2008 | | false, /* isEliminatable. Not relevant for setters. */ |
2009 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
2010 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
2011 | | false, /* isTypedMethod. Only relevant for methods. */ |
2012 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
2013 | | }; |
2014 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
2015 | | static_assert(0 < 1, "There is no slot for us"); |
2016 | | static const JSJitInfo x_setterinfo = { |
2017 | | { (JSJitGetterOp)set_x }, |
2018 | | { prototypes::id::SVGPathSegCurvetoCubicAbs }, |
2019 | | { PrototypeTraits<prototypes::id::SVGPathSegCurvetoCubicAbs>::Depth }, |
2020 | | JSJitInfo::Setter, |
2021 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
2022 | | JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */ |
2023 | | false, /* isInfallible. False in setters. */ |
2024 | | false, /* isMovable. Not relevant for setters. */ |
2025 | | false, /* isEliminatable. Not relevant for setters. */ |
2026 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
2027 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
2028 | | false, /* isTypedMethod. Only relevant for methods. */ |
2029 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
2030 | | }; |
2031 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
2032 | | static_assert(0 < 1, "There is no slot for us"); |
2033 | | |
2034 | | MOZ_CAN_RUN_SCRIPT static bool |
2035 | | get_y(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::DOMSVGPathSegCurvetoCubicAbs* self, JSJitGetterCallArgs args) |
2036 | 0 | { |
2037 | 0 | AUTO_PROFILER_LABEL_FAST("get SVGPathSegCurvetoCubicAbs.y", DOM, cx); |
2038 | 0 |
|
2039 | 0 | float result(self->Y()); |
2040 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
2041 | 0 | args.rval().set(JS_NumberValue(double(result))); |
2042 | 0 | return true; |
2043 | 0 | } |
2044 | | |
2045 | | MOZ_CAN_RUN_SCRIPT static bool |
2046 | | set_y(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::DOMSVGPathSegCurvetoCubicAbs* self, JSJitSetterCallArgs args) |
2047 | 0 | { |
2048 | 0 | AUTO_PROFILER_LABEL_FAST("set SVGPathSegCurvetoCubicAbs.y", DOM, cx); |
2049 | 0 |
|
2050 | 0 | float arg0; |
2051 | 0 | if (!ValueToPrimitive<float, eDefault>(cx, args[0], &arg0)) { |
2052 | 0 | return false; |
2053 | 0 | } else if (!mozilla::IsFinite(arg0)) { |
2054 | 0 | ThrowErrorMessage(cx, MSG_NOT_FINITE, "Value being assigned to SVGPathSegCurvetoCubicAbs.y"); |
2055 | 0 | return false; |
2056 | 0 | } |
2057 | 0 | FastErrorResult rv; |
2058 | 0 | self->SetY(arg0, rv); |
2059 | 0 | if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) { |
2060 | 0 | return false; |
2061 | 0 | } |
2062 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
2063 | 0 |
|
2064 | 0 | return true; |
2065 | 0 | } |
2066 | | |
2067 | | static const JSJitInfo y_getterinfo = { |
2068 | | { (JSJitGetterOp)get_y }, |
2069 | | { prototypes::id::SVGPathSegCurvetoCubicAbs }, |
2070 | | { PrototypeTraits<prototypes::id::SVGPathSegCurvetoCubicAbs>::Depth }, |
2071 | | JSJitInfo::Getter, |
2072 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
2073 | | JSVAL_TYPE_DOUBLE, /* returnType. Not relevant for setters. */ |
2074 | | true, /* isInfallible. False in setters. */ |
2075 | | false, /* isMovable. Not relevant for setters. */ |
2076 | | false, /* isEliminatable. Not relevant for setters. */ |
2077 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
2078 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
2079 | | false, /* isTypedMethod. Only relevant for methods. */ |
2080 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
2081 | | }; |
2082 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
2083 | | static_assert(0 < 1, "There is no slot for us"); |
2084 | | static const JSJitInfo y_setterinfo = { |
2085 | | { (JSJitGetterOp)set_y }, |
2086 | | { prototypes::id::SVGPathSegCurvetoCubicAbs }, |
2087 | | { PrototypeTraits<prototypes::id::SVGPathSegCurvetoCubicAbs>::Depth }, |
2088 | | JSJitInfo::Setter, |
2089 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
2090 | | JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */ |
2091 | | false, /* isInfallible. False in setters. */ |
2092 | | false, /* isMovable. Not relevant for setters. */ |
2093 | | false, /* isEliminatable. Not relevant for setters. */ |
2094 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
2095 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
2096 | | false, /* isTypedMethod. Only relevant for methods. */ |
2097 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
2098 | | }; |
2099 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
2100 | | static_assert(0 < 1, "There is no slot for us"); |
2101 | | |
2102 | | MOZ_CAN_RUN_SCRIPT static bool |
2103 | | get_x1(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::DOMSVGPathSegCurvetoCubicAbs* self, JSJitGetterCallArgs args) |
2104 | 0 | { |
2105 | 0 | AUTO_PROFILER_LABEL_FAST("get SVGPathSegCurvetoCubicAbs.x1", DOM, cx); |
2106 | 0 |
|
2107 | 0 | float result(self->X1()); |
2108 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
2109 | 0 | args.rval().set(JS_NumberValue(double(result))); |
2110 | 0 | return true; |
2111 | 0 | } |
2112 | | |
2113 | | MOZ_CAN_RUN_SCRIPT static bool |
2114 | | set_x1(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::DOMSVGPathSegCurvetoCubicAbs* self, JSJitSetterCallArgs args) |
2115 | 0 | { |
2116 | 0 | AUTO_PROFILER_LABEL_FAST("set SVGPathSegCurvetoCubicAbs.x1", DOM, cx); |
2117 | 0 |
|
2118 | 0 | float arg0; |
2119 | 0 | if (!ValueToPrimitive<float, eDefault>(cx, args[0], &arg0)) { |
2120 | 0 | return false; |
2121 | 0 | } else if (!mozilla::IsFinite(arg0)) { |
2122 | 0 | ThrowErrorMessage(cx, MSG_NOT_FINITE, "Value being assigned to SVGPathSegCurvetoCubicAbs.x1"); |
2123 | 0 | return false; |
2124 | 0 | } |
2125 | 0 | FastErrorResult rv; |
2126 | 0 | self->SetX1(arg0, rv); |
2127 | 0 | if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) { |
2128 | 0 | return false; |
2129 | 0 | } |
2130 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
2131 | 0 |
|
2132 | 0 | return true; |
2133 | 0 | } |
2134 | | |
2135 | | static const JSJitInfo x1_getterinfo = { |
2136 | | { (JSJitGetterOp)get_x1 }, |
2137 | | { prototypes::id::SVGPathSegCurvetoCubicAbs }, |
2138 | | { PrototypeTraits<prototypes::id::SVGPathSegCurvetoCubicAbs>::Depth }, |
2139 | | JSJitInfo::Getter, |
2140 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
2141 | | JSVAL_TYPE_DOUBLE, /* returnType. Not relevant for setters. */ |
2142 | | true, /* isInfallible. False in setters. */ |
2143 | | false, /* isMovable. Not relevant for setters. */ |
2144 | | false, /* isEliminatable. Not relevant for setters. */ |
2145 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
2146 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
2147 | | false, /* isTypedMethod. Only relevant for methods. */ |
2148 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
2149 | | }; |
2150 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
2151 | | static_assert(0 < 1, "There is no slot for us"); |
2152 | | static const JSJitInfo x1_setterinfo = { |
2153 | | { (JSJitGetterOp)set_x1 }, |
2154 | | { prototypes::id::SVGPathSegCurvetoCubicAbs }, |
2155 | | { PrototypeTraits<prototypes::id::SVGPathSegCurvetoCubicAbs>::Depth }, |
2156 | | JSJitInfo::Setter, |
2157 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
2158 | | JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */ |
2159 | | false, /* isInfallible. False in setters. */ |
2160 | | false, /* isMovable. Not relevant for setters. */ |
2161 | | false, /* isEliminatable. Not relevant for setters. */ |
2162 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
2163 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
2164 | | false, /* isTypedMethod. Only relevant for methods. */ |
2165 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
2166 | | }; |
2167 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
2168 | | static_assert(0 < 1, "There is no slot for us"); |
2169 | | |
2170 | | MOZ_CAN_RUN_SCRIPT static bool |
2171 | | get_y1(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::DOMSVGPathSegCurvetoCubicAbs* self, JSJitGetterCallArgs args) |
2172 | 0 | { |
2173 | 0 | AUTO_PROFILER_LABEL_FAST("get SVGPathSegCurvetoCubicAbs.y1", DOM, cx); |
2174 | 0 |
|
2175 | 0 | float result(self->Y1()); |
2176 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
2177 | 0 | args.rval().set(JS_NumberValue(double(result))); |
2178 | 0 | return true; |
2179 | 0 | } |
2180 | | |
2181 | | MOZ_CAN_RUN_SCRIPT static bool |
2182 | | set_y1(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::DOMSVGPathSegCurvetoCubicAbs* self, JSJitSetterCallArgs args) |
2183 | 0 | { |
2184 | 0 | AUTO_PROFILER_LABEL_FAST("set SVGPathSegCurvetoCubicAbs.y1", DOM, cx); |
2185 | 0 |
|
2186 | 0 | float arg0; |
2187 | 0 | if (!ValueToPrimitive<float, eDefault>(cx, args[0], &arg0)) { |
2188 | 0 | return false; |
2189 | 0 | } else if (!mozilla::IsFinite(arg0)) { |
2190 | 0 | ThrowErrorMessage(cx, MSG_NOT_FINITE, "Value being assigned to SVGPathSegCurvetoCubicAbs.y1"); |
2191 | 0 | return false; |
2192 | 0 | } |
2193 | 0 | FastErrorResult rv; |
2194 | 0 | self->SetY1(arg0, rv); |
2195 | 0 | if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) { |
2196 | 0 | return false; |
2197 | 0 | } |
2198 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
2199 | 0 |
|
2200 | 0 | return true; |
2201 | 0 | } |
2202 | | |
2203 | | static const JSJitInfo y1_getterinfo = { |
2204 | | { (JSJitGetterOp)get_y1 }, |
2205 | | { prototypes::id::SVGPathSegCurvetoCubicAbs }, |
2206 | | { PrototypeTraits<prototypes::id::SVGPathSegCurvetoCubicAbs>::Depth }, |
2207 | | JSJitInfo::Getter, |
2208 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
2209 | | JSVAL_TYPE_DOUBLE, /* returnType. Not relevant for setters. */ |
2210 | | true, /* isInfallible. False in setters. */ |
2211 | | false, /* isMovable. Not relevant for setters. */ |
2212 | | false, /* isEliminatable. Not relevant for setters. */ |
2213 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
2214 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
2215 | | false, /* isTypedMethod. Only relevant for methods. */ |
2216 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
2217 | | }; |
2218 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
2219 | | static_assert(0 < 1, "There is no slot for us"); |
2220 | | static const JSJitInfo y1_setterinfo = { |
2221 | | { (JSJitGetterOp)set_y1 }, |
2222 | | { prototypes::id::SVGPathSegCurvetoCubicAbs }, |
2223 | | { PrototypeTraits<prototypes::id::SVGPathSegCurvetoCubicAbs>::Depth }, |
2224 | | JSJitInfo::Setter, |
2225 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
2226 | | JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */ |
2227 | | false, /* isInfallible. False in setters. */ |
2228 | | false, /* isMovable. Not relevant for setters. */ |
2229 | | false, /* isEliminatable. Not relevant for setters. */ |
2230 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
2231 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
2232 | | false, /* isTypedMethod. Only relevant for methods. */ |
2233 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
2234 | | }; |
2235 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
2236 | | static_assert(0 < 1, "There is no slot for us"); |
2237 | | |
2238 | | MOZ_CAN_RUN_SCRIPT static bool |
2239 | | get_x2(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::DOMSVGPathSegCurvetoCubicAbs* self, JSJitGetterCallArgs args) |
2240 | 0 | { |
2241 | 0 | AUTO_PROFILER_LABEL_FAST("get SVGPathSegCurvetoCubicAbs.x2", DOM, cx); |
2242 | 0 |
|
2243 | 0 | float result(self->X2()); |
2244 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
2245 | 0 | args.rval().set(JS_NumberValue(double(result))); |
2246 | 0 | return true; |
2247 | 0 | } |
2248 | | |
2249 | | MOZ_CAN_RUN_SCRIPT static bool |
2250 | | set_x2(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::DOMSVGPathSegCurvetoCubicAbs* self, JSJitSetterCallArgs args) |
2251 | 0 | { |
2252 | 0 | AUTO_PROFILER_LABEL_FAST("set SVGPathSegCurvetoCubicAbs.x2", DOM, cx); |
2253 | 0 |
|
2254 | 0 | float arg0; |
2255 | 0 | if (!ValueToPrimitive<float, eDefault>(cx, args[0], &arg0)) { |
2256 | 0 | return false; |
2257 | 0 | } else if (!mozilla::IsFinite(arg0)) { |
2258 | 0 | ThrowErrorMessage(cx, MSG_NOT_FINITE, "Value being assigned to SVGPathSegCurvetoCubicAbs.x2"); |
2259 | 0 | return false; |
2260 | 0 | } |
2261 | 0 | FastErrorResult rv; |
2262 | 0 | self->SetX2(arg0, rv); |
2263 | 0 | if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) { |
2264 | 0 | return false; |
2265 | 0 | } |
2266 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
2267 | 0 |
|
2268 | 0 | return true; |
2269 | 0 | } |
2270 | | |
2271 | | static const JSJitInfo x2_getterinfo = { |
2272 | | { (JSJitGetterOp)get_x2 }, |
2273 | | { prototypes::id::SVGPathSegCurvetoCubicAbs }, |
2274 | | { PrototypeTraits<prototypes::id::SVGPathSegCurvetoCubicAbs>::Depth }, |
2275 | | JSJitInfo::Getter, |
2276 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
2277 | | JSVAL_TYPE_DOUBLE, /* returnType. Not relevant for setters. */ |
2278 | | true, /* isInfallible. False in setters. */ |
2279 | | false, /* isMovable. Not relevant for setters. */ |
2280 | | false, /* isEliminatable. Not relevant for setters. */ |
2281 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
2282 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
2283 | | false, /* isTypedMethod. Only relevant for methods. */ |
2284 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
2285 | | }; |
2286 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
2287 | | static_assert(0 < 1, "There is no slot for us"); |
2288 | | static const JSJitInfo x2_setterinfo = { |
2289 | | { (JSJitGetterOp)set_x2 }, |
2290 | | { prototypes::id::SVGPathSegCurvetoCubicAbs }, |
2291 | | { PrototypeTraits<prototypes::id::SVGPathSegCurvetoCubicAbs>::Depth }, |
2292 | | JSJitInfo::Setter, |
2293 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
2294 | | JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */ |
2295 | | false, /* isInfallible. False in setters. */ |
2296 | | false, /* isMovable. Not relevant for setters. */ |
2297 | | false, /* isEliminatable. Not relevant for setters. */ |
2298 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
2299 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
2300 | | false, /* isTypedMethod. Only relevant for methods. */ |
2301 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
2302 | | }; |
2303 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
2304 | | static_assert(0 < 1, "There is no slot for us"); |
2305 | | |
2306 | | MOZ_CAN_RUN_SCRIPT static bool |
2307 | | get_y2(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::DOMSVGPathSegCurvetoCubicAbs* self, JSJitGetterCallArgs args) |
2308 | 0 | { |
2309 | 0 | AUTO_PROFILER_LABEL_FAST("get SVGPathSegCurvetoCubicAbs.y2", DOM, cx); |
2310 | 0 |
|
2311 | 0 | float result(self->Y2()); |
2312 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
2313 | 0 | args.rval().set(JS_NumberValue(double(result))); |
2314 | 0 | return true; |
2315 | 0 | } |
2316 | | |
2317 | | MOZ_CAN_RUN_SCRIPT static bool |
2318 | | set_y2(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::DOMSVGPathSegCurvetoCubicAbs* self, JSJitSetterCallArgs args) |
2319 | 0 | { |
2320 | 0 | AUTO_PROFILER_LABEL_FAST("set SVGPathSegCurvetoCubicAbs.y2", DOM, cx); |
2321 | 0 |
|
2322 | 0 | float arg0; |
2323 | 0 | if (!ValueToPrimitive<float, eDefault>(cx, args[0], &arg0)) { |
2324 | 0 | return false; |
2325 | 0 | } else if (!mozilla::IsFinite(arg0)) { |
2326 | 0 | ThrowErrorMessage(cx, MSG_NOT_FINITE, "Value being assigned to SVGPathSegCurvetoCubicAbs.y2"); |
2327 | 0 | return false; |
2328 | 0 | } |
2329 | 0 | FastErrorResult rv; |
2330 | 0 | self->SetY2(arg0, rv); |
2331 | 0 | if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) { |
2332 | 0 | return false; |
2333 | 0 | } |
2334 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
2335 | 0 |
|
2336 | 0 | return true; |
2337 | 0 | } |
2338 | | |
2339 | | static const JSJitInfo y2_getterinfo = { |
2340 | | { (JSJitGetterOp)get_y2 }, |
2341 | | { prototypes::id::SVGPathSegCurvetoCubicAbs }, |
2342 | | { PrototypeTraits<prototypes::id::SVGPathSegCurvetoCubicAbs>::Depth }, |
2343 | | JSJitInfo::Getter, |
2344 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
2345 | | JSVAL_TYPE_DOUBLE, /* returnType. Not relevant for setters. */ |
2346 | | true, /* isInfallible. False in setters. */ |
2347 | | false, /* isMovable. Not relevant for setters. */ |
2348 | | false, /* isEliminatable. Not relevant for setters. */ |
2349 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
2350 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
2351 | | false, /* isTypedMethod. Only relevant for methods. */ |
2352 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
2353 | | }; |
2354 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
2355 | | static_assert(0 < 1, "There is no slot for us"); |
2356 | | static const JSJitInfo y2_setterinfo = { |
2357 | | { (JSJitGetterOp)set_y2 }, |
2358 | | { prototypes::id::SVGPathSegCurvetoCubicAbs }, |
2359 | | { PrototypeTraits<prototypes::id::SVGPathSegCurvetoCubicAbs>::Depth }, |
2360 | | JSJitInfo::Setter, |
2361 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
2362 | | JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */ |
2363 | | false, /* isInfallible. False in setters. */ |
2364 | | false, /* isMovable. Not relevant for setters. */ |
2365 | | false, /* isEliminatable. Not relevant for setters. */ |
2366 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
2367 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
2368 | | false, /* isTypedMethod. Only relevant for methods. */ |
2369 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
2370 | | }; |
2371 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
2372 | | static_assert(0 < 1, "There is no slot for us"); |
2373 | | |
2374 | | static bool |
2375 | | _addProperty(JSContext* cx, JS::Handle<JSObject*> obj, JS::Handle<jsid> id, JS::Handle<JS::Value> val) |
2376 | 0 | { |
2377 | 0 | mozilla::DOMSVGPathSegCurvetoCubicAbs* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::DOMSVGPathSegCurvetoCubicAbs>(obj); |
2378 | 0 | // We don't want to preserve if we don't have a wrapper, and we |
2379 | 0 | // obviously can't preserve if we're not initialized. |
2380 | 0 | if (self && self->GetWrapperPreserveColor()) { |
2381 | 0 | PreserveWrapper(self); |
2382 | 0 | } |
2383 | 0 | return true; |
2384 | 0 | } |
2385 | | |
2386 | | static void |
2387 | | _finalize(js::FreeOp* fop, JSObject* obj) |
2388 | 0 | { |
2389 | 0 | mozilla::DOMSVGPathSegCurvetoCubicAbs* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::DOMSVGPathSegCurvetoCubicAbs>(obj); |
2390 | 0 | if (self) { |
2391 | 0 | ClearWrapper(self, self, obj); |
2392 | 0 | AddForDeferredFinalization<mozilla::DOMSVGPathSegCurvetoCubicAbs>(self); |
2393 | 0 | } |
2394 | 0 | } |
2395 | | |
2396 | | static size_t |
2397 | | _objectMoved(JSObject* obj, JSObject* old) |
2398 | 0 | { |
2399 | 0 | mozilla::DOMSVGPathSegCurvetoCubicAbs* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::DOMSVGPathSegCurvetoCubicAbs>(obj); |
2400 | 0 | if (self) { |
2401 | 0 | UpdateWrapper(self, self, obj, old); |
2402 | 0 | } |
2403 | 0 |
|
2404 | 0 | return 0; |
2405 | 0 | } |
2406 | | |
2407 | | // We deliberately use brace-elision to make Visual Studio produce better initalization code. |
2408 | | #if defined(__clang__) |
2409 | | #pragma clang diagnostic push |
2410 | | #pragma clang diagnostic ignored "-Wmissing-braces" |
2411 | | #endif |
2412 | | static const JSPropertySpec sAttributes_specs[] = { |
2413 | | { "x", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &x_getterinfo, GenericSetter<NormalThisPolicy>, &x_setterinfo }, |
2414 | | { "y", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &y_getterinfo, GenericSetter<NormalThisPolicy>, &y_setterinfo }, |
2415 | | { "x1", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &x1_getterinfo, GenericSetter<NormalThisPolicy>, &x1_setterinfo }, |
2416 | | { "y1", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &y1_getterinfo, GenericSetter<NormalThisPolicy>, &y1_setterinfo }, |
2417 | | { "x2", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &x2_getterinfo, GenericSetter<NormalThisPolicy>, &x2_setterinfo }, |
2418 | | { "y2", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &y2_getterinfo, GenericSetter<NormalThisPolicy>, &y2_setterinfo }, |
2419 | | { nullptr, 0, nullptr, nullptr, nullptr, nullptr } |
2420 | | }; |
2421 | | #if defined(__clang__) |
2422 | | #pragma clang diagnostic pop |
2423 | | #endif |
2424 | | |
2425 | | |
2426 | | static const Prefable<const JSPropertySpec> sAttributes[] = { |
2427 | | { nullptr, &sAttributes_specs[0] }, |
2428 | | { nullptr, nullptr } |
2429 | | }; |
2430 | | |
2431 | | static_assert(1 <= 1ull << NUM_BITS_PROPERTY_INFO_PREF_INDEX, |
2432 | | "We have a prefable index that is >= (1 << NUM_BITS_PROPERTY_INFO_PREF_INDEX)"); |
2433 | | static_assert(6 <= 1ull << NUM_BITS_PROPERTY_INFO_SPEC_INDEX, |
2434 | | "We have a spec index that is >= (1 << NUM_BITS_PROPERTY_INFO_SPEC_INDEX)"); |
2435 | | |
2436 | | |
2437 | | static uint16_t sNativeProperties_sortedPropertyIndices[6]; |
2438 | | static PropertyInfo sNativeProperties_propertyInfos[6]; |
2439 | | |
2440 | | static const NativePropertiesN<1> sNativeProperties = { |
2441 | | false, 0, |
2442 | | false, 0, |
2443 | | false, 0, |
2444 | | true, 0 /* sAttributes */, |
2445 | | false, 0, |
2446 | | false, 0, |
2447 | | false, 0, |
2448 | | -1, |
2449 | | 6, |
2450 | | sNativeProperties_sortedPropertyIndices, |
2451 | | { |
2452 | | { sAttributes, &sNativeProperties_propertyInfos[0] } |
2453 | | } |
2454 | | }; |
2455 | | static_assert(6 < 1ull << CHAR_BIT * sizeof(sNativeProperties.propertyInfoCount), |
2456 | | "We have a property info count that is oversized"); |
2457 | | |
2458 | | static const DOMIfaceAndProtoJSClass sPrototypeClass = { |
2459 | | { |
2460 | | "SVGPathSegCurvetoCubicAbsPrototype", |
2461 | | JSCLASS_IS_DOMIFACEANDPROTOJSCLASS | JSCLASS_HAS_RESERVED_SLOTS(DOM_INTERFACE_PROTO_SLOTS_BASE), |
2462 | | JS_NULL_CLASS_OPS, |
2463 | | JS_NULL_CLASS_SPEC, |
2464 | | JS_NULL_CLASS_EXT, |
2465 | | JS_NULL_OBJECT_OPS |
2466 | | }, |
2467 | | eInterfacePrototype, |
2468 | | false, |
2469 | | prototypes::id::SVGPathSegCurvetoCubicAbs, |
2470 | | PrototypeTraits<prototypes::id::SVGPathSegCurvetoCubicAbs>::Depth, |
2471 | | sNativePropertyHooks, |
2472 | | "[object SVGPathSegCurvetoCubicAbsPrototype]", |
2473 | | SVGPathSeg_Binding::GetProtoObject |
2474 | | }; |
2475 | | |
2476 | | static const js::ClassOps sClassOps = { |
2477 | | _addProperty, /* addProperty */ |
2478 | | nullptr, /* delProperty */ |
2479 | | nullptr, /* enumerate */ |
2480 | | nullptr, /* newEnumerate */ |
2481 | | nullptr, /* resolve */ |
2482 | | nullptr, /* mayResolve */ |
2483 | | _finalize, /* finalize */ |
2484 | | nullptr, /* call */ |
2485 | | nullptr, /* hasInstance */ |
2486 | | nullptr, /* construct */ |
2487 | | nullptr, /* trace */ |
2488 | | }; |
2489 | | |
2490 | | static const js::ClassExtension sClassExtension = { |
2491 | | nullptr, /* weakmapKeyDelegateOp */ |
2492 | | _objectMoved /* objectMovedOp */ |
2493 | | }; |
2494 | | |
2495 | | static const DOMJSClass sClass = { |
2496 | | { "SVGPathSegCurvetoCubicAbs", |
2497 | | JSCLASS_IS_DOMJSCLASS | JSCLASS_FOREGROUND_FINALIZE | JSCLASS_HAS_RESERVED_SLOTS(1), |
2498 | | &sClassOps, |
2499 | | JS_NULL_CLASS_SPEC, |
2500 | | &sClassExtension, |
2501 | | JS_NULL_OBJECT_OPS |
2502 | | }, |
2503 | | { prototypes::id::SVGPathSeg, prototypes::id::SVGPathSegCurvetoCubicAbs, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count }, |
2504 | | IsBaseOf<nsISupports, mozilla::DOMSVGPathSegCurvetoCubicAbs >::value, |
2505 | | sNativePropertyHooks, |
2506 | | FindAssociatedGlobalForNative<mozilla::DOMSVGPathSegCurvetoCubicAbs>::Get, |
2507 | | GetProtoObjectHandle, |
2508 | | GetCCParticipant<mozilla::DOMSVGPathSegCurvetoCubicAbs>::Get() |
2509 | | }; |
2510 | | static_assert(1 == DOM_INSTANCE_RESERVED_SLOTS, |
2511 | | "Must have the right minimal number of reserved slots."); |
2512 | | static_assert(1 >= 1, |
2513 | | "Must have enough reserved slots."); |
2514 | | |
2515 | | const JSClass* |
2516 | | GetJSClass() |
2517 | 0 | { |
2518 | 0 | return sClass.ToJSClass(); |
2519 | 0 | } |
2520 | | |
2521 | | bool |
2522 | | Wrap(JSContext* aCx, mozilla::DOMSVGPathSegCurvetoCubicAbs* aObject, nsWrapperCache* aCache, JS::Handle<JSObject*> aGivenProto, JS::MutableHandle<JSObject*> aReflector) |
2523 | 0 | { |
2524 | 0 | static_assert(!IsBaseOf<NonRefcountedDOMObject, mozilla::DOMSVGPathSegCurvetoCubicAbs>::value, |
2525 | 0 | "Shouldn't have wrappercached things that are not refcounted."); |
2526 | 0 | MOZ_ASSERT(static_cast<mozilla::DOMSVGPathSegCurvetoCubicAbs*>(aObject) == |
2527 | 0 | reinterpret_cast<mozilla::DOMSVGPathSegCurvetoCubicAbs*>(aObject), |
2528 | 0 | "Multiple inheritance for mozilla::DOMSVGPathSegCurvetoCubicAbs is broken."); |
2529 | 0 | MOZ_ASSERT(static_cast<mozilla::DOMSVGPathSeg*>(aObject) == |
2530 | 0 | reinterpret_cast<mozilla::DOMSVGPathSeg*>(aObject), |
2531 | 0 | "Multiple inheritance for mozilla::DOMSVGPathSeg is broken."); |
2532 | 0 | MOZ_ASSERT(ToSupportsIsCorrect(aObject)); |
2533 | 0 | MOZ_ASSERT_IF(aGivenProto, js::IsObjectInContextCompartment(aGivenProto, aCx)); |
2534 | 0 | MOZ_ASSERT(!aCache->GetWrapper(), |
2535 | 0 | "You should probably not be using Wrap() directly; use " |
2536 | 0 | "GetOrCreateDOMReflector instead"); |
2537 | 0 |
|
2538 | 0 | MOZ_ASSERT(ToSupportsIsOnPrimaryInheritanceChain(aObject, aCache), |
2539 | 0 | "nsISupports must be on our primary inheritance chain"); |
2540 | 0 |
|
2541 | 0 | JS::Rooted<JSObject*> global(aCx, FindAssociatedGlobal(aCx, aObject->GetParentObject())); |
2542 | 0 | if (!global) { |
2543 | 0 | return false; |
2544 | 0 | } |
2545 | 0 | MOZ_ASSERT(JS_IsGlobalObject(global)); |
2546 | 0 | MOZ_ASSERT(JS::ObjectIsNotGray(global)); |
2547 | 0 |
|
2548 | 0 | // That might have ended up wrapping us already, due to the wonders |
2549 | 0 | // of XBL. Check for that, and bail out as needed. |
2550 | 0 | aReflector.set(aCache->GetWrapper()); |
2551 | 0 | if (aReflector) { |
2552 | | #ifdef DEBUG |
2553 | | AssertReflectorHasGivenProto(aCx, aReflector, aGivenProto); |
2554 | | #endif // DEBUG |
2555 | | return true; |
2556 | 0 | } |
2557 | 0 |
|
2558 | 0 | JSAutoRealm ar(aCx, global); |
2559 | 0 | JS::Handle<JSObject*> canonicalProto = GetProtoObjectHandle(aCx); |
2560 | 0 | if (!canonicalProto) { |
2561 | 0 | return false; |
2562 | 0 | } |
2563 | 0 | JS::Rooted<JSObject*> proto(aCx); |
2564 | 0 | if (aGivenProto) { |
2565 | 0 | proto = aGivenProto; |
2566 | 0 | // Unfortunately, while aGivenProto was in the compartment of aCx |
2567 | 0 | // coming in, we changed compartments to that of "parent" so may need |
2568 | 0 | // to wrap the proto here. |
2569 | 0 | if (js::GetContextCompartment(aCx) != js::GetObjectCompartment(proto)) { |
2570 | 0 | if (!JS_WrapObject(aCx, &proto)) { |
2571 | 0 | return false; |
2572 | 0 | } |
2573 | 0 | } |
2574 | 0 | } else { |
2575 | 0 | proto = canonicalProto; |
2576 | 0 | } |
2577 | 0 |
|
2578 | 0 | BindingJSObjectCreator<mozilla::DOMSVGPathSegCurvetoCubicAbs> creator(aCx); |
2579 | 0 | creator.CreateObject(aCx, sClass.ToJSClass(), proto, aObject, aReflector); |
2580 | 0 | if (!aReflector) { |
2581 | 0 | return false; |
2582 | 0 | } |
2583 | 0 | |
2584 | 0 | aCache->SetWrapper(aReflector); |
2585 | 0 | creator.InitializationSucceeded(); |
2586 | 0 |
|
2587 | 0 | MOZ_ASSERT(aCache->GetWrapperPreserveColor() && |
2588 | 0 | aCache->GetWrapperPreserveColor() == aReflector); |
2589 | 0 | // If proto != canonicalProto, we have to preserve our wrapper; |
2590 | 0 | // otherwise we won't be able to properly recreate it later, since |
2591 | 0 | // we won't know what proto to use. Note that we don't check |
2592 | 0 | // aGivenProto here, since it's entirely possible (and even |
2593 | 0 | // somewhat common) to have a non-null aGivenProto which is the |
2594 | 0 | // same as canonicalProto. |
2595 | 0 | if (proto != canonicalProto) { |
2596 | 0 | PreserveWrapper(aObject); |
2597 | 0 | } |
2598 | 0 |
|
2599 | 0 | return true; |
2600 | 0 | } |
2601 | | |
2602 | | const NativePropertyHooks sNativePropertyHooks[] = { { |
2603 | | nullptr, |
2604 | | nullptr, |
2605 | | nullptr, |
2606 | | { sNativeProperties.Upcast(), nullptr }, |
2607 | | prototypes::id::SVGPathSegCurvetoCubicAbs, |
2608 | | constructors::id::_ID_Count, |
2609 | | SVGPathSeg_Binding::sNativePropertyHooks, |
2610 | | &DefaultXrayExpandoObjectClass |
2611 | | } }; |
2612 | | |
2613 | | void |
2614 | | CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, bool aDefineOnGlobal) |
2615 | 0 | { |
2616 | 0 | JS::Handle<JSObject*> parentProto(SVGPathSeg_Binding::GetProtoObjectHandle(aCx)); |
2617 | 0 | if (!parentProto) { |
2618 | 0 | return; |
2619 | 0 | } |
2620 | 0 | |
2621 | 0 | static bool sIdsInited = false; |
2622 | 0 | if (!sIdsInited && NS_IsMainThread()) { |
2623 | 0 | if (!InitIds(aCx, sNativeProperties.Upcast())) { |
2624 | 0 | return; |
2625 | 0 | } |
2626 | 0 | sIdsInited = true; |
2627 | 0 | } |
2628 | 0 |
|
2629 | 0 | JS::Heap<JSObject*>* protoCache = &aProtoAndIfaceCache.EntrySlotOrCreate(prototypes::id::SVGPathSegCurvetoCubicAbs); |
2630 | 0 | JS::Heap<JSObject*>* interfaceCache = nullptr; |
2631 | 0 | dom::CreateInterfaceObjects(aCx, aGlobal, parentProto, |
2632 | 0 | &sPrototypeClass.mBase, protoCache, |
2633 | 0 | nullptr, |
2634 | 0 | nullptr, nullptr, 0, nullptr, |
2635 | 0 | interfaceCache, |
2636 | 0 | sNativeProperties.Upcast(), |
2637 | 0 | nullptr, |
2638 | 0 | nullptr, aDefineOnGlobal, |
2639 | 0 | nullptr, |
2640 | 0 | false); |
2641 | 0 | } |
2642 | | |
2643 | | } // namespace SVGPathSegCurvetoCubicAbs_Binding |
2644 | | |
2645 | | |
2646 | | |
2647 | | namespace SVGPathSegCurvetoCubicRel_Binding { |
2648 | | |
2649 | | static_assert(IsRefcounted<NativeType>::value == IsRefcounted<SVGPathSeg_Binding::NativeType>::value, |
2650 | | "Can't inherit from an interface with a different ownership model."); |
2651 | | |
2652 | | MOZ_CAN_RUN_SCRIPT static bool |
2653 | | get_x(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::DOMSVGPathSegCurvetoCubicRel* self, JSJitGetterCallArgs args) |
2654 | 0 | { |
2655 | 0 | AUTO_PROFILER_LABEL_FAST("get SVGPathSegCurvetoCubicRel.x", DOM, cx); |
2656 | 0 |
|
2657 | 0 | float result(self->X()); |
2658 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
2659 | 0 | args.rval().set(JS_NumberValue(double(result))); |
2660 | 0 | return true; |
2661 | 0 | } |
2662 | | |
2663 | | MOZ_CAN_RUN_SCRIPT static bool |
2664 | | set_x(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::DOMSVGPathSegCurvetoCubicRel* self, JSJitSetterCallArgs args) |
2665 | 0 | { |
2666 | 0 | AUTO_PROFILER_LABEL_FAST("set SVGPathSegCurvetoCubicRel.x", DOM, cx); |
2667 | 0 |
|
2668 | 0 | float arg0; |
2669 | 0 | if (!ValueToPrimitive<float, eDefault>(cx, args[0], &arg0)) { |
2670 | 0 | return false; |
2671 | 0 | } else if (!mozilla::IsFinite(arg0)) { |
2672 | 0 | ThrowErrorMessage(cx, MSG_NOT_FINITE, "Value being assigned to SVGPathSegCurvetoCubicRel.x"); |
2673 | 0 | return false; |
2674 | 0 | } |
2675 | 0 | FastErrorResult rv; |
2676 | 0 | self->SetX(arg0, rv); |
2677 | 0 | if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) { |
2678 | 0 | return false; |
2679 | 0 | } |
2680 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
2681 | 0 |
|
2682 | 0 | return true; |
2683 | 0 | } |
2684 | | |
2685 | | static const JSJitInfo x_getterinfo = { |
2686 | | { (JSJitGetterOp)get_x }, |
2687 | | { prototypes::id::SVGPathSegCurvetoCubicRel }, |
2688 | | { PrototypeTraits<prototypes::id::SVGPathSegCurvetoCubicRel>::Depth }, |
2689 | | JSJitInfo::Getter, |
2690 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
2691 | | JSVAL_TYPE_DOUBLE, /* returnType. Not relevant for setters. */ |
2692 | | true, /* isInfallible. False in setters. */ |
2693 | | false, /* isMovable. Not relevant for setters. */ |
2694 | | false, /* isEliminatable. Not relevant for setters. */ |
2695 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
2696 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
2697 | | false, /* isTypedMethod. Only relevant for methods. */ |
2698 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
2699 | | }; |
2700 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
2701 | | static_assert(0 < 1, "There is no slot for us"); |
2702 | | static const JSJitInfo x_setterinfo = { |
2703 | | { (JSJitGetterOp)set_x }, |
2704 | | { prototypes::id::SVGPathSegCurvetoCubicRel }, |
2705 | | { PrototypeTraits<prototypes::id::SVGPathSegCurvetoCubicRel>::Depth }, |
2706 | | JSJitInfo::Setter, |
2707 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
2708 | | JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */ |
2709 | | false, /* isInfallible. False in setters. */ |
2710 | | false, /* isMovable. Not relevant for setters. */ |
2711 | | false, /* isEliminatable. Not relevant for setters. */ |
2712 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
2713 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
2714 | | false, /* isTypedMethod. Only relevant for methods. */ |
2715 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
2716 | | }; |
2717 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
2718 | | static_assert(0 < 1, "There is no slot for us"); |
2719 | | |
2720 | | MOZ_CAN_RUN_SCRIPT static bool |
2721 | | get_y(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::DOMSVGPathSegCurvetoCubicRel* self, JSJitGetterCallArgs args) |
2722 | 0 | { |
2723 | 0 | AUTO_PROFILER_LABEL_FAST("get SVGPathSegCurvetoCubicRel.y", DOM, cx); |
2724 | 0 |
|
2725 | 0 | float result(self->Y()); |
2726 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
2727 | 0 | args.rval().set(JS_NumberValue(double(result))); |
2728 | 0 | return true; |
2729 | 0 | } |
2730 | | |
2731 | | MOZ_CAN_RUN_SCRIPT static bool |
2732 | | set_y(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::DOMSVGPathSegCurvetoCubicRel* self, JSJitSetterCallArgs args) |
2733 | 0 | { |
2734 | 0 | AUTO_PROFILER_LABEL_FAST("set SVGPathSegCurvetoCubicRel.y", DOM, cx); |
2735 | 0 |
|
2736 | 0 | float arg0; |
2737 | 0 | if (!ValueToPrimitive<float, eDefault>(cx, args[0], &arg0)) { |
2738 | 0 | return false; |
2739 | 0 | } else if (!mozilla::IsFinite(arg0)) { |
2740 | 0 | ThrowErrorMessage(cx, MSG_NOT_FINITE, "Value being assigned to SVGPathSegCurvetoCubicRel.y"); |
2741 | 0 | return false; |
2742 | 0 | } |
2743 | 0 | FastErrorResult rv; |
2744 | 0 | self->SetY(arg0, rv); |
2745 | 0 | if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) { |
2746 | 0 | return false; |
2747 | 0 | } |
2748 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
2749 | 0 |
|
2750 | 0 | return true; |
2751 | 0 | } |
2752 | | |
2753 | | static const JSJitInfo y_getterinfo = { |
2754 | | { (JSJitGetterOp)get_y }, |
2755 | | { prototypes::id::SVGPathSegCurvetoCubicRel }, |
2756 | | { PrototypeTraits<prototypes::id::SVGPathSegCurvetoCubicRel>::Depth }, |
2757 | | JSJitInfo::Getter, |
2758 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
2759 | | JSVAL_TYPE_DOUBLE, /* returnType. Not relevant for setters. */ |
2760 | | true, /* isInfallible. False in setters. */ |
2761 | | false, /* isMovable. Not relevant for setters. */ |
2762 | | false, /* isEliminatable. Not relevant for setters. */ |
2763 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
2764 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
2765 | | false, /* isTypedMethod. Only relevant for methods. */ |
2766 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
2767 | | }; |
2768 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
2769 | | static_assert(0 < 1, "There is no slot for us"); |
2770 | | static const JSJitInfo y_setterinfo = { |
2771 | | { (JSJitGetterOp)set_y }, |
2772 | | { prototypes::id::SVGPathSegCurvetoCubicRel }, |
2773 | | { PrototypeTraits<prototypes::id::SVGPathSegCurvetoCubicRel>::Depth }, |
2774 | | JSJitInfo::Setter, |
2775 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
2776 | | JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */ |
2777 | | false, /* isInfallible. False in setters. */ |
2778 | | false, /* isMovable. Not relevant for setters. */ |
2779 | | false, /* isEliminatable. Not relevant for setters. */ |
2780 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
2781 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
2782 | | false, /* isTypedMethod. Only relevant for methods. */ |
2783 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
2784 | | }; |
2785 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
2786 | | static_assert(0 < 1, "There is no slot for us"); |
2787 | | |
2788 | | MOZ_CAN_RUN_SCRIPT static bool |
2789 | | get_x1(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::DOMSVGPathSegCurvetoCubicRel* self, JSJitGetterCallArgs args) |
2790 | 0 | { |
2791 | 0 | AUTO_PROFILER_LABEL_FAST("get SVGPathSegCurvetoCubicRel.x1", DOM, cx); |
2792 | 0 |
|
2793 | 0 | float result(self->X1()); |
2794 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
2795 | 0 | args.rval().set(JS_NumberValue(double(result))); |
2796 | 0 | return true; |
2797 | 0 | } |
2798 | | |
2799 | | MOZ_CAN_RUN_SCRIPT static bool |
2800 | | set_x1(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::DOMSVGPathSegCurvetoCubicRel* self, JSJitSetterCallArgs args) |
2801 | 0 | { |
2802 | 0 | AUTO_PROFILER_LABEL_FAST("set SVGPathSegCurvetoCubicRel.x1", DOM, cx); |
2803 | 0 |
|
2804 | 0 | float arg0; |
2805 | 0 | if (!ValueToPrimitive<float, eDefault>(cx, args[0], &arg0)) { |
2806 | 0 | return false; |
2807 | 0 | } else if (!mozilla::IsFinite(arg0)) { |
2808 | 0 | ThrowErrorMessage(cx, MSG_NOT_FINITE, "Value being assigned to SVGPathSegCurvetoCubicRel.x1"); |
2809 | 0 | return false; |
2810 | 0 | } |
2811 | 0 | FastErrorResult rv; |
2812 | 0 | self->SetX1(arg0, rv); |
2813 | 0 | if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) { |
2814 | 0 | return false; |
2815 | 0 | } |
2816 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
2817 | 0 |
|
2818 | 0 | return true; |
2819 | 0 | } |
2820 | | |
2821 | | static const JSJitInfo x1_getterinfo = { |
2822 | | { (JSJitGetterOp)get_x1 }, |
2823 | | { prototypes::id::SVGPathSegCurvetoCubicRel }, |
2824 | | { PrototypeTraits<prototypes::id::SVGPathSegCurvetoCubicRel>::Depth }, |
2825 | | JSJitInfo::Getter, |
2826 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
2827 | | JSVAL_TYPE_DOUBLE, /* returnType. Not relevant for setters. */ |
2828 | | true, /* isInfallible. False in setters. */ |
2829 | | false, /* isMovable. Not relevant for setters. */ |
2830 | | false, /* isEliminatable. Not relevant for setters. */ |
2831 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
2832 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
2833 | | false, /* isTypedMethod. Only relevant for methods. */ |
2834 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
2835 | | }; |
2836 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
2837 | | static_assert(0 < 1, "There is no slot for us"); |
2838 | | static const JSJitInfo x1_setterinfo = { |
2839 | | { (JSJitGetterOp)set_x1 }, |
2840 | | { prototypes::id::SVGPathSegCurvetoCubicRel }, |
2841 | | { PrototypeTraits<prototypes::id::SVGPathSegCurvetoCubicRel>::Depth }, |
2842 | | JSJitInfo::Setter, |
2843 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
2844 | | JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */ |
2845 | | false, /* isInfallible. False in setters. */ |
2846 | | false, /* isMovable. Not relevant for setters. */ |
2847 | | false, /* isEliminatable. Not relevant for setters. */ |
2848 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
2849 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
2850 | | false, /* isTypedMethod. Only relevant for methods. */ |
2851 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
2852 | | }; |
2853 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
2854 | | static_assert(0 < 1, "There is no slot for us"); |
2855 | | |
2856 | | MOZ_CAN_RUN_SCRIPT static bool |
2857 | | get_y1(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::DOMSVGPathSegCurvetoCubicRel* self, JSJitGetterCallArgs args) |
2858 | 0 | { |
2859 | 0 | AUTO_PROFILER_LABEL_FAST("get SVGPathSegCurvetoCubicRel.y1", DOM, cx); |
2860 | 0 |
|
2861 | 0 | float result(self->Y1()); |
2862 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
2863 | 0 | args.rval().set(JS_NumberValue(double(result))); |
2864 | 0 | return true; |
2865 | 0 | } |
2866 | | |
2867 | | MOZ_CAN_RUN_SCRIPT static bool |
2868 | | set_y1(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::DOMSVGPathSegCurvetoCubicRel* self, JSJitSetterCallArgs args) |
2869 | 0 | { |
2870 | 0 | AUTO_PROFILER_LABEL_FAST("set SVGPathSegCurvetoCubicRel.y1", DOM, cx); |
2871 | 0 |
|
2872 | 0 | float arg0; |
2873 | 0 | if (!ValueToPrimitive<float, eDefault>(cx, args[0], &arg0)) { |
2874 | 0 | return false; |
2875 | 0 | } else if (!mozilla::IsFinite(arg0)) { |
2876 | 0 | ThrowErrorMessage(cx, MSG_NOT_FINITE, "Value being assigned to SVGPathSegCurvetoCubicRel.y1"); |
2877 | 0 | return false; |
2878 | 0 | } |
2879 | 0 | FastErrorResult rv; |
2880 | 0 | self->SetY1(arg0, rv); |
2881 | 0 | if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) { |
2882 | 0 | return false; |
2883 | 0 | } |
2884 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
2885 | 0 |
|
2886 | 0 | return true; |
2887 | 0 | } |
2888 | | |
2889 | | static const JSJitInfo y1_getterinfo = { |
2890 | | { (JSJitGetterOp)get_y1 }, |
2891 | | { prototypes::id::SVGPathSegCurvetoCubicRel }, |
2892 | | { PrototypeTraits<prototypes::id::SVGPathSegCurvetoCubicRel>::Depth }, |
2893 | | JSJitInfo::Getter, |
2894 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
2895 | | JSVAL_TYPE_DOUBLE, /* returnType. Not relevant for setters. */ |
2896 | | true, /* isInfallible. False in setters. */ |
2897 | | false, /* isMovable. Not relevant for setters. */ |
2898 | | false, /* isEliminatable. Not relevant for setters. */ |
2899 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
2900 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
2901 | | false, /* isTypedMethod. Only relevant for methods. */ |
2902 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
2903 | | }; |
2904 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
2905 | | static_assert(0 < 1, "There is no slot for us"); |
2906 | | static const JSJitInfo y1_setterinfo = { |
2907 | | { (JSJitGetterOp)set_y1 }, |
2908 | | { prototypes::id::SVGPathSegCurvetoCubicRel }, |
2909 | | { PrototypeTraits<prototypes::id::SVGPathSegCurvetoCubicRel>::Depth }, |
2910 | | JSJitInfo::Setter, |
2911 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
2912 | | JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */ |
2913 | | false, /* isInfallible. False in setters. */ |
2914 | | false, /* isMovable. Not relevant for setters. */ |
2915 | | false, /* isEliminatable. Not relevant for setters. */ |
2916 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
2917 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
2918 | | false, /* isTypedMethod. Only relevant for methods. */ |
2919 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
2920 | | }; |
2921 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
2922 | | static_assert(0 < 1, "There is no slot for us"); |
2923 | | |
2924 | | MOZ_CAN_RUN_SCRIPT static bool |
2925 | | get_x2(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::DOMSVGPathSegCurvetoCubicRel* self, JSJitGetterCallArgs args) |
2926 | 0 | { |
2927 | 0 | AUTO_PROFILER_LABEL_FAST("get SVGPathSegCurvetoCubicRel.x2", DOM, cx); |
2928 | 0 |
|
2929 | 0 | float result(self->X2()); |
2930 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
2931 | 0 | args.rval().set(JS_NumberValue(double(result))); |
2932 | 0 | return true; |
2933 | 0 | } |
2934 | | |
2935 | | MOZ_CAN_RUN_SCRIPT static bool |
2936 | | set_x2(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::DOMSVGPathSegCurvetoCubicRel* self, JSJitSetterCallArgs args) |
2937 | 0 | { |
2938 | 0 | AUTO_PROFILER_LABEL_FAST("set SVGPathSegCurvetoCubicRel.x2", DOM, cx); |
2939 | 0 |
|
2940 | 0 | float arg0; |
2941 | 0 | if (!ValueToPrimitive<float, eDefault>(cx, args[0], &arg0)) { |
2942 | 0 | return false; |
2943 | 0 | } else if (!mozilla::IsFinite(arg0)) { |
2944 | 0 | ThrowErrorMessage(cx, MSG_NOT_FINITE, "Value being assigned to SVGPathSegCurvetoCubicRel.x2"); |
2945 | 0 | return false; |
2946 | 0 | } |
2947 | 0 | FastErrorResult rv; |
2948 | 0 | self->SetX2(arg0, rv); |
2949 | 0 | if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) { |
2950 | 0 | return false; |
2951 | 0 | } |
2952 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
2953 | 0 |
|
2954 | 0 | return true; |
2955 | 0 | } |
2956 | | |
2957 | | static const JSJitInfo x2_getterinfo = { |
2958 | | { (JSJitGetterOp)get_x2 }, |
2959 | | { prototypes::id::SVGPathSegCurvetoCubicRel }, |
2960 | | { PrototypeTraits<prototypes::id::SVGPathSegCurvetoCubicRel>::Depth }, |
2961 | | JSJitInfo::Getter, |
2962 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
2963 | | JSVAL_TYPE_DOUBLE, /* returnType. Not relevant for setters. */ |
2964 | | true, /* isInfallible. False in setters. */ |
2965 | | false, /* isMovable. Not relevant for setters. */ |
2966 | | false, /* isEliminatable. Not relevant for setters. */ |
2967 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
2968 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
2969 | | false, /* isTypedMethod. Only relevant for methods. */ |
2970 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
2971 | | }; |
2972 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
2973 | | static_assert(0 < 1, "There is no slot for us"); |
2974 | | static const JSJitInfo x2_setterinfo = { |
2975 | | { (JSJitGetterOp)set_x2 }, |
2976 | | { prototypes::id::SVGPathSegCurvetoCubicRel }, |
2977 | | { PrototypeTraits<prototypes::id::SVGPathSegCurvetoCubicRel>::Depth }, |
2978 | | JSJitInfo::Setter, |
2979 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
2980 | | JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */ |
2981 | | false, /* isInfallible. False in setters. */ |
2982 | | false, /* isMovable. Not relevant for setters. */ |
2983 | | false, /* isEliminatable. Not relevant for setters. */ |
2984 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
2985 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
2986 | | false, /* isTypedMethod. Only relevant for methods. */ |
2987 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
2988 | | }; |
2989 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
2990 | | static_assert(0 < 1, "There is no slot for us"); |
2991 | | |
2992 | | MOZ_CAN_RUN_SCRIPT static bool |
2993 | | get_y2(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::DOMSVGPathSegCurvetoCubicRel* self, JSJitGetterCallArgs args) |
2994 | 0 | { |
2995 | 0 | AUTO_PROFILER_LABEL_FAST("get SVGPathSegCurvetoCubicRel.y2", DOM, cx); |
2996 | 0 |
|
2997 | 0 | float result(self->Y2()); |
2998 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
2999 | 0 | args.rval().set(JS_NumberValue(double(result))); |
3000 | 0 | return true; |
3001 | 0 | } |
3002 | | |
3003 | | MOZ_CAN_RUN_SCRIPT static bool |
3004 | | set_y2(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::DOMSVGPathSegCurvetoCubicRel* self, JSJitSetterCallArgs args) |
3005 | 0 | { |
3006 | 0 | AUTO_PROFILER_LABEL_FAST("set SVGPathSegCurvetoCubicRel.y2", DOM, cx); |
3007 | 0 |
|
3008 | 0 | float arg0; |
3009 | 0 | if (!ValueToPrimitive<float, eDefault>(cx, args[0], &arg0)) { |
3010 | 0 | return false; |
3011 | 0 | } else if (!mozilla::IsFinite(arg0)) { |
3012 | 0 | ThrowErrorMessage(cx, MSG_NOT_FINITE, "Value being assigned to SVGPathSegCurvetoCubicRel.y2"); |
3013 | 0 | return false; |
3014 | 0 | } |
3015 | 0 | FastErrorResult rv; |
3016 | 0 | self->SetY2(arg0, rv); |
3017 | 0 | if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) { |
3018 | 0 | return false; |
3019 | 0 | } |
3020 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
3021 | 0 |
|
3022 | 0 | return true; |
3023 | 0 | } |
3024 | | |
3025 | | static const JSJitInfo y2_getterinfo = { |
3026 | | { (JSJitGetterOp)get_y2 }, |
3027 | | { prototypes::id::SVGPathSegCurvetoCubicRel }, |
3028 | | { PrototypeTraits<prototypes::id::SVGPathSegCurvetoCubicRel>::Depth }, |
3029 | | JSJitInfo::Getter, |
3030 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
3031 | | JSVAL_TYPE_DOUBLE, /* returnType. Not relevant for setters. */ |
3032 | | true, /* isInfallible. False in setters. */ |
3033 | | false, /* isMovable. Not relevant for setters. */ |
3034 | | false, /* isEliminatable. Not relevant for setters. */ |
3035 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
3036 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
3037 | | false, /* isTypedMethod. Only relevant for methods. */ |
3038 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
3039 | | }; |
3040 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
3041 | | static_assert(0 < 1, "There is no slot for us"); |
3042 | | static const JSJitInfo y2_setterinfo = { |
3043 | | { (JSJitGetterOp)set_y2 }, |
3044 | | { prototypes::id::SVGPathSegCurvetoCubicRel }, |
3045 | | { PrototypeTraits<prototypes::id::SVGPathSegCurvetoCubicRel>::Depth }, |
3046 | | JSJitInfo::Setter, |
3047 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
3048 | | JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */ |
3049 | | false, /* isInfallible. False in setters. */ |
3050 | | false, /* isMovable. Not relevant for setters. */ |
3051 | | false, /* isEliminatable. Not relevant for setters. */ |
3052 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
3053 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
3054 | | false, /* isTypedMethod. Only relevant for methods. */ |
3055 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
3056 | | }; |
3057 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
3058 | | static_assert(0 < 1, "There is no slot for us"); |
3059 | | |
3060 | | static bool |
3061 | | _addProperty(JSContext* cx, JS::Handle<JSObject*> obj, JS::Handle<jsid> id, JS::Handle<JS::Value> val) |
3062 | 0 | { |
3063 | 0 | mozilla::DOMSVGPathSegCurvetoCubicRel* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::DOMSVGPathSegCurvetoCubicRel>(obj); |
3064 | 0 | // We don't want to preserve if we don't have a wrapper, and we |
3065 | 0 | // obviously can't preserve if we're not initialized. |
3066 | 0 | if (self && self->GetWrapperPreserveColor()) { |
3067 | 0 | PreserveWrapper(self); |
3068 | 0 | } |
3069 | 0 | return true; |
3070 | 0 | } |
3071 | | |
3072 | | static void |
3073 | | _finalize(js::FreeOp* fop, JSObject* obj) |
3074 | 0 | { |
3075 | 0 | mozilla::DOMSVGPathSegCurvetoCubicRel* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::DOMSVGPathSegCurvetoCubicRel>(obj); |
3076 | 0 | if (self) { |
3077 | 0 | ClearWrapper(self, self, obj); |
3078 | 0 | AddForDeferredFinalization<mozilla::DOMSVGPathSegCurvetoCubicRel>(self); |
3079 | 0 | } |
3080 | 0 | } |
3081 | | |
3082 | | static size_t |
3083 | | _objectMoved(JSObject* obj, JSObject* old) |
3084 | 0 | { |
3085 | 0 | mozilla::DOMSVGPathSegCurvetoCubicRel* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::DOMSVGPathSegCurvetoCubicRel>(obj); |
3086 | 0 | if (self) { |
3087 | 0 | UpdateWrapper(self, self, obj, old); |
3088 | 0 | } |
3089 | 0 |
|
3090 | 0 | return 0; |
3091 | 0 | } |
3092 | | |
3093 | | // We deliberately use brace-elision to make Visual Studio produce better initalization code. |
3094 | | #if defined(__clang__) |
3095 | | #pragma clang diagnostic push |
3096 | | #pragma clang diagnostic ignored "-Wmissing-braces" |
3097 | | #endif |
3098 | | static const JSPropertySpec sAttributes_specs[] = { |
3099 | | { "x", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &x_getterinfo, GenericSetter<NormalThisPolicy>, &x_setterinfo }, |
3100 | | { "y", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &y_getterinfo, GenericSetter<NormalThisPolicy>, &y_setterinfo }, |
3101 | | { "x1", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &x1_getterinfo, GenericSetter<NormalThisPolicy>, &x1_setterinfo }, |
3102 | | { "y1", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &y1_getterinfo, GenericSetter<NormalThisPolicy>, &y1_setterinfo }, |
3103 | | { "x2", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &x2_getterinfo, GenericSetter<NormalThisPolicy>, &x2_setterinfo }, |
3104 | | { "y2", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &y2_getterinfo, GenericSetter<NormalThisPolicy>, &y2_setterinfo }, |
3105 | | { nullptr, 0, nullptr, nullptr, nullptr, nullptr } |
3106 | | }; |
3107 | | #if defined(__clang__) |
3108 | | #pragma clang diagnostic pop |
3109 | | #endif |
3110 | | |
3111 | | |
3112 | | static const Prefable<const JSPropertySpec> sAttributes[] = { |
3113 | | { nullptr, &sAttributes_specs[0] }, |
3114 | | { nullptr, nullptr } |
3115 | | }; |
3116 | | |
3117 | | static_assert(1 <= 1ull << NUM_BITS_PROPERTY_INFO_PREF_INDEX, |
3118 | | "We have a prefable index that is >= (1 << NUM_BITS_PROPERTY_INFO_PREF_INDEX)"); |
3119 | | static_assert(6 <= 1ull << NUM_BITS_PROPERTY_INFO_SPEC_INDEX, |
3120 | | "We have a spec index that is >= (1 << NUM_BITS_PROPERTY_INFO_SPEC_INDEX)"); |
3121 | | |
3122 | | |
3123 | | static uint16_t sNativeProperties_sortedPropertyIndices[6]; |
3124 | | static PropertyInfo sNativeProperties_propertyInfos[6]; |
3125 | | |
3126 | | static const NativePropertiesN<1> sNativeProperties = { |
3127 | | false, 0, |
3128 | | false, 0, |
3129 | | false, 0, |
3130 | | true, 0 /* sAttributes */, |
3131 | | false, 0, |
3132 | | false, 0, |
3133 | | false, 0, |
3134 | | -1, |
3135 | | 6, |
3136 | | sNativeProperties_sortedPropertyIndices, |
3137 | | { |
3138 | | { sAttributes, &sNativeProperties_propertyInfos[0] } |
3139 | | } |
3140 | | }; |
3141 | | static_assert(6 < 1ull << CHAR_BIT * sizeof(sNativeProperties.propertyInfoCount), |
3142 | | "We have a property info count that is oversized"); |
3143 | | |
3144 | | static const DOMIfaceAndProtoJSClass sPrototypeClass = { |
3145 | | { |
3146 | | "SVGPathSegCurvetoCubicRelPrototype", |
3147 | | JSCLASS_IS_DOMIFACEANDPROTOJSCLASS | JSCLASS_HAS_RESERVED_SLOTS(DOM_INTERFACE_PROTO_SLOTS_BASE), |
3148 | | JS_NULL_CLASS_OPS, |
3149 | | JS_NULL_CLASS_SPEC, |
3150 | | JS_NULL_CLASS_EXT, |
3151 | | JS_NULL_OBJECT_OPS |
3152 | | }, |
3153 | | eInterfacePrototype, |
3154 | | false, |
3155 | | prototypes::id::SVGPathSegCurvetoCubicRel, |
3156 | | PrototypeTraits<prototypes::id::SVGPathSegCurvetoCubicRel>::Depth, |
3157 | | sNativePropertyHooks, |
3158 | | "[object SVGPathSegCurvetoCubicRelPrototype]", |
3159 | | SVGPathSeg_Binding::GetProtoObject |
3160 | | }; |
3161 | | |
3162 | | static const js::ClassOps sClassOps = { |
3163 | | _addProperty, /* addProperty */ |
3164 | | nullptr, /* delProperty */ |
3165 | | nullptr, /* enumerate */ |
3166 | | nullptr, /* newEnumerate */ |
3167 | | nullptr, /* resolve */ |
3168 | | nullptr, /* mayResolve */ |
3169 | | _finalize, /* finalize */ |
3170 | | nullptr, /* call */ |
3171 | | nullptr, /* hasInstance */ |
3172 | | nullptr, /* construct */ |
3173 | | nullptr, /* trace */ |
3174 | | }; |
3175 | | |
3176 | | static const js::ClassExtension sClassExtension = { |
3177 | | nullptr, /* weakmapKeyDelegateOp */ |
3178 | | _objectMoved /* objectMovedOp */ |
3179 | | }; |
3180 | | |
3181 | | static const DOMJSClass sClass = { |
3182 | | { "SVGPathSegCurvetoCubicRel", |
3183 | | JSCLASS_IS_DOMJSCLASS | JSCLASS_FOREGROUND_FINALIZE | JSCLASS_HAS_RESERVED_SLOTS(1), |
3184 | | &sClassOps, |
3185 | | JS_NULL_CLASS_SPEC, |
3186 | | &sClassExtension, |
3187 | | JS_NULL_OBJECT_OPS |
3188 | | }, |
3189 | | { prototypes::id::SVGPathSeg, prototypes::id::SVGPathSegCurvetoCubicRel, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count }, |
3190 | | IsBaseOf<nsISupports, mozilla::DOMSVGPathSegCurvetoCubicRel >::value, |
3191 | | sNativePropertyHooks, |
3192 | | FindAssociatedGlobalForNative<mozilla::DOMSVGPathSegCurvetoCubicRel>::Get, |
3193 | | GetProtoObjectHandle, |
3194 | | GetCCParticipant<mozilla::DOMSVGPathSegCurvetoCubicRel>::Get() |
3195 | | }; |
3196 | | static_assert(1 == DOM_INSTANCE_RESERVED_SLOTS, |
3197 | | "Must have the right minimal number of reserved slots."); |
3198 | | static_assert(1 >= 1, |
3199 | | "Must have enough reserved slots."); |
3200 | | |
3201 | | const JSClass* |
3202 | | GetJSClass() |
3203 | 0 | { |
3204 | 0 | return sClass.ToJSClass(); |
3205 | 0 | } |
3206 | | |
3207 | | bool |
3208 | | Wrap(JSContext* aCx, mozilla::DOMSVGPathSegCurvetoCubicRel* aObject, nsWrapperCache* aCache, JS::Handle<JSObject*> aGivenProto, JS::MutableHandle<JSObject*> aReflector) |
3209 | 0 | { |
3210 | 0 | static_assert(!IsBaseOf<NonRefcountedDOMObject, mozilla::DOMSVGPathSegCurvetoCubicRel>::value, |
3211 | 0 | "Shouldn't have wrappercached things that are not refcounted."); |
3212 | 0 | MOZ_ASSERT(static_cast<mozilla::DOMSVGPathSegCurvetoCubicRel*>(aObject) == |
3213 | 0 | reinterpret_cast<mozilla::DOMSVGPathSegCurvetoCubicRel*>(aObject), |
3214 | 0 | "Multiple inheritance for mozilla::DOMSVGPathSegCurvetoCubicRel is broken."); |
3215 | 0 | MOZ_ASSERT(static_cast<mozilla::DOMSVGPathSeg*>(aObject) == |
3216 | 0 | reinterpret_cast<mozilla::DOMSVGPathSeg*>(aObject), |
3217 | 0 | "Multiple inheritance for mozilla::DOMSVGPathSeg is broken."); |
3218 | 0 | MOZ_ASSERT(ToSupportsIsCorrect(aObject)); |
3219 | 0 | MOZ_ASSERT_IF(aGivenProto, js::IsObjectInContextCompartment(aGivenProto, aCx)); |
3220 | 0 | MOZ_ASSERT(!aCache->GetWrapper(), |
3221 | 0 | "You should probably not be using Wrap() directly; use " |
3222 | 0 | "GetOrCreateDOMReflector instead"); |
3223 | 0 |
|
3224 | 0 | MOZ_ASSERT(ToSupportsIsOnPrimaryInheritanceChain(aObject, aCache), |
3225 | 0 | "nsISupports must be on our primary inheritance chain"); |
3226 | 0 |
|
3227 | 0 | JS::Rooted<JSObject*> global(aCx, FindAssociatedGlobal(aCx, aObject->GetParentObject())); |
3228 | 0 | if (!global) { |
3229 | 0 | return false; |
3230 | 0 | } |
3231 | 0 | MOZ_ASSERT(JS_IsGlobalObject(global)); |
3232 | 0 | MOZ_ASSERT(JS::ObjectIsNotGray(global)); |
3233 | 0 |
|
3234 | 0 | // That might have ended up wrapping us already, due to the wonders |
3235 | 0 | // of XBL. Check for that, and bail out as needed. |
3236 | 0 | aReflector.set(aCache->GetWrapper()); |
3237 | 0 | if (aReflector) { |
3238 | | #ifdef DEBUG |
3239 | | AssertReflectorHasGivenProto(aCx, aReflector, aGivenProto); |
3240 | | #endif // DEBUG |
3241 | | return true; |
3242 | 0 | } |
3243 | 0 |
|
3244 | 0 | JSAutoRealm ar(aCx, global); |
3245 | 0 | JS::Handle<JSObject*> canonicalProto = GetProtoObjectHandle(aCx); |
3246 | 0 | if (!canonicalProto) { |
3247 | 0 | return false; |
3248 | 0 | } |
3249 | 0 | JS::Rooted<JSObject*> proto(aCx); |
3250 | 0 | if (aGivenProto) { |
3251 | 0 | proto = aGivenProto; |
3252 | 0 | // Unfortunately, while aGivenProto was in the compartment of aCx |
3253 | 0 | // coming in, we changed compartments to that of "parent" so may need |
3254 | 0 | // to wrap the proto here. |
3255 | 0 | if (js::GetContextCompartment(aCx) != js::GetObjectCompartment(proto)) { |
3256 | 0 | if (!JS_WrapObject(aCx, &proto)) { |
3257 | 0 | return false; |
3258 | 0 | } |
3259 | 0 | } |
3260 | 0 | } else { |
3261 | 0 | proto = canonicalProto; |
3262 | 0 | } |
3263 | 0 |
|
3264 | 0 | BindingJSObjectCreator<mozilla::DOMSVGPathSegCurvetoCubicRel> creator(aCx); |
3265 | 0 | creator.CreateObject(aCx, sClass.ToJSClass(), proto, aObject, aReflector); |
3266 | 0 | if (!aReflector) { |
3267 | 0 | return false; |
3268 | 0 | } |
3269 | 0 | |
3270 | 0 | aCache->SetWrapper(aReflector); |
3271 | 0 | creator.InitializationSucceeded(); |
3272 | 0 |
|
3273 | 0 | MOZ_ASSERT(aCache->GetWrapperPreserveColor() && |
3274 | 0 | aCache->GetWrapperPreserveColor() == aReflector); |
3275 | 0 | // If proto != canonicalProto, we have to preserve our wrapper; |
3276 | 0 | // otherwise we won't be able to properly recreate it later, since |
3277 | 0 | // we won't know what proto to use. Note that we don't check |
3278 | 0 | // aGivenProto here, since it's entirely possible (and even |
3279 | 0 | // somewhat common) to have a non-null aGivenProto which is the |
3280 | 0 | // same as canonicalProto. |
3281 | 0 | if (proto != canonicalProto) { |
3282 | 0 | PreserveWrapper(aObject); |
3283 | 0 | } |
3284 | 0 |
|
3285 | 0 | return true; |
3286 | 0 | } |
3287 | | |
3288 | | const NativePropertyHooks sNativePropertyHooks[] = { { |
3289 | | nullptr, |
3290 | | nullptr, |
3291 | | nullptr, |
3292 | | { sNativeProperties.Upcast(), nullptr }, |
3293 | | prototypes::id::SVGPathSegCurvetoCubicRel, |
3294 | | constructors::id::_ID_Count, |
3295 | | SVGPathSeg_Binding::sNativePropertyHooks, |
3296 | | &DefaultXrayExpandoObjectClass |
3297 | | } }; |
3298 | | |
3299 | | void |
3300 | | CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, bool aDefineOnGlobal) |
3301 | 0 | { |
3302 | 0 | JS::Handle<JSObject*> parentProto(SVGPathSeg_Binding::GetProtoObjectHandle(aCx)); |
3303 | 0 | if (!parentProto) { |
3304 | 0 | return; |
3305 | 0 | } |
3306 | 0 | |
3307 | 0 | static bool sIdsInited = false; |
3308 | 0 | if (!sIdsInited && NS_IsMainThread()) { |
3309 | 0 | if (!InitIds(aCx, sNativeProperties.Upcast())) { |
3310 | 0 | return; |
3311 | 0 | } |
3312 | 0 | sIdsInited = true; |
3313 | 0 | } |
3314 | 0 |
|
3315 | 0 | JS::Heap<JSObject*>* protoCache = &aProtoAndIfaceCache.EntrySlotOrCreate(prototypes::id::SVGPathSegCurvetoCubicRel); |
3316 | 0 | JS::Heap<JSObject*>* interfaceCache = nullptr; |
3317 | 0 | dom::CreateInterfaceObjects(aCx, aGlobal, parentProto, |
3318 | 0 | &sPrototypeClass.mBase, protoCache, |
3319 | 0 | nullptr, |
3320 | 0 | nullptr, nullptr, 0, nullptr, |
3321 | 0 | interfaceCache, |
3322 | 0 | sNativeProperties.Upcast(), |
3323 | 0 | nullptr, |
3324 | 0 | nullptr, aDefineOnGlobal, |
3325 | 0 | nullptr, |
3326 | 0 | false); |
3327 | 0 | } |
3328 | | |
3329 | | } // namespace SVGPathSegCurvetoCubicRel_Binding |
3330 | | |
3331 | | |
3332 | | |
3333 | | namespace SVGPathSegCurvetoCubicSmoothAbs_Binding { |
3334 | | |
3335 | | static_assert(IsRefcounted<NativeType>::value == IsRefcounted<SVGPathSeg_Binding::NativeType>::value, |
3336 | | "Can't inherit from an interface with a different ownership model."); |
3337 | | |
3338 | | MOZ_CAN_RUN_SCRIPT static bool |
3339 | | get_x(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::DOMSVGPathSegCurvetoCubicSmoothAbs* self, JSJitGetterCallArgs args) |
3340 | 0 | { |
3341 | 0 | AUTO_PROFILER_LABEL_FAST("get SVGPathSegCurvetoCubicSmoothAbs.x", DOM, cx); |
3342 | 0 |
|
3343 | 0 | float result(self->X()); |
3344 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
3345 | 0 | args.rval().set(JS_NumberValue(double(result))); |
3346 | 0 | return true; |
3347 | 0 | } |
3348 | | |
3349 | | MOZ_CAN_RUN_SCRIPT static bool |
3350 | | set_x(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::DOMSVGPathSegCurvetoCubicSmoothAbs* self, JSJitSetterCallArgs args) |
3351 | 0 | { |
3352 | 0 | AUTO_PROFILER_LABEL_FAST("set SVGPathSegCurvetoCubicSmoothAbs.x", DOM, cx); |
3353 | 0 |
|
3354 | 0 | float arg0; |
3355 | 0 | if (!ValueToPrimitive<float, eDefault>(cx, args[0], &arg0)) { |
3356 | 0 | return false; |
3357 | 0 | } else if (!mozilla::IsFinite(arg0)) { |
3358 | 0 | ThrowErrorMessage(cx, MSG_NOT_FINITE, "Value being assigned to SVGPathSegCurvetoCubicSmoothAbs.x"); |
3359 | 0 | return false; |
3360 | 0 | } |
3361 | 0 | FastErrorResult rv; |
3362 | 0 | self->SetX(arg0, rv); |
3363 | 0 | if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) { |
3364 | 0 | return false; |
3365 | 0 | } |
3366 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
3367 | 0 |
|
3368 | 0 | return true; |
3369 | 0 | } |
3370 | | |
3371 | | static const JSJitInfo x_getterinfo = { |
3372 | | { (JSJitGetterOp)get_x }, |
3373 | | { prototypes::id::SVGPathSegCurvetoCubicSmoothAbs }, |
3374 | | { PrototypeTraits<prototypes::id::SVGPathSegCurvetoCubicSmoothAbs>::Depth }, |
3375 | | JSJitInfo::Getter, |
3376 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
3377 | | JSVAL_TYPE_DOUBLE, /* returnType. Not relevant for setters. */ |
3378 | | true, /* isInfallible. False in setters. */ |
3379 | | false, /* isMovable. Not relevant for setters. */ |
3380 | | false, /* isEliminatable. Not relevant for setters. */ |
3381 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
3382 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
3383 | | false, /* isTypedMethod. Only relevant for methods. */ |
3384 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
3385 | | }; |
3386 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
3387 | | static_assert(0 < 1, "There is no slot for us"); |
3388 | | static const JSJitInfo x_setterinfo = { |
3389 | | { (JSJitGetterOp)set_x }, |
3390 | | { prototypes::id::SVGPathSegCurvetoCubicSmoothAbs }, |
3391 | | { PrototypeTraits<prototypes::id::SVGPathSegCurvetoCubicSmoothAbs>::Depth }, |
3392 | | JSJitInfo::Setter, |
3393 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
3394 | | JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */ |
3395 | | false, /* isInfallible. False in setters. */ |
3396 | | false, /* isMovable. Not relevant for setters. */ |
3397 | | false, /* isEliminatable. Not relevant for setters. */ |
3398 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
3399 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
3400 | | false, /* isTypedMethod. Only relevant for methods. */ |
3401 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
3402 | | }; |
3403 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
3404 | | static_assert(0 < 1, "There is no slot for us"); |
3405 | | |
3406 | | MOZ_CAN_RUN_SCRIPT static bool |
3407 | | get_y(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::DOMSVGPathSegCurvetoCubicSmoothAbs* self, JSJitGetterCallArgs args) |
3408 | 0 | { |
3409 | 0 | AUTO_PROFILER_LABEL_FAST("get SVGPathSegCurvetoCubicSmoothAbs.y", DOM, cx); |
3410 | 0 |
|
3411 | 0 | float result(self->Y()); |
3412 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
3413 | 0 | args.rval().set(JS_NumberValue(double(result))); |
3414 | 0 | return true; |
3415 | 0 | } |
3416 | | |
3417 | | MOZ_CAN_RUN_SCRIPT static bool |
3418 | | set_y(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::DOMSVGPathSegCurvetoCubicSmoothAbs* self, JSJitSetterCallArgs args) |
3419 | 0 | { |
3420 | 0 | AUTO_PROFILER_LABEL_FAST("set SVGPathSegCurvetoCubicSmoothAbs.y", DOM, cx); |
3421 | 0 |
|
3422 | 0 | float arg0; |
3423 | 0 | if (!ValueToPrimitive<float, eDefault>(cx, args[0], &arg0)) { |
3424 | 0 | return false; |
3425 | 0 | } else if (!mozilla::IsFinite(arg0)) { |
3426 | 0 | ThrowErrorMessage(cx, MSG_NOT_FINITE, "Value being assigned to SVGPathSegCurvetoCubicSmoothAbs.y"); |
3427 | 0 | return false; |
3428 | 0 | } |
3429 | 0 | FastErrorResult rv; |
3430 | 0 | self->SetY(arg0, rv); |
3431 | 0 | if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) { |
3432 | 0 | return false; |
3433 | 0 | } |
3434 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
3435 | 0 |
|
3436 | 0 | return true; |
3437 | 0 | } |
3438 | | |
3439 | | static const JSJitInfo y_getterinfo = { |
3440 | | { (JSJitGetterOp)get_y }, |
3441 | | { prototypes::id::SVGPathSegCurvetoCubicSmoothAbs }, |
3442 | | { PrototypeTraits<prototypes::id::SVGPathSegCurvetoCubicSmoothAbs>::Depth }, |
3443 | | JSJitInfo::Getter, |
3444 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
3445 | | JSVAL_TYPE_DOUBLE, /* returnType. Not relevant for setters. */ |
3446 | | true, /* isInfallible. False in setters. */ |
3447 | | false, /* isMovable. Not relevant for setters. */ |
3448 | | false, /* isEliminatable. Not relevant for setters. */ |
3449 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
3450 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
3451 | | false, /* isTypedMethod. Only relevant for methods. */ |
3452 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
3453 | | }; |
3454 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
3455 | | static_assert(0 < 1, "There is no slot for us"); |
3456 | | static const JSJitInfo y_setterinfo = { |
3457 | | { (JSJitGetterOp)set_y }, |
3458 | | { prototypes::id::SVGPathSegCurvetoCubicSmoothAbs }, |
3459 | | { PrototypeTraits<prototypes::id::SVGPathSegCurvetoCubicSmoothAbs>::Depth }, |
3460 | | JSJitInfo::Setter, |
3461 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
3462 | | JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */ |
3463 | | false, /* isInfallible. False in setters. */ |
3464 | | false, /* isMovable. Not relevant for setters. */ |
3465 | | false, /* isEliminatable. Not relevant for setters. */ |
3466 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
3467 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
3468 | | false, /* isTypedMethod. Only relevant for methods. */ |
3469 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
3470 | | }; |
3471 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
3472 | | static_assert(0 < 1, "There is no slot for us"); |
3473 | | |
3474 | | MOZ_CAN_RUN_SCRIPT static bool |
3475 | | get_x2(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::DOMSVGPathSegCurvetoCubicSmoothAbs* self, JSJitGetterCallArgs args) |
3476 | 0 | { |
3477 | 0 | AUTO_PROFILER_LABEL_FAST("get SVGPathSegCurvetoCubicSmoothAbs.x2", DOM, cx); |
3478 | 0 |
|
3479 | 0 | float result(self->X2()); |
3480 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
3481 | 0 | args.rval().set(JS_NumberValue(double(result))); |
3482 | 0 | return true; |
3483 | 0 | } |
3484 | | |
3485 | | MOZ_CAN_RUN_SCRIPT static bool |
3486 | | set_x2(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::DOMSVGPathSegCurvetoCubicSmoothAbs* self, JSJitSetterCallArgs args) |
3487 | 0 | { |
3488 | 0 | AUTO_PROFILER_LABEL_FAST("set SVGPathSegCurvetoCubicSmoothAbs.x2", DOM, cx); |
3489 | 0 |
|
3490 | 0 | float arg0; |
3491 | 0 | if (!ValueToPrimitive<float, eDefault>(cx, args[0], &arg0)) { |
3492 | 0 | return false; |
3493 | 0 | } else if (!mozilla::IsFinite(arg0)) { |
3494 | 0 | ThrowErrorMessage(cx, MSG_NOT_FINITE, "Value being assigned to SVGPathSegCurvetoCubicSmoothAbs.x2"); |
3495 | 0 | return false; |
3496 | 0 | } |
3497 | 0 | FastErrorResult rv; |
3498 | 0 | self->SetX2(arg0, rv); |
3499 | 0 | if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) { |
3500 | 0 | return false; |
3501 | 0 | } |
3502 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
3503 | 0 |
|
3504 | 0 | return true; |
3505 | 0 | } |
3506 | | |
3507 | | static const JSJitInfo x2_getterinfo = { |
3508 | | { (JSJitGetterOp)get_x2 }, |
3509 | | { prototypes::id::SVGPathSegCurvetoCubicSmoothAbs }, |
3510 | | { PrototypeTraits<prototypes::id::SVGPathSegCurvetoCubicSmoothAbs>::Depth }, |
3511 | | JSJitInfo::Getter, |
3512 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
3513 | | JSVAL_TYPE_DOUBLE, /* returnType. Not relevant for setters. */ |
3514 | | true, /* isInfallible. False in setters. */ |
3515 | | false, /* isMovable. Not relevant for setters. */ |
3516 | | false, /* isEliminatable. Not relevant for setters. */ |
3517 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
3518 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
3519 | | false, /* isTypedMethod. Only relevant for methods. */ |
3520 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
3521 | | }; |
3522 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
3523 | | static_assert(0 < 1, "There is no slot for us"); |
3524 | | static const JSJitInfo x2_setterinfo = { |
3525 | | { (JSJitGetterOp)set_x2 }, |
3526 | | { prototypes::id::SVGPathSegCurvetoCubicSmoothAbs }, |
3527 | | { PrototypeTraits<prototypes::id::SVGPathSegCurvetoCubicSmoothAbs>::Depth }, |
3528 | | JSJitInfo::Setter, |
3529 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
3530 | | JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */ |
3531 | | false, /* isInfallible. False in setters. */ |
3532 | | false, /* isMovable. Not relevant for setters. */ |
3533 | | false, /* isEliminatable. Not relevant for setters. */ |
3534 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
3535 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
3536 | | false, /* isTypedMethod. Only relevant for methods. */ |
3537 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
3538 | | }; |
3539 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
3540 | | static_assert(0 < 1, "There is no slot for us"); |
3541 | | |
3542 | | MOZ_CAN_RUN_SCRIPT static bool |
3543 | | get_y2(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::DOMSVGPathSegCurvetoCubicSmoothAbs* self, JSJitGetterCallArgs args) |
3544 | 0 | { |
3545 | 0 | AUTO_PROFILER_LABEL_FAST("get SVGPathSegCurvetoCubicSmoothAbs.y2", DOM, cx); |
3546 | 0 |
|
3547 | 0 | float result(self->Y2()); |
3548 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
3549 | 0 | args.rval().set(JS_NumberValue(double(result))); |
3550 | 0 | return true; |
3551 | 0 | } |
3552 | | |
3553 | | MOZ_CAN_RUN_SCRIPT static bool |
3554 | | set_y2(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::DOMSVGPathSegCurvetoCubicSmoothAbs* self, JSJitSetterCallArgs args) |
3555 | 0 | { |
3556 | 0 | AUTO_PROFILER_LABEL_FAST("set SVGPathSegCurvetoCubicSmoothAbs.y2", DOM, cx); |
3557 | 0 |
|
3558 | 0 | float arg0; |
3559 | 0 | if (!ValueToPrimitive<float, eDefault>(cx, args[0], &arg0)) { |
3560 | 0 | return false; |
3561 | 0 | } else if (!mozilla::IsFinite(arg0)) { |
3562 | 0 | ThrowErrorMessage(cx, MSG_NOT_FINITE, "Value being assigned to SVGPathSegCurvetoCubicSmoothAbs.y2"); |
3563 | 0 | return false; |
3564 | 0 | } |
3565 | 0 | FastErrorResult rv; |
3566 | 0 | self->SetY2(arg0, rv); |
3567 | 0 | if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) { |
3568 | 0 | return false; |
3569 | 0 | } |
3570 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
3571 | 0 |
|
3572 | 0 | return true; |
3573 | 0 | } |
3574 | | |
3575 | | static const JSJitInfo y2_getterinfo = { |
3576 | | { (JSJitGetterOp)get_y2 }, |
3577 | | { prototypes::id::SVGPathSegCurvetoCubicSmoothAbs }, |
3578 | | { PrototypeTraits<prototypes::id::SVGPathSegCurvetoCubicSmoothAbs>::Depth }, |
3579 | | JSJitInfo::Getter, |
3580 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
3581 | | JSVAL_TYPE_DOUBLE, /* returnType. Not relevant for setters. */ |
3582 | | true, /* isInfallible. False in setters. */ |
3583 | | false, /* isMovable. Not relevant for setters. */ |
3584 | | false, /* isEliminatable. Not relevant for setters. */ |
3585 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
3586 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
3587 | | false, /* isTypedMethod. Only relevant for methods. */ |
3588 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
3589 | | }; |
3590 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
3591 | | static_assert(0 < 1, "There is no slot for us"); |
3592 | | static const JSJitInfo y2_setterinfo = { |
3593 | | { (JSJitGetterOp)set_y2 }, |
3594 | | { prototypes::id::SVGPathSegCurvetoCubicSmoothAbs }, |
3595 | | { PrototypeTraits<prototypes::id::SVGPathSegCurvetoCubicSmoothAbs>::Depth }, |
3596 | | JSJitInfo::Setter, |
3597 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
3598 | | JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */ |
3599 | | false, /* isInfallible. False in setters. */ |
3600 | | false, /* isMovable. Not relevant for setters. */ |
3601 | | false, /* isEliminatable. Not relevant for setters. */ |
3602 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
3603 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
3604 | | false, /* isTypedMethod. Only relevant for methods. */ |
3605 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
3606 | | }; |
3607 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
3608 | | static_assert(0 < 1, "There is no slot for us"); |
3609 | | |
3610 | | static bool |
3611 | | _addProperty(JSContext* cx, JS::Handle<JSObject*> obj, JS::Handle<jsid> id, JS::Handle<JS::Value> val) |
3612 | 0 | { |
3613 | 0 | mozilla::DOMSVGPathSegCurvetoCubicSmoothAbs* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::DOMSVGPathSegCurvetoCubicSmoothAbs>(obj); |
3614 | 0 | // We don't want to preserve if we don't have a wrapper, and we |
3615 | 0 | // obviously can't preserve if we're not initialized. |
3616 | 0 | if (self && self->GetWrapperPreserveColor()) { |
3617 | 0 | PreserveWrapper(self); |
3618 | 0 | } |
3619 | 0 | return true; |
3620 | 0 | } |
3621 | | |
3622 | | static void |
3623 | | _finalize(js::FreeOp* fop, JSObject* obj) |
3624 | 0 | { |
3625 | 0 | mozilla::DOMSVGPathSegCurvetoCubicSmoothAbs* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::DOMSVGPathSegCurvetoCubicSmoothAbs>(obj); |
3626 | 0 | if (self) { |
3627 | 0 | ClearWrapper(self, self, obj); |
3628 | 0 | AddForDeferredFinalization<mozilla::DOMSVGPathSegCurvetoCubicSmoothAbs>(self); |
3629 | 0 | } |
3630 | 0 | } |
3631 | | |
3632 | | static size_t |
3633 | | _objectMoved(JSObject* obj, JSObject* old) |
3634 | 0 | { |
3635 | 0 | mozilla::DOMSVGPathSegCurvetoCubicSmoothAbs* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::DOMSVGPathSegCurvetoCubicSmoothAbs>(obj); |
3636 | 0 | if (self) { |
3637 | 0 | UpdateWrapper(self, self, obj, old); |
3638 | 0 | } |
3639 | 0 |
|
3640 | 0 | return 0; |
3641 | 0 | } |
3642 | | |
3643 | | // We deliberately use brace-elision to make Visual Studio produce better initalization code. |
3644 | | #if defined(__clang__) |
3645 | | #pragma clang diagnostic push |
3646 | | #pragma clang diagnostic ignored "-Wmissing-braces" |
3647 | | #endif |
3648 | | static const JSPropertySpec sAttributes_specs[] = { |
3649 | | { "x", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &x_getterinfo, GenericSetter<NormalThisPolicy>, &x_setterinfo }, |
3650 | | { "y", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &y_getterinfo, GenericSetter<NormalThisPolicy>, &y_setterinfo }, |
3651 | | { "x2", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &x2_getterinfo, GenericSetter<NormalThisPolicy>, &x2_setterinfo }, |
3652 | | { "y2", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &y2_getterinfo, GenericSetter<NormalThisPolicy>, &y2_setterinfo }, |
3653 | | { nullptr, 0, nullptr, nullptr, nullptr, nullptr } |
3654 | | }; |
3655 | | #if defined(__clang__) |
3656 | | #pragma clang diagnostic pop |
3657 | | #endif |
3658 | | |
3659 | | |
3660 | | static const Prefable<const JSPropertySpec> sAttributes[] = { |
3661 | | { nullptr, &sAttributes_specs[0] }, |
3662 | | { nullptr, nullptr } |
3663 | | }; |
3664 | | |
3665 | | static_assert(1 <= 1ull << NUM_BITS_PROPERTY_INFO_PREF_INDEX, |
3666 | | "We have a prefable index that is >= (1 << NUM_BITS_PROPERTY_INFO_PREF_INDEX)"); |
3667 | | static_assert(4 <= 1ull << NUM_BITS_PROPERTY_INFO_SPEC_INDEX, |
3668 | | "We have a spec index that is >= (1 << NUM_BITS_PROPERTY_INFO_SPEC_INDEX)"); |
3669 | | |
3670 | | |
3671 | | static uint16_t sNativeProperties_sortedPropertyIndices[4]; |
3672 | | static PropertyInfo sNativeProperties_propertyInfos[4]; |
3673 | | |
3674 | | static const NativePropertiesN<1> sNativeProperties = { |
3675 | | false, 0, |
3676 | | false, 0, |
3677 | | false, 0, |
3678 | | true, 0 /* sAttributes */, |
3679 | | false, 0, |
3680 | | false, 0, |
3681 | | false, 0, |
3682 | | -1, |
3683 | | 4, |
3684 | | sNativeProperties_sortedPropertyIndices, |
3685 | | { |
3686 | | { sAttributes, &sNativeProperties_propertyInfos[0] } |
3687 | | } |
3688 | | }; |
3689 | | static_assert(4 < 1ull << CHAR_BIT * sizeof(sNativeProperties.propertyInfoCount), |
3690 | | "We have a property info count that is oversized"); |
3691 | | |
3692 | | static const DOMIfaceAndProtoJSClass sPrototypeClass = { |
3693 | | { |
3694 | | "SVGPathSegCurvetoCubicSmoothAbsPrototype", |
3695 | | JSCLASS_IS_DOMIFACEANDPROTOJSCLASS | JSCLASS_HAS_RESERVED_SLOTS(DOM_INTERFACE_PROTO_SLOTS_BASE), |
3696 | | JS_NULL_CLASS_OPS, |
3697 | | JS_NULL_CLASS_SPEC, |
3698 | | JS_NULL_CLASS_EXT, |
3699 | | JS_NULL_OBJECT_OPS |
3700 | | }, |
3701 | | eInterfacePrototype, |
3702 | | false, |
3703 | | prototypes::id::SVGPathSegCurvetoCubicSmoothAbs, |
3704 | | PrototypeTraits<prototypes::id::SVGPathSegCurvetoCubicSmoothAbs>::Depth, |
3705 | | sNativePropertyHooks, |
3706 | | "[object SVGPathSegCurvetoCubicSmoothAbsPrototype]", |
3707 | | SVGPathSeg_Binding::GetProtoObject |
3708 | | }; |
3709 | | |
3710 | | static const js::ClassOps sClassOps = { |
3711 | | _addProperty, /* addProperty */ |
3712 | | nullptr, /* delProperty */ |
3713 | | nullptr, /* enumerate */ |
3714 | | nullptr, /* newEnumerate */ |
3715 | | nullptr, /* resolve */ |
3716 | | nullptr, /* mayResolve */ |
3717 | | _finalize, /* finalize */ |
3718 | | nullptr, /* call */ |
3719 | | nullptr, /* hasInstance */ |
3720 | | nullptr, /* construct */ |
3721 | | nullptr, /* trace */ |
3722 | | }; |
3723 | | |
3724 | | static const js::ClassExtension sClassExtension = { |
3725 | | nullptr, /* weakmapKeyDelegateOp */ |
3726 | | _objectMoved /* objectMovedOp */ |
3727 | | }; |
3728 | | |
3729 | | static const DOMJSClass sClass = { |
3730 | | { "SVGPathSegCurvetoCubicSmoothAbs", |
3731 | | JSCLASS_IS_DOMJSCLASS | JSCLASS_FOREGROUND_FINALIZE | JSCLASS_HAS_RESERVED_SLOTS(1), |
3732 | | &sClassOps, |
3733 | | JS_NULL_CLASS_SPEC, |
3734 | | &sClassExtension, |
3735 | | JS_NULL_OBJECT_OPS |
3736 | | }, |
3737 | | { prototypes::id::SVGPathSeg, prototypes::id::SVGPathSegCurvetoCubicSmoothAbs, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count }, |
3738 | | IsBaseOf<nsISupports, mozilla::DOMSVGPathSegCurvetoCubicSmoothAbs >::value, |
3739 | | sNativePropertyHooks, |
3740 | | FindAssociatedGlobalForNative<mozilla::DOMSVGPathSegCurvetoCubicSmoothAbs>::Get, |
3741 | | GetProtoObjectHandle, |
3742 | | GetCCParticipant<mozilla::DOMSVGPathSegCurvetoCubicSmoothAbs>::Get() |
3743 | | }; |
3744 | | static_assert(1 == DOM_INSTANCE_RESERVED_SLOTS, |
3745 | | "Must have the right minimal number of reserved slots."); |
3746 | | static_assert(1 >= 1, |
3747 | | "Must have enough reserved slots."); |
3748 | | |
3749 | | const JSClass* |
3750 | | GetJSClass() |
3751 | 0 | { |
3752 | 0 | return sClass.ToJSClass(); |
3753 | 0 | } |
3754 | | |
3755 | | bool |
3756 | | Wrap(JSContext* aCx, mozilla::DOMSVGPathSegCurvetoCubicSmoothAbs* aObject, nsWrapperCache* aCache, JS::Handle<JSObject*> aGivenProto, JS::MutableHandle<JSObject*> aReflector) |
3757 | 0 | { |
3758 | 0 | static_assert(!IsBaseOf<NonRefcountedDOMObject, mozilla::DOMSVGPathSegCurvetoCubicSmoothAbs>::value, |
3759 | 0 | "Shouldn't have wrappercached things that are not refcounted."); |
3760 | 0 | MOZ_ASSERT(static_cast<mozilla::DOMSVGPathSegCurvetoCubicSmoothAbs*>(aObject) == |
3761 | 0 | reinterpret_cast<mozilla::DOMSVGPathSegCurvetoCubicSmoothAbs*>(aObject), |
3762 | 0 | "Multiple inheritance for mozilla::DOMSVGPathSegCurvetoCubicSmoothAbs is broken."); |
3763 | 0 | MOZ_ASSERT(static_cast<mozilla::DOMSVGPathSeg*>(aObject) == |
3764 | 0 | reinterpret_cast<mozilla::DOMSVGPathSeg*>(aObject), |
3765 | 0 | "Multiple inheritance for mozilla::DOMSVGPathSeg is broken."); |
3766 | 0 | MOZ_ASSERT(ToSupportsIsCorrect(aObject)); |
3767 | 0 | MOZ_ASSERT_IF(aGivenProto, js::IsObjectInContextCompartment(aGivenProto, aCx)); |
3768 | 0 | MOZ_ASSERT(!aCache->GetWrapper(), |
3769 | 0 | "You should probably not be using Wrap() directly; use " |
3770 | 0 | "GetOrCreateDOMReflector instead"); |
3771 | 0 |
|
3772 | 0 | MOZ_ASSERT(ToSupportsIsOnPrimaryInheritanceChain(aObject, aCache), |
3773 | 0 | "nsISupports must be on our primary inheritance chain"); |
3774 | 0 |
|
3775 | 0 | JS::Rooted<JSObject*> global(aCx, FindAssociatedGlobal(aCx, aObject->GetParentObject())); |
3776 | 0 | if (!global) { |
3777 | 0 | return false; |
3778 | 0 | } |
3779 | 0 | MOZ_ASSERT(JS_IsGlobalObject(global)); |
3780 | 0 | MOZ_ASSERT(JS::ObjectIsNotGray(global)); |
3781 | 0 |
|
3782 | 0 | // That might have ended up wrapping us already, due to the wonders |
3783 | 0 | // of XBL. Check for that, and bail out as needed. |
3784 | 0 | aReflector.set(aCache->GetWrapper()); |
3785 | 0 | if (aReflector) { |
3786 | | #ifdef DEBUG |
3787 | | AssertReflectorHasGivenProto(aCx, aReflector, aGivenProto); |
3788 | | #endif // DEBUG |
3789 | | return true; |
3790 | 0 | } |
3791 | 0 |
|
3792 | 0 | JSAutoRealm ar(aCx, global); |
3793 | 0 | JS::Handle<JSObject*> canonicalProto = GetProtoObjectHandle(aCx); |
3794 | 0 | if (!canonicalProto) { |
3795 | 0 | return false; |
3796 | 0 | } |
3797 | 0 | JS::Rooted<JSObject*> proto(aCx); |
3798 | 0 | if (aGivenProto) { |
3799 | 0 | proto = aGivenProto; |
3800 | 0 | // Unfortunately, while aGivenProto was in the compartment of aCx |
3801 | 0 | // coming in, we changed compartments to that of "parent" so may need |
3802 | 0 | // to wrap the proto here. |
3803 | 0 | if (js::GetContextCompartment(aCx) != js::GetObjectCompartment(proto)) { |
3804 | 0 | if (!JS_WrapObject(aCx, &proto)) { |
3805 | 0 | return false; |
3806 | 0 | } |
3807 | 0 | } |
3808 | 0 | } else { |
3809 | 0 | proto = canonicalProto; |
3810 | 0 | } |
3811 | 0 |
|
3812 | 0 | BindingJSObjectCreator<mozilla::DOMSVGPathSegCurvetoCubicSmoothAbs> creator(aCx); |
3813 | 0 | creator.CreateObject(aCx, sClass.ToJSClass(), proto, aObject, aReflector); |
3814 | 0 | if (!aReflector) { |
3815 | 0 | return false; |
3816 | 0 | } |
3817 | 0 | |
3818 | 0 | aCache->SetWrapper(aReflector); |
3819 | 0 | creator.InitializationSucceeded(); |
3820 | 0 |
|
3821 | 0 | MOZ_ASSERT(aCache->GetWrapperPreserveColor() && |
3822 | 0 | aCache->GetWrapperPreserveColor() == aReflector); |
3823 | 0 | // If proto != canonicalProto, we have to preserve our wrapper; |
3824 | 0 | // otherwise we won't be able to properly recreate it later, since |
3825 | 0 | // we won't know what proto to use. Note that we don't check |
3826 | 0 | // aGivenProto here, since it's entirely possible (and even |
3827 | 0 | // somewhat common) to have a non-null aGivenProto which is the |
3828 | 0 | // same as canonicalProto. |
3829 | 0 | if (proto != canonicalProto) { |
3830 | 0 | PreserveWrapper(aObject); |
3831 | 0 | } |
3832 | 0 |
|
3833 | 0 | return true; |
3834 | 0 | } |
3835 | | |
3836 | | const NativePropertyHooks sNativePropertyHooks[] = { { |
3837 | | nullptr, |
3838 | | nullptr, |
3839 | | nullptr, |
3840 | | { sNativeProperties.Upcast(), nullptr }, |
3841 | | prototypes::id::SVGPathSegCurvetoCubicSmoothAbs, |
3842 | | constructors::id::_ID_Count, |
3843 | | SVGPathSeg_Binding::sNativePropertyHooks, |
3844 | | &DefaultXrayExpandoObjectClass |
3845 | | } }; |
3846 | | |
3847 | | void |
3848 | | CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, bool aDefineOnGlobal) |
3849 | 0 | { |
3850 | 0 | JS::Handle<JSObject*> parentProto(SVGPathSeg_Binding::GetProtoObjectHandle(aCx)); |
3851 | 0 | if (!parentProto) { |
3852 | 0 | return; |
3853 | 0 | } |
3854 | 0 | |
3855 | 0 | static bool sIdsInited = false; |
3856 | 0 | if (!sIdsInited && NS_IsMainThread()) { |
3857 | 0 | if (!InitIds(aCx, sNativeProperties.Upcast())) { |
3858 | 0 | return; |
3859 | 0 | } |
3860 | 0 | sIdsInited = true; |
3861 | 0 | } |
3862 | 0 |
|
3863 | 0 | JS::Heap<JSObject*>* protoCache = &aProtoAndIfaceCache.EntrySlotOrCreate(prototypes::id::SVGPathSegCurvetoCubicSmoothAbs); |
3864 | 0 | JS::Heap<JSObject*>* interfaceCache = nullptr; |
3865 | 0 | dom::CreateInterfaceObjects(aCx, aGlobal, parentProto, |
3866 | 0 | &sPrototypeClass.mBase, protoCache, |
3867 | 0 | nullptr, |
3868 | 0 | nullptr, nullptr, 0, nullptr, |
3869 | 0 | interfaceCache, |
3870 | 0 | sNativeProperties.Upcast(), |
3871 | 0 | nullptr, |
3872 | 0 | nullptr, aDefineOnGlobal, |
3873 | 0 | nullptr, |
3874 | 0 | false); |
3875 | 0 | } |
3876 | | |
3877 | | } // namespace SVGPathSegCurvetoCubicSmoothAbs_Binding |
3878 | | |
3879 | | |
3880 | | |
3881 | | namespace SVGPathSegCurvetoCubicSmoothRel_Binding { |
3882 | | |
3883 | | static_assert(IsRefcounted<NativeType>::value == IsRefcounted<SVGPathSeg_Binding::NativeType>::value, |
3884 | | "Can't inherit from an interface with a different ownership model."); |
3885 | | |
3886 | | MOZ_CAN_RUN_SCRIPT static bool |
3887 | | get_x(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::DOMSVGPathSegCurvetoCubicSmoothRel* self, JSJitGetterCallArgs args) |
3888 | 0 | { |
3889 | 0 | AUTO_PROFILER_LABEL_FAST("get SVGPathSegCurvetoCubicSmoothRel.x", DOM, cx); |
3890 | 0 |
|
3891 | 0 | float result(self->X()); |
3892 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
3893 | 0 | args.rval().set(JS_NumberValue(double(result))); |
3894 | 0 | return true; |
3895 | 0 | } |
3896 | | |
3897 | | MOZ_CAN_RUN_SCRIPT static bool |
3898 | | set_x(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::DOMSVGPathSegCurvetoCubicSmoothRel* self, JSJitSetterCallArgs args) |
3899 | 0 | { |
3900 | 0 | AUTO_PROFILER_LABEL_FAST("set SVGPathSegCurvetoCubicSmoothRel.x", DOM, cx); |
3901 | 0 |
|
3902 | 0 | float arg0; |
3903 | 0 | if (!ValueToPrimitive<float, eDefault>(cx, args[0], &arg0)) { |
3904 | 0 | return false; |
3905 | 0 | } else if (!mozilla::IsFinite(arg0)) { |
3906 | 0 | ThrowErrorMessage(cx, MSG_NOT_FINITE, "Value being assigned to SVGPathSegCurvetoCubicSmoothRel.x"); |
3907 | 0 | return false; |
3908 | 0 | } |
3909 | 0 | FastErrorResult rv; |
3910 | 0 | self->SetX(arg0, rv); |
3911 | 0 | if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) { |
3912 | 0 | return false; |
3913 | 0 | } |
3914 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
3915 | 0 |
|
3916 | 0 | return true; |
3917 | 0 | } |
3918 | | |
3919 | | static const JSJitInfo x_getterinfo = { |
3920 | | { (JSJitGetterOp)get_x }, |
3921 | | { prototypes::id::SVGPathSegCurvetoCubicSmoothRel }, |
3922 | | { PrototypeTraits<prototypes::id::SVGPathSegCurvetoCubicSmoothRel>::Depth }, |
3923 | | JSJitInfo::Getter, |
3924 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
3925 | | JSVAL_TYPE_DOUBLE, /* returnType. Not relevant for setters. */ |
3926 | | true, /* isInfallible. False in setters. */ |
3927 | | false, /* isMovable. Not relevant for setters. */ |
3928 | | false, /* isEliminatable. Not relevant for setters. */ |
3929 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
3930 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
3931 | | false, /* isTypedMethod. Only relevant for methods. */ |
3932 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
3933 | | }; |
3934 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
3935 | | static_assert(0 < 1, "There is no slot for us"); |
3936 | | static const JSJitInfo x_setterinfo = { |
3937 | | { (JSJitGetterOp)set_x }, |
3938 | | { prototypes::id::SVGPathSegCurvetoCubicSmoothRel }, |
3939 | | { PrototypeTraits<prototypes::id::SVGPathSegCurvetoCubicSmoothRel>::Depth }, |
3940 | | JSJitInfo::Setter, |
3941 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
3942 | | JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */ |
3943 | | false, /* isInfallible. False in setters. */ |
3944 | | false, /* isMovable. Not relevant for setters. */ |
3945 | | false, /* isEliminatable. Not relevant for setters. */ |
3946 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
3947 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
3948 | | false, /* isTypedMethod. Only relevant for methods. */ |
3949 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
3950 | | }; |
3951 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
3952 | | static_assert(0 < 1, "There is no slot for us"); |
3953 | | |
3954 | | MOZ_CAN_RUN_SCRIPT static bool |
3955 | | get_y(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::DOMSVGPathSegCurvetoCubicSmoothRel* self, JSJitGetterCallArgs args) |
3956 | 0 | { |
3957 | 0 | AUTO_PROFILER_LABEL_FAST("get SVGPathSegCurvetoCubicSmoothRel.y", DOM, cx); |
3958 | 0 |
|
3959 | 0 | float result(self->Y()); |
3960 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
3961 | 0 | args.rval().set(JS_NumberValue(double(result))); |
3962 | 0 | return true; |
3963 | 0 | } |
3964 | | |
3965 | | MOZ_CAN_RUN_SCRIPT static bool |
3966 | | set_y(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::DOMSVGPathSegCurvetoCubicSmoothRel* self, JSJitSetterCallArgs args) |
3967 | 0 | { |
3968 | 0 | AUTO_PROFILER_LABEL_FAST("set SVGPathSegCurvetoCubicSmoothRel.y", DOM, cx); |
3969 | 0 |
|
3970 | 0 | float arg0; |
3971 | 0 | if (!ValueToPrimitive<float, eDefault>(cx, args[0], &arg0)) { |
3972 | 0 | return false; |
3973 | 0 | } else if (!mozilla::IsFinite(arg0)) { |
3974 | 0 | ThrowErrorMessage(cx, MSG_NOT_FINITE, "Value being assigned to SVGPathSegCurvetoCubicSmoothRel.y"); |
3975 | 0 | return false; |
3976 | 0 | } |
3977 | 0 | FastErrorResult rv; |
3978 | 0 | self->SetY(arg0, rv); |
3979 | 0 | if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) { |
3980 | 0 | return false; |
3981 | 0 | } |
3982 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
3983 | 0 |
|
3984 | 0 | return true; |
3985 | 0 | } |
3986 | | |
3987 | | static const JSJitInfo y_getterinfo = { |
3988 | | { (JSJitGetterOp)get_y }, |
3989 | | { prototypes::id::SVGPathSegCurvetoCubicSmoothRel }, |
3990 | | { PrototypeTraits<prototypes::id::SVGPathSegCurvetoCubicSmoothRel>::Depth }, |
3991 | | JSJitInfo::Getter, |
3992 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
3993 | | JSVAL_TYPE_DOUBLE, /* returnType. Not relevant for setters. */ |
3994 | | true, /* isInfallible. False in setters. */ |
3995 | | false, /* isMovable. Not relevant for setters. */ |
3996 | | false, /* isEliminatable. Not relevant for setters. */ |
3997 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
3998 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
3999 | | false, /* isTypedMethod. Only relevant for methods. */ |
4000 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
4001 | | }; |
4002 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
4003 | | static_assert(0 < 1, "There is no slot for us"); |
4004 | | static const JSJitInfo y_setterinfo = { |
4005 | | { (JSJitGetterOp)set_y }, |
4006 | | { prototypes::id::SVGPathSegCurvetoCubicSmoothRel }, |
4007 | | { PrototypeTraits<prototypes::id::SVGPathSegCurvetoCubicSmoothRel>::Depth }, |
4008 | | JSJitInfo::Setter, |
4009 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
4010 | | JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */ |
4011 | | false, /* isInfallible. False in setters. */ |
4012 | | false, /* isMovable. Not relevant for setters. */ |
4013 | | false, /* isEliminatable. Not relevant for setters. */ |
4014 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
4015 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
4016 | | false, /* isTypedMethod. Only relevant for methods. */ |
4017 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
4018 | | }; |
4019 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
4020 | | static_assert(0 < 1, "There is no slot for us"); |
4021 | | |
4022 | | MOZ_CAN_RUN_SCRIPT static bool |
4023 | | get_x2(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::DOMSVGPathSegCurvetoCubicSmoothRel* self, JSJitGetterCallArgs args) |
4024 | 0 | { |
4025 | 0 | AUTO_PROFILER_LABEL_FAST("get SVGPathSegCurvetoCubicSmoothRel.x2", DOM, cx); |
4026 | 0 |
|
4027 | 0 | float result(self->X2()); |
4028 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
4029 | 0 | args.rval().set(JS_NumberValue(double(result))); |
4030 | 0 | return true; |
4031 | 0 | } |
4032 | | |
4033 | | MOZ_CAN_RUN_SCRIPT static bool |
4034 | | set_x2(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::DOMSVGPathSegCurvetoCubicSmoothRel* self, JSJitSetterCallArgs args) |
4035 | 0 | { |
4036 | 0 | AUTO_PROFILER_LABEL_FAST("set SVGPathSegCurvetoCubicSmoothRel.x2", DOM, cx); |
4037 | 0 |
|
4038 | 0 | float arg0; |
4039 | 0 | if (!ValueToPrimitive<float, eDefault>(cx, args[0], &arg0)) { |
4040 | 0 | return false; |
4041 | 0 | } else if (!mozilla::IsFinite(arg0)) { |
4042 | 0 | ThrowErrorMessage(cx, MSG_NOT_FINITE, "Value being assigned to SVGPathSegCurvetoCubicSmoothRel.x2"); |
4043 | 0 | return false; |
4044 | 0 | } |
4045 | 0 | FastErrorResult rv; |
4046 | 0 | self->SetX2(arg0, rv); |
4047 | 0 | if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) { |
4048 | 0 | return false; |
4049 | 0 | } |
4050 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
4051 | 0 |
|
4052 | 0 | return true; |
4053 | 0 | } |
4054 | | |
4055 | | static const JSJitInfo x2_getterinfo = { |
4056 | | { (JSJitGetterOp)get_x2 }, |
4057 | | { prototypes::id::SVGPathSegCurvetoCubicSmoothRel }, |
4058 | | { PrototypeTraits<prototypes::id::SVGPathSegCurvetoCubicSmoothRel>::Depth }, |
4059 | | JSJitInfo::Getter, |
4060 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
4061 | | JSVAL_TYPE_DOUBLE, /* returnType. Not relevant for setters. */ |
4062 | | true, /* isInfallible. False in setters. */ |
4063 | | false, /* isMovable. Not relevant for setters. */ |
4064 | | false, /* isEliminatable. Not relevant for setters. */ |
4065 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
4066 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
4067 | | false, /* isTypedMethod. Only relevant for methods. */ |
4068 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
4069 | | }; |
4070 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
4071 | | static_assert(0 < 1, "There is no slot for us"); |
4072 | | static const JSJitInfo x2_setterinfo = { |
4073 | | { (JSJitGetterOp)set_x2 }, |
4074 | | { prototypes::id::SVGPathSegCurvetoCubicSmoothRel }, |
4075 | | { PrototypeTraits<prototypes::id::SVGPathSegCurvetoCubicSmoothRel>::Depth }, |
4076 | | JSJitInfo::Setter, |
4077 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
4078 | | JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */ |
4079 | | false, /* isInfallible. False in setters. */ |
4080 | | false, /* isMovable. Not relevant for setters. */ |
4081 | | false, /* isEliminatable. Not relevant for setters. */ |
4082 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
4083 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
4084 | | false, /* isTypedMethod. Only relevant for methods. */ |
4085 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
4086 | | }; |
4087 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
4088 | | static_assert(0 < 1, "There is no slot for us"); |
4089 | | |
4090 | | MOZ_CAN_RUN_SCRIPT static bool |
4091 | | get_y2(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::DOMSVGPathSegCurvetoCubicSmoothRel* self, JSJitGetterCallArgs args) |
4092 | 0 | { |
4093 | 0 | AUTO_PROFILER_LABEL_FAST("get SVGPathSegCurvetoCubicSmoothRel.y2", DOM, cx); |
4094 | 0 |
|
4095 | 0 | float result(self->Y2()); |
4096 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
4097 | 0 | args.rval().set(JS_NumberValue(double(result))); |
4098 | 0 | return true; |
4099 | 0 | } |
4100 | | |
4101 | | MOZ_CAN_RUN_SCRIPT static bool |
4102 | | set_y2(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::DOMSVGPathSegCurvetoCubicSmoothRel* self, JSJitSetterCallArgs args) |
4103 | 0 | { |
4104 | 0 | AUTO_PROFILER_LABEL_FAST("set SVGPathSegCurvetoCubicSmoothRel.y2", DOM, cx); |
4105 | 0 |
|
4106 | 0 | float arg0; |
4107 | 0 | if (!ValueToPrimitive<float, eDefault>(cx, args[0], &arg0)) { |
4108 | 0 | return false; |
4109 | 0 | } else if (!mozilla::IsFinite(arg0)) { |
4110 | 0 | ThrowErrorMessage(cx, MSG_NOT_FINITE, "Value being assigned to SVGPathSegCurvetoCubicSmoothRel.y2"); |
4111 | 0 | return false; |
4112 | 0 | } |
4113 | 0 | FastErrorResult rv; |
4114 | 0 | self->SetY2(arg0, rv); |
4115 | 0 | if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) { |
4116 | 0 | return false; |
4117 | 0 | } |
4118 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
4119 | 0 |
|
4120 | 0 | return true; |
4121 | 0 | } |
4122 | | |
4123 | | static const JSJitInfo y2_getterinfo = { |
4124 | | { (JSJitGetterOp)get_y2 }, |
4125 | | { prototypes::id::SVGPathSegCurvetoCubicSmoothRel }, |
4126 | | { PrototypeTraits<prototypes::id::SVGPathSegCurvetoCubicSmoothRel>::Depth }, |
4127 | | JSJitInfo::Getter, |
4128 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
4129 | | JSVAL_TYPE_DOUBLE, /* returnType. Not relevant for setters. */ |
4130 | | true, /* isInfallible. False in setters. */ |
4131 | | false, /* isMovable. Not relevant for setters. */ |
4132 | | false, /* isEliminatable. Not relevant for setters. */ |
4133 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
4134 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
4135 | | false, /* isTypedMethod. Only relevant for methods. */ |
4136 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
4137 | | }; |
4138 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
4139 | | static_assert(0 < 1, "There is no slot for us"); |
4140 | | static const JSJitInfo y2_setterinfo = { |
4141 | | { (JSJitGetterOp)set_y2 }, |
4142 | | { prototypes::id::SVGPathSegCurvetoCubicSmoothRel }, |
4143 | | { PrototypeTraits<prototypes::id::SVGPathSegCurvetoCubicSmoothRel>::Depth }, |
4144 | | JSJitInfo::Setter, |
4145 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
4146 | | JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */ |
4147 | | false, /* isInfallible. False in setters. */ |
4148 | | false, /* isMovable. Not relevant for setters. */ |
4149 | | false, /* isEliminatable. Not relevant for setters. */ |
4150 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
4151 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
4152 | | false, /* isTypedMethod. Only relevant for methods. */ |
4153 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
4154 | | }; |
4155 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
4156 | | static_assert(0 < 1, "There is no slot for us"); |
4157 | | |
4158 | | static bool |
4159 | | _addProperty(JSContext* cx, JS::Handle<JSObject*> obj, JS::Handle<jsid> id, JS::Handle<JS::Value> val) |
4160 | 0 | { |
4161 | 0 | mozilla::DOMSVGPathSegCurvetoCubicSmoothRel* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::DOMSVGPathSegCurvetoCubicSmoothRel>(obj); |
4162 | 0 | // We don't want to preserve if we don't have a wrapper, and we |
4163 | 0 | // obviously can't preserve if we're not initialized. |
4164 | 0 | if (self && self->GetWrapperPreserveColor()) { |
4165 | 0 | PreserveWrapper(self); |
4166 | 0 | } |
4167 | 0 | return true; |
4168 | 0 | } |
4169 | | |
4170 | | static void |
4171 | | _finalize(js::FreeOp* fop, JSObject* obj) |
4172 | 0 | { |
4173 | 0 | mozilla::DOMSVGPathSegCurvetoCubicSmoothRel* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::DOMSVGPathSegCurvetoCubicSmoothRel>(obj); |
4174 | 0 | if (self) { |
4175 | 0 | ClearWrapper(self, self, obj); |
4176 | 0 | AddForDeferredFinalization<mozilla::DOMSVGPathSegCurvetoCubicSmoothRel>(self); |
4177 | 0 | } |
4178 | 0 | } |
4179 | | |
4180 | | static size_t |
4181 | | _objectMoved(JSObject* obj, JSObject* old) |
4182 | 0 | { |
4183 | 0 | mozilla::DOMSVGPathSegCurvetoCubicSmoothRel* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::DOMSVGPathSegCurvetoCubicSmoothRel>(obj); |
4184 | 0 | if (self) { |
4185 | 0 | UpdateWrapper(self, self, obj, old); |
4186 | 0 | } |
4187 | 0 |
|
4188 | 0 | return 0; |
4189 | 0 | } |
4190 | | |
4191 | | // We deliberately use brace-elision to make Visual Studio produce better initalization code. |
4192 | | #if defined(__clang__) |
4193 | | #pragma clang diagnostic push |
4194 | | #pragma clang diagnostic ignored "-Wmissing-braces" |
4195 | | #endif |
4196 | | static const JSPropertySpec sAttributes_specs[] = { |
4197 | | { "x", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &x_getterinfo, GenericSetter<NormalThisPolicy>, &x_setterinfo }, |
4198 | | { "y", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &y_getterinfo, GenericSetter<NormalThisPolicy>, &y_setterinfo }, |
4199 | | { "x2", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &x2_getterinfo, GenericSetter<NormalThisPolicy>, &x2_setterinfo }, |
4200 | | { "y2", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &y2_getterinfo, GenericSetter<NormalThisPolicy>, &y2_setterinfo }, |
4201 | | { nullptr, 0, nullptr, nullptr, nullptr, nullptr } |
4202 | | }; |
4203 | | #if defined(__clang__) |
4204 | | #pragma clang diagnostic pop |
4205 | | #endif |
4206 | | |
4207 | | |
4208 | | static const Prefable<const JSPropertySpec> sAttributes[] = { |
4209 | | { nullptr, &sAttributes_specs[0] }, |
4210 | | { nullptr, nullptr } |
4211 | | }; |
4212 | | |
4213 | | static_assert(1 <= 1ull << NUM_BITS_PROPERTY_INFO_PREF_INDEX, |
4214 | | "We have a prefable index that is >= (1 << NUM_BITS_PROPERTY_INFO_PREF_INDEX)"); |
4215 | | static_assert(4 <= 1ull << NUM_BITS_PROPERTY_INFO_SPEC_INDEX, |
4216 | | "We have a spec index that is >= (1 << NUM_BITS_PROPERTY_INFO_SPEC_INDEX)"); |
4217 | | |
4218 | | |
4219 | | static uint16_t sNativeProperties_sortedPropertyIndices[4]; |
4220 | | static PropertyInfo sNativeProperties_propertyInfos[4]; |
4221 | | |
4222 | | static const NativePropertiesN<1> sNativeProperties = { |
4223 | | false, 0, |
4224 | | false, 0, |
4225 | | false, 0, |
4226 | | true, 0 /* sAttributes */, |
4227 | | false, 0, |
4228 | | false, 0, |
4229 | | false, 0, |
4230 | | -1, |
4231 | | 4, |
4232 | | sNativeProperties_sortedPropertyIndices, |
4233 | | { |
4234 | | { sAttributes, &sNativeProperties_propertyInfos[0] } |
4235 | | } |
4236 | | }; |
4237 | | static_assert(4 < 1ull << CHAR_BIT * sizeof(sNativeProperties.propertyInfoCount), |
4238 | | "We have a property info count that is oversized"); |
4239 | | |
4240 | | static const DOMIfaceAndProtoJSClass sPrototypeClass = { |
4241 | | { |
4242 | | "SVGPathSegCurvetoCubicSmoothRelPrototype", |
4243 | | JSCLASS_IS_DOMIFACEANDPROTOJSCLASS | JSCLASS_HAS_RESERVED_SLOTS(DOM_INTERFACE_PROTO_SLOTS_BASE), |
4244 | | JS_NULL_CLASS_OPS, |
4245 | | JS_NULL_CLASS_SPEC, |
4246 | | JS_NULL_CLASS_EXT, |
4247 | | JS_NULL_OBJECT_OPS |
4248 | | }, |
4249 | | eInterfacePrototype, |
4250 | | false, |
4251 | | prototypes::id::SVGPathSegCurvetoCubicSmoothRel, |
4252 | | PrototypeTraits<prototypes::id::SVGPathSegCurvetoCubicSmoothRel>::Depth, |
4253 | | sNativePropertyHooks, |
4254 | | "[object SVGPathSegCurvetoCubicSmoothRelPrototype]", |
4255 | | SVGPathSeg_Binding::GetProtoObject |
4256 | | }; |
4257 | | |
4258 | | static const js::ClassOps sClassOps = { |
4259 | | _addProperty, /* addProperty */ |
4260 | | nullptr, /* delProperty */ |
4261 | | nullptr, /* enumerate */ |
4262 | | nullptr, /* newEnumerate */ |
4263 | | nullptr, /* resolve */ |
4264 | | nullptr, /* mayResolve */ |
4265 | | _finalize, /* finalize */ |
4266 | | nullptr, /* call */ |
4267 | | nullptr, /* hasInstance */ |
4268 | | nullptr, /* construct */ |
4269 | | nullptr, /* trace */ |
4270 | | }; |
4271 | | |
4272 | | static const js::ClassExtension sClassExtension = { |
4273 | | nullptr, /* weakmapKeyDelegateOp */ |
4274 | | _objectMoved /* objectMovedOp */ |
4275 | | }; |
4276 | | |
4277 | | static const DOMJSClass sClass = { |
4278 | | { "SVGPathSegCurvetoCubicSmoothRel", |
4279 | | JSCLASS_IS_DOMJSCLASS | JSCLASS_FOREGROUND_FINALIZE | JSCLASS_HAS_RESERVED_SLOTS(1), |
4280 | | &sClassOps, |
4281 | | JS_NULL_CLASS_SPEC, |
4282 | | &sClassExtension, |
4283 | | JS_NULL_OBJECT_OPS |
4284 | | }, |
4285 | | { prototypes::id::SVGPathSeg, prototypes::id::SVGPathSegCurvetoCubicSmoothRel, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count }, |
4286 | | IsBaseOf<nsISupports, mozilla::DOMSVGPathSegCurvetoCubicSmoothRel >::value, |
4287 | | sNativePropertyHooks, |
4288 | | FindAssociatedGlobalForNative<mozilla::DOMSVGPathSegCurvetoCubicSmoothRel>::Get, |
4289 | | GetProtoObjectHandle, |
4290 | | GetCCParticipant<mozilla::DOMSVGPathSegCurvetoCubicSmoothRel>::Get() |
4291 | | }; |
4292 | | static_assert(1 == DOM_INSTANCE_RESERVED_SLOTS, |
4293 | | "Must have the right minimal number of reserved slots."); |
4294 | | static_assert(1 >= 1, |
4295 | | "Must have enough reserved slots."); |
4296 | | |
4297 | | const JSClass* |
4298 | | GetJSClass() |
4299 | 0 | { |
4300 | 0 | return sClass.ToJSClass(); |
4301 | 0 | } |
4302 | | |
4303 | | bool |
4304 | | Wrap(JSContext* aCx, mozilla::DOMSVGPathSegCurvetoCubicSmoothRel* aObject, nsWrapperCache* aCache, JS::Handle<JSObject*> aGivenProto, JS::MutableHandle<JSObject*> aReflector) |
4305 | 0 | { |
4306 | 0 | static_assert(!IsBaseOf<NonRefcountedDOMObject, mozilla::DOMSVGPathSegCurvetoCubicSmoothRel>::value, |
4307 | 0 | "Shouldn't have wrappercached things that are not refcounted."); |
4308 | 0 | MOZ_ASSERT(static_cast<mozilla::DOMSVGPathSegCurvetoCubicSmoothRel*>(aObject) == |
4309 | 0 | reinterpret_cast<mozilla::DOMSVGPathSegCurvetoCubicSmoothRel*>(aObject), |
4310 | 0 | "Multiple inheritance for mozilla::DOMSVGPathSegCurvetoCubicSmoothRel is broken."); |
4311 | 0 | MOZ_ASSERT(static_cast<mozilla::DOMSVGPathSeg*>(aObject) == |
4312 | 0 | reinterpret_cast<mozilla::DOMSVGPathSeg*>(aObject), |
4313 | 0 | "Multiple inheritance for mozilla::DOMSVGPathSeg is broken."); |
4314 | 0 | MOZ_ASSERT(ToSupportsIsCorrect(aObject)); |
4315 | 0 | MOZ_ASSERT_IF(aGivenProto, js::IsObjectInContextCompartment(aGivenProto, aCx)); |
4316 | 0 | MOZ_ASSERT(!aCache->GetWrapper(), |
4317 | 0 | "You should probably not be using Wrap() directly; use " |
4318 | 0 | "GetOrCreateDOMReflector instead"); |
4319 | 0 |
|
4320 | 0 | MOZ_ASSERT(ToSupportsIsOnPrimaryInheritanceChain(aObject, aCache), |
4321 | 0 | "nsISupports must be on our primary inheritance chain"); |
4322 | 0 |
|
4323 | 0 | JS::Rooted<JSObject*> global(aCx, FindAssociatedGlobal(aCx, aObject->GetParentObject())); |
4324 | 0 | if (!global) { |
4325 | 0 | return false; |
4326 | 0 | } |
4327 | 0 | MOZ_ASSERT(JS_IsGlobalObject(global)); |
4328 | 0 | MOZ_ASSERT(JS::ObjectIsNotGray(global)); |
4329 | 0 |
|
4330 | 0 | // That might have ended up wrapping us already, due to the wonders |
4331 | 0 | // of XBL. Check for that, and bail out as needed. |
4332 | 0 | aReflector.set(aCache->GetWrapper()); |
4333 | 0 | if (aReflector) { |
4334 | | #ifdef DEBUG |
4335 | | AssertReflectorHasGivenProto(aCx, aReflector, aGivenProto); |
4336 | | #endif // DEBUG |
4337 | | return true; |
4338 | 0 | } |
4339 | 0 |
|
4340 | 0 | JSAutoRealm ar(aCx, global); |
4341 | 0 | JS::Handle<JSObject*> canonicalProto = GetProtoObjectHandle(aCx); |
4342 | 0 | if (!canonicalProto) { |
4343 | 0 | return false; |
4344 | 0 | } |
4345 | 0 | JS::Rooted<JSObject*> proto(aCx); |
4346 | 0 | if (aGivenProto) { |
4347 | 0 | proto = aGivenProto; |
4348 | 0 | // Unfortunately, while aGivenProto was in the compartment of aCx |
4349 | 0 | // coming in, we changed compartments to that of "parent" so may need |
4350 | 0 | // to wrap the proto here. |
4351 | 0 | if (js::GetContextCompartment(aCx) != js::GetObjectCompartment(proto)) { |
4352 | 0 | if (!JS_WrapObject(aCx, &proto)) { |
4353 | 0 | return false; |
4354 | 0 | } |
4355 | 0 | } |
4356 | 0 | } else { |
4357 | 0 | proto = canonicalProto; |
4358 | 0 | } |
4359 | 0 |
|
4360 | 0 | BindingJSObjectCreator<mozilla::DOMSVGPathSegCurvetoCubicSmoothRel> creator(aCx); |
4361 | 0 | creator.CreateObject(aCx, sClass.ToJSClass(), proto, aObject, aReflector); |
4362 | 0 | if (!aReflector) { |
4363 | 0 | return false; |
4364 | 0 | } |
4365 | 0 | |
4366 | 0 | aCache->SetWrapper(aReflector); |
4367 | 0 | creator.InitializationSucceeded(); |
4368 | 0 |
|
4369 | 0 | MOZ_ASSERT(aCache->GetWrapperPreserveColor() && |
4370 | 0 | aCache->GetWrapperPreserveColor() == aReflector); |
4371 | 0 | // If proto != canonicalProto, we have to preserve our wrapper; |
4372 | 0 | // otherwise we won't be able to properly recreate it later, since |
4373 | 0 | // we won't know what proto to use. Note that we don't check |
4374 | 0 | // aGivenProto here, since it's entirely possible (and even |
4375 | 0 | // somewhat common) to have a non-null aGivenProto which is the |
4376 | 0 | // same as canonicalProto. |
4377 | 0 | if (proto != canonicalProto) { |
4378 | 0 | PreserveWrapper(aObject); |
4379 | 0 | } |
4380 | 0 |
|
4381 | 0 | return true; |
4382 | 0 | } |
4383 | | |
4384 | | const NativePropertyHooks sNativePropertyHooks[] = { { |
4385 | | nullptr, |
4386 | | nullptr, |
4387 | | nullptr, |
4388 | | { sNativeProperties.Upcast(), nullptr }, |
4389 | | prototypes::id::SVGPathSegCurvetoCubicSmoothRel, |
4390 | | constructors::id::_ID_Count, |
4391 | | SVGPathSeg_Binding::sNativePropertyHooks, |
4392 | | &DefaultXrayExpandoObjectClass |
4393 | | } }; |
4394 | | |
4395 | | void |
4396 | | CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, bool aDefineOnGlobal) |
4397 | 0 | { |
4398 | 0 | JS::Handle<JSObject*> parentProto(SVGPathSeg_Binding::GetProtoObjectHandle(aCx)); |
4399 | 0 | if (!parentProto) { |
4400 | 0 | return; |
4401 | 0 | } |
4402 | 0 | |
4403 | 0 | static bool sIdsInited = false; |
4404 | 0 | if (!sIdsInited && NS_IsMainThread()) { |
4405 | 0 | if (!InitIds(aCx, sNativeProperties.Upcast())) { |
4406 | 0 | return; |
4407 | 0 | } |
4408 | 0 | sIdsInited = true; |
4409 | 0 | } |
4410 | 0 |
|
4411 | 0 | JS::Heap<JSObject*>* protoCache = &aProtoAndIfaceCache.EntrySlotOrCreate(prototypes::id::SVGPathSegCurvetoCubicSmoothRel); |
4412 | 0 | JS::Heap<JSObject*>* interfaceCache = nullptr; |
4413 | 0 | dom::CreateInterfaceObjects(aCx, aGlobal, parentProto, |
4414 | 0 | &sPrototypeClass.mBase, protoCache, |
4415 | 0 | nullptr, |
4416 | 0 | nullptr, nullptr, 0, nullptr, |
4417 | 0 | interfaceCache, |
4418 | 0 | sNativeProperties.Upcast(), |
4419 | 0 | nullptr, |
4420 | 0 | nullptr, aDefineOnGlobal, |
4421 | 0 | nullptr, |
4422 | 0 | false); |
4423 | 0 | } |
4424 | | |
4425 | | } // namespace SVGPathSegCurvetoCubicSmoothRel_Binding |
4426 | | |
4427 | | |
4428 | | |
4429 | | namespace SVGPathSegCurvetoQuadraticAbs_Binding { |
4430 | | |
4431 | | static_assert(IsRefcounted<NativeType>::value == IsRefcounted<SVGPathSeg_Binding::NativeType>::value, |
4432 | | "Can't inherit from an interface with a different ownership model."); |
4433 | | |
4434 | | MOZ_CAN_RUN_SCRIPT static bool |
4435 | | get_x(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::DOMSVGPathSegCurvetoQuadraticAbs* self, JSJitGetterCallArgs args) |
4436 | 0 | { |
4437 | 0 | AUTO_PROFILER_LABEL_FAST("get SVGPathSegCurvetoQuadraticAbs.x", DOM, cx); |
4438 | 0 |
|
4439 | 0 | float result(self->X()); |
4440 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
4441 | 0 | args.rval().set(JS_NumberValue(double(result))); |
4442 | 0 | return true; |
4443 | 0 | } |
4444 | | |
4445 | | MOZ_CAN_RUN_SCRIPT static bool |
4446 | | set_x(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::DOMSVGPathSegCurvetoQuadraticAbs* self, JSJitSetterCallArgs args) |
4447 | 0 | { |
4448 | 0 | AUTO_PROFILER_LABEL_FAST("set SVGPathSegCurvetoQuadraticAbs.x", DOM, cx); |
4449 | 0 |
|
4450 | 0 | float arg0; |
4451 | 0 | if (!ValueToPrimitive<float, eDefault>(cx, args[0], &arg0)) { |
4452 | 0 | return false; |
4453 | 0 | } else if (!mozilla::IsFinite(arg0)) { |
4454 | 0 | ThrowErrorMessage(cx, MSG_NOT_FINITE, "Value being assigned to SVGPathSegCurvetoQuadraticAbs.x"); |
4455 | 0 | return false; |
4456 | 0 | } |
4457 | 0 | FastErrorResult rv; |
4458 | 0 | self->SetX(arg0, rv); |
4459 | 0 | if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) { |
4460 | 0 | return false; |
4461 | 0 | } |
4462 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
4463 | 0 |
|
4464 | 0 | return true; |
4465 | 0 | } |
4466 | | |
4467 | | static const JSJitInfo x_getterinfo = { |
4468 | | { (JSJitGetterOp)get_x }, |
4469 | | { prototypes::id::SVGPathSegCurvetoQuadraticAbs }, |
4470 | | { PrototypeTraits<prototypes::id::SVGPathSegCurvetoQuadraticAbs>::Depth }, |
4471 | | JSJitInfo::Getter, |
4472 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
4473 | | JSVAL_TYPE_DOUBLE, /* returnType. Not relevant for setters. */ |
4474 | | true, /* isInfallible. False in setters. */ |
4475 | | false, /* isMovable. Not relevant for setters. */ |
4476 | | false, /* isEliminatable. Not relevant for setters. */ |
4477 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
4478 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
4479 | | false, /* isTypedMethod. Only relevant for methods. */ |
4480 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
4481 | | }; |
4482 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
4483 | | static_assert(0 < 1, "There is no slot for us"); |
4484 | | static const JSJitInfo x_setterinfo = { |
4485 | | { (JSJitGetterOp)set_x }, |
4486 | | { prototypes::id::SVGPathSegCurvetoQuadraticAbs }, |
4487 | | { PrototypeTraits<prototypes::id::SVGPathSegCurvetoQuadraticAbs>::Depth }, |
4488 | | JSJitInfo::Setter, |
4489 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
4490 | | JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */ |
4491 | | false, /* isInfallible. False in setters. */ |
4492 | | false, /* isMovable. Not relevant for setters. */ |
4493 | | false, /* isEliminatable. Not relevant for setters. */ |
4494 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
4495 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
4496 | | false, /* isTypedMethod. Only relevant for methods. */ |
4497 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
4498 | | }; |
4499 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
4500 | | static_assert(0 < 1, "There is no slot for us"); |
4501 | | |
4502 | | MOZ_CAN_RUN_SCRIPT static bool |
4503 | | get_y(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::DOMSVGPathSegCurvetoQuadraticAbs* self, JSJitGetterCallArgs args) |
4504 | 0 | { |
4505 | 0 | AUTO_PROFILER_LABEL_FAST("get SVGPathSegCurvetoQuadraticAbs.y", DOM, cx); |
4506 | 0 |
|
4507 | 0 | float result(self->Y()); |
4508 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
4509 | 0 | args.rval().set(JS_NumberValue(double(result))); |
4510 | 0 | return true; |
4511 | 0 | } |
4512 | | |
4513 | | MOZ_CAN_RUN_SCRIPT static bool |
4514 | | set_y(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::DOMSVGPathSegCurvetoQuadraticAbs* self, JSJitSetterCallArgs args) |
4515 | 0 | { |
4516 | 0 | AUTO_PROFILER_LABEL_FAST("set SVGPathSegCurvetoQuadraticAbs.y", DOM, cx); |
4517 | 0 |
|
4518 | 0 | float arg0; |
4519 | 0 | if (!ValueToPrimitive<float, eDefault>(cx, args[0], &arg0)) { |
4520 | 0 | return false; |
4521 | 0 | } else if (!mozilla::IsFinite(arg0)) { |
4522 | 0 | ThrowErrorMessage(cx, MSG_NOT_FINITE, "Value being assigned to SVGPathSegCurvetoQuadraticAbs.y"); |
4523 | 0 | return false; |
4524 | 0 | } |
4525 | 0 | FastErrorResult rv; |
4526 | 0 | self->SetY(arg0, rv); |
4527 | 0 | if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) { |
4528 | 0 | return false; |
4529 | 0 | } |
4530 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
4531 | 0 |
|
4532 | 0 | return true; |
4533 | 0 | } |
4534 | | |
4535 | | static const JSJitInfo y_getterinfo = { |
4536 | | { (JSJitGetterOp)get_y }, |
4537 | | { prototypes::id::SVGPathSegCurvetoQuadraticAbs }, |
4538 | | { PrototypeTraits<prototypes::id::SVGPathSegCurvetoQuadraticAbs>::Depth }, |
4539 | | JSJitInfo::Getter, |
4540 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
4541 | | JSVAL_TYPE_DOUBLE, /* returnType. Not relevant for setters. */ |
4542 | | true, /* isInfallible. False in setters. */ |
4543 | | false, /* isMovable. Not relevant for setters. */ |
4544 | | false, /* isEliminatable. Not relevant for setters. */ |
4545 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
4546 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
4547 | | false, /* isTypedMethod. Only relevant for methods. */ |
4548 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
4549 | | }; |
4550 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
4551 | | static_assert(0 < 1, "There is no slot for us"); |
4552 | | static const JSJitInfo y_setterinfo = { |
4553 | | { (JSJitGetterOp)set_y }, |
4554 | | { prototypes::id::SVGPathSegCurvetoQuadraticAbs }, |
4555 | | { PrototypeTraits<prototypes::id::SVGPathSegCurvetoQuadraticAbs>::Depth }, |
4556 | | JSJitInfo::Setter, |
4557 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
4558 | | JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */ |
4559 | | false, /* isInfallible. False in setters. */ |
4560 | | false, /* isMovable. Not relevant for setters. */ |
4561 | | false, /* isEliminatable. Not relevant for setters. */ |
4562 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
4563 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
4564 | | false, /* isTypedMethod. Only relevant for methods. */ |
4565 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
4566 | | }; |
4567 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
4568 | | static_assert(0 < 1, "There is no slot for us"); |
4569 | | |
4570 | | MOZ_CAN_RUN_SCRIPT static bool |
4571 | | get_x1(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::DOMSVGPathSegCurvetoQuadraticAbs* self, JSJitGetterCallArgs args) |
4572 | 0 | { |
4573 | 0 | AUTO_PROFILER_LABEL_FAST("get SVGPathSegCurvetoQuadraticAbs.x1", DOM, cx); |
4574 | 0 |
|
4575 | 0 | float result(self->X1()); |
4576 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
4577 | 0 | args.rval().set(JS_NumberValue(double(result))); |
4578 | 0 | return true; |
4579 | 0 | } |
4580 | | |
4581 | | MOZ_CAN_RUN_SCRIPT static bool |
4582 | | set_x1(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::DOMSVGPathSegCurvetoQuadraticAbs* self, JSJitSetterCallArgs args) |
4583 | 0 | { |
4584 | 0 | AUTO_PROFILER_LABEL_FAST("set SVGPathSegCurvetoQuadraticAbs.x1", DOM, cx); |
4585 | 0 |
|
4586 | 0 | float arg0; |
4587 | 0 | if (!ValueToPrimitive<float, eDefault>(cx, args[0], &arg0)) { |
4588 | 0 | return false; |
4589 | 0 | } else if (!mozilla::IsFinite(arg0)) { |
4590 | 0 | ThrowErrorMessage(cx, MSG_NOT_FINITE, "Value being assigned to SVGPathSegCurvetoQuadraticAbs.x1"); |
4591 | 0 | return false; |
4592 | 0 | } |
4593 | 0 | FastErrorResult rv; |
4594 | 0 | self->SetX1(arg0, rv); |
4595 | 0 | if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) { |
4596 | 0 | return false; |
4597 | 0 | } |
4598 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
4599 | 0 |
|
4600 | 0 | return true; |
4601 | 0 | } |
4602 | | |
4603 | | static const JSJitInfo x1_getterinfo = { |
4604 | | { (JSJitGetterOp)get_x1 }, |
4605 | | { prototypes::id::SVGPathSegCurvetoQuadraticAbs }, |
4606 | | { PrototypeTraits<prototypes::id::SVGPathSegCurvetoQuadraticAbs>::Depth }, |
4607 | | JSJitInfo::Getter, |
4608 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
4609 | | JSVAL_TYPE_DOUBLE, /* returnType. Not relevant for setters. */ |
4610 | | true, /* isInfallible. False in setters. */ |
4611 | | false, /* isMovable. Not relevant for setters. */ |
4612 | | false, /* isEliminatable. Not relevant for setters. */ |
4613 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
4614 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
4615 | | false, /* isTypedMethod. Only relevant for methods. */ |
4616 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
4617 | | }; |
4618 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
4619 | | static_assert(0 < 1, "There is no slot for us"); |
4620 | | static const JSJitInfo x1_setterinfo = { |
4621 | | { (JSJitGetterOp)set_x1 }, |
4622 | | { prototypes::id::SVGPathSegCurvetoQuadraticAbs }, |
4623 | | { PrototypeTraits<prototypes::id::SVGPathSegCurvetoQuadraticAbs>::Depth }, |
4624 | | JSJitInfo::Setter, |
4625 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
4626 | | JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */ |
4627 | | false, /* isInfallible. False in setters. */ |
4628 | | false, /* isMovable. Not relevant for setters. */ |
4629 | | false, /* isEliminatable. Not relevant for setters. */ |
4630 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
4631 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
4632 | | false, /* isTypedMethod. Only relevant for methods. */ |
4633 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
4634 | | }; |
4635 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
4636 | | static_assert(0 < 1, "There is no slot for us"); |
4637 | | |
4638 | | MOZ_CAN_RUN_SCRIPT static bool |
4639 | | get_y1(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::DOMSVGPathSegCurvetoQuadraticAbs* self, JSJitGetterCallArgs args) |
4640 | 0 | { |
4641 | 0 | AUTO_PROFILER_LABEL_FAST("get SVGPathSegCurvetoQuadraticAbs.y1", DOM, cx); |
4642 | 0 |
|
4643 | 0 | float result(self->Y1()); |
4644 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
4645 | 0 | args.rval().set(JS_NumberValue(double(result))); |
4646 | 0 | return true; |
4647 | 0 | } |
4648 | | |
4649 | | MOZ_CAN_RUN_SCRIPT static bool |
4650 | | set_y1(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::DOMSVGPathSegCurvetoQuadraticAbs* self, JSJitSetterCallArgs args) |
4651 | 0 | { |
4652 | 0 | AUTO_PROFILER_LABEL_FAST("set SVGPathSegCurvetoQuadraticAbs.y1", DOM, cx); |
4653 | 0 |
|
4654 | 0 | float arg0; |
4655 | 0 | if (!ValueToPrimitive<float, eDefault>(cx, args[0], &arg0)) { |
4656 | 0 | return false; |
4657 | 0 | } else if (!mozilla::IsFinite(arg0)) { |
4658 | 0 | ThrowErrorMessage(cx, MSG_NOT_FINITE, "Value being assigned to SVGPathSegCurvetoQuadraticAbs.y1"); |
4659 | 0 | return false; |
4660 | 0 | } |
4661 | 0 | FastErrorResult rv; |
4662 | 0 | self->SetY1(arg0, rv); |
4663 | 0 | if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) { |
4664 | 0 | return false; |
4665 | 0 | } |
4666 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
4667 | 0 |
|
4668 | 0 | return true; |
4669 | 0 | } |
4670 | | |
4671 | | static const JSJitInfo y1_getterinfo = { |
4672 | | { (JSJitGetterOp)get_y1 }, |
4673 | | { prototypes::id::SVGPathSegCurvetoQuadraticAbs }, |
4674 | | { PrototypeTraits<prototypes::id::SVGPathSegCurvetoQuadraticAbs>::Depth }, |
4675 | | JSJitInfo::Getter, |
4676 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
4677 | | JSVAL_TYPE_DOUBLE, /* returnType. Not relevant for setters. */ |
4678 | | true, /* isInfallible. False in setters. */ |
4679 | | false, /* isMovable. Not relevant for setters. */ |
4680 | | false, /* isEliminatable. Not relevant for setters. */ |
4681 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
4682 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
4683 | | false, /* isTypedMethod. Only relevant for methods. */ |
4684 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
4685 | | }; |
4686 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
4687 | | static_assert(0 < 1, "There is no slot for us"); |
4688 | | static const JSJitInfo y1_setterinfo = { |
4689 | | { (JSJitGetterOp)set_y1 }, |
4690 | | { prototypes::id::SVGPathSegCurvetoQuadraticAbs }, |
4691 | | { PrototypeTraits<prototypes::id::SVGPathSegCurvetoQuadraticAbs>::Depth }, |
4692 | | JSJitInfo::Setter, |
4693 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
4694 | | JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */ |
4695 | | false, /* isInfallible. False in setters. */ |
4696 | | false, /* isMovable. Not relevant for setters. */ |
4697 | | false, /* isEliminatable. Not relevant for setters. */ |
4698 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
4699 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
4700 | | false, /* isTypedMethod. Only relevant for methods. */ |
4701 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
4702 | | }; |
4703 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
4704 | | static_assert(0 < 1, "There is no slot for us"); |
4705 | | |
4706 | | static bool |
4707 | | _addProperty(JSContext* cx, JS::Handle<JSObject*> obj, JS::Handle<jsid> id, JS::Handle<JS::Value> val) |
4708 | 0 | { |
4709 | 0 | mozilla::DOMSVGPathSegCurvetoQuadraticAbs* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::DOMSVGPathSegCurvetoQuadraticAbs>(obj); |
4710 | 0 | // We don't want to preserve if we don't have a wrapper, and we |
4711 | 0 | // obviously can't preserve if we're not initialized. |
4712 | 0 | if (self && self->GetWrapperPreserveColor()) { |
4713 | 0 | PreserveWrapper(self); |
4714 | 0 | } |
4715 | 0 | return true; |
4716 | 0 | } |
4717 | | |
4718 | | static void |
4719 | | _finalize(js::FreeOp* fop, JSObject* obj) |
4720 | 0 | { |
4721 | 0 | mozilla::DOMSVGPathSegCurvetoQuadraticAbs* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::DOMSVGPathSegCurvetoQuadraticAbs>(obj); |
4722 | 0 | if (self) { |
4723 | 0 | ClearWrapper(self, self, obj); |
4724 | 0 | AddForDeferredFinalization<mozilla::DOMSVGPathSegCurvetoQuadraticAbs>(self); |
4725 | 0 | } |
4726 | 0 | } |
4727 | | |
4728 | | static size_t |
4729 | | _objectMoved(JSObject* obj, JSObject* old) |
4730 | 0 | { |
4731 | 0 | mozilla::DOMSVGPathSegCurvetoQuadraticAbs* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::DOMSVGPathSegCurvetoQuadraticAbs>(obj); |
4732 | 0 | if (self) { |
4733 | 0 | UpdateWrapper(self, self, obj, old); |
4734 | 0 | } |
4735 | 0 |
|
4736 | 0 | return 0; |
4737 | 0 | } |
4738 | | |
4739 | | // We deliberately use brace-elision to make Visual Studio produce better initalization code. |
4740 | | #if defined(__clang__) |
4741 | | #pragma clang diagnostic push |
4742 | | #pragma clang diagnostic ignored "-Wmissing-braces" |
4743 | | #endif |
4744 | | static const JSPropertySpec sAttributes_specs[] = { |
4745 | | { "x", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &x_getterinfo, GenericSetter<NormalThisPolicy>, &x_setterinfo }, |
4746 | | { "y", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &y_getterinfo, GenericSetter<NormalThisPolicy>, &y_setterinfo }, |
4747 | | { "x1", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &x1_getterinfo, GenericSetter<NormalThisPolicy>, &x1_setterinfo }, |
4748 | | { "y1", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &y1_getterinfo, GenericSetter<NormalThisPolicy>, &y1_setterinfo }, |
4749 | | { nullptr, 0, nullptr, nullptr, nullptr, nullptr } |
4750 | | }; |
4751 | | #if defined(__clang__) |
4752 | | #pragma clang diagnostic pop |
4753 | | #endif |
4754 | | |
4755 | | |
4756 | | static const Prefable<const JSPropertySpec> sAttributes[] = { |
4757 | | { nullptr, &sAttributes_specs[0] }, |
4758 | | { nullptr, nullptr } |
4759 | | }; |
4760 | | |
4761 | | static_assert(1 <= 1ull << NUM_BITS_PROPERTY_INFO_PREF_INDEX, |
4762 | | "We have a prefable index that is >= (1 << NUM_BITS_PROPERTY_INFO_PREF_INDEX)"); |
4763 | | static_assert(4 <= 1ull << NUM_BITS_PROPERTY_INFO_SPEC_INDEX, |
4764 | | "We have a spec index that is >= (1 << NUM_BITS_PROPERTY_INFO_SPEC_INDEX)"); |
4765 | | |
4766 | | |
4767 | | static uint16_t sNativeProperties_sortedPropertyIndices[4]; |
4768 | | static PropertyInfo sNativeProperties_propertyInfos[4]; |
4769 | | |
4770 | | static const NativePropertiesN<1> sNativeProperties = { |
4771 | | false, 0, |
4772 | | false, 0, |
4773 | | false, 0, |
4774 | | true, 0 /* sAttributes */, |
4775 | | false, 0, |
4776 | | false, 0, |
4777 | | false, 0, |
4778 | | -1, |
4779 | | 4, |
4780 | | sNativeProperties_sortedPropertyIndices, |
4781 | | { |
4782 | | { sAttributes, &sNativeProperties_propertyInfos[0] } |
4783 | | } |
4784 | | }; |
4785 | | static_assert(4 < 1ull << CHAR_BIT * sizeof(sNativeProperties.propertyInfoCount), |
4786 | | "We have a property info count that is oversized"); |
4787 | | |
4788 | | static const DOMIfaceAndProtoJSClass sPrototypeClass = { |
4789 | | { |
4790 | | "SVGPathSegCurvetoQuadraticAbsPrototype", |
4791 | | JSCLASS_IS_DOMIFACEANDPROTOJSCLASS | JSCLASS_HAS_RESERVED_SLOTS(DOM_INTERFACE_PROTO_SLOTS_BASE), |
4792 | | JS_NULL_CLASS_OPS, |
4793 | | JS_NULL_CLASS_SPEC, |
4794 | | JS_NULL_CLASS_EXT, |
4795 | | JS_NULL_OBJECT_OPS |
4796 | | }, |
4797 | | eInterfacePrototype, |
4798 | | false, |
4799 | | prototypes::id::SVGPathSegCurvetoQuadraticAbs, |
4800 | | PrototypeTraits<prototypes::id::SVGPathSegCurvetoQuadraticAbs>::Depth, |
4801 | | sNativePropertyHooks, |
4802 | | "[object SVGPathSegCurvetoQuadraticAbsPrototype]", |
4803 | | SVGPathSeg_Binding::GetProtoObject |
4804 | | }; |
4805 | | |
4806 | | static const js::ClassOps sClassOps = { |
4807 | | _addProperty, /* addProperty */ |
4808 | | nullptr, /* delProperty */ |
4809 | | nullptr, /* enumerate */ |
4810 | | nullptr, /* newEnumerate */ |
4811 | | nullptr, /* resolve */ |
4812 | | nullptr, /* mayResolve */ |
4813 | | _finalize, /* finalize */ |
4814 | | nullptr, /* call */ |
4815 | | nullptr, /* hasInstance */ |
4816 | | nullptr, /* construct */ |
4817 | | nullptr, /* trace */ |
4818 | | }; |
4819 | | |
4820 | | static const js::ClassExtension sClassExtension = { |
4821 | | nullptr, /* weakmapKeyDelegateOp */ |
4822 | | _objectMoved /* objectMovedOp */ |
4823 | | }; |
4824 | | |
4825 | | static const DOMJSClass sClass = { |
4826 | | { "SVGPathSegCurvetoQuadraticAbs", |
4827 | | JSCLASS_IS_DOMJSCLASS | JSCLASS_FOREGROUND_FINALIZE | JSCLASS_HAS_RESERVED_SLOTS(1), |
4828 | | &sClassOps, |
4829 | | JS_NULL_CLASS_SPEC, |
4830 | | &sClassExtension, |
4831 | | JS_NULL_OBJECT_OPS |
4832 | | }, |
4833 | | { prototypes::id::SVGPathSeg, prototypes::id::SVGPathSegCurvetoQuadraticAbs, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count }, |
4834 | | IsBaseOf<nsISupports, mozilla::DOMSVGPathSegCurvetoQuadraticAbs >::value, |
4835 | | sNativePropertyHooks, |
4836 | | FindAssociatedGlobalForNative<mozilla::DOMSVGPathSegCurvetoQuadraticAbs>::Get, |
4837 | | GetProtoObjectHandle, |
4838 | | GetCCParticipant<mozilla::DOMSVGPathSegCurvetoQuadraticAbs>::Get() |
4839 | | }; |
4840 | | static_assert(1 == DOM_INSTANCE_RESERVED_SLOTS, |
4841 | | "Must have the right minimal number of reserved slots."); |
4842 | | static_assert(1 >= 1, |
4843 | | "Must have enough reserved slots."); |
4844 | | |
4845 | | const JSClass* |
4846 | | GetJSClass() |
4847 | 0 | { |
4848 | 0 | return sClass.ToJSClass(); |
4849 | 0 | } |
4850 | | |
4851 | | bool |
4852 | | Wrap(JSContext* aCx, mozilla::DOMSVGPathSegCurvetoQuadraticAbs* aObject, nsWrapperCache* aCache, JS::Handle<JSObject*> aGivenProto, JS::MutableHandle<JSObject*> aReflector) |
4853 | 0 | { |
4854 | 0 | static_assert(!IsBaseOf<NonRefcountedDOMObject, mozilla::DOMSVGPathSegCurvetoQuadraticAbs>::value, |
4855 | 0 | "Shouldn't have wrappercached things that are not refcounted."); |
4856 | 0 | MOZ_ASSERT(static_cast<mozilla::DOMSVGPathSegCurvetoQuadraticAbs*>(aObject) == |
4857 | 0 | reinterpret_cast<mozilla::DOMSVGPathSegCurvetoQuadraticAbs*>(aObject), |
4858 | 0 | "Multiple inheritance for mozilla::DOMSVGPathSegCurvetoQuadraticAbs is broken."); |
4859 | 0 | MOZ_ASSERT(static_cast<mozilla::DOMSVGPathSeg*>(aObject) == |
4860 | 0 | reinterpret_cast<mozilla::DOMSVGPathSeg*>(aObject), |
4861 | 0 | "Multiple inheritance for mozilla::DOMSVGPathSeg is broken."); |
4862 | 0 | MOZ_ASSERT(ToSupportsIsCorrect(aObject)); |
4863 | 0 | MOZ_ASSERT_IF(aGivenProto, js::IsObjectInContextCompartment(aGivenProto, aCx)); |
4864 | 0 | MOZ_ASSERT(!aCache->GetWrapper(), |
4865 | 0 | "You should probably not be using Wrap() directly; use " |
4866 | 0 | "GetOrCreateDOMReflector instead"); |
4867 | 0 |
|
4868 | 0 | MOZ_ASSERT(ToSupportsIsOnPrimaryInheritanceChain(aObject, aCache), |
4869 | 0 | "nsISupports must be on our primary inheritance chain"); |
4870 | 0 |
|
4871 | 0 | JS::Rooted<JSObject*> global(aCx, FindAssociatedGlobal(aCx, aObject->GetParentObject())); |
4872 | 0 | if (!global) { |
4873 | 0 | return false; |
4874 | 0 | } |
4875 | 0 | MOZ_ASSERT(JS_IsGlobalObject(global)); |
4876 | 0 | MOZ_ASSERT(JS::ObjectIsNotGray(global)); |
4877 | 0 |
|
4878 | 0 | // That might have ended up wrapping us already, due to the wonders |
4879 | 0 | // of XBL. Check for that, and bail out as needed. |
4880 | 0 | aReflector.set(aCache->GetWrapper()); |
4881 | 0 | if (aReflector) { |
4882 | | #ifdef DEBUG |
4883 | | AssertReflectorHasGivenProto(aCx, aReflector, aGivenProto); |
4884 | | #endif // DEBUG |
4885 | | return true; |
4886 | 0 | } |
4887 | 0 |
|
4888 | 0 | JSAutoRealm ar(aCx, global); |
4889 | 0 | JS::Handle<JSObject*> canonicalProto = GetProtoObjectHandle(aCx); |
4890 | 0 | if (!canonicalProto) { |
4891 | 0 | return false; |
4892 | 0 | } |
4893 | 0 | JS::Rooted<JSObject*> proto(aCx); |
4894 | 0 | if (aGivenProto) { |
4895 | 0 | proto = aGivenProto; |
4896 | 0 | // Unfortunately, while aGivenProto was in the compartment of aCx |
4897 | 0 | // coming in, we changed compartments to that of "parent" so may need |
4898 | 0 | // to wrap the proto here. |
4899 | 0 | if (js::GetContextCompartment(aCx) != js::GetObjectCompartment(proto)) { |
4900 | 0 | if (!JS_WrapObject(aCx, &proto)) { |
4901 | 0 | return false; |
4902 | 0 | } |
4903 | 0 | } |
4904 | 0 | } else { |
4905 | 0 | proto = canonicalProto; |
4906 | 0 | } |
4907 | 0 |
|
4908 | 0 | BindingJSObjectCreator<mozilla::DOMSVGPathSegCurvetoQuadraticAbs> creator(aCx); |
4909 | 0 | creator.CreateObject(aCx, sClass.ToJSClass(), proto, aObject, aReflector); |
4910 | 0 | if (!aReflector) { |
4911 | 0 | return false; |
4912 | 0 | } |
4913 | 0 | |
4914 | 0 | aCache->SetWrapper(aReflector); |
4915 | 0 | creator.InitializationSucceeded(); |
4916 | 0 |
|
4917 | 0 | MOZ_ASSERT(aCache->GetWrapperPreserveColor() && |
4918 | 0 | aCache->GetWrapperPreserveColor() == aReflector); |
4919 | 0 | // If proto != canonicalProto, we have to preserve our wrapper; |
4920 | 0 | // otherwise we won't be able to properly recreate it later, since |
4921 | 0 | // we won't know what proto to use. Note that we don't check |
4922 | 0 | // aGivenProto here, since it's entirely possible (and even |
4923 | 0 | // somewhat common) to have a non-null aGivenProto which is the |
4924 | 0 | // same as canonicalProto. |
4925 | 0 | if (proto != canonicalProto) { |
4926 | 0 | PreserveWrapper(aObject); |
4927 | 0 | } |
4928 | 0 |
|
4929 | 0 | return true; |
4930 | 0 | } |
4931 | | |
4932 | | const NativePropertyHooks sNativePropertyHooks[] = { { |
4933 | | nullptr, |
4934 | | nullptr, |
4935 | | nullptr, |
4936 | | { sNativeProperties.Upcast(), nullptr }, |
4937 | | prototypes::id::SVGPathSegCurvetoQuadraticAbs, |
4938 | | constructors::id::_ID_Count, |
4939 | | SVGPathSeg_Binding::sNativePropertyHooks, |
4940 | | &DefaultXrayExpandoObjectClass |
4941 | | } }; |
4942 | | |
4943 | | void |
4944 | | CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, bool aDefineOnGlobal) |
4945 | 0 | { |
4946 | 0 | JS::Handle<JSObject*> parentProto(SVGPathSeg_Binding::GetProtoObjectHandle(aCx)); |
4947 | 0 | if (!parentProto) { |
4948 | 0 | return; |
4949 | 0 | } |
4950 | 0 | |
4951 | 0 | static bool sIdsInited = false; |
4952 | 0 | if (!sIdsInited && NS_IsMainThread()) { |
4953 | 0 | if (!InitIds(aCx, sNativeProperties.Upcast())) { |
4954 | 0 | return; |
4955 | 0 | } |
4956 | 0 | sIdsInited = true; |
4957 | 0 | } |
4958 | 0 |
|
4959 | 0 | JS::Heap<JSObject*>* protoCache = &aProtoAndIfaceCache.EntrySlotOrCreate(prototypes::id::SVGPathSegCurvetoQuadraticAbs); |
4960 | 0 | JS::Heap<JSObject*>* interfaceCache = nullptr; |
4961 | 0 | dom::CreateInterfaceObjects(aCx, aGlobal, parentProto, |
4962 | 0 | &sPrototypeClass.mBase, protoCache, |
4963 | 0 | nullptr, |
4964 | 0 | nullptr, nullptr, 0, nullptr, |
4965 | 0 | interfaceCache, |
4966 | 0 | sNativeProperties.Upcast(), |
4967 | 0 | nullptr, |
4968 | 0 | nullptr, aDefineOnGlobal, |
4969 | 0 | nullptr, |
4970 | 0 | false); |
4971 | 0 | } |
4972 | | |
4973 | | } // namespace SVGPathSegCurvetoQuadraticAbs_Binding |
4974 | | |
4975 | | |
4976 | | |
4977 | | namespace SVGPathSegCurvetoQuadraticRel_Binding { |
4978 | | |
4979 | | static_assert(IsRefcounted<NativeType>::value == IsRefcounted<SVGPathSeg_Binding::NativeType>::value, |
4980 | | "Can't inherit from an interface with a different ownership model."); |
4981 | | |
4982 | | MOZ_CAN_RUN_SCRIPT static bool |
4983 | | get_x(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::DOMSVGPathSegCurvetoQuadraticRel* self, JSJitGetterCallArgs args) |
4984 | 0 | { |
4985 | 0 | AUTO_PROFILER_LABEL_FAST("get SVGPathSegCurvetoQuadraticRel.x", DOM, cx); |
4986 | 0 |
|
4987 | 0 | float result(self->X()); |
4988 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
4989 | 0 | args.rval().set(JS_NumberValue(double(result))); |
4990 | 0 | return true; |
4991 | 0 | } |
4992 | | |
4993 | | MOZ_CAN_RUN_SCRIPT static bool |
4994 | | set_x(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::DOMSVGPathSegCurvetoQuadraticRel* self, JSJitSetterCallArgs args) |
4995 | 0 | { |
4996 | 0 | AUTO_PROFILER_LABEL_FAST("set SVGPathSegCurvetoQuadraticRel.x", DOM, cx); |
4997 | 0 |
|
4998 | 0 | float arg0; |
4999 | 0 | if (!ValueToPrimitive<float, eDefault>(cx, args[0], &arg0)) { |
5000 | 0 | return false; |
5001 | 0 | } else if (!mozilla::IsFinite(arg0)) { |
5002 | 0 | ThrowErrorMessage(cx, MSG_NOT_FINITE, "Value being assigned to SVGPathSegCurvetoQuadraticRel.x"); |
5003 | 0 | return false; |
5004 | 0 | } |
5005 | 0 | FastErrorResult rv; |
5006 | 0 | self->SetX(arg0, rv); |
5007 | 0 | if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) { |
5008 | 0 | return false; |
5009 | 0 | } |
5010 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
5011 | 0 |
|
5012 | 0 | return true; |
5013 | 0 | } |
5014 | | |
5015 | | static const JSJitInfo x_getterinfo = { |
5016 | | { (JSJitGetterOp)get_x }, |
5017 | | { prototypes::id::SVGPathSegCurvetoQuadraticRel }, |
5018 | | { PrototypeTraits<prototypes::id::SVGPathSegCurvetoQuadraticRel>::Depth }, |
5019 | | JSJitInfo::Getter, |
5020 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
5021 | | JSVAL_TYPE_DOUBLE, /* returnType. Not relevant for setters. */ |
5022 | | true, /* isInfallible. False in setters. */ |
5023 | | false, /* isMovable. Not relevant for setters. */ |
5024 | | false, /* isEliminatable. Not relevant for setters. */ |
5025 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
5026 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
5027 | | false, /* isTypedMethod. Only relevant for methods. */ |
5028 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
5029 | | }; |
5030 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
5031 | | static_assert(0 < 1, "There is no slot for us"); |
5032 | | static const JSJitInfo x_setterinfo = { |
5033 | | { (JSJitGetterOp)set_x }, |
5034 | | { prototypes::id::SVGPathSegCurvetoQuadraticRel }, |
5035 | | { PrototypeTraits<prototypes::id::SVGPathSegCurvetoQuadraticRel>::Depth }, |
5036 | | JSJitInfo::Setter, |
5037 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
5038 | | JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */ |
5039 | | false, /* isInfallible. False in setters. */ |
5040 | | false, /* isMovable. Not relevant for setters. */ |
5041 | | false, /* isEliminatable. Not relevant for setters. */ |
5042 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
5043 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
5044 | | false, /* isTypedMethod. Only relevant for methods. */ |
5045 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
5046 | | }; |
5047 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
5048 | | static_assert(0 < 1, "There is no slot for us"); |
5049 | | |
5050 | | MOZ_CAN_RUN_SCRIPT static bool |
5051 | | get_y(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::DOMSVGPathSegCurvetoQuadraticRel* self, JSJitGetterCallArgs args) |
5052 | 0 | { |
5053 | 0 | AUTO_PROFILER_LABEL_FAST("get SVGPathSegCurvetoQuadraticRel.y", DOM, cx); |
5054 | 0 |
|
5055 | 0 | float result(self->Y()); |
5056 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
5057 | 0 | args.rval().set(JS_NumberValue(double(result))); |
5058 | 0 | return true; |
5059 | 0 | } |
5060 | | |
5061 | | MOZ_CAN_RUN_SCRIPT static bool |
5062 | | set_y(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::DOMSVGPathSegCurvetoQuadraticRel* self, JSJitSetterCallArgs args) |
5063 | 0 | { |
5064 | 0 | AUTO_PROFILER_LABEL_FAST("set SVGPathSegCurvetoQuadraticRel.y", DOM, cx); |
5065 | 0 |
|
5066 | 0 | float arg0; |
5067 | 0 | if (!ValueToPrimitive<float, eDefault>(cx, args[0], &arg0)) { |
5068 | 0 | return false; |
5069 | 0 | } else if (!mozilla::IsFinite(arg0)) { |
5070 | 0 | ThrowErrorMessage(cx, MSG_NOT_FINITE, "Value being assigned to SVGPathSegCurvetoQuadraticRel.y"); |
5071 | 0 | return false; |
5072 | 0 | } |
5073 | 0 | FastErrorResult rv; |
5074 | 0 | self->SetY(arg0, rv); |
5075 | 0 | if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) { |
5076 | 0 | return false; |
5077 | 0 | } |
5078 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
5079 | 0 |
|
5080 | 0 | return true; |
5081 | 0 | } |
5082 | | |
5083 | | static const JSJitInfo y_getterinfo = { |
5084 | | { (JSJitGetterOp)get_y }, |
5085 | | { prototypes::id::SVGPathSegCurvetoQuadraticRel }, |
5086 | | { PrototypeTraits<prototypes::id::SVGPathSegCurvetoQuadraticRel>::Depth }, |
5087 | | JSJitInfo::Getter, |
5088 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
5089 | | JSVAL_TYPE_DOUBLE, /* returnType. Not relevant for setters. */ |
5090 | | true, /* isInfallible. False in setters. */ |
5091 | | false, /* isMovable. Not relevant for setters. */ |
5092 | | false, /* isEliminatable. Not relevant for setters. */ |
5093 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
5094 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
5095 | | false, /* isTypedMethod. Only relevant for methods. */ |
5096 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
5097 | | }; |
5098 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
5099 | | static_assert(0 < 1, "There is no slot for us"); |
5100 | | static const JSJitInfo y_setterinfo = { |
5101 | | { (JSJitGetterOp)set_y }, |
5102 | | { prototypes::id::SVGPathSegCurvetoQuadraticRel }, |
5103 | | { PrototypeTraits<prototypes::id::SVGPathSegCurvetoQuadraticRel>::Depth }, |
5104 | | JSJitInfo::Setter, |
5105 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
5106 | | JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */ |
5107 | | false, /* isInfallible. False in setters. */ |
5108 | | false, /* isMovable. Not relevant for setters. */ |
5109 | | false, /* isEliminatable. Not relevant for setters. */ |
5110 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
5111 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
5112 | | false, /* isTypedMethod. Only relevant for methods. */ |
5113 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
5114 | | }; |
5115 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
5116 | | static_assert(0 < 1, "There is no slot for us"); |
5117 | | |
5118 | | MOZ_CAN_RUN_SCRIPT static bool |
5119 | | get_x1(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::DOMSVGPathSegCurvetoQuadraticRel* self, JSJitGetterCallArgs args) |
5120 | 0 | { |
5121 | 0 | AUTO_PROFILER_LABEL_FAST("get SVGPathSegCurvetoQuadraticRel.x1", DOM, cx); |
5122 | 0 |
|
5123 | 0 | float result(self->X1()); |
5124 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
5125 | 0 | args.rval().set(JS_NumberValue(double(result))); |
5126 | 0 | return true; |
5127 | 0 | } |
5128 | | |
5129 | | MOZ_CAN_RUN_SCRIPT static bool |
5130 | | set_x1(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::DOMSVGPathSegCurvetoQuadraticRel* self, JSJitSetterCallArgs args) |
5131 | 0 | { |
5132 | 0 | AUTO_PROFILER_LABEL_FAST("set SVGPathSegCurvetoQuadraticRel.x1", DOM, cx); |
5133 | 0 |
|
5134 | 0 | float arg0; |
5135 | 0 | if (!ValueToPrimitive<float, eDefault>(cx, args[0], &arg0)) { |
5136 | 0 | return false; |
5137 | 0 | } else if (!mozilla::IsFinite(arg0)) { |
5138 | 0 | ThrowErrorMessage(cx, MSG_NOT_FINITE, "Value being assigned to SVGPathSegCurvetoQuadraticRel.x1"); |
5139 | 0 | return false; |
5140 | 0 | } |
5141 | 0 | FastErrorResult rv; |
5142 | 0 | self->SetX1(arg0, rv); |
5143 | 0 | if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) { |
5144 | 0 | return false; |
5145 | 0 | } |
5146 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
5147 | 0 |
|
5148 | 0 | return true; |
5149 | 0 | } |
5150 | | |
5151 | | static const JSJitInfo x1_getterinfo = { |
5152 | | { (JSJitGetterOp)get_x1 }, |
5153 | | { prototypes::id::SVGPathSegCurvetoQuadraticRel }, |
5154 | | { PrototypeTraits<prototypes::id::SVGPathSegCurvetoQuadraticRel>::Depth }, |
5155 | | JSJitInfo::Getter, |
5156 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
5157 | | JSVAL_TYPE_DOUBLE, /* returnType. Not relevant for setters. */ |
5158 | | true, /* isInfallible. False in setters. */ |
5159 | | false, /* isMovable. Not relevant for setters. */ |
5160 | | false, /* isEliminatable. Not relevant for setters. */ |
5161 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
5162 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
5163 | | false, /* isTypedMethod. Only relevant for methods. */ |
5164 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
5165 | | }; |
5166 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
5167 | | static_assert(0 < 1, "There is no slot for us"); |
5168 | | static const JSJitInfo x1_setterinfo = { |
5169 | | { (JSJitGetterOp)set_x1 }, |
5170 | | { prototypes::id::SVGPathSegCurvetoQuadraticRel }, |
5171 | | { PrototypeTraits<prototypes::id::SVGPathSegCurvetoQuadraticRel>::Depth }, |
5172 | | JSJitInfo::Setter, |
5173 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
5174 | | JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */ |
5175 | | false, /* isInfallible. False in setters. */ |
5176 | | false, /* isMovable. Not relevant for setters. */ |
5177 | | false, /* isEliminatable. Not relevant for setters. */ |
5178 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
5179 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
5180 | | false, /* isTypedMethod. Only relevant for methods. */ |
5181 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
5182 | | }; |
5183 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
5184 | | static_assert(0 < 1, "There is no slot for us"); |
5185 | | |
5186 | | MOZ_CAN_RUN_SCRIPT static bool |
5187 | | get_y1(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::DOMSVGPathSegCurvetoQuadraticRel* self, JSJitGetterCallArgs args) |
5188 | 0 | { |
5189 | 0 | AUTO_PROFILER_LABEL_FAST("get SVGPathSegCurvetoQuadraticRel.y1", DOM, cx); |
5190 | 0 |
|
5191 | 0 | float result(self->Y1()); |
5192 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
5193 | 0 | args.rval().set(JS_NumberValue(double(result))); |
5194 | 0 | return true; |
5195 | 0 | } |
5196 | | |
5197 | | MOZ_CAN_RUN_SCRIPT static bool |
5198 | | set_y1(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::DOMSVGPathSegCurvetoQuadraticRel* self, JSJitSetterCallArgs args) |
5199 | 0 | { |
5200 | 0 | AUTO_PROFILER_LABEL_FAST("set SVGPathSegCurvetoQuadraticRel.y1", DOM, cx); |
5201 | 0 |
|
5202 | 0 | float arg0; |
5203 | 0 | if (!ValueToPrimitive<float, eDefault>(cx, args[0], &arg0)) { |
5204 | 0 | return false; |
5205 | 0 | } else if (!mozilla::IsFinite(arg0)) { |
5206 | 0 | ThrowErrorMessage(cx, MSG_NOT_FINITE, "Value being assigned to SVGPathSegCurvetoQuadraticRel.y1"); |
5207 | 0 | return false; |
5208 | 0 | } |
5209 | 0 | FastErrorResult rv; |
5210 | 0 | self->SetY1(arg0, rv); |
5211 | 0 | if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) { |
5212 | 0 | return false; |
5213 | 0 | } |
5214 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
5215 | 0 |
|
5216 | 0 | return true; |
5217 | 0 | } |
5218 | | |
5219 | | static const JSJitInfo y1_getterinfo = { |
5220 | | { (JSJitGetterOp)get_y1 }, |
5221 | | { prototypes::id::SVGPathSegCurvetoQuadraticRel }, |
5222 | | { PrototypeTraits<prototypes::id::SVGPathSegCurvetoQuadraticRel>::Depth }, |
5223 | | JSJitInfo::Getter, |
5224 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
5225 | | JSVAL_TYPE_DOUBLE, /* returnType. Not relevant for setters. */ |
5226 | | true, /* isInfallible. False in setters. */ |
5227 | | false, /* isMovable. Not relevant for setters. */ |
5228 | | false, /* isEliminatable. Not relevant for setters. */ |
5229 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
5230 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
5231 | | false, /* isTypedMethod. Only relevant for methods. */ |
5232 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
5233 | | }; |
5234 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
5235 | | static_assert(0 < 1, "There is no slot for us"); |
5236 | | static const JSJitInfo y1_setterinfo = { |
5237 | | { (JSJitGetterOp)set_y1 }, |
5238 | | { prototypes::id::SVGPathSegCurvetoQuadraticRel }, |
5239 | | { PrototypeTraits<prototypes::id::SVGPathSegCurvetoQuadraticRel>::Depth }, |
5240 | | JSJitInfo::Setter, |
5241 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
5242 | | JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */ |
5243 | | false, /* isInfallible. False in setters. */ |
5244 | | false, /* isMovable. Not relevant for setters. */ |
5245 | | false, /* isEliminatable. Not relevant for setters. */ |
5246 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
5247 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
5248 | | false, /* isTypedMethod. Only relevant for methods. */ |
5249 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
5250 | | }; |
5251 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
5252 | | static_assert(0 < 1, "There is no slot for us"); |
5253 | | |
5254 | | static bool |
5255 | | _addProperty(JSContext* cx, JS::Handle<JSObject*> obj, JS::Handle<jsid> id, JS::Handle<JS::Value> val) |
5256 | 0 | { |
5257 | 0 | mozilla::DOMSVGPathSegCurvetoQuadraticRel* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::DOMSVGPathSegCurvetoQuadraticRel>(obj); |
5258 | 0 | // We don't want to preserve if we don't have a wrapper, and we |
5259 | 0 | // obviously can't preserve if we're not initialized. |
5260 | 0 | if (self && self->GetWrapperPreserveColor()) { |
5261 | 0 | PreserveWrapper(self); |
5262 | 0 | } |
5263 | 0 | return true; |
5264 | 0 | } |
5265 | | |
5266 | | static void |
5267 | | _finalize(js::FreeOp* fop, JSObject* obj) |
5268 | 0 | { |
5269 | 0 | mozilla::DOMSVGPathSegCurvetoQuadraticRel* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::DOMSVGPathSegCurvetoQuadraticRel>(obj); |
5270 | 0 | if (self) { |
5271 | 0 | ClearWrapper(self, self, obj); |
5272 | 0 | AddForDeferredFinalization<mozilla::DOMSVGPathSegCurvetoQuadraticRel>(self); |
5273 | 0 | } |
5274 | 0 | } |
5275 | | |
5276 | | static size_t |
5277 | | _objectMoved(JSObject* obj, JSObject* old) |
5278 | 0 | { |
5279 | 0 | mozilla::DOMSVGPathSegCurvetoQuadraticRel* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::DOMSVGPathSegCurvetoQuadraticRel>(obj); |
5280 | 0 | if (self) { |
5281 | 0 | UpdateWrapper(self, self, obj, old); |
5282 | 0 | } |
5283 | 0 |
|
5284 | 0 | return 0; |
5285 | 0 | } |
5286 | | |
5287 | | // We deliberately use brace-elision to make Visual Studio produce better initalization code. |
5288 | | #if defined(__clang__) |
5289 | | #pragma clang diagnostic push |
5290 | | #pragma clang diagnostic ignored "-Wmissing-braces" |
5291 | | #endif |
5292 | | static const JSPropertySpec sAttributes_specs[] = { |
5293 | | { "x", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &x_getterinfo, GenericSetter<NormalThisPolicy>, &x_setterinfo }, |
5294 | | { "y", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &y_getterinfo, GenericSetter<NormalThisPolicy>, &y_setterinfo }, |
5295 | | { "x1", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &x1_getterinfo, GenericSetter<NormalThisPolicy>, &x1_setterinfo }, |
5296 | | { "y1", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &y1_getterinfo, GenericSetter<NormalThisPolicy>, &y1_setterinfo }, |
5297 | | { nullptr, 0, nullptr, nullptr, nullptr, nullptr } |
5298 | | }; |
5299 | | #if defined(__clang__) |
5300 | | #pragma clang diagnostic pop |
5301 | | #endif |
5302 | | |
5303 | | |
5304 | | static const Prefable<const JSPropertySpec> sAttributes[] = { |
5305 | | { nullptr, &sAttributes_specs[0] }, |
5306 | | { nullptr, nullptr } |
5307 | | }; |
5308 | | |
5309 | | static_assert(1 <= 1ull << NUM_BITS_PROPERTY_INFO_PREF_INDEX, |
5310 | | "We have a prefable index that is >= (1 << NUM_BITS_PROPERTY_INFO_PREF_INDEX)"); |
5311 | | static_assert(4 <= 1ull << NUM_BITS_PROPERTY_INFO_SPEC_INDEX, |
5312 | | "We have a spec index that is >= (1 << NUM_BITS_PROPERTY_INFO_SPEC_INDEX)"); |
5313 | | |
5314 | | |
5315 | | static uint16_t sNativeProperties_sortedPropertyIndices[4]; |
5316 | | static PropertyInfo sNativeProperties_propertyInfos[4]; |
5317 | | |
5318 | | static const NativePropertiesN<1> sNativeProperties = { |
5319 | | false, 0, |
5320 | | false, 0, |
5321 | | false, 0, |
5322 | | true, 0 /* sAttributes */, |
5323 | | false, 0, |
5324 | | false, 0, |
5325 | | false, 0, |
5326 | | -1, |
5327 | | 4, |
5328 | | sNativeProperties_sortedPropertyIndices, |
5329 | | { |
5330 | | { sAttributes, &sNativeProperties_propertyInfos[0] } |
5331 | | } |
5332 | | }; |
5333 | | static_assert(4 < 1ull << CHAR_BIT * sizeof(sNativeProperties.propertyInfoCount), |
5334 | | "We have a property info count that is oversized"); |
5335 | | |
5336 | | static const DOMIfaceAndProtoJSClass sPrototypeClass = { |
5337 | | { |
5338 | | "SVGPathSegCurvetoQuadraticRelPrototype", |
5339 | | JSCLASS_IS_DOMIFACEANDPROTOJSCLASS | JSCLASS_HAS_RESERVED_SLOTS(DOM_INTERFACE_PROTO_SLOTS_BASE), |
5340 | | JS_NULL_CLASS_OPS, |
5341 | | JS_NULL_CLASS_SPEC, |
5342 | | JS_NULL_CLASS_EXT, |
5343 | | JS_NULL_OBJECT_OPS |
5344 | | }, |
5345 | | eInterfacePrototype, |
5346 | | false, |
5347 | | prototypes::id::SVGPathSegCurvetoQuadraticRel, |
5348 | | PrototypeTraits<prototypes::id::SVGPathSegCurvetoQuadraticRel>::Depth, |
5349 | | sNativePropertyHooks, |
5350 | | "[object SVGPathSegCurvetoQuadraticRelPrototype]", |
5351 | | SVGPathSeg_Binding::GetProtoObject |
5352 | | }; |
5353 | | |
5354 | | static const js::ClassOps sClassOps = { |
5355 | | _addProperty, /* addProperty */ |
5356 | | nullptr, /* delProperty */ |
5357 | | nullptr, /* enumerate */ |
5358 | | nullptr, /* newEnumerate */ |
5359 | | nullptr, /* resolve */ |
5360 | | nullptr, /* mayResolve */ |
5361 | | _finalize, /* finalize */ |
5362 | | nullptr, /* call */ |
5363 | | nullptr, /* hasInstance */ |
5364 | | nullptr, /* construct */ |
5365 | | nullptr, /* trace */ |
5366 | | }; |
5367 | | |
5368 | | static const js::ClassExtension sClassExtension = { |
5369 | | nullptr, /* weakmapKeyDelegateOp */ |
5370 | | _objectMoved /* objectMovedOp */ |
5371 | | }; |
5372 | | |
5373 | | static const DOMJSClass sClass = { |
5374 | | { "SVGPathSegCurvetoQuadraticRel", |
5375 | | JSCLASS_IS_DOMJSCLASS | JSCLASS_FOREGROUND_FINALIZE | JSCLASS_HAS_RESERVED_SLOTS(1), |
5376 | | &sClassOps, |
5377 | | JS_NULL_CLASS_SPEC, |
5378 | | &sClassExtension, |
5379 | | JS_NULL_OBJECT_OPS |
5380 | | }, |
5381 | | { prototypes::id::SVGPathSeg, prototypes::id::SVGPathSegCurvetoQuadraticRel, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count }, |
5382 | | IsBaseOf<nsISupports, mozilla::DOMSVGPathSegCurvetoQuadraticRel >::value, |
5383 | | sNativePropertyHooks, |
5384 | | FindAssociatedGlobalForNative<mozilla::DOMSVGPathSegCurvetoQuadraticRel>::Get, |
5385 | | GetProtoObjectHandle, |
5386 | | GetCCParticipant<mozilla::DOMSVGPathSegCurvetoQuadraticRel>::Get() |
5387 | | }; |
5388 | | static_assert(1 == DOM_INSTANCE_RESERVED_SLOTS, |
5389 | | "Must have the right minimal number of reserved slots."); |
5390 | | static_assert(1 >= 1, |
5391 | | "Must have enough reserved slots."); |
5392 | | |
5393 | | const JSClass* |
5394 | | GetJSClass() |
5395 | 0 | { |
5396 | 0 | return sClass.ToJSClass(); |
5397 | 0 | } |
5398 | | |
5399 | | bool |
5400 | | Wrap(JSContext* aCx, mozilla::DOMSVGPathSegCurvetoQuadraticRel* aObject, nsWrapperCache* aCache, JS::Handle<JSObject*> aGivenProto, JS::MutableHandle<JSObject*> aReflector) |
5401 | 0 | { |
5402 | 0 | static_assert(!IsBaseOf<NonRefcountedDOMObject, mozilla::DOMSVGPathSegCurvetoQuadraticRel>::value, |
5403 | 0 | "Shouldn't have wrappercached things that are not refcounted."); |
5404 | 0 | MOZ_ASSERT(static_cast<mozilla::DOMSVGPathSegCurvetoQuadraticRel*>(aObject) == |
5405 | 0 | reinterpret_cast<mozilla::DOMSVGPathSegCurvetoQuadraticRel*>(aObject), |
5406 | 0 | "Multiple inheritance for mozilla::DOMSVGPathSegCurvetoQuadraticRel is broken."); |
5407 | 0 | MOZ_ASSERT(static_cast<mozilla::DOMSVGPathSeg*>(aObject) == |
5408 | 0 | reinterpret_cast<mozilla::DOMSVGPathSeg*>(aObject), |
5409 | 0 | "Multiple inheritance for mozilla::DOMSVGPathSeg is broken."); |
5410 | 0 | MOZ_ASSERT(ToSupportsIsCorrect(aObject)); |
5411 | 0 | MOZ_ASSERT_IF(aGivenProto, js::IsObjectInContextCompartment(aGivenProto, aCx)); |
5412 | 0 | MOZ_ASSERT(!aCache->GetWrapper(), |
5413 | 0 | "You should probably not be using Wrap() directly; use " |
5414 | 0 | "GetOrCreateDOMReflector instead"); |
5415 | 0 |
|
5416 | 0 | MOZ_ASSERT(ToSupportsIsOnPrimaryInheritanceChain(aObject, aCache), |
5417 | 0 | "nsISupports must be on our primary inheritance chain"); |
5418 | 0 |
|
5419 | 0 | JS::Rooted<JSObject*> global(aCx, FindAssociatedGlobal(aCx, aObject->GetParentObject())); |
5420 | 0 | if (!global) { |
5421 | 0 | return false; |
5422 | 0 | } |
5423 | 0 | MOZ_ASSERT(JS_IsGlobalObject(global)); |
5424 | 0 | MOZ_ASSERT(JS::ObjectIsNotGray(global)); |
5425 | 0 |
|
5426 | 0 | // That might have ended up wrapping us already, due to the wonders |
5427 | 0 | // of XBL. Check for that, and bail out as needed. |
5428 | 0 | aReflector.set(aCache->GetWrapper()); |
5429 | 0 | if (aReflector) { |
5430 | | #ifdef DEBUG |
5431 | | AssertReflectorHasGivenProto(aCx, aReflector, aGivenProto); |
5432 | | #endif // DEBUG |
5433 | | return true; |
5434 | 0 | } |
5435 | 0 |
|
5436 | 0 | JSAutoRealm ar(aCx, global); |
5437 | 0 | JS::Handle<JSObject*> canonicalProto = GetProtoObjectHandle(aCx); |
5438 | 0 | if (!canonicalProto) { |
5439 | 0 | return false; |
5440 | 0 | } |
5441 | 0 | JS::Rooted<JSObject*> proto(aCx); |
5442 | 0 | if (aGivenProto) { |
5443 | 0 | proto = aGivenProto; |
5444 | 0 | // Unfortunately, while aGivenProto was in the compartment of aCx |
5445 | 0 | // coming in, we changed compartments to that of "parent" so may need |
5446 | 0 | // to wrap the proto here. |
5447 | 0 | if (js::GetContextCompartment(aCx) != js::GetObjectCompartment(proto)) { |
5448 | 0 | if (!JS_WrapObject(aCx, &proto)) { |
5449 | 0 | return false; |
5450 | 0 | } |
5451 | 0 | } |
5452 | 0 | } else { |
5453 | 0 | proto = canonicalProto; |
5454 | 0 | } |
5455 | 0 |
|
5456 | 0 | BindingJSObjectCreator<mozilla::DOMSVGPathSegCurvetoQuadraticRel> creator(aCx); |
5457 | 0 | creator.CreateObject(aCx, sClass.ToJSClass(), proto, aObject, aReflector); |
5458 | 0 | if (!aReflector) { |
5459 | 0 | return false; |
5460 | 0 | } |
5461 | 0 | |
5462 | 0 | aCache->SetWrapper(aReflector); |
5463 | 0 | creator.InitializationSucceeded(); |
5464 | 0 |
|
5465 | 0 | MOZ_ASSERT(aCache->GetWrapperPreserveColor() && |
5466 | 0 | aCache->GetWrapperPreserveColor() == aReflector); |
5467 | 0 | // If proto != canonicalProto, we have to preserve our wrapper; |
5468 | 0 | // otherwise we won't be able to properly recreate it later, since |
5469 | 0 | // we won't know what proto to use. Note that we don't check |
5470 | 0 | // aGivenProto here, since it's entirely possible (and even |
5471 | 0 | // somewhat common) to have a non-null aGivenProto which is the |
5472 | 0 | // same as canonicalProto. |
5473 | 0 | if (proto != canonicalProto) { |
5474 | 0 | PreserveWrapper(aObject); |
5475 | 0 | } |
5476 | 0 |
|
5477 | 0 | return true; |
5478 | 0 | } |
5479 | | |
5480 | | const NativePropertyHooks sNativePropertyHooks[] = { { |
5481 | | nullptr, |
5482 | | nullptr, |
5483 | | nullptr, |
5484 | | { sNativeProperties.Upcast(), nullptr }, |
5485 | | prototypes::id::SVGPathSegCurvetoQuadraticRel, |
5486 | | constructors::id::_ID_Count, |
5487 | | SVGPathSeg_Binding::sNativePropertyHooks, |
5488 | | &DefaultXrayExpandoObjectClass |
5489 | | } }; |
5490 | | |
5491 | | void |
5492 | | CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, bool aDefineOnGlobal) |
5493 | 0 | { |
5494 | 0 | JS::Handle<JSObject*> parentProto(SVGPathSeg_Binding::GetProtoObjectHandle(aCx)); |
5495 | 0 | if (!parentProto) { |
5496 | 0 | return; |
5497 | 0 | } |
5498 | 0 | |
5499 | 0 | static bool sIdsInited = false; |
5500 | 0 | if (!sIdsInited && NS_IsMainThread()) { |
5501 | 0 | if (!InitIds(aCx, sNativeProperties.Upcast())) { |
5502 | 0 | return; |
5503 | 0 | } |
5504 | 0 | sIdsInited = true; |
5505 | 0 | } |
5506 | 0 |
|
5507 | 0 | JS::Heap<JSObject*>* protoCache = &aProtoAndIfaceCache.EntrySlotOrCreate(prototypes::id::SVGPathSegCurvetoQuadraticRel); |
5508 | 0 | JS::Heap<JSObject*>* interfaceCache = nullptr; |
5509 | 0 | dom::CreateInterfaceObjects(aCx, aGlobal, parentProto, |
5510 | 0 | &sPrototypeClass.mBase, protoCache, |
5511 | 0 | nullptr, |
5512 | 0 | nullptr, nullptr, 0, nullptr, |
5513 | 0 | interfaceCache, |
5514 | 0 | sNativeProperties.Upcast(), |
5515 | 0 | nullptr, |
5516 | 0 | nullptr, aDefineOnGlobal, |
5517 | 0 | nullptr, |
5518 | 0 | false); |
5519 | 0 | } |
5520 | | |
5521 | | } // namespace SVGPathSegCurvetoQuadraticRel_Binding |
5522 | | |
5523 | | |
5524 | | |
5525 | | namespace SVGPathSegCurvetoQuadraticSmoothAbs_Binding { |
5526 | | |
5527 | | static_assert(IsRefcounted<NativeType>::value == IsRefcounted<SVGPathSeg_Binding::NativeType>::value, |
5528 | | "Can't inherit from an interface with a different ownership model."); |
5529 | | |
5530 | | MOZ_CAN_RUN_SCRIPT static bool |
5531 | | get_x(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::DOMSVGPathSegCurvetoQuadraticSmoothAbs* self, JSJitGetterCallArgs args) |
5532 | 0 | { |
5533 | 0 | AUTO_PROFILER_LABEL_FAST("get SVGPathSegCurvetoQuadraticSmoothAbs.x", DOM, cx); |
5534 | 0 |
|
5535 | 0 | float result(self->X()); |
5536 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
5537 | 0 | args.rval().set(JS_NumberValue(double(result))); |
5538 | 0 | return true; |
5539 | 0 | } |
5540 | | |
5541 | | MOZ_CAN_RUN_SCRIPT static bool |
5542 | | set_x(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::DOMSVGPathSegCurvetoQuadraticSmoothAbs* self, JSJitSetterCallArgs args) |
5543 | 0 | { |
5544 | 0 | AUTO_PROFILER_LABEL_FAST("set SVGPathSegCurvetoQuadraticSmoothAbs.x", DOM, cx); |
5545 | 0 |
|
5546 | 0 | float arg0; |
5547 | 0 | if (!ValueToPrimitive<float, eDefault>(cx, args[0], &arg0)) { |
5548 | 0 | return false; |
5549 | 0 | } else if (!mozilla::IsFinite(arg0)) { |
5550 | 0 | ThrowErrorMessage(cx, MSG_NOT_FINITE, "Value being assigned to SVGPathSegCurvetoQuadraticSmoothAbs.x"); |
5551 | 0 | return false; |
5552 | 0 | } |
5553 | 0 | FastErrorResult rv; |
5554 | 0 | self->SetX(arg0, rv); |
5555 | 0 | if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) { |
5556 | 0 | return false; |
5557 | 0 | } |
5558 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
5559 | 0 |
|
5560 | 0 | return true; |
5561 | 0 | } |
5562 | | |
5563 | | static const JSJitInfo x_getterinfo = { |
5564 | | { (JSJitGetterOp)get_x }, |
5565 | | { prototypes::id::SVGPathSegCurvetoQuadraticSmoothAbs }, |
5566 | | { PrototypeTraits<prototypes::id::SVGPathSegCurvetoQuadraticSmoothAbs>::Depth }, |
5567 | | JSJitInfo::Getter, |
5568 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
5569 | | JSVAL_TYPE_DOUBLE, /* returnType. Not relevant for setters. */ |
5570 | | true, /* isInfallible. False in setters. */ |
5571 | | false, /* isMovable. Not relevant for setters. */ |
5572 | | false, /* isEliminatable. Not relevant for setters. */ |
5573 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
5574 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
5575 | | false, /* isTypedMethod. Only relevant for methods. */ |
5576 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
5577 | | }; |
5578 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
5579 | | static_assert(0 < 1, "There is no slot for us"); |
5580 | | static const JSJitInfo x_setterinfo = { |
5581 | | { (JSJitGetterOp)set_x }, |
5582 | | { prototypes::id::SVGPathSegCurvetoQuadraticSmoothAbs }, |
5583 | | { PrototypeTraits<prototypes::id::SVGPathSegCurvetoQuadraticSmoothAbs>::Depth }, |
5584 | | JSJitInfo::Setter, |
5585 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
5586 | | JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */ |
5587 | | false, /* isInfallible. False in setters. */ |
5588 | | false, /* isMovable. Not relevant for setters. */ |
5589 | | false, /* isEliminatable. Not relevant for setters. */ |
5590 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
5591 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
5592 | | false, /* isTypedMethod. Only relevant for methods. */ |
5593 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
5594 | | }; |
5595 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
5596 | | static_assert(0 < 1, "There is no slot for us"); |
5597 | | |
5598 | | MOZ_CAN_RUN_SCRIPT static bool |
5599 | | get_y(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::DOMSVGPathSegCurvetoQuadraticSmoothAbs* self, JSJitGetterCallArgs args) |
5600 | 0 | { |
5601 | 0 | AUTO_PROFILER_LABEL_FAST("get SVGPathSegCurvetoQuadraticSmoothAbs.y", DOM, cx); |
5602 | 0 |
|
5603 | 0 | float result(self->Y()); |
5604 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
5605 | 0 | args.rval().set(JS_NumberValue(double(result))); |
5606 | 0 | return true; |
5607 | 0 | } |
5608 | | |
5609 | | MOZ_CAN_RUN_SCRIPT static bool |
5610 | | set_y(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::DOMSVGPathSegCurvetoQuadraticSmoothAbs* self, JSJitSetterCallArgs args) |
5611 | 0 | { |
5612 | 0 | AUTO_PROFILER_LABEL_FAST("set SVGPathSegCurvetoQuadraticSmoothAbs.y", DOM, cx); |
5613 | 0 |
|
5614 | 0 | float arg0; |
5615 | 0 | if (!ValueToPrimitive<float, eDefault>(cx, args[0], &arg0)) { |
5616 | 0 | return false; |
5617 | 0 | } else if (!mozilla::IsFinite(arg0)) { |
5618 | 0 | ThrowErrorMessage(cx, MSG_NOT_FINITE, "Value being assigned to SVGPathSegCurvetoQuadraticSmoothAbs.y"); |
5619 | 0 | return false; |
5620 | 0 | } |
5621 | 0 | FastErrorResult rv; |
5622 | 0 | self->SetY(arg0, rv); |
5623 | 0 | if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) { |
5624 | 0 | return false; |
5625 | 0 | } |
5626 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
5627 | 0 |
|
5628 | 0 | return true; |
5629 | 0 | } |
5630 | | |
5631 | | static const JSJitInfo y_getterinfo = { |
5632 | | { (JSJitGetterOp)get_y }, |
5633 | | { prototypes::id::SVGPathSegCurvetoQuadraticSmoothAbs }, |
5634 | | { PrototypeTraits<prototypes::id::SVGPathSegCurvetoQuadraticSmoothAbs>::Depth }, |
5635 | | JSJitInfo::Getter, |
5636 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
5637 | | JSVAL_TYPE_DOUBLE, /* returnType. Not relevant for setters. */ |
5638 | | true, /* isInfallible. False in setters. */ |
5639 | | false, /* isMovable. Not relevant for setters. */ |
5640 | | false, /* isEliminatable. Not relevant for setters. */ |
5641 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
5642 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
5643 | | false, /* isTypedMethod. Only relevant for methods. */ |
5644 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
5645 | | }; |
5646 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
5647 | | static_assert(0 < 1, "There is no slot for us"); |
5648 | | static const JSJitInfo y_setterinfo = { |
5649 | | { (JSJitGetterOp)set_y }, |
5650 | | { prototypes::id::SVGPathSegCurvetoQuadraticSmoothAbs }, |
5651 | | { PrototypeTraits<prototypes::id::SVGPathSegCurvetoQuadraticSmoothAbs>::Depth }, |
5652 | | JSJitInfo::Setter, |
5653 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
5654 | | JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */ |
5655 | | false, /* isInfallible. False in setters. */ |
5656 | | false, /* isMovable. Not relevant for setters. */ |
5657 | | false, /* isEliminatable. Not relevant for setters. */ |
5658 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
5659 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
5660 | | false, /* isTypedMethod. Only relevant for methods. */ |
5661 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
5662 | | }; |
5663 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
5664 | | static_assert(0 < 1, "There is no slot for us"); |
5665 | | |
5666 | | static bool |
5667 | | _addProperty(JSContext* cx, JS::Handle<JSObject*> obj, JS::Handle<jsid> id, JS::Handle<JS::Value> val) |
5668 | 0 | { |
5669 | 0 | mozilla::DOMSVGPathSegCurvetoQuadraticSmoothAbs* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::DOMSVGPathSegCurvetoQuadraticSmoothAbs>(obj); |
5670 | 0 | // We don't want to preserve if we don't have a wrapper, and we |
5671 | 0 | // obviously can't preserve if we're not initialized. |
5672 | 0 | if (self && self->GetWrapperPreserveColor()) { |
5673 | 0 | PreserveWrapper(self); |
5674 | 0 | } |
5675 | 0 | return true; |
5676 | 0 | } |
5677 | | |
5678 | | static void |
5679 | | _finalize(js::FreeOp* fop, JSObject* obj) |
5680 | 0 | { |
5681 | 0 | mozilla::DOMSVGPathSegCurvetoQuadraticSmoothAbs* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::DOMSVGPathSegCurvetoQuadraticSmoothAbs>(obj); |
5682 | 0 | if (self) { |
5683 | 0 | ClearWrapper(self, self, obj); |
5684 | 0 | AddForDeferredFinalization<mozilla::DOMSVGPathSegCurvetoQuadraticSmoothAbs>(self); |
5685 | 0 | } |
5686 | 0 | } |
5687 | | |
5688 | | static size_t |
5689 | | _objectMoved(JSObject* obj, JSObject* old) |
5690 | 0 | { |
5691 | 0 | mozilla::DOMSVGPathSegCurvetoQuadraticSmoothAbs* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::DOMSVGPathSegCurvetoQuadraticSmoothAbs>(obj); |
5692 | 0 | if (self) { |
5693 | 0 | UpdateWrapper(self, self, obj, old); |
5694 | 0 | } |
5695 | 0 |
|
5696 | 0 | return 0; |
5697 | 0 | } |
5698 | | |
5699 | | // We deliberately use brace-elision to make Visual Studio produce better initalization code. |
5700 | | #if defined(__clang__) |
5701 | | #pragma clang diagnostic push |
5702 | | #pragma clang diagnostic ignored "-Wmissing-braces" |
5703 | | #endif |
5704 | | static const JSPropertySpec sAttributes_specs[] = { |
5705 | | { "x", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &x_getterinfo, GenericSetter<NormalThisPolicy>, &x_setterinfo }, |
5706 | | { "y", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &y_getterinfo, GenericSetter<NormalThisPolicy>, &y_setterinfo }, |
5707 | | { nullptr, 0, nullptr, nullptr, nullptr, nullptr } |
5708 | | }; |
5709 | | #if defined(__clang__) |
5710 | | #pragma clang diagnostic pop |
5711 | | #endif |
5712 | | |
5713 | | |
5714 | | static const Prefable<const JSPropertySpec> sAttributes[] = { |
5715 | | { nullptr, &sAttributes_specs[0] }, |
5716 | | { nullptr, nullptr } |
5717 | | }; |
5718 | | |
5719 | | static_assert(1 <= 1ull << NUM_BITS_PROPERTY_INFO_PREF_INDEX, |
5720 | | "We have a prefable index that is >= (1 << NUM_BITS_PROPERTY_INFO_PREF_INDEX)"); |
5721 | | static_assert(2 <= 1ull << NUM_BITS_PROPERTY_INFO_SPEC_INDEX, |
5722 | | "We have a spec index that is >= (1 << NUM_BITS_PROPERTY_INFO_SPEC_INDEX)"); |
5723 | | |
5724 | | |
5725 | | static uint16_t sNativeProperties_sortedPropertyIndices[2]; |
5726 | | static PropertyInfo sNativeProperties_propertyInfos[2]; |
5727 | | |
5728 | | static const NativePropertiesN<1> sNativeProperties = { |
5729 | | false, 0, |
5730 | | false, 0, |
5731 | | false, 0, |
5732 | | true, 0 /* sAttributes */, |
5733 | | false, 0, |
5734 | | false, 0, |
5735 | | false, 0, |
5736 | | -1, |
5737 | | 2, |
5738 | | sNativeProperties_sortedPropertyIndices, |
5739 | | { |
5740 | | { sAttributes, &sNativeProperties_propertyInfos[0] } |
5741 | | } |
5742 | | }; |
5743 | | static_assert(2 < 1ull << CHAR_BIT * sizeof(sNativeProperties.propertyInfoCount), |
5744 | | "We have a property info count that is oversized"); |
5745 | | |
5746 | | static const DOMIfaceAndProtoJSClass sPrototypeClass = { |
5747 | | { |
5748 | | "SVGPathSegCurvetoQuadraticSmoothAbsPrototype", |
5749 | | JSCLASS_IS_DOMIFACEANDPROTOJSCLASS | JSCLASS_HAS_RESERVED_SLOTS(DOM_INTERFACE_PROTO_SLOTS_BASE), |
5750 | | JS_NULL_CLASS_OPS, |
5751 | | JS_NULL_CLASS_SPEC, |
5752 | | JS_NULL_CLASS_EXT, |
5753 | | JS_NULL_OBJECT_OPS |
5754 | | }, |
5755 | | eInterfacePrototype, |
5756 | | false, |
5757 | | prototypes::id::SVGPathSegCurvetoQuadraticSmoothAbs, |
5758 | | PrototypeTraits<prototypes::id::SVGPathSegCurvetoQuadraticSmoothAbs>::Depth, |
5759 | | sNativePropertyHooks, |
5760 | | "[object SVGPathSegCurvetoQuadraticSmoothAbsPrototype]", |
5761 | | SVGPathSeg_Binding::GetProtoObject |
5762 | | }; |
5763 | | |
5764 | | static const js::ClassOps sClassOps = { |
5765 | | _addProperty, /* addProperty */ |
5766 | | nullptr, /* delProperty */ |
5767 | | nullptr, /* enumerate */ |
5768 | | nullptr, /* newEnumerate */ |
5769 | | nullptr, /* resolve */ |
5770 | | nullptr, /* mayResolve */ |
5771 | | _finalize, /* finalize */ |
5772 | | nullptr, /* call */ |
5773 | | nullptr, /* hasInstance */ |
5774 | | nullptr, /* construct */ |
5775 | | nullptr, /* trace */ |
5776 | | }; |
5777 | | |
5778 | | static const js::ClassExtension sClassExtension = { |
5779 | | nullptr, /* weakmapKeyDelegateOp */ |
5780 | | _objectMoved /* objectMovedOp */ |
5781 | | }; |
5782 | | |
5783 | | static const DOMJSClass sClass = { |
5784 | | { "SVGPathSegCurvetoQuadraticSmoothAbs", |
5785 | | JSCLASS_IS_DOMJSCLASS | JSCLASS_FOREGROUND_FINALIZE | JSCLASS_HAS_RESERVED_SLOTS(1), |
5786 | | &sClassOps, |
5787 | | JS_NULL_CLASS_SPEC, |
5788 | | &sClassExtension, |
5789 | | JS_NULL_OBJECT_OPS |
5790 | | }, |
5791 | | { prototypes::id::SVGPathSeg, prototypes::id::SVGPathSegCurvetoQuadraticSmoothAbs, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count }, |
5792 | | IsBaseOf<nsISupports, mozilla::DOMSVGPathSegCurvetoQuadraticSmoothAbs >::value, |
5793 | | sNativePropertyHooks, |
5794 | | FindAssociatedGlobalForNative<mozilla::DOMSVGPathSegCurvetoQuadraticSmoothAbs>::Get, |
5795 | | GetProtoObjectHandle, |
5796 | | GetCCParticipant<mozilla::DOMSVGPathSegCurvetoQuadraticSmoothAbs>::Get() |
5797 | | }; |
5798 | | static_assert(1 == DOM_INSTANCE_RESERVED_SLOTS, |
5799 | | "Must have the right minimal number of reserved slots."); |
5800 | | static_assert(1 >= 1, |
5801 | | "Must have enough reserved slots."); |
5802 | | |
5803 | | const JSClass* |
5804 | | GetJSClass() |
5805 | 0 | { |
5806 | 0 | return sClass.ToJSClass(); |
5807 | 0 | } |
5808 | | |
5809 | | bool |
5810 | | Wrap(JSContext* aCx, mozilla::DOMSVGPathSegCurvetoQuadraticSmoothAbs* aObject, nsWrapperCache* aCache, JS::Handle<JSObject*> aGivenProto, JS::MutableHandle<JSObject*> aReflector) |
5811 | 0 | { |
5812 | 0 | static_assert(!IsBaseOf<NonRefcountedDOMObject, mozilla::DOMSVGPathSegCurvetoQuadraticSmoothAbs>::value, |
5813 | 0 | "Shouldn't have wrappercached things that are not refcounted."); |
5814 | 0 | MOZ_ASSERT(static_cast<mozilla::DOMSVGPathSegCurvetoQuadraticSmoothAbs*>(aObject) == |
5815 | 0 | reinterpret_cast<mozilla::DOMSVGPathSegCurvetoQuadraticSmoothAbs*>(aObject), |
5816 | 0 | "Multiple inheritance for mozilla::DOMSVGPathSegCurvetoQuadraticSmoothAbs is broken."); |
5817 | 0 | MOZ_ASSERT(static_cast<mozilla::DOMSVGPathSeg*>(aObject) == |
5818 | 0 | reinterpret_cast<mozilla::DOMSVGPathSeg*>(aObject), |
5819 | 0 | "Multiple inheritance for mozilla::DOMSVGPathSeg is broken."); |
5820 | 0 | MOZ_ASSERT(ToSupportsIsCorrect(aObject)); |
5821 | 0 | MOZ_ASSERT_IF(aGivenProto, js::IsObjectInContextCompartment(aGivenProto, aCx)); |
5822 | 0 | MOZ_ASSERT(!aCache->GetWrapper(), |
5823 | 0 | "You should probably not be using Wrap() directly; use " |
5824 | 0 | "GetOrCreateDOMReflector instead"); |
5825 | 0 |
|
5826 | 0 | MOZ_ASSERT(ToSupportsIsOnPrimaryInheritanceChain(aObject, aCache), |
5827 | 0 | "nsISupports must be on our primary inheritance chain"); |
5828 | 0 |
|
5829 | 0 | JS::Rooted<JSObject*> global(aCx, FindAssociatedGlobal(aCx, aObject->GetParentObject())); |
5830 | 0 | if (!global) { |
5831 | 0 | return false; |
5832 | 0 | } |
5833 | 0 | MOZ_ASSERT(JS_IsGlobalObject(global)); |
5834 | 0 | MOZ_ASSERT(JS::ObjectIsNotGray(global)); |
5835 | 0 |
|
5836 | 0 | // That might have ended up wrapping us already, due to the wonders |
5837 | 0 | // of XBL. Check for that, and bail out as needed. |
5838 | 0 | aReflector.set(aCache->GetWrapper()); |
5839 | 0 | if (aReflector) { |
5840 | | #ifdef DEBUG |
5841 | | AssertReflectorHasGivenProto(aCx, aReflector, aGivenProto); |
5842 | | #endif // DEBUG |
5843 | | return true; |
5844 | 0 | } |
5845 | 0 |
|
5846 | 0 | JSAutoRealm ar(aCx, global); |
5847 | 0 | JS::Handle<JSObject*> canonicalProto = GetProtoObjectHandle(aCx); |
5848 | 0 | if (!canonicalProto) { |
5849 | 0 | return false; |
5850 | 0 | } |
5851 | 0 | JS::Rooted<JSObject*> proto(aCx); |
5852 | 0 | if (aGivenProto) { |
5853 | 0 | proto = aGivenProto; |
5854 | 0 | // Unfortunately, while aGivenProto was in the compartment of aCx |
5855 | 0 | // coming in, we changed compartments to that of "parent" so may need |
5856 | 0 | // to wrap the proto here. |
5857 | 0 | if (js::GetContextCompartment(aCx) != js::GetObjectCompartment(proto)) { |
5858 | 0 | if (!JS_WrapObject(aCx, &proto)) { |
5859 | 0 | return false; |
5860 | 0 | } |
5861 | 0 | } |
5862 | 0 | } else { |
5863 | 0 | proto = canonicalProto; |
5864 | 0 | } |
5865 | 0 |
|
5866 | 0 | BindingJSObjectCreator<mozilla::DOMSVGPathSegCurvetoQuadraticSmoothAbs> creator(aCx); |
5867 | 0 | creator.CreateObject(aCx, sClass.ToJSClass(), proto, aObject, aReflector); |
5868 | 0 | if (!aReflector) { |
5869 | 0 | return false; |
5870 | 0 | } |
5871 | 0 | |
5872 | 0 | aCache->SetWrapper(aReflector); |
5873 | 0 | creator.InitializationSucceeded(); |
5874 | 0 |
|
5875 | 0 | MOZ_ASSERT(aCache->GetWrapperPreserveColor() && |
5876 | 0 | aCache->GetWrapperPreserveColor() == aReflector); |
5877 | 0 | // If proto != canonicalProto, we have to preserve our wrapper; |
5878 | 0 | // otherwise we won't be able to properly recreate it later, since |
5879 | 0 | // we won't know what proto to use. Note that we don't check |
5880 | 0 | // aGivenProto here, since it's entirely possible (and even |
5881 | 0 | // somewhat common) to have a non-null aGivenProto which is the |
5882 | 0 | // same as canonicalProto. |
5883 | 0 | if (proto != canonicalProto) { |
5884 | 0 | PreserveWrapper(aObject); |
5885 | 0 | } |
5886 | 0 |
|
5887 | 0 | return true; |
5888 | 0 | } |
5889 | | |
5890 | | const NativePropertyHooks sNativePropertyHooks[] = { { |
5891 | | nullptr, |
5892 | | nullptr, |
5893 | | nullptr, |
5894 | | { sNativeProperties.Upcast(), nullptr }, |
5895 | | prototypes::id::SVGPathSegCurvetoQuadraticSmoothAbs, |
5896 | | constructors::id::_ID_Count, |
5897 | | SVGPathSeg_Binding::sNativePropertyHooks, |
5898 | | &DefaultXrayExpandoObjectClass |
5899 | | } }; |
5900 | | |
5901 | | void |
5902 | | CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, bool aDefineOnGlobal) |
5903 | 0 | { |
5904 | 0 | JS::Handle<JSObject*> parentProto(SVGPathSeg_Binding::GetProtoObjectHandle(aCx)); |
5905 | 0 | if (!parentProto) { |
5906 | 0 | return; |
5907 | 0 | } |
5908 | 0 | |
5909 | 0 | static bool sIdsInited = false; |
5910 | 0 | if (!sIdsInited && NS_IsMainThread()) { |
5911 | 0 | if (!InitIds(aCx, sNativeProperties.Upcast())) { |
5912 | 0 | return; |
5913 | 0 | } |
5914 | 0 | sIdsInited = true; |
5915 | 0 | } |
5916 | 0 |
|
5917 | 0 | JS::Heap<JSObject*>* protoCache = &aProtoAndIfaceCache.EntrySlotOrCreate(prototypes::id::SVGPathSegCurvetoQuadraticSmoothAbs); |
5918 | 0 | JS::Heap<JSObject*>* interfaceCache = nullptr; |
5919 | 0 | dom::CreateInterfaceObjects(aCx, aGlobal, parentProto, |
5920 | 0 | &sPrototypeClass.mBase, protoCache, |
5921 | 0 | nullptr, |
5922 | 0 | nullptr, nullptr, 0, nullptr, |
5923 | 0 | interfaceCache, |
5924 | 0 | sNativeProperties.Upcast(), |
5925 | 0 | nullptr, |
5926 | 0 | nullptr, aDefineOnGlobal, |
5927 | 0 | nullptr, |
5928 | 0 | false); |
5929 | 0 | } |
5930 | | |
5931 | | } // namespace SVGPathSegCurvetoQuadraticSmoothAbs_Binding |
5932 | | |
5933 | | |
5934 | | |
5935 | | namespace SVGPathSegCurvetoQuadraticSmoothRel_Binding { |
5936 | | |
5937 | | static_assert(IsRefcounted<NativeType>::value == IsRefcounted<SVGPathSeg_Binding::NativeType>::value, |
5938 | | "Can't inherit from an interface with a different ownership model."); |
5939 | | |
5940 | | MOZ_CAN_RUN_SCRIPT static bool |
5941 | | get_x(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::DOMSVGPathSegCurvetoQuadraticSmoothRel* self, JSJitGetterCallArgs args) |
5942 | 0 | { |
5943 | 0 | AUTO_PROFILER_LABEL_FAST("get SVGPathSegCurvetoQuadraticSmoothRel.x", DOM, cx); |
5944 | 0 |
|
5945 | 0 | float result(self->X()); |
5946 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
5947 | 0 | args.rval().set(JS_NumberValue(double(result))); |
5948 | 0 | return true; |
5949 | 0 | } |
5950 | | |
5951 | | MOZ_CAN_RUN_SCRIPT static bool |
5952 | | set_x(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::DOMSVGPathSegCurvetoQuadraticSmoothRel* self, JSJitSetterCallArgs args) |
5953 | 0 | { |
5954 | 0 | AUTO_PROFILER_LABEL_FAST("set SVGPathSegCurvetoQuadraticSmoothRel.x", DOM, cx); |
5955 | 0 |
|
5956 | 0 | float arg0; |
5957 | 0 | if (!ValueToPrimitive<float, eDefault>(cx, args[0], &arg0)) { |
5958 | 0 | return false; |
5959 | 0 | } else if (!mozilla::IsFinite(arg0)) { |
5960 | 0 | ThrowErrorMessage(cx, MSG_NOT_FINITE, "Value being assigned to SVGPathSegCurvetoQuadraticSmoothRel.x"); |
5961 | 0 | return false; |
5962 | 0 | } |
5963 | 0 | FastErrorResult rv; |
5964 | 0 | self->SetX(arg0, rv); |
5965 | 0 | if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) { |
5966 | 0 | return false; |
5967 | 0 | } |
5968 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
5969 | 0 |
|
5970 | 0 | return true; |
5971 | 0 | } |
5972 | | |
5973 | | static const JSJitInfo x_getterinfo = { |
5974 | | { (JSJitGetterOp)get_x }, |
5975 | | { prototypes::id::SVGPathSegCurvetoQuadraticSmoothRel }, |
5976 | | { PrototypeTraits<prototypes::id::SVGPathSegCurvetoQuadraticSmoothRel>::Depth }, |
5977 | | JSJitInfo::Getter, |
5978 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
5979 | | JSVAL_TYPE_DOUBLE, /* returnType. Not relevant for setters. */ |
5980 | | true, /* isInfallible. False in setters. */ |
5981 | | false, /* isMovable. Not relevant for setters. */ |
5982 | | false, /* isEliminatable. Not relevant for setters. */ |
5983 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
5984 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
5985 | | false, /* isTypedMethod. Only relevant for methods. */ |
5986 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
5987 | | }; |
5988 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
5989 | | static_assert(0 < 1, "There is no slot for us"); |
5990 | | static const JSJitInfo x_setterinfo = { |
5991 | | { (JSJitGetterOp)set_x }, |
5992 | | { prototypes::id::SVGPathSegCurvetoQuadraticSmoothRel }, |
5993 | | { PrototypeTraits<prototypes::id::SVGPathSegCurvetoQuadraticSmoothRel>::Depth }, |
5994 | | JSJitInfo::Setter, |
5995 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
5996 | | JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */ |
5997 | | false, /* isInfallible. False in setters. */ |
5998 | | false, /* isMovable. Not relevant for setters. */ |
5999 | | false, /* isEliminatable. Not relevant for setters. */ |
6000 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
6001 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
6002 | | false, /* isTypedMethod. Only relevant for methods. */ |
6003 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
6004 | | }; |
6005 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
6006 | | static_assert(0 < 1, "There is no slot for us"); |
6007 | | |
6008 | | MOZ_CAN_RUN_SCRIPT static bool |
6009 | | get_y(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::DOMSVGPathSegCurvetoQuadraticSmoothRel* self, JSJitGetterCallArgs args) |
6010 | 0 | { |
6011 | 0 | AUTO_PROFILER_LABEL_FAST("get SVGPathSegCurvetoQuadraticSmoothRel.y", DOM, cx); |
6012 | 0 |
|
6013 | 0 | float result(self->Y()); |
6014 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
6015 | 0 | args.rval().set(JS_NumberValue(double(result))); |
6016 | 0 | return true; |
6017 | 0 | } |
6018 | | |
6019 | | MOZ_CAN_RUN_SCRIPT static bool |
6020 | | set_y(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::DOMSVGPathSegCurvetoQuadraticSmoothRel* self, JSJitSetterCallArgs args) |
6021 | 0 | { |
6022 | 0 | AUTO_PROFILER_LABEL_FAST("set SVGPathSegCurvetoQuadraticSmoothRel.y", DOM, cx); |
6023 | 0 |
|
6024 | 0 | float arg0; |
6025 | 0 | if (!ValueToPrimitive<float, eDefault>(cx, args[0], &arg0)) { |
6026 | 0 | return false; |
6027 | 0 | } else if (!mozilla::IsFinite(arg0)) { |
6028 | 0 | ThrowErrorMessage(cx, MSG_NOT_FINITE, "Value being assigned to SVGPathSegCurvetoQuadraticSmoothRel.y"); |
6029 | 0 | return false; |
6030 | 0 | } |
6031 | 0 | FastErrorResult rv; |
6032 | 0 | self->SetY(arg0, rv); |
6033 | 0 | if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) { |
6034 | 0 | return false; |
6035 | 0 | } |
6036 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
6037 | 0 |
|
6038 | 0 | return true; |
6039 | 0 | } |
6040 | | |
6041 | | static const JSJitInfo y_getterinfo = { |
6042 | | { (JSJitGetterOp)get_y }, |
6043 | | { prototypes::id::SVGPathSegCurvetoQuadraticSmoothRel }, |
6044 | | { PrototypeTraits<prototypes::id::SVGPathSegCurvetoQuadraticSmoothRel>::Depth }, |
6045 | | JSJitInfo::Getter, |
6046 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
6047 | | JSVAL_TYPE_DOUBLE, /* returnType. Not relevant for setters. */ |
6048 | | true, /* isInfallible. False in setters. */ |
6049 | | false, /* isMovable. Not relevant for setters. */ |
6050 | | false, /* isEliminatable. Not relevant for setters. */ |
6051 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
6052 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
6053 | | false, /* isTypedMethod. Only relevant for methods. */ |
6054 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
6055 | | }; |
6056 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
6057 | | static_assert(0 < 1, "There is no slot for us"); |
6058 | | static const JSJitInfo y_setterinfo = { |
6059 | | { (JSJitGetterOp)set_y }, |
6060 | | { prototypes::id::SVGPathSegCurvetoQuadraticSmoothRel }, |
6061 | | { PrototypeTraits<prototypes::id::SVGPathSegCurvetoQuadraticSmoothRel>::Depth }, |
6062 | | JSJitInfo::Setter, |
6063 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
6064 | | JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */ |
6065 | | false, /* isInfallible. False in setters. */ |
6066 | | false, /* isMovable. Not relevant for setters. */ |
6067 | | false, /* isEliminatable. Not relevant for setters. */ |
6068 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
6069 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
6070 | | false, /* isTypedMethod. Only relevant for methods. */ |
6071 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
6072 | | }; |
6073 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
6074 | | static_assert(0 < 1, "There is no slot for us"); |
6075 | | |
6076 | | static bool |
6077 | | _addProperty(JSContext* cx, JS::Handle<JSObject*> obj, JS::Handle<jsid> id, JS::Handle<JS::Value> val) |
6078 | 0 | { |
6079 | 0 | mozilla::DOMSVGPathSegCurvetoQuadraticSmoothRel* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::DOMSVGPathSegCurvetoQuadraticSmoothRel>(obj); |
6080 | 0 | // We don't want to preserve if we don't have a wrapper, and we |
6081 | 0 | // obviously can't preserve if we're not initialized. |
6082 | 0 | if (self && self->GetWrapperPreserveColor()) { |
6083 | 0 | PreserveWrapper(self); |
6084 | 0 | } |
6085 | 0 | return true; |
6086 | 0 | } |
6087 | | |
6088 | | static void |
6089 | | _finalize(js::FreeOp* fop, JSObject* obj) |
6090 | 0 | { |
6091 | 0 | mozilla::DOMSVGPathSegCurvetoQuadraticSmoothRel* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::DOMSVGPathSegCurvetoQuadraticSmoothRel>(obj); |
6092 | 0 | if (self) { |
6093 | 0 | ClearWrapper(self, self, obj); |
6094 | 0 | AddForDeferredFinalization<mozilla::DOMSVGPathSegCurvetoQuadraticSmoothRel>(self); |
6095 | 0 | } |
6096 | 0 | } |
6097 | | |
6098 | | static size_t |
6099 | | _objectMoved(JSObject* obj, JSObject* old) |
6100 | 0 | { |
6101 | 0 | mozilla::DOMSVGPathSegCurvetoQuadraticSmoothRel* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::DOMSVGPathSegCurvetoQuadraticSmoothRel>(obj); |
6102 | 0 | if (self) { |
6103 | 0 | UpdateWrapper(self, self, obj, old); |
6104 | 0 | } |
6105 | 0 |
|
6106 | 0 | return 0; |
6107 | 0 | } |
6108 | | |
6109 | | // We deliberately use brace-elision to make Visual Studio produce better initalization code. |
6110 | | #if defined(__clang__) |
6111 | | #pragma clang diagnostic push |
6112 | | #pragma clang diagnostic ignored "-Wmissing-braces" |
6113 | | #endif |
6114 | | static const JSPropertySpec sAttributes_specs[] = { |
6115 | | { "x", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &x_getterinfo, GenericSetter<NormalThisPolicy>, &x_setterinfo }, |
6116 | | { "y", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &y_getterinfo, GenericSetter<NormalThisPolicy>, &y_setterinfo }, |
6117 | | { nullptr, 0, nullptr, nullptr, nullptr, nullptr } |
6118 | | }; |
6119 | | #if defined(__clang__) |
6120 | | #pragma clang diagnostic pop |
6121 | | #endif |
6122 | | |
6123 | | |
6124 | | static const Prefable<const JSPropertySpec> sAttributes[] = { |
6125 | | { nullptr, &sAttributes_specs[0] }, |
6126 | | { nullptr, nullptr } |
6127 | | }; |
6128 | | |
6129 | | static_assert(1 <= 1ull << NUM_BITS_PROPERTY_INFO_PREF_INDEX, |
6130 | | "We have a prefable index that is >= (1 << NUM_BITS_PROPERTY_INFO_PREF_INDEX)"); |
6131 | | static_assert(2 <= 1ull << NUM_BITS_PROPERTY_INFO_SPEC_INDEX, |
6132 | | "We have a spec index that is >= (1 << NUM_BITS_PROPERTY_INFO_SPEC_INDEX)"); |
6133 | | |
6134 | | |
6135 | | static uint16_t sNativeProperties_sortedPropertyIndices[2]; |
6136 | | static PropertyInfo sNativeProperties_propertyInfos[2]; |
6137 | | |
6138 | | static const NativePropertiesN<1> sNativeProperties = { |
6139 | | false, 0, |
6140 | | false, 0, |
6141 | | false, 0, |
6142 | | true, 0 /* sAttributes */, |
6143 | | false, 0, |
6144 | | false, 0, |
6145 | | false, 0, |
6146 | | -1, |
6147 | | 2, |
6148 | | sNativeProperties_sortedPropertyIndices, |
6149 | | { |
6150 | | { sAttributes, &sNativeProperties_propertyInfos[0] } |
6151 | | } |
6152 | | }; |
6153 | | static_assert(2 < 1ull << CHAR_BIT * sizeof(sNativeProperties.propertyInfoCount), |
6154 | | "We have a property info count that is oversized"); |
6155 | | |
6156 | | static const DOMIfaceAndProtoJSClass sPrototypeClass = { |
6157 | | { |
6158 | | "SVGPathSegCurvetoQuadraticSmoothRelPrototype", |
6159 | | JSCLASS_IS_DOMIFACEANDPROTOJSCLASS | JSCLASS_HAS_RESERVED_SLOTS(DOM_INTERFACE_PROTO_SLOTS_BASE), |
6160 | | JS_NULL_CLASS_OPS, |
6161 | | JS_NULL_CLASS_SPEC, |
6162 | | JS_NULL_CLASS_EXT, |
6163 | | JS_NULL_OBJECT_OPS |
6164 | | }, |
6165 | | eInterfacePrototype, |
6166 | | false, |
6167 | | prototypes::id::SVGPathSegCurvetoQuadraticSmoothRel, |
6168 | | PrototypeTraits<prototypes::id::SVGPathSegCurvetoQuadraticSmoothRel>::Depth, |
6169 | | sNativePropertyHooks, |
6170 | | "[object SVGPathSegCurvetoQuadraticSmoothRelPrototype]", |
6171 | | SVGPathSeg_Binding::GetProtoObject |
6172 | | }; |
6173 | | |
6174 | | static const js::ClassOps sClassOps = { |
6175 | | _addProperty, /* addProperty */ |
6176 | | nullptr, /* delProperty */ |
6177 | | nullptr, /* enumerate */ |
6178 | | nullptr, /* newEnumerate */ |
6179 | | nullptr, /* resolve */ |
6180 | | nullptr, /* mayResolve */ |
6181 | | _finalize, /* finalize */ |
6182 | | nullptr, /* call */ |
6183 | | nullptr, /* hasInstance */ |
6184 | | nullptr, /* construct */ |
6185 | | nullptr, /* trace */ |
6186 | | }; |
6187 | | |
6188 | | static const js::ClassExtension sClassExtension = { |
6189 | | nullptr, /* weakmapKeyDelegateOp */ |
6190 | | _objectMoved /* objectMovedOp */ |
6191 | | }; |
6192 | | |
6193 | | static const DOMJSClass sClass = { |
6194 | | { "SVGPathSegCurvetoQuadraticSmoothRel", |
6195 | | JSCLASS_IS_DOMJSCLASS | JSCLASS_FOREGROUND_FINALIZE | JSCLASS_HAS_RESERVED_SLOTS(1), |
6196 | | &sClassOps, |
6197 | | JS_NULL_CLASS_SPEC, |
6198 | | &sClassExtension, |
6199 | | JS_NULL_OBJECT_OPS |
6200 | | }, |
6201 | | { prototypes::id::SVGPathSeg, prototypes::id::SVGPathSegCurvetoQuadraticSmoothRel, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count }, |
6202 | | IsBaseOf<nsISupports, mozilla::DOMSVGPathSegCurvetoQuadraticSmoothRel >::value, |
6203 | | sNativePropertyHooks, |
6204 | | FindAssociatedGlobalForNative<mozilla::DOMSVGPathSegCurvetoQuadraticSmoothRel>::Get, |
6205 | | GetProtoObjectHandle, |
6206 | | GetCCParticipant<mozilla::DOMSVGPathSegCurvetoQuadraticSmoothRel>::Get() |
6207 | | }; |
6208 | | static_assert(1 == DOM_INSTANCE_RESERVED_SLOTS, |
6209 | | "Must have the right minimal number of reserved slots."); |
6210 | | static_assert(1 >= 1, |
6211 | | "Must have enough reserved slots."); |
6212 | | |
6213 | | const JSClass* |
6214 | | GetJSClass() |
6215 | 0 | { |
6216 | 0 | return sClass.ToJSClass(); |
6217 | 0 | } |
6218 | | |
6219 | | bool |
6220 | | Wrap(JSContext* aCx, mozilla::DOMSVGPathSegCurvetoQuadraticSmoothRel* aObject, nsWrapperCache* aCache, JS::Handle<JSObject*> aGivenProto, JS::MutableHandle<JSObject*> aReflector) |
6221 | 0 | { |
6222 | 0 | static_assert(!IsBaseOf<NonRefcountedDOMObject, mozilla::DOMSVGPathSegCurvetoQuadraticSmoothRel>::value, |
6223 | 0 | "Shouldn't have wrappercached things that are not refcounted."); |
6224 | 0 | MOZ_ASSERT(static_cast<mozilla::DOMSVGPathSegCurvetoQuadraticSmoothRel*>(aObject) == |
6225 | 0 | reinterpret_cast<mozilla::DOMSVGPathSegCurvetoQuadraticSmoothRel*>(aObject), |
6226 | 0 | "Multiple inheritance for mozilla::DOMSVGPathSegCurvetoQuadraticSmoothRel is broken."); |
6227 | 0 | MOZ_ASSERT(static_cast<mozilla::DOMSVGPathSeg*>(aObject) == |
6228 | 0 | reinterpret_cast<mozilla::DOMSVGPathSeg*>(aObject), |
6229 | 0 | "Multiple inheritance for mozilla::DOMSVGPathSeg is broken."); |
6230 | 0 | MOZ_ASSERT(ToSupportsIsCorrect(aObject)); |
6231 | 0 | MOZ_ASSERT_IF(aGivenProto, js::IsObjectInContextCompartment(aGivenProto, aCx)); |
6232 | 0 | MOZ_ASSERT(!aCache->GetWrapper(), |
6233 | 0 | "You should probably not be using Wrap() directly; use " |
6234 | 0 | "GetOrCreateDOMReflector instead"); |
6235 | 0 |
|
6236 | 0 | MOZ_ASSERT(ToSupportsIsOnPrimaryInheritanceChain(aObject, aCache), |
6237 | 0 | "nsISupports must be on our primary inheritance chain"); |
6238 | 0 |
|
6239 | 0 | JS::Rooted<JSObject*> global(aCx, FindAssociatedGlobal(aCx, aObject->GetParentObject())); |
6240 | 0 | if (!global) { |
6241 | 0 | return false; |
6242 | 0 | } |
6243 | 0 | MOZ_ASSERT(JS_IsGlobalObject(global)); |
6244 | 0 | MOZ_ASSERT(JS::ObjectIsNotGray(global)); |
6245 | 0 |
|
6246 | 0 | // That might have ended up wrapping us already, due to the wonders |
6247 | 0 | // of XBL. Check for that, and bail out as needed. |
6248 | 0 | aReflector.set(aCache->GetWrapper()); |
6249 | 0 | if (aReflector) { |
6250 | | #ifdef DEBUG |
6251 | | AssertReflectorHasGivenProto(aCx, aReflector, aGivenProto); |
6252 | | #endif // DEBUG |
6253 | | return true; |
6254 | 0 | } |
6255 | 0 |
|
6256 | 0 | JSAutoRealm ar(aCx, global); |
6257 | 0 | JS::Handle<JSObject*> canonicalProto = GetProtoObjectHandle(aCx); |
6258 | 0 | if (!canonicalProto) { |
6259 | 0 | return false; |
6260 | 0 | } |
6261 | 0 | JS::Rooted<JSObject*> proto(aCx); |
6262 | 0 | if (aGivenProto) { |
6263 | 0 | proto = aGivenProto; |
6264 | 0 | // Unfortunately, while aGivenProto was in the compartment of aCx |
6265 | 0 | // coming in, we changed compartments to that of "parent" so may need |
6266 | 0 | // to wrap the proto here. |
6267 | 0 | if (js::GetContextCompartment(aCx) != js::GetObjectCompartment(proto)) { |
6268 | 0 | if (!JS_WrapObject(aCx, &proto)) { |
6269 | 0 | return false; |
6270 | 0 | } |
6271 | 0 | } |
6272 | 0 | } else { |
6273 | 0 | proto = canonicalProto; |
6274 | 0 | } |
6275 | 0 |
|
6276 | 0 | BindingJSObjectCreator<mozilla::DOMSVGPathSegCurvetoQuadraticSmoothRel> creator(aCx); |
6277 | 0 | creator.CreateObject(aCx, sClass.ToJSClass(), proto, aObject, aReflector); |
6278 | 0 | if (!aReflector) { |
6279 | 0 | return false; |
6280 | 0 | } |
6281 | 0 | |
6282 | 0 | aCache->SetWrapper(aReflector); |
6283 | 0 | creator.InitializationSucceeded(); |
6284 | 0 |
|
6285 | 0 | MOZ_ASSERT(aCache->GetWrapperPreserveColor() && |
6286 | 0 | aCache->GetWrapperPreserveColor() == aReflector); |
6287 | 0 | // If proto != canonicalProto, we have to preserve our wrapper; |
6288 | 0 | // otherwise we won't be able to properly recreate it later, since |
6289 | 0 | // we won't know what proto to use. Note that we don't check |
6290 | 0 | // aGivenProto here, since it's entirely possible (and even |
6291 | 0 | // somewhat common) to have a non-null aGivenProto which is the |
6292 | 0 | // same as canonicalProto. |
6293 | 0 | if (proto != canonicalProto) { |
6294 | 0 | PreserveWrapper(aObject); |
6295 | 0 | } |
6296 | 0 |
|
6297 | 0 | return true; |
6298 | 0 | } |
6299 | | |
6300 | | const NativePropertyHooks sNativePropertyHooks[] = { { |
6301 | | nullptr, |
6302 | | nullptr, |
6303 | | nullptr, |
6304 | | { sNativeProperties.Upcast(), nullptr }, |
6305 | | prototypes::id::SVGPathSegCurvetoQuadraticSmoothRel, |
6306 | | constructors::id::_ID_Count, |
6307 | | SVGPathSeg_Binding::sNativePropertyHooks, |
6308 | | &DefaultXrayExpandoObjectClass |
6309 | | } }; |
6310 | | |
6311 | | void |
6312 | | CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, bool aDefineOnGlobal) |
6313 | 0 | { |
6314 | 0 | JS::Handle<JSObject*> parentProto(SVGPathSeg_Binding::GetProtoObjectHandle(aCx)); |
6315 | 0 | if (!parentProto) { |
6316 | 0 | return; |
6317 | 0 | } |
6318 | 0 | |
6319 | 0 | static bool sIdsInited = false; |
6320 | 0 | if (!sIdsInited && NS_IsMainThread()) { |
6321 | 0 | if (!InitIds(aCx, sNativeProperties.Upcast())) { |
6322 | 0 | return; |
6323 | 0 | } |
6324 | 0 | sIdsInited = true; |
6325 | 0 | } |
6326 | 0 |
|
6327 | 0 | JS::Heap<JSObject*>* protoCache = &aProtoAndIfaceCache.EntrySlotOrCreate(prototypes::id::SVGPathSegCurvetoQuadraticSmoothRel); |
6328 | 0 | JS::Heap<JSObject*>* interfaceCache = nullptr; |
6329 | 0 | dom::CreateInterfaceObjects(aCx, aGlobal, parentProto, |
6330 | 0 | &sPrototypeClass.mBase, protoCache, |
6331 | 0 | nullptr, |
6332 | 0 | nullptr, nullptr, 0, nullptr, |
6333 | 0 | interfaceCache, |
6334 | 0 | sNativeProperties.Upcast(), |
6335 | 0 | nullptr, |
6336 | 0 | nullptr, aDefineOnGlobal, |
6337 | 0 | nullptr, |
6338 | 0 | false); |
6339 | 0 | } |
6340 | | |
6341 | | } // namespace SVGPathSegCurvetoQuadraticSmoothRel_Binding |
6342 | | |
6343 | | |
6344 | | |
6345 | | namespace SVGPathSegLinetoAbs_Binding { |
6346 | | |
6347 | | static_assert(IsRefcounted<NativeType>::value == IsRefcounted<SVGPathSeg_Binding::NativeType>::value, |
6348 | | "Can't inherit from an interface with a different ownership model."); |
6349 | | |
6350 | | MOZ_CAN_RUN_SCRIPT static bool |
6351 | | get_x(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::DOMSVGPathSegLinetoAbs* self, JSJitGetterCallArgs args) |
6352 | 0 | { |
6353 | 0 | AUTO_PROFILER_LABEL_FAST("get SVGPathSegLinetoAbs.x", DOM, cx); |
6354 | 0 |
|
6355 | 0 | float result(self->X()); |
6356 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
6357 | 0 | args.rval().set(JS_NumberValue(double(result))); |
6358 | 0 | return true; |
6359 | 0 | } |
6360 | | |
6361 | | MOZ_CAN_RUN_SCRIPT static bool |
6362 | | set_x(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::DOMSVGPathSegLinetoAbs* self, JSJitSetterCallArgs args) |
6363 | 0 | { |
6364 | 0 | AUTO_PROFILER_LABEL_FAST("set SVGPathSegLinetoAbs.x", DOM, cx); |
6365 | 0 |
|
6366 | 0 | float arg0; |
6367 | 0 | if (!ValueToPrimitive<float, eDefault>(cx, args[0], &arg0)) { |
6368 | 0 | return false; |
6369 | 0 | } else if (!mozilla::IsFinite(arg0)) { |
6370 | 0 | ThrowErrorMessage(cx, MSG_NOT_FINITE, "Value being assigned to SVGPathSegLinetoAbs.x"); |
6371 | 0 | return false; |
6372 | 0 | } |
6373 | 0 | FastErrorResult rv; |
6374 | 0 | self->SetX(arg0, rv); |
6375 | 0 | if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) { |
6376 | 0 | return false; |
6377 | 0 | } |
6378 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
6379 | 0 |
|
6380 | 0 | return true; |
6381 | 0 | } |
6382 | | |
6383 | | static const JSJitInfo x_getterinfo = { |
6384 | | { (JSJitGetterOp)get_x }, |
6385 | | { prototypes::id::SVGPathSegLinetoAbs }, |
6386 | | { PrototypeTraits<prototypes::id::SVGPathSegLinetoAbs>::Depth }, |
6387 | | JSJitInfo::Getter, |
6388 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
6389 | | JSVAL_TYPE_DOUBLE, /* returnType. Not relevant for setters. */ |
6390 | | true, /* isInfallible. False in setters. */ |
6391 | | false, /* isMovable. Not relevant for setters. */ |
6392 | | false, /* isEliminatable. Not relevant for setters. */ |
6393 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
6394 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
6395 | | false, /* isTypedMethod. Only relevant for methods. */ |
6396 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
6397 | | }; |
6398 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
6399 | | static_assert(0 < 1, "There is no slot for us"); |
6400 | | static const JSJitInfo x_setterinfo = { |
6401 | | { (JSJitGetterOp)set_x }, |
6402 | | { prototypes::id::SVGPathSegLinetoAbs }, |
6403 | | { PrototypeTraits<prototypes::id::SVGPathSegLinetoAbs>::Depth }, |
6404 | | JSJitInfo::Setter, |
6405 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
6406 | | JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */ |
6407 | | false, /* isInfallible. False in setters. */ |
6408 | | false, /* isMovable. Not relevant for setters. */ |
6409 | | false, /* isEliminatable. Not relevant for setters. */ |
6410 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
6411 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
6412 | | false, /* isTypedMethod. Only relevant for methods. */ |
6413 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
6414 | | }; |
6415 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
6416 | | static_assert(0 < 1, "There is no slot for us"); |
6417 | | |
6418 | | MOZ_CAN_RUN_SCRIPT static bool |
6419 | | get_y(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::DOMSVGPathSegLinetoAbs* self, JSJitGetterCallArgs args) |
6420 | 0 | { |
6421 | 0 | AUTO_PROFILER_LABEL_FAST("get SVGPathSegLinetoAbs.y", DOM, cx); |
6422 | 0 |
|
6423 | 0 | float result(self->Y()); |
6424 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
6425 | 0 | args.rval().set(JS_NumberValue(double(result))); |
6426 | 0 | return true; |
6427 | 0 | } |
6428 | | |
6429 | | MOZ_CAN_RUN_SCRIPT static bool |
6430 | | set_y(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::DOMSVGPathSegLinetoAbs* self, JSJitSetterCallArgs args) |
6431 | 0 | { |
6432 | 0 | AUTO_PROFILER_LABEL_FAST("set SVGPathSegLinetoAbs.y", DOM, cx); |
6433 | 0 |
|
6434 | 0 | float arg0; |
6435 | 0 | if (!ValueToPrimitive<float, eDefault>(cx, args[0], &arg0)) { |
6436 | 0 | return false; |
6437 | 0 | } else if (!mozilla::IsFinite(arg0)) { |
6438 | 0 | ThrowErrorMessage(cx, MSG_NOT_FINITE, "Value being assigned to SVGPathSegLinetoAbs.y"); |
6439 | 0 | return false; |
6440 | 0 | } |
6441 | 0 | FastErrorResult rv; |
6442 | 0 | self->SetY(arg0, rv); |
6443 | 0 | if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) { |
6444 | 0 | return false; |
6445 | 0 | } |
6446 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
6447 | 0 |
|
6448 | 0 | return true; |
6449 | 0 | } |
6450 | | |
6451 | | static const JSJitInfo y_getterinfo = { |
6452 | | { (JSJitGetterOp)get_y }, |
6453 | | { prototypes::id::SVGPathSegLinetoAbs }, |
6454 | | { PrototypeTraits<prototypes::id::SVGPathSegLinetoAbs>::Depth }, |
6455 | | JSJitInfo::Getter, |
6456 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
6457 | | JSVAL_TYPE_DOUBLE, /* returnType. Not relevant for setters. */ |
6458 | | true, /* isInfallible. False in setters. */ |
6459 | | false, /* isMovable. Not relevant for setters. */ |
6460 | | false, /* isEliminatable. Not relevant for setters. */ |
6461 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
6462 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
6463 | | false, /* isTypedMethod. Only relevant for methods. */ |
6464 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
6465 | | }; |
6466 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
6467 | | static_assert(0 < 1, "There is no slot for us"); |
6468 | | static const JSJitInfo y_setterinfo = { |
6469 | | { (JSJitGetterOp)set_y }, |
6470 | | { prototypes::id::SVGPathSegLinetoAbs }, |
6471 | | { PrototypeTraits<prototypes::id::SVGPathSegLinetoAbs>::Depth }, |
6472 | | JSJitInfo::Setter, |
6473 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
6474 | | JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */ |
6475 | | false, /* isInfallible. False in setters. */ |
6476 | | false, /* isMovable. Not relevant for setters. */ |
6477 | | false, /* isEliminatable. Not relevant for setters. */ |
6478 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
6479 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
6480 | | false, /* isTypedMethod. Only relevant for methods. */ |
6481 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
6482 | | }; |
6483 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
6484 | | static_assert(0 < 1, "There is no slot for us"); |
6485 | | |
6486 | | static bool |
6487 | | _addProperty(JSContext* cx, JS::Handle<JSObject*> obj, JS::Handle<jsid> id, JS::Handle<JS::Value> val) |
6488 | 0 | { |
6489 | 0 | mozilla::DOMSVGPathSegLinetoAbs* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::DOMSVGPathSegLinetoAbs>(obj); |
6490 | 0 | // We don't want to preserve if we don't have a wrapper, and we |
6491 | 0 | // obviously can't preserve if we're not initialized. |
6492 | 0 | if (self && self->GetWrapperPreserveColor()) { |
6493 | 0 | PreserveWrapper(self); |
6494 | 0 | } |
6495 | 0 | return true; |
6496 | 0 | } |
6497 | | |
6498 | | static void |
6499 | | _finalize(js::FreeOp* fop, JSObject* obj) |
6500 | 0 | { |
6501 | 0 | mozilla::DOMSVGPathSegLinetoAbs* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::DOMSVGPathSegLinetoAbs>(obj); |
6502 | 0 | if (self) { |
6503 | 0 | ClearWrapper(self, self, obj); |
6504 | 0 | AddForDeferredFinalization<mozilla::DOMSVGPathSegLinetoAbs>(self); |
6505 | 0 | } |
6506 | 0 | } |
6507 | | |
6508 | | static size_t |
6509 | | _objectMoved(JSObject* obj, JSObject* old) |
6510 | 0 | { |
6511 | 0 | mozilla::DOMSVGPathSegLinetoAbs* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::DOMSVGPathSegLinetoAbs>(obj); |
6512 | 0 | if (self) { |
6513 | 0 | UpdateWrapper(self, self, obj, old); |
6514 | 0 | } |
6515 | 0 |
|
6516 | 0 | return 0; |
6517 | 0 | } |
6518 | | |
6519 | | // We deliberately use brace-elision to make Visual Studio produce better initalization code. |
6520 | | #if defined(__clang__) |
6521 | | #pragma clang diagnostic push |
6522 | | #pragma clang diagnostic ignored "-Wmissing-braces" |
6523 | | #endif |
6524 | | static const JSPropertySpec sAttributes_specs[] = { |
6525 | | { "x", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &x_getterinfo, GenericSetter<NormalThisPolicy>, &x_setterinfo }, |
6526 | | { "y", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &y_getterinfo, GenericSetter<NormalThisPolicy>, &y_setterinfo }, |
6527 | | { nullptr, 0, nullptr, nullptr, nullptr, nullptr } |
6528 | | }; |
6529 | | #if defined(__clang__) |
6530 | | #pragma clang diagnostic pop |
6531 | | #endif |
6532 | | |
6533 | | |
6534 | | static const Prefable<const JSPropertySpec> sAttributes[] = { |
6535 | | { nullptr, &sAttributes_specs[0] }, |
6536 | | { nullptr, nullptr } |
6537 | | }; |
6538 | | |
6539 | | static_assert(1 <= 1ull << NUM_BITS_PROPERTY_INFO_PREF_INDEX, |
6540 | | "We have a prefable index that is >= (1 << NUM_BITS_PROPERTY_INFO_PREF_INDEX)"); |
6541 | | static_assert(2 <= 1ull << NUM_BITS_PROPERTY_INFO_SPEC_INDEX, |
6542 | | "We have a spec index that is >= (1 << NUM_BITS_PROPERTY_INFO_SPEC_INDEX)"); |
6543 | | |
6544 | | |
6545 | | static uint16_t sNativeProperties_sortedPropertyIndices[2]; |
6546 | | static PropertyInfo sNativeProperties_propertyInfos[2]; |
6547 | | |
6548 | | static const NativePropertiesN<1> sNativeProperties = { |
6549 | | false, 0, |
6550 | | false, 0, |
6551 | | false, 0, |
6552 | | true, 0 /* sAttributes */, |
6553 | | false, 0, |
6554 | | false, 0, |
6555 | | false, 0, |
6556 | | -1, |
6557 | | 2, |
6558 | | sNativeProperties_sortedPropertyIndices, |
6559 | | { |
6560 | | { sAttributes, &sNativeProperties_propertyInfos[0] } |
6561 | | } |
6562 | | }; |
6563 | | static_assert(2 < 1ull << CHAR_BIT * sizeof(sNativeProperties.propertyInfoCount), |
6564 | | "We have a property info count that is oversized"); |
6565 | | |
6566 | | static const DOMIfaceAndProtoJSClass sPrototypeClass = { |
6567 | | { |
6568 | | "SVGPathSegLinetoAbsPrototype", |
6569 | | JSCLASS_IS_DOMIFACEANDPROTOJSCLASS | JSCLASS_HAS_RESERVED_SLOTS(DOM_INTERFACE_PROTO_SLOTS_BASE), |
6570 | | JS_NULL_CLASS_OPS, |
6571 | | JS_NULL_CLASS_SPEC, |
6572 | | JS_NULL_CLASS_EXT, |
6573 | | JS_NULL_OBJECT_OPS |
6574 | | }, |
6575 | | eInterfacePrototype, |
6576 | | false, |
6577 | | prototypes::id::SVGPathSegLinetoAbs, |
6578 | | PrototypeTraits<prototypes::id::SVGPathSegLinetoAbs>::Depth, |
6579 | | sNativePropertyHooks, |
6580 | | "[object SVGPathSegLinetoAbsPrototype]", |
6581 | | SVGPathSeg_Binding::GetProtoObject |
6582 | | }; |
6583 | | |
6584 | | static const js::ClassOps sClassOps = { |
6585 | | _addProperty, /* addProperty */ |
6586 | | nullptr, /* delProperty */ |
6587 | | nullptr, /* enumerate */ |
6588 | | nullptr, /* newEnumerate */ |
6589 | | nullptr, /* resolve */ |
6590 | | nullptr, /* mayResolve */ |
6591 | | _finalize, /* finalize */ |
6592 | | nullptr, /* call */ |
6593 | | nullptr, /* hasInstance */ |
6594 | | nullptr, /* construct */ |
6595 | | nullptr, /* trace */ |
6596 | | }; |
6597 | | |
6598 | | static const js::ClassExtension sClassExtension = { |
6599 | | nullptr, /* weakmapKeyDelegateOp */ |
6600 | | _objectMoved /* objectMovedOp */ |
6601 | | }; |
6602 | | |
6603 | | static const DOMJSClass sClass = { |
6604 | | { "SVGPathSegLinetoAbs", |
6605 | | JSCLASS_IS_DOMJSCLASS | JSCLASS_FOREGROUND_FINALIZE | JSCLASS_HAS_RESERVED_SLOTS(1), |
6606 | | &sClassOps, |
6607 | | JS_NULL_CLASS_SPEC, |
6608 | | &sClassExtension, |
6609 | | JS_NULL_OBJECT_OPS |
6610 | | }, |
6611 | | { prototypes::id::SVGPathSeg, prototypes::id::SVGPathSegLinetoAbs, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count }, |
6612 | | IsBaseOf<nsISupports, mozilla::DOMSVGPathSegLinetoAbs >::value, |
6613 | | sNativePropertyHooks, |
6614 | | FindAssociatedGlobalForNative<mozilla::DOMSVGPathSegLinetoAbs>::Get, |
6615 | | GetProtoObjectHandle, |
6616 | | GetCCParticipant<mozilla::DOMSVGPathSegLinetoAbs>::Get() |
6617 | | }; |
6618 | | static_assert(1 == DOM_INSTANCE_RESERVED_SLOTS, |
6619 | | "Must have the right minimal number of reserved slots."); |
6620 | | static_assert(1 >= 1, |
6621 | | "Must have enough reserved slots."); |
6622 | | |
6623 | | const JSClass* |
6624 | | GetJSClass() |
6625 | 0 | { |
6626 | 0 | return sClass.ToJSClass(); |
6627 | 0 | } |
6628 | | |
6629 | | bool |
6630 | | Wrap(JSContext* aCx, mozilla::DOMSVGPathSegLinetoAbs* aObject, nsWrapperCache* aCache, JS::Handle<JSObject*> aGivenProto, JS::MutableHandle<JSObject*> aReflector) |
6631 | 0 | { |
6632 | 0 | static_assert(!IsBaseOf<NonRefcountedDOMObject, mozilla::DOMSVGPathSegLinetoAbs>::value, |
6633 | 0 | "Shouldn't have wrappercached things that are not refcounted."); |
6634 | 0 | MOZ_ASSERT(static_cast<mozilla::DOMSVGPathSegLinetoAbs*>(aObject) == |
6635 | 0 | reinterpret_cast<mozilla::DOMSVGPathSegLinetoAbs*>(aObject), |
6636 | 0 | "Multiple inheritance for mozilla::DOMSVGPathSegLinetoAbs is broken."); |
6637 | 0 | MOZ_ASSERT(static_cast<mozilla::DOMSVGPathSeg*>(aObject) == |
6638 | 0 | reinterpret_cast<mozilla::DOMSVGPathSeg*>(aObject), |
6639 | 0 | "Multiple inheritance for mozilla::DOMSVGPathSeg is broken."); |
6640 | 0 | MOZ_ASSERT(ToSupportsIsCorrect(aObject)); |
6641 | 0 | MOZ_ASSERT_IF(aGivenProto, js::IsObjectInContextCompartment(aGivenProto, aCx)); |
6642 | 0 | MOZ_ASSERT(!aCache->GetWrapper(), |
6643 | 0 | "You should probably not be using Wrap() directly; use " |
6644 | 0 | "GetOrCreateDOMReflector instead"); |
6645 | 0 |
|
6646 | 0 | MOZ_ASSERT(ToSupportsIsOnPrimaryInheritanceChain(aObject, aCache), |
6647 | 0 | "nsISupports must be on our primary inheritance chain"); |
6648 | 0 |
|
6649 | 0 | JS::Rooted<JSObject*> global(aCx, FindAssociatedGlobal(aCx, aObject->GetParentObject())); |
6650 | 0 | if (!global) { |
6651 | 0 | return false; |
6652 | 0 | } |
6653 | 0 | MOZ_ASSERT(JS_IsGlobalObject(global)); |
6654 | 0 | MOZ_ASSERT(JS::ObjectIsNotGray(global)); |
6655 | 0 |
|
6656 | 0 | // That might have ended up wrapping us already, due to the wonders |
6657 | 0 | // of XBL. Check for that, and bail out as needed. |
6658 | 0 | aReflector.set(aCache->GetWrapper()); |
6659 | 0 | if (aReflector) { |
6660 | | #ifdef DEBUG |
6661 | | AssertReflectorHasGivenProto(aCx, aReflector, aGivenProto); |
6662 | | #endif // DEBUG |
6663 | | return true; |
6664 | 0 | } |
6665 | 0 |
|
6666 | 0 | JSAutoRealm ar(aCx, global); |
6667 | 0 | JS::Handle<JSObject*> canonicalProto = GetProtoObjectHandle(aCx); |
6668 | 0 | if (!canonicalProto) { |
6669 | 0 | return false; |
6670 | 0 | } |
6671 | 0 | JS::Rooted<JSObject*> proto(aCx); |
6672 | 0 | if (aGivenProto) { |
6673 | 0 | proto = aGivenProto; |
6674 | 0 | // Unfortunately, while aGivenProto was in the compartment of aCx |
6675 | 0 | // coming in, we changed compartments to that of "parent" so may need |
6676 | 0 | // to wrap the proto here. |
6677 | 0 | if (js::GetContextCompartment(aCx) != js::GetObjectCompartment(proto)) { |
6678 | 0 | if (!JS_WrapObject(aCx, &proto)) { |
6679 | 0 | return false; |
6680 | 0 | } |
6681 | 0 | } |
6682 | 0 | } else { |
6683 | 0 | proto = canonicalProto; |
6684 | 0 | } |
6685 | 0 |
|
6686 | 0 | BindingJSObjectCreator<mozilla::DOMSVGPathSegLinetoAbs> creator(aCx); |
6687 | 0 | creator.CreateObject(aCx, sClass.ToJSClass(), proto, aObject, aReflector); |
6688 | 0 | if (!aReflector) { |
6689 | 0 | return false; |
6690 | 0 | } |
6691 | 0 | |
6692 | 0 | aCache->SetWrapper(aReflector); |
6693 | 0 | creator.InitializationSucceeded(); |
6694 | 0 |
|
6695 | 0 | MOZ_ASSERT(aCache->GetWrapperPreserveColor() && |
6696 | 0 | aCache->GetWrapperPreserveColor() == aReflector); |
6697 | 0 | // If proto != canonicalProto, we have to preserve our wrapper; |
6698 | 0 | // otherwise we won't be able to properly recreate it later, since |
6699 | 0 | // we won't know what proto to use. Note that we don't check |
6700 | 0 | // aGivenProto here, since it's entirely possible (and even |
6701 | 0 | // somewhat common) to have a non-null aGivenProto which is the |
6702 | 0 | // same as canonicalProto. |
6703 | 0 | if (proto != canonicalProto) { |
6704 | 0 | PreserveWrapper(aObject); |
6705 | 0 | } |
6706 | 0 |
|
6707 | 0 | return true; |
6708 | 0 | } |
6709 | | |
6710 | | const NativePropertyHooks sNativePropertyHooks[] = { { |
6711 | | nullptr, |
6712 | | nullptr, |
6713 | | nullptr, |
6714 | | { sNativeProperties.Upcast(), nullptr }, |
6715 | | prototypes::id::SVGPathSegLinetoAbs, |
6716 | | constructors::id::_ID_Count, |
6717 | | SVGPathSeg_Binding::sNativePropertyHooks, |
6718 | | &DefaultXrayExpandoObjectClass |
6719 | | } }; |
6720 | | |
6721 | | void |
6722 | | CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, bool aDefineOnGlobal) |
6723 | 0 | { |
6724 | 0 | JS::Handle<JSObject*> parentProto(SVGPathSeg_Binding::GetProtoObjectHandle(aCx)); |
6725 | 0 | if (!parentProto) { |
6726 | 0 | return; |
6727 | 0 | } |
6728 | 0 | |
6729 | 0 | static bool sIdsInited = false; |
6730 | 0 | if (!sIdsInited && NS_IsMainThread()) { |
6731 | 0 | if (!InitIds(aCx, sNativeProperties.Upcast())) { |
6732 | 0 | return; |
6733 | 0 | } |
6734 | 0 | sIdsInited = true; |
6735 | 0 | } |
6736 | 0 |
|
6737 | 0 | JS::Heap<JSObject*>* protoCache = &aProtoAndIfaceCache.EntrySlotOrCreate(prototypes::id::SVGPathSegLinetoAbs); |
6738 | 0 | JS::Heap<JSObject*>* interfaceCache = nullptr; |
6739 | 0 | dom::CreateInterfaceObjects(aCx, aGlobal, parentProto, |
6740 | 0 | &sPrototypeClass.mBase, protoCache, |
6741 | 0 | nullptr, |
6742 | 0 | nullptr, nullptr, 0, nullptr, |
6743 | 0 | interfaceCache, |
6744 | 0 | sNativeProperties.Upcast(), |
6745 | 0 | nullptr, |
6746 | 0 | nullptr, aDefineOnGlobal, |
6747 | 0 | nullptr, |
6748 | 0 | false); |
6749 | 0 | } |
6750 | | |
6751 | | } // namespace SVGPathSegLinetoAbs_Binding |
6752 | | |
6753 | | |
6754 | | |
6755 | | namespace SVGPathSegLinetoHorizontalAbs_Binding { |
6756 | | |
6757 | | static_assert(IsRefcounted<NativeType>::value == IsRefcounted<SVGPathSeg_Binding::NativeType>::value, |
6758 | | "Can't inherit from an interface with a different ownership model."); |
6759 | | |
6760 | | MOZ_CAN_RUN_SCRIPT static bool |
6761 | | get_x(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::DOMSVGPathSegLinetoHorizontalAbs* self, JSJitGetterCallArgs args) |
6762 | 0 | { |
6763 | 0 | AUTO_PROFILER_LABEL_FAST("get SVGPathSegLinetoHorizontalAbs.x", DOM, cx); |
6764 | 0 |
|
6765 | 0 | float result(self->X()); |
6766 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
6767 | 0 | args.rval().set(JS_NumberValue(double(result))); |
6768 | 0 | return true; |
6769 | 0 | } |
6770 | | |
6771 | | MOZ_CAN_RUN_SCRIPT static bool |
6772 | | set_x(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::DOMSVGPathSegLinetoHorizontalAbs* self, JSJitSetterCallArgs args) |
6773 | 0 | { |
6774 | 0 | AUTO_PROFILER_LABEL_FAST("set SVGPathSegLinetoHorizontalAbs.x", DOM, cx); |
6775 | 0 |
|
6776 | 0 | float arg0; |
6777 | 0 | if (!ValueToPrimitive<float, eDefault>(cx, args[0], &arg0)) { |
6778 | 0 | return false; |
6779 | 0 | } else if (!mozilla::IsFinite(arg0)) { |
6780 | 0 | ThrowErrorMessage(cx, MSG_NOT_FINITE, "Value being assigned to SVGPathSegLinetoHorizontalAbs.x"); |
6781 | 0 | return false; |
6782 | 0 | } |
6783 | 0 | FastErrorResult rv; |
6784 | 0 | self->SetX(arg0, rv); |
6785 | 0 | if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) { |
6786 | 0 | return false; |
6787 | 0 | } |
6788 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
6789 | 0 |
|
6790 | 0 | return true; |
6791 | 0 | } |
6792 | | |
6793 | | static const JSJitInfo x_getterinfo = { |
6794 | | { (JSJitGetterOp)get_x }, |
6795 | | { prototypes::id::SVGPathSegLinetoHorizontalAbs }, |
6796 | | { PrototypeTraits<prototypes::id::SVGPathSegLinetoHorizontalAbs>::Depth }, |
6797 | | JSJitInfo::Getter, |
6798 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
6799 | | JSVAL_TYPE_DOUBLE, /* returnType. Not relevant for setters. */ |
6800 | | true, /* isInfallible. False in setters. */ |
6801 | | false, /* isMovable. Not relevant for setters. */ |
6802 | | false, /* isEliminatable. Not relevant for setters. */ |
6803 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
6804 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
6805 | | false, /* isTypedMethod. Only relevant for methods. */ |
6806 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
6807 | | }; |
6808 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
6809 | | static_assert(0 < 1, "There is no slot for us"); |
6810 | | static const JSJitInfo x_setterinfo = { |
6811 | | { (JSJitGetterOp)set_x }, |
6812 | | { prototypes::id::SVGPathSegLinetoHorizontalAbs }, |
6813 | | { PrototypeTraits<prototypes::id::SVGPathSegLinetoHorizontalAbs>::Depth }, |
6814 | | JSJitInfo::Setter, |
6815 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
6816 | | JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */ |
6817 | | false, /* isInfallible. False in setters. */ |
6818 | | false, /* isMovable. Not relevant for setters. */ |
6819 | | false, /* isEliminatable. Not relevant for setters. */ |
6820 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
6821 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
6822 | | false, /* isTypedMethod. Only relevant for methods. */ |
6823 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
6824 | | }; |
6825 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
6826 | | static_assert(0 < 1, "There is no slot for us"); |
6827 | | |
6828 | | static bool |
6829 | | _addProperty(JSContext* cx, JS::Handle<JSObject*> obj, JS::Handle<jsid> id, JS::Handle<JS::Value> val) |
6830 | 0 | { |
6831 | 0 | mozilla::DOMSVGPathSegLinetoHorizontalAbs* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::DOMSVGPathSegLinetoHorizontalAbs>(obj); |
6832 | 0 | // We don't want to preserve if we don't have a wrapper, and we |
6833 | 0 | // obviously can't preserve if we're not initialized. |
6834 | 0 | if (self && self->GetWrapperPreserveColor()) { |
6835 | 0 | PreserveWrapper(self); |
6836 | 0 | } |
6837 | 0 | return true; |
6838 | 0 | } |
6839 | | |
6840 | | static void |
6841 | | _finalize(js::FreeOp* fop, JSObject* obj) |
6842 | 0 | { |
6843 | 0 | mozilla::DOMSVGPathSegLinetoHorizontalAbs* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::DOMSVGPathSegLinetoHorizontalAbs>(obj); |
6844 | 0 | if (self) { |
6845 | 0 | ClearWrapper(self, self, obj); |
6846 | 0 | AddForDeferredFinalization<mozilla::DOMSVGPathSegLinetoHorizontalAbs>(self); |
6847 | 0 | } |
6848 | 0 | } |
6849 | | |
6850 | | static size_t |
6851 | | _objectMoved(JSObject* obj, JSObject* old) |
6852 | 0 | { |
6853 | 0 | mozilla::DOMSVGPathSegLinetoHorizontalAbs* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::DOMSVGPathSegLinetoHorizontalAbs>(obj); |
6854 | 0 | if (self) { |
6855 | 0 | UpdateWrapper(self, self, obj, old); |
6856 | 0 | } |
6857 | 0 |
|
6858 | 0 | return 0; |
6859 | 0 | } |
6860 | | |
6861 | | // We deliberately use brace-elision to make Visual Studio produce better initalization code. |
6862 | | #if defined(__clang__) |
6863 | | #pragma clang diagnostic push |
6864 | | #pragma clang diagnostic ignored "-Wmissing-braces" |
6865 | | #endif |
6866 | | static const JSPropertySpec sAttributes_specs[] = { |
6867 | | { "x", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &x_getterinfo, GenericSetter<NormalThisPolicy>, &x_setterinfo }, |
6868 | | { nullptr, 0, nullptr, nullptr, nullptr, nullptr } |
6869 | | }; |
6870 | | #if defined(__clang__) |
6871 | | #pragma clang diagnostic pop |
6872 | | #endif |
6873 | | |
6874 | | |
6875 | | static const Prefable<const JSPropertySpec> sAttributes[] = { |
6876 | | { nullptr, &sAttributes_specs[0] }, |
6877 | | { nullptr, nullptr } |
6878 | | }; |
6879 | | |
6880 | | static_assert(1 <= 1ull << NUM_BITS_PROPERTY_INFO_PREF_INDEX, |
6881 | | "We have a prefable index that is >= (1 << NUM_BITS_PROPERTY_INFO_PREF_INDEX)"); |
6882 | | static_assert(1 <= 1ull << NUM_BITS_PROPERTY_INFO_SPEC_INDEX, |
6883 | | "We have a spec index that is >= (1 << NUM_BITS_PROPERTY_INFO_SPEC_INDEX)"); |
6884 | | |
6885 | | |
6886 | | static uint16_t sNativeProperties_sortedPropertyIndices[1]; |
6887 | | static PropertyInfo sNativeProperties_propertyInfos[1]; |
6888 | | |
6889 | | static const NativePropertiesN<1> sNativeProperties = { |
6890 | | false, 0, |
6891 | | false, 0, |
6892 | | false, 0, |
6893 | | true, 0 /* sAttributes */, |
6894 | | false, 0, |
6895 | | false, 0, |
6896 | | false, 0, |
6897 | | -1, |
6898 | | 1, |
6899 | | sNativeProperties_sortedPropertyIndices, |
6900 | | { |
6901 | | { sAttributes, &sNativeProperties_propertyInfos[0] } |
6902 | | } |
6903 | | }; |
6904 | | static_assert(1 < 1ull << CHAR_BIT * sizeof(sNativeProperties.propertyInfoCount), |
6905 | | "We have a property info count that is oversized"); |
6906 | | |
6907 | | static const DOMIfaceAndProtoJSClass sPrototypeClass = { |
6908 | | { |
6909 | | "SVGPathSegLinetoHorizontalAbsPrototype", |
6910 | | JSCLASS_IS_DOMIFACEANDPROTOJSCLASS | JSCLASS_HAS_RESERVED_SLOTS(DOM_INTERFACE_PROTO_SLOTS_BASE), |
6911 | | JS_NULL_CLASS_OPS, |
6912 | | JS_NULL_CLASS_SPEC, |
6913 | | JS_NULL_CLASS_EXT, |
6914 | | JS_NULL_OBJECT_OPS |
6915 | | }, |
6916 | | eInterfacePrototype, |
6917 | | false, |
6918 | | prototypes::id::SVGPathSegLinetoHorizontalAbs, |
6919 | | PrototypeTraits<prototypes::id::SVGPathSegLinetoHorizontalAbs>::Depth, |
6920 | | sNativePropertyHooks, |
6921 | | "[object SVGPathSegLinetoHorizontalAbsPrototype]", |
6922 | | SVGPathSeg_Binding::GetProtoObject |
6923 | | }; |
6924 | | |
6925 | | static const js::ClassOps sClassOps = { |
6926 | | _addProperty, /* addProperty */ |
6927 | | nullptr, /* delProperty */ |
6928 | | nullptr, /* enumerate */ |
6929 | | nullptr, /* newEnumerate */ |
6930 | | nullptr, /* resolve */ |
6931 | | nullptr, /* mayResolve */ |
6932 | | _finalize, /* finalize */ |
6933 | | nullptr, /* call */ |
6934 | | nullptr, /* hasInstance */ |
6935 | | nullptr, /* construct */ |
6936 | | nullptr, /* trace */ |
6937 | | }; |
6938 | | |
6939 | | static const js::ClassExtension sClassExtension = { |
6940 | | nullptr, /* weakmapKeyDelegateOp */ |
6941 | | _objectMoved /* objectMovedOp */ |
6942 | | }; |
6943 | | |
6944 | | static const DOMJSClass sClass = { |
6945 | | { "SVGPathSegLinetoHorizontalAbs", |
6946 | | JSCLASS_IS_DOMJSCLASS | JSCLASS_FOREGROUND_FINALIZE | JSCLASS_HAS_RESERVED_SLOTS(1), |
6947 | | &sClassOps, |
6948 | | JS_NULL_CLASS_SPEC, |
6949 | | &sClassExtension, |
6950 | | JS_NULL_OBJECT_OPS |
6951 | | }, |
6952 | | { prototypes::id::SVGPathSeg, prototypes::id::SVGPathSegLinetoHorizontalAbs, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count }, |
6953 | | IsBaseOf<nsISupports, mozilla::DOMSVGPathSegLinetoHorizontalAbs >::value, |
6954 | | sNativePropertyHooks, |
6955 | | FindAssociatedGlobalForNative<mozilla::DOMSVGPathSegLinetoHorizontalAbs>::Get, |
6956 | | GetProtoObjectHandle, |
6957 | | GetCCParticipant<mozilla::DOMSVGPathSegLinetoHorizontalAbs>::Get() |
6958 | | }; |
6959 | | static_assert(1 == DOM_INSTANCE_RESERVED_SLOTS, |
6960 | | "Must have the right minimal number of reserved slots."); |
6961 | | static_assert(1 >= 1, |
6962 | | "Must have enough reserved slots."); |
6963 | | |
6964 | | const JSClass* |
6965 | | GetJSClass() |
6966 | 0 | { |
6967 | 0 | return sClass.ToJSClass(); |
6968 | 0 | } |
6969 | | |
6970 | | bool |
6971 | | Wrap(JSContext* aCx, mozilla::DOMSVGPathSegLinetoHorizontalAbs* aObject, nsWrapperCache* aCache, JS::Handle<JSObject*> aGivenProto, JS::MutableHandle<JSObject*> aReflector) |
6972 | 0 | { |
6973 | 0 | static_assert(!IsBaseOf<NonRefcountedDOMObject, mozilla::DOMSVGPathSegLinetoHorizontalAbs>::value, |
6974 | 0 | "Shouldn't have wrappercached things that are not refcounted."); |
6975 | 0 | MOZ_ASSERT(static_cast<mozilla::DOMSVGPathSegLinetoHorizontalAbs*>(aObject) == |
6976 | 0 | reinterpret_cast<mozilla::DOMSVGPathSegLinetoHorizontalAbs*>(aObject), |
6977 | 0 | "Multiple inheritance for mozilla::DOMSVGPathSegLinetoHorizontalAbs is broken."); |
6978 | 0 | MOZ_ASSERT(static_cast<mozilla::DOMSVGPathSeg*>(aObject) == |
6979 | 0 | reinterpret_cast<mozilla::DOMSVGPathSeg*>(aObject), |
6980 | 0 | "Multiple inheritance for mozilla::DOMSVGPathSeg is broken."); |
6981 | 0 | MOZ_ASSERT(ToSupportsIsCorrect(aObject)); |
6982 | 0 | MOZ_ASSERT_IF(aGivenProto, js::IsObjectInContextCompartment(aGivenProto, aCx)); |
6983 | 0 | MOZ_ASSERT(!aCache->GetWrapper(), |
6984 | 0 | "You should probably not be using Wrap() directly; use " |
6985 | 0 | "GetOrCreateDOMReflector instead"); |
6986 | 0 |
|
6987 | 0 | MOZ_ASSERT(ToSupportsIsOnPrimaryInheritanceChain(aObject, aCache), |
6988 | 0 | "nsISupports must be on our primary inheritance chain"); |
6989 | 0 |
|
6990 | 0 | JS::Rooted<JSObject*> global(aCx, FindAssociatedGlobal(aCx, aObject->GetParentObject())); |
6991 | 0 | if (!global) { |
6992 | 0 | return false; |
6993 | 0 | } |
6994 | 0 | MOZ_ASSERT(JS_IsGlobalObject(global)); |
6995 | 0 | MOZ_ASSERT(JS::ObjectIsNotGray(global)); |
6996 | 0 |
|
6997 | 0 | // That might have ended up wrapping us already, due to the wonders |
6998 | 0 | // of XBL. Check for that, and bail out as needed. |
6999 | 0 | aReflector.set(aCache->GetWrapper()); |
7000 | 0 | if (aReflector) { |
7001 | | #ifdef DEBUG |
7002 | | AssertReflectorHasGivenProto(aCx, aReflector, aGivenProto); |
7003 | | #endif // DEBUG |
7004 | | return true; |
7005 | 0 | } |
7006 | 0 |
|
7007 | 0 | JSAutoRealm ar(aCx, global); |
7008 | 0 | JS::Handle<JSObject*> canonicalProto = GetProtoObjectHandle(aCx); |
7009 | 0 | if (!canonicalProto) { |
7010 | 0 | return false; |
7011 | 0 | } |
7012 | 0 | JS::Rooted<JSObject*> proto(aCx); |
7013 | 0 | if (aGivenProto) { |
7014 | 0 | proto = aGivenProto; |
7015 | 0 | // Unfortunately, while aGivenProto was in the compartment of aCx |
7016 | 0 | // coming in, we changed compartments to that of "parent" so may need |
7017 | 0 | // to wrap the proto here. |
7018 | 0 | if (js::GetContextCompartment(aCx) != js::GetObjectCompartment(proto)) { |
7019 | 0 | if (!JS_WrapObject(aCx, &proto)) { |
7020 | 0 | return false; |
7021 | 0 | } |
7022 | 0 | } |
7023 | 0 | } else { |
7024 | 0 | proto = canonicalProto; |
7025 | 0 | } |
7026 | 0 |
|
7027 | 0 | BindingJSObjectCreator<mozilla::DOMSVGPathSegLinetoHorizontalAbs> creator(aCx); |
7028 | 0 | creator.CreateObject(aCx, sClass.ToJSClass(), proto, aObject, aReflector); |
7029 | 0 | if (!aReflector) { |
7030 | 0 | return false; |
7031 | 0 | } |
7032 | 0 | |
7033 | 0 | aCache->SetWrapper(aReflector); |
7034 | 0 | creator.InitializationSucceeded(); |
7035 | 0 |
|
7036 | 0 | MOZ_ASSERT(aCache->GetWrapperPreserveColor() && |
7037 | 0 | aCache->GetWrapperPreserveColor() == aReflector); |
7038 | 0 | // If proto != canonicalProto, we have to preserve our wrapper; |
7039 | 0 | // otherwise we won't be able to properly recreate it later, since |
7040 | 0 | // we won't know what proto to use. Note that we don't check |
7041 | 0 | // aGivenProto here, since it's entirely possible (and even |
7042 | 0 | // somewhat common) to have a non-null aGivenProto which is the |
7043 | 0 | // same as canonicalProto. |
7044 | 0 | if (proto != canonicalProto) { |
7045 | 0 | PreserveWrapper(aObject); |
7046 | 0 | } |
7047 | 0 |
|
7048 | 0 | return true; |
7049 | 0 | } |
7050 | | |
7051 | | const NativePropertyHooks sNativePropertyHooks[] = { { |
7052 | | nullptr, |
7053 | | nullptr, |
7054 | | nullptr, |
7055 | | { sNativeProperties.Upcast(), nullptr }, |
7056 | | prototypes::id::SVGPathSegLinetoHorizontalAbs, |
7057 | | constructors::id::_ID_Count, |
7058 | | SVGPathSeg_Binding::sNativePropertyHooks, |
7059 | | &DefaultXrayExpandoObjectClass |
7060 | | } }; |
7061 | | |
7062 | | void |
7063 | | CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, bool aDefineOnGlobal) |
7064 | 0 | { |
7065 | 0 | JS::Handle<JSObject*> parentProto(SVGPathSeg_Binding::GetProtoObjectHandle(aCx)); |
7066 | 0 | if (!parentProto) { |
7067 | 0 | return; |
7068 | 0 | } |
7069 | 0 | |
7070 | 0 | static bool sIdsInited = false; |
7071 | 0 | if (!sIdsInited && NS_IsMainThread()) { |
7072 | 0 | if (!InitIds(aCx, sNativeProperties.Upcast())) { |
7073 | 0 | return; |
7074 | 0 | } |
7075 | 0 | sIdsInited = true; |
7076 | 0 | } |
7077 | 0 |
|
7078 | 0 | JS::Heap<JSObject*>* protoCache = &aProtoAndIfaceCache.EntrySlotOrCreate(prototypes::id::SVGPathSegLinetoHorizontalAbs); |
7079 | 0 | JS::Heap<JSObject*>* interfaceCache = nullptr; |
7080 | 0 | dom::CreateInterfaceObjects(aCx, aGlobal, parentProto, |
7081 | 0 | &sPrototypeClass.mBase, protoCache, |
7082 | 0 | nullptr, |
7083 | 0 | nullptr, nullptr, 0, nullptr, |
7084 | 0 | interfaceCache, |
7085 | 0 | sNativeProperties.Upcast(), |
7086 | 0 | nullptr, |
7087 | 0 | nullptr, aDefineOnGlobal, |
7088 | 0 | nullptr, |
7089 | 0 | false); |
7090 | 0 | } |
7091 | | |
7092 | | } // namespace SVGPathSegLinetoHorizontalAbs_Binding |
7093 | | |
7094 | | |
7095 | | |
7096 | | namespace SVGPathSegLinetoHorizontalRel_Binding { |
7097 | | |
7098 | | static_assert(IsRefcounted<NativeType>::value == IsRefcounted<SVGPathSeg_Binding::NativeType>::value, |
7099 | | "Can't inherit from an interface with a different ownership model."); |
7100 | | |
7101 | | MOZ_CAN_RUN_SCRIPT static bool |
7102 | | get_x(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::DOMSVGPathSegLinetoHorizontalRel* self, JSJitGetterCallArgs args) |
7103 | 0 | { |
7104 | 0 | AUTO_PROFILER_LABEL_FAST("get SVGPathSegLinetoHorizontalRel.x", DOM, cx); |
7105 | 0 |
|
7106 | 0 | float result(self->X()); |
7107 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
7108 | 0 | args.rval().set(JS_NumberValue(double(result))); |
7109 | 0 | return true; |
7110 | 0 | } |
7111 | | |
7112 | | MOZ_CAN_RUN_SCRIPT static bool |
7113 | | set_x(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::DOMSVGPathSegLinetoHorizontalRel* self, JSJitSetterCallArgs args) |
7114 | 0 | { |
7115 | 0 | AUTO_PROFILER_LABEL_FAST("set SVGPathSegLinetoHorizontalRel.x", DOM, cx); |
7116 | 0 |
|
7117 | 0 | float arg0; |
7118 | 0 | if (!ValueToPrimitive<float, eDefault>(cx, args[0], &arg0)) { |
7119 | 0 | return false; |
7120 | 0 | } else if (!mozilla::IsFinite(arg0)) { |
7121 | 0 | ThrowErrorMessage(cx, MSG_NOT_FINITE, "Value being assigned to SVGPathSegLinetoHorizontalRel.x"); |
7122 | 0 | return false; |
7123 | 0 | } |
7124 | 0 | FastErrorResult rv; |
7125 | 0 | self->SetX(arg0, rv); |
7126 | 0 | if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) { |
7127 | 0 | return false; |
7128 | 0 | } |
7129 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
7130 | 0 |
|
7131 | 0 | return true; |
7132 | 0 | } |
7133 | | |
7134 | | static const JSJitInfo x_getterinfo = { |
7135 | | { (JSJitGetterOp)get_x }, |
7136 | | { prototypes::id::SVGPathSegLinetoHorizontalRel }, |
7137 | | { PrototypeTraits<prototypes::id::SVGPathSegLinetoHorizontalRel>::Depth }, |
7138 | | JSJitInfo::Getter, |
7139 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
7140 | | JSVAL_TYPE_DOUBLE, /* returnType. Not relevant for setters. */ |
7141 | | true, /* isInfallible. False in setters. */ |
7142 | | false, /* isMovable. Not relevant for setters. */ |
7143 | | false, /* isEliminatable. Not relevant for setters. */ |
7144 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
7145 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
7146 | | false, /* isTypedMethod. Only relevant for methods. */ |
7147 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
7148 | | }; |
7149 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
7150 | | static_assert(0 < 1, "There is no slot for us"); |
7151 | | static const JSJitInfo x_setterinfo = { |
7152 | | { (JSJitGetterOp)set_x }, |
7153 | | { prototypes::id::SVGPathSegLinetoHorizontalRel }, |
7154 | | { PrototypeTraits<prototypes::id::SVGPathSegLinetoHorizontalRel>::Depth }, |
7155 | | JSJitInfo::Setter, |
7156 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
7157 | | JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */ |
7158 | | false, /* isInfallible. False in setters. */ |
7159 | | false, /* isMovable. Not relevant for setters. */ |
7160 | | false, /* isEliminatable. Not relevant for setters. */ |
7161 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
7162 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
7163 | | false, /* isTypedMethod. Only relevant for methods. */ |
7164 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
7165 | | }; |
7166 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
7167 | | static_assert(0 < 1, "There is no slot for us"); |
7168 | | |
7169 | | static bool |
7170 | | _addProperty(JSContext* cx, JS::Handle<JSObject*> obj, JS::Handle<jsid> id, JS::Handle<JS::Value> val) |
7171 | 0 | { |
7172 | 0 | mozilla::DOMSVGPathSegLinetoHorizontalRel* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::DOMSVGPathSegLinetoHorizontalRel>(obj); |
7173 | 0 | // We don't want to preserve if we don't have a wrapper, and we |
7174 | 0 | // obviously can't preserve if we're not initialized. |
7175 | 0 | if (self && self->GetWrapperPreserveColor()) { |
7176 | 0 | PreserveWrapper(self); |
7177 | 0 | } |
7178 | 0 | return true; |
7179 | 0 | } |
7180 | | |
7181 | | static void |
7182 | | _finalize(js::FreeOp* fop, JSObject* obj) |
7183 | 0 | { |
7184 | 0 | mozilla::DOMSVGPathSegLinetoHorizontalRel* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::DOMSVGPathSegLinetoHorizontalRel>(obj); |
7185 | 0 | if (self) { |
7186 | 0 | ClearWrapper(self, self, obj); |
7187 | 0 | AddForDeferredFinalization<mozilla::DOMSVGPathSegLinetoHorizontalRel>(self); |
7188 | 0 | } |
7189 | 0 | } |
7190 | | |
7191 | | static size_t |
7192 | | _objectMoved(JSObject* obj, JSObject* old) |
7193 | 0 | { |
7194 | 0 | mozilla::DOMSVGPathSegLinetoHorizontalRel* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::DOMSVGPathSegLinetoHorizontalRel>(obj); |
7195 | 0 | if (self) { |
7196 | 0 | UpdateWrapper(self, self, obj, old); |
7197 | 0 | } |
7198 | 0 |
|
7199 | 0 | return 0; |
7200 | 0 | } |
7201 | | |
7202 | | // We deliberately use brace-elision to make Visual Studio produce better initalization code. |
7203 | | #if defined(__clang__) |
7204 | | #pragma clang diagnostic push |
7205 | | #pragma clang diagnostic ignored "-Wmissing-braces" |
7206 | | #endif |
7207 | | static const JSPropertySpec sAttributes_specs[] = { |
7208 | | { "x", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &x_getterinfo, GenericSetter<NormalThisPolicy>, &x_setterinfo }, |
7209 | | { nullptr, 0, nullptr, nullptr, nullptr, nullptr } |
7210 | | }; |
7211 | | #if defined(__clang__) |
7212 | | #pragma clang diagnostic pop |
7213 | | #endif |
7214 | | |
7215 | | |
7216 | | static const Prefable<const JSPropertySpec> sAttributes[] = { |
7217 | | { nullptr, &sAttributes_specs[0] }, |
7218 | | { nullptr, nullptr } |
7219 | | }; |
7220 | | |
7221 | | static_assert(1 <= 1ull << NUM_BITS_PROPERTY_INFO_PREF_INDEX, |
7222 | | "We have a prefable index that is >= (1 << NUM_BITS_PROPERTY_INFO_PREF_INDEX)"); |
7223 | | static_assert(1 <= 1ull << NUM_BITS_PROPERTY_INFO_SPEC_INDEX, |
7224 | | "We have a spec index that is >= (1 << NUM_BITS_PROPERTY_INFO_SPEC_INDEX)"); |
7225 | | |
7226 | | |
7227 | | static uint16_t sNativeProperties_sortedPropertyIndices[1]; |
7228 | | static PropertyInfo sNativeProperties_propertyInfos[1]; |
7229 | | |
7230 | | static const NativePropertiesN<1> sNativeProperties = { |
7231 | | false, 0, |
7232 | | false, 0, |
7233 | | false, 0, |
7234 | | true, 0 /* sAttributes */, |
7235 | | false, 0, |
7236 | | false, 0, |
7237 | | false, 0, |
7238 | | -1, |
7239 | | 1, |
7240 | | sNativeProperties_sortedPropertyIndices, |
7241 | | { |
7242 | | { sAttributes, &sNativeProperties_propertyInfos[0] } |
7243 | | } |
7244 | | }; |
7245 | | static_assert(1 < 1ull << CHAR_BIT * sizeof(sNativeProperties.propertyInfoCount), |
7246 | | "We have a property info count that is oversized"); |
7247 | | |
7248 | | static const DOMIfaceAndProtoJSClass sPrototypeClass = { |
7249 | | { |
7250 | | "SVGPathSegLinetoHorizontalRelPrototype", |
7251 | | JSCLASS_IS_DOMIFACEANDPROTOJSCLASS | JSCLASS_HAS_RESERVED_SLOTS(DOM_INTERFACE_PROTO_SLOTS_BASE), |
7252 | | JS_NULL_CLASS_OPS, |
7253 | | JS_NULL_CLASS_SPEC, |
7254 | | JS_NULL_CLASS_EXT, |
7255 | | JS_NULL_OBJECT_OPS |
7256 | | }, |
7257 | | eInterfacePrototype, |
7258 | | false, |
7259 | | prototypes::id::SVGPathSegLinetoHorizontalRel, |
7260 | | PrototypeTraits<prototypes::id::SVGPathSegLinetoHorizontalRel>::Depth, |
7261 | | sNativePropertyHooks, |
7262 | | "[object SVGPathSegLinetoHorizontalRelPrototype]", |
7263 | | SVGPathSeg_Binding::GetProtoObject |
7264 | | }; |
7265 | | |
7266 | | static const js::ClassOps sClassOps = { |
7267 | | _addProperty, /* addProperty */ |
7268 | | nullptr, /* delProperty */ |
7269 | | nullptr, /* enumerate */ |
7270 | | nullptr, /* newEnumerate */ |
7271 | | nullptr, /* resolve */ |
7272 | | nullptr, /* mayResolve */ |
7273 | | _finalize, /* finalize */ |
7274 | | nullptr, /* call */ |
7275 | | nullptr, /* hasInstance */ |
7276 | | nullptr, /* construct */ |
7277 | | nullptr, /* trace */ |
7278 | | }; |
7279 | | |
7280 | | static const js::ClassExtension sClassExtension = { |
7281 | | nullptr, /* weakmapKeyDelegateOp */ |
7282 | | _objectMoved /* objectMovedOp */ |
7283 | | }; |
7284 | | |
7285 | | static const DOMJSClass sClass = { |
7286 | | { "SVGPathSegLinetoHorizontalRel", |
7287 | | JSCLASS_IS_DOMJSCLASS | JSCLASS_FOREGROUND_FINALIZE | JSCLASS_HAS_RESERVED_SLOTS(1), |
7288 | | &sClassOps, |
7289 | | JS_NULL_CLASS_SPEC, |
7290 | | &sClassExtension, |
7291 | | JS_NULL_OBJECT_OPS |
7292 | | }, |
7293 | | { prototypes::id::SVGPathSeg, prototypes::id::SVGPathSegLinetoHorizontalRel, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count }, |
7294 | | IsBaseOf<nsISupports, mozilla::DOMSVGPathSegLinetoHorizontalRel >::value, |
7295 | | sNativePropertyHooks, |
7296 | | FindAssociatedGlobalForNative<mozilla::DOMSVGPathSegLinetoHorizontalRel>::Get, |
7297 | | GetProtoObjectHandle, |
7298 | | GetCCParticipant<mozilla::DOMSVGPathSegLinetoHorizontalRel>::Get() |
7299 | | }; |
7300 | | static_assert(1 == DOM_INSTANCE_RESERVED_SLOTS, |
7301 | | "Must have the right minimal number of reserved slots."); |
7302 | | static_assert(1 >= 1, |
7303 | | "Must have enough reserved slots."); |
7304 | | |
7305 | | const JSClass* |
7306 | | GetJSClass() |
7307 | 0 | { |
7308 | 0 | return sClass.ToJSClass(); |
7309 | 0 | } |
7310 | | |
7311 | | bool |
7312 | | Wrap(JSContext* aCx, mozilla::DOMSVGPathSegLinetoHorizontalRel* aObject, nsWrapperCache* aCache, JS::Handle<JSObject*> aGivenProto, JS::MutableHandle<JSObject*> aReflector) |
7313 | 0 | { |
7314 | 0 | static_assert(!IsBaseOf<NonRefcountedDOMObject, mozilla::DOMSVGPathSegLinetoHorizontalRel>::value, |
7315 | 0 | "Shouldn't have wrappercached things that are not refcounted."); |
7316 | 0 | MOZ_ASSERT(static_cast<mozilla::DOMSVGPathSegLinetoHorizontalRel*>(aObject) == |
7317 | 0 | reinterpret_cast<mozilla::DOMSVGPathSegLinetoHorizontalRel*>(aObject), |
7318 | 0 | "Multiple inheritance for mozilla::DOMSVGPathSegLinetoHorizontalRel is broken."); |
7319 | 0 | MOZ_ASSERT(static_cast<mozilla::DOMSVGPathSeg*>(aObject) == |
7320 | 0 | reinterpret_cast<mozilla::DOMSVGPathSeg*>(aObject), |
7321 | 0 | "Multiple inheritance for mozilla::DOMSVGPathSeg is broken."); |
7322 | 0 | MOZ_ASSERT(ToSupportsIsCorrect(aObject)); |
7323 | 0 | MOZ_ASSERT_IF(aGivenProto, js::IsObjectInContextCompartment(aGivenProto, aCx)); |
7324 | 0 | MOZ_ASSERT(!aCache->GetWrapper(), |
7325 | 0 | "You should probably not be using Wrap() directly; use " |
7326 | 0 | "GetOrCreateDOMReflector instead"); |
7327 | 0 |
|
7328 | 0 | MOZ_ASSERT(ToSupportsIsOnPrimaryInheritanceChain(aObject, aCache), |
7329 | 0 | "nsISupports must be on our primary inheritance chain"); |
7330 | 0 |
|
7331 | 0 | JS::Rooted<JSObject*> global(aCx, FindAssociatedGlobal(aCx, aObject->GetParentObject())); |
7332 | 0 | if (!global) { |
7333 | 0 | return false; |
7334 | 0 | } |
7335 | 0 | MOZ_ASSERT(JS_IsGlobalObject(global)); |
7336 | 0 | MOZ_ASSERT(JS::ObjectIsNotGray(global)); |
7337 | 0 |
|
7338 | 0 | // That might have ended up wrapping us already, due to the wonders |
7339 | 0 | // of XBL. Check for that, and bail out as needed. |
7340 | 0 | aReflector.set(aCache->GetWrapper()); |
7341 | 0 | if (aReflector) { |
7342 | | #ifdef DEBUG |
7343 | | AssertReflectorHasGivenProto(aCx, aReflector, aGivenProto); |
7344 | | #endif // DEBUG |
7345 | | return true; |
7346 | 0 | } |
7347 | 0 |
|
7348 | 0 | JSAutoRealm ar(aCx, global); |
7349 | 0 | JS::Handle<JSObject*> canonicalProto = GetProtoObjectHandle(aCx); |
7350 | 0 | if (!canonicalProto) { |
7351 | 0 | return false; |
7352 | 0 | } |
7353 | 0 | JS::Rooted<JSObject*> proto(aCx); |
7354 | 0 | if (aGivenProto) { |
7355 | 0 | proto = aGivenProto; |
7356 | 0 | // Unfortunately, while aGivenProto was in the compartment of aCx |
7357 | 0 | // coming in, we changed compartments to that of "parent" so may need |
7358 | 0 | // to wrap the proto here. |
7359 | 0 | if (js::GetContextCompartment(aCx) != js::GetObjectCompartment(proto)) { |
7360 | 0 | if (!JS_WrapObject(aCx, &proto)) { |
7361 | 0 | return false; |
7362 | 0 | } |
7363 | 0 | } |
7364 | 0 | } else { |
7365 | 0 | proto = canonicalProto; |
7366 | 0 | } |
7367 | 0 |
|
7368 | 0 | BindingJSObjectCreator<mozilla::DOMSVGPathSegLinetoHorizontalRel> creator(aCx); |
7369 | 0 | creator.CreateObject(aCx, sClass.ToJSClass(), proto, aObject, aReflector); |
7370 | 0 | if (!aReflector) { |
7371 | 0 | return false; |
7372 | 0 | } |
7373 | 0 | |
7374 | 0 | aCache->SetWrapper(aReflector); |
7375 | 0 | creator.InitializationSucceeded(); |
7376 | 0 |
|
7377 | 0 | MOZ_ASSERT(aCache->GetWrapperPreserveColor() && |
7378 | 0 | aCache->GetWrapperPreserveColor() == aReflector); |
7379 | 0 | // If proto != canonicalProto, we have to preserve our wrapper; |
7380 | 0 | // otherwise we won't be able to properly recreate it later, since |
7381 | 0 | // we won't know what proto to use. Note that we don't check |
7382 | 0 | // aGivenProto here, since it's entirely possible (and even |
7383 | 0 | // somewhat common) to have a non-null aGivenProto which is the |
7384 | 0 | // same as canonicalProto. |
7385 | 0 | if (proto != canonicalProto) { |
7386 | 0 | PreserveWrapper(aObject); |
7387 | 0 | } |
7388 | 0 |
|
7389 | 0 | return true; |
7390 | 0 | } |
7391 | | |
7392 | | const NativePropertyHooks sNativePropertyHooks[] = { { |
7393 | | nullptr, |
7394 | | nullptr, |
7395 | | nullptr, |
7396 | | { sNativeProperties.Upcast(), nullptr }, |
7397 | | prototypes::id::SVGPathSegLinetoHorizontalRel, |
7398 | | constructors::id::_ID_Count, |
7399 | | SVGPathSeg_Binding::sNativePropertyHooks, |
7400 | | &DefaultXrayExpandoObjectClass |
7401 | | } }; |
7402 | | |
7403 | | void |
7404 | | CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, bool aDefineOnGlobal) |
7405 | 0 | { |
7406 | 0 | JS::Handle<JSObject*> parentProto(SVGPathSeg_Binding::GetProtoObjectHandle(aCx)); |
7407 | 0 | if (!parentProto) { |
7408 | 0 | return; |
7409 | 0 | } |
7410 | 0 | |
7411 | 0 | static bool sIdsInited = false; |
7412 | 0 | if (!sIdsInited && NS_IsMainThread()) { |
7413 | 0 | if (!InitIds(aCx, sNativeProperties.Upcast())) { |
7414 | 0 | return; |
7415 | 0 | } |
7416 | 0 | sIdsInited = true; |
7417 | 0 | } |
7418 | 0 |
|
7419 | 0 | JS::Heap<JSObject*>* protoCache = &aProtoAndIfaceCache.EntrySlotOrCreate(prototypes::id::SVGPathSegLinetoHorizontalRel); |
7420 | 0 | JS::Heap<JSObject*>* interfaceCache = nullptr; |
7421 | 0 | dom::CreateInterfaceObjects(aCx, aGlobal, parentProto, |
7422 | 0 | &sPrototypeClass.mBase, protoCache, |
7423 | 0 | nullptr, |
7424 | 0 | nullptr, nullptr, 0, nullptr, |
7425 | 0 | interfaceCache, |
7426 | 0 | sNativeProperties.Upcast(), |
7427 | 0 | nullptr, |
7428 | 0 | nullptr, aDefineOnGlobal, |
7429 | 0 | nullptr, |
7430 | 0 | false); |
7431 | 0 | } |
7432 | | |
7433 | | } // namespace SVGPathSegLinetoHorizontalRel_Binding |
7434 | | |
7435 | | |
7436 | | |
7437 | | namespace SVGPathSegLinetoRel_Binding { |
7438 | | |
7439 | | static_assert(IsRefcounted<NativeType>::value == IsRefcounted<SVGPathSeg_Binding::NativeType>::value, |
7440 | | "Can't inherit from an interface with a different ownership model."); |
7441 | | |
7442 | | MOZ_CAN_RUN_SCRIPT static bool |
7443 | | get_x(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::DOMSVGPathSegLinetoRel* self, JSJitGetterCallArgs args) |
7444 | 0 | { |
7445 | 0 | AUTO_PROFILER_LABEL_FAST("get SVGPathSegLinetoRel.x", DOM, cx); |
7446 | 0 |
|
7447 | 0 | float result(self->X()); |
7448 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
7449 | 0 | args.rval().set(JS_NumberValue(double(result))); |
7450 | 0 | return true; |
7451 | 0 | } |
7452 | | |
7453 | | MOZ_CAN_RUN_SCRIPT static bool |
7454 | | set_x(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::DOMSVGPathSegLinetoRel* self, JSJitSetterCallArgs args) |
7455 | 0 | { |
7456 | 0 | AUTO_PROFILER_LABEL_FAST("set SVGPathSegLinetoRel.x", DOM, cx); |
7457 | 0 |
|
7458 | 0 | float arg0; |
7459 | 0 | if (!ValueToPrimitive<float, eDefault>(cx, args[0], &arg0)) { |
7460 | 0 | return false; |
7461 | 0 | } else if (!mozilla::IsFinite(arg0)) { |
7462 | 0 | ThrowErrorMessage(cx, MSG_NOT_FINITE, "Value being assigned to SVGPathSegLinetoRel.x"); |
7463 | 0 | return false; |
7464 | 0 | } |
7465 | 0 | FastErrorResult rv; |
7466 | 0 | self->SetX(arg0, rv); |
7467 | 0 | if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) { |
7468 | 0 | return false; |
7469 | 0 | } |
7470 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
7471 | 0 |
|
7472 | 0 | return true; |
7473 | 0 | } |
7474 | | |
7475 | | static const JSJitInfo x_getterinfo = { |
7476 | | { (JSJitGetterOp)get_x }, |
7477 | | { prototypes::id::SVGPathSegLinetoRel }, |
7478 | | { PrototypeTraits<prototypes::id::SVGPathSegLinetoRel>::Depth }, |
7479 | | JSJitInfo::Getter, |
7480 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
7481 | | JSVAL_TYPE_DOUBLE, /* returnType. Not relevant for setters. */ |
7482 | | true, /* isInfallible. False in setters. */ |
7483 | | false, /* isMovable. Not relevant for setters. */ |
7484 | | false, /* isEliminatable. Not relevant for setters. */ |
7485 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
7486 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
7487 | | false, /* isTypedMethod. Only relevant for methods. */ |
7488 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
7489 | | }; |
7490 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
7491 | | static_assert(0 < 1, "There is no slot for us"); |
7492 | | static const JSJitInfo x_setterinfo = { |
7493 | | { (JSJitGetterOp)set_x }, |
7494 | | { prototypes::id::SVGPathSegLinetoRel }, |
7495 | | { PrototypeTraits<prototypes::id::SVGPathSegLinetoRel>::Depth }, |
7496 | | JSJitInfo::Setter, |
7497 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
7498 | | JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */ |
7499 | | false, /* isInfallible. False in setters. */ |
7500 | | false, /* isMovable. Not relevant for setters. */ |
7501 | | false, /* isEliminatable. Not relevant for setters. */ |
7502 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
7503 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
7504 | | false, /* isTypedMethod. Only relevant for methods. */ |
7505 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
7506 | | }; |
7507 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
7508 | | static_assert(0 < 1, "There is no slot for us"); |
7509 | | |
7510 | | MOZ_CAN_RUN_SCRIPT static bool |
7511 | | get_y(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::DOMSVGPathSegLinetoRel* self, JSJitGetterCallArgs args) |
7512 | 0 | { |
7513 | 0 | AUTO_PROFILER_LABEL_FAST("get SVGPathSegLinetoRel.y", DOM, cx); |
7514 | 0 |
|
7515 | 0 | float result(self->Y()); |
7516 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
7517 | 0 | args.rval().set(JS_NumberValue(double(result))); |
7518 | 0 | return true; |
7519 | 0 | } |
7520 | | |
7521 | | MOZ_CAN_RUN_SCRIPT static bool |
7522 | | set_y(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::DOMSVGPathSegLinetoRel* self, JSJitSetterCallArgs args) |
7523 | 0 | { |
7524 | 0 | AUTO_PROFILER_LABEL_FAST("set SVGPathSegLinetoRel.y", DOM, cx); |
7525 | 0 |
|
7526 | 0 | float arg0; |
7527 | 0 | if (!ValueToPrimitive<float, eDefault>(cx, args[0], &arg0)) { |
7528 | 0 | return false; |
7529 | 0 | } else if (!mozilla::IsFinite(arg0)) { |
7530 | 0 | ThrowErrorMessage(cx, MSG_NOT_FINITE, "Value being assigned to SVGPathSegLinetoRel.y"); |
7531 | 0 | return false; |
7532 | 0 | } |
7533 | 0 | FastErrorResult rv; |
7534 | 0 | self->SetY(arg0, rv); |
7535 | 0 | if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) { |
7536 | 0 | return false; |
7537 | 0 | } |
7538 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
7539 | 0 |
|
7540 | 0 | return true; |
7541 | 0 | } |
7542 | | |
7543 | | static const JSJitInfo y_getterinfo = { |
7544 | | { (JSJitGetterOp)get_y }, |
7545 | | { prototypes::id::SVGPathSegLinetoRel }, |
7546 | | { PrototypeTraits<prototypes::id::SVGPathSegLinetoRel>::Depth }, |
7547 | | JSJitInfo::Getter, |
7548 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
7549 | | JSVAL_TYPE_DOUBLE, /* returnType. Not relevant for setters. */ |
7550 | | true, /* isInfallible. False in setters. */ |
7551 | | false, /* isMovable. Not relevant for setters. */ |
7552 | | false, /* isEliminatable. Not relevant for setters. */ |
7553 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
7554 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
7555 | | false, /* isTypedMethod. Only relevant for methods. */ |
7556 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
7557 | | }; |
7558 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
7559 | | static_assert(0 < 1, "There is no slot for us"); |
7560 | | static const JSJitInfo y_setterinfo = { |
7561 | | { (JSJitGetterOp)set_y }, |
7562 | | { prototypes::id::SVGPathSegLinetoRel }, |
7563 | | { PrototypeTraits<prototypes::id::SVGPathSegLinetoRel>::Depth }, |
7564 | | JSJitInfo::Setter, |
7565 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
7566 | | JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */ |
7567 | | false, /* isInfallible. False in setters. */ |
7568 | | false, /* isMovable. Not relevant for setters. */ |
7569 | | false, /* isEliminatable. Not relevant for setters. */ |
7570 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
7571 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
7572 | | false, /* isTypedMethod. Only relevant for methods. */ |
7573 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
7574 | | }; |
7575 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
7576 | | static_assert(0 < 1, "There is no slot for us"); |
7577 | | |
7578 | | static bool |
7579 | | _addProperty(JSContext* cx, JS::Handle<JSObject*> obj, JS::Handle<jsid> id, JS::Handle<JS::Value> val) |
7580 | 0 | { |
7581 | 0 | mozilla::DOMSVGPathSegLinetoRel* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::DOMSVGPathSegLinetoRel>(obj); |
7582 | 0 | // We don't want to preserve if we don't have a wrapper, and we |
7583 | 0 | // obviously can't preserve if we're not initialized. |
7584 | 0 | if (self && self->GetWrapperPreserveColor()) { |
7585 | 0 | PreserveWrapper(self); |
7586 | 0 | } |
7587 | 0 | return true; |
7588 | 0 | } |
7589 | | |
7590 | | static void |
7591 | | _finalize(js::FreeOp* fop, JSObject* obj) |
7592 | 0 | { |
7593 | 0 | mozilla::DOMSVGPathSegLinetoRel* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::DOMSVGPathSegLinetoRel>(obj); |
7594 | 0 | if (self) { |
7595 | 0 | ClearWrapper(self, self, obj); |
7596 | 0 | AddForDeferredFinalization<mozilla::DOMSVGPathSegLinetoRel>(self); |
7597 | 0 | } |
7598 | 0 | } |
7599 | | |
7600 | | static size_t |
7601 | | _objectMoved(JSObject* obj, JSObject* old) |
7602 | 0 | { |
7603 | 0 | mozilla::DOMSVGPathSegLinetoRel* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::DOMSVGPathSegLinetoRel>(obj); |
7604 | 0 | if (self) { |
7605 | 0 | UpdateWrapper(self, self, obj, old); |
7606 | 0 | } |
7607 | 0 |
|
7608 | 0 | return 0; |
7609 | 0 | } |
7610 | | |
7611 | | // We deliberately use brace-elision to make Visual Studio produce better initalization code. |
7612 | | #if defined(__clang__) |
7613 | | #pragma clang diagnostic push |
7614 | | #pragma clang diagnostic ignored "-Wmissing-braces" |
7615 | | #endif |
7616 | | static const JSPropertySpec sAttributes_specs[] = { |
7617 | | { "x", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &x_getterinfo, GenericSetter<NormalThisPolicy>, &x_setterinfo }, |
7618 | | { "y", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &y_getterinfo, GenericSetter<NormalThisPolicy>, &y_setterinfo }, |
7619 | | { nullptr, 0, nullptr, nullptr, nullptr, nullptr } |
7620 | | }; |
7621 | | #if defined(__clang__) |
7622 | | #pragma clang diagnostic pop |
7623 | | #endif |
7624 | | |
7625 | | |
7626 | | static const Prefable<const JSPropertySpec> sAttributes[] = { |
7627 | | { nullptr, &sAttributes_specs[0] }, |
7628 | | { nullptr, nullptr } |
7629 | | }; |
7630 | | |
7631 | | static_assert(1 <= 1ull << NUM_BITS_PROPERTY_INFO_PREF_INDEX, |
7632 | | "We have a prefable index that is >= (1 << NUM_BITS_PROPERTY_INFO_PREF_INDEX)"); |
7633 | | static_assert(2 <= 1ull << NUM_BITS_PROPERTY_INFO_SPEC_INDEX, |
7634 | | "We have a spec index that is >= (1 << NUM_BITS_PROPERTY_INFO_SPEC_INDEX)"); |
7635 | | |
7636 | | |
7637 | | static uint16_t sNativeProperties_sortedPropertyIndices[2]; |
7638 | | static PropertyInfo sNativeProperties_propertyInfos[2]; |
7639 | | |
7640 | | static const NativePropertiesN<1> sNativeProperties = { |
7641 | | false, 0, |
7642 | | false, 0, |
7643 | | false, 0, |
7644 | | true, 0 /* sAttributes */, |
7645 | | false, 0, |
7646 | | false, 0, |
7647 | | false, 0, |
7648 | | -1, |
7649 | | 2, |
7650 | | sNativeProperties_sortedPropertyIndices, |
7651 | | { |
7652 | | { sAttributes, &sNativeProperties_propertyInfos[0] } |
7653 | | } |
7654 | | }; |
7655 | | static_assert(2 < 1ull << CHAR_BIT * sizeof(sNativeProperties.propertyInfoCount), |
7656 | | "We have a property info count that is oversized"); |
7657 | | |
7658 | | static const DOMIfaceAndProtoJSClass sPrototypeClass = { |
7659 | | { |
7660 | | "SVGPathSegLinetoRelPrototype", |
7661 | | JSCLASS_IS_DOMIFACEANDPROTOJSCLASS | JSCLASS_HAS_RESERVED_SLOTS(DOM_INTERFACE_PROTO_SLOTS_BASE), |
7662 | | JS_NULL_CLASS_OPS, |
7663 | | JS_NULL_CLASS_SPEC, |
7664 | | JS_NULL_CLASS_EXT, |
7665 | | JS_NULL_OBJECT_OPS |
7666 | | }, |
7667 | | eInterfacePrototype, |
7668 | | false, |
7669 | | prototypes::id::SVGPathSegLinetoRel, |
7670 | | PrototypeTraits<prototypes::id::SVGPathSegLinetoRel>::Depth, |
7671 | | sNativePropertyHooks, |
7672 | | "[object SVGPathSegLinetoRelPrototype]", |
7673 | | SVGPathSeg_Binding::GetProtoObject |
7674 | | }; |
7675 | | |
7676 | | static const js::ClassOps sClassOps = { |
7677 | | _addProperty, /* addProperty */ |
7678 | | nullptr, /* delProperty */ |
7679 | | nullptr, /* enumerate */ |
7680 | | nullptr, /* newEnumerate */ |
7681 | | nullptr, /* resolve */ |
7682 | | nullptr, /* mayResolve */ |
7683 | | _finalize, /* finalize */ |
7684 | | nullptr, /* call */ |
7685 | | nullptr, /* hasInstance */ |
7686 | | nullptr, /* construct */ |
7687 | | nullptr, /* trace */ |
7688 | | }; |
7689 | | |
7690 | | static const js::ClassExtension sClassExtension = { |
7691 | | nullptr, /* weakmapKeyDelegateOp */ |
7692 | | _objectMoved /* objectMovedOp */ |
7693 | | }; |
7694 | | |
7695 | | static const DOMJSClass sClass = { |
7696 | | { "SVGPathSegLinetoRel", |
7697 | | JSCLASS_IS_DOMJSCLASS | JSCLASS_FOREGROUND_FINALIZE | JSCLASS_HAS_RESERVED_SLOTS(1), |
7698 | | &sClassOps, |
7699 | | JS_NULL_CLASS_SPEC, |
7700 | | &sClassExtension, |
7701 | | JS_NULL_OBJECT_OPS |
7702 | | }, |
7703 | | { prototypes::id::SVGPathSeg, prototypes::id::SVGPathSegLinetoRel, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count }, |
7704 | | IsBaseOf<nsISupports, mozilla::DOMSVGPathSegLinetoRel >::value, |
7705 | | sNativePropertyHooks, |
7706 | | FindAssociatedGlobalForNative<mozilla::DOMSVGPathSegLinetoRel>::Get, |
7707 | | GetProtoObjectHandle, |
7708 | | GetCCParticipant<mozilla::DOMSVGPathSegLinetoRel>::Get() |
7709 | | }; |
7710 | | static_assert(1 == DOM_INSTANCE_RESERVED_SLOTS, |
7711 | | "Must have the right minimal number of reserved slots."); |
7712 | | static_assert(1 >= 1, |
7713 | | "Must have enough reserved slots."); |
7714 | | |
7715 | | const JSClass* |
7716 | | GetJSClass() |
7717 | 0 | { |
7718 | 0 | return sClass.ToJSClass(); |
7719 | 0 | } |
7720 | | |
7721 | | bool |
7722 | | Wrap(JSContext* aCx, mozilla::DOMSVGPathSegLinetoRel* aObject, nsWrapperCache* aCache, JS::Handle<JSObject*> aGivenProto, JS::MutableHandle<JSObject*> aReflector) |
7723 | 0 | { |
7724 | 0 | static_assert(!IsBaseOf<NonRefcountedDOMObject, mozilla::DOMSVGPathSegLinetoRel>::value, |
7725 | 0 | "Shouldn't have wrappercached things that are not refcounted."); |
7726 | 0 | MOZ_ASSERT(static_cast<mozilla::DOMSVGPathSegLinetoRel*>(aObject) == |
7727 | 0 | reinterpret_cast<mozilla::DOMSVGPathSegLinetoRel*>(aObject), |
7728 | 0 | "Multiple inheritance for mozilla::DOMSVGPathSegLinetoRel is broken."); |
7729 | 0 | MOZ_ASSERT(static_cast<mozilla::DOMSVGPathSeg*>(aObject) == |
7730 | 0 | reinterpret_cast<mozilla::DOMSVGPathSeg*>(aObject), |
7731 | 0 | "Multiple inheritance for mozilla::DOMSVGPathSeg is broken."); |
7732 | 0 | MOZ_ASSERT(ToSupportsIsCorrect(aObject)); |
7733 | 0 | MOZ_ASSERT_IF(aGivenProto, js::IsObjectInContextCompartment(aGivenProto, aCx)); |
7734 | 0 | MOZ_ASSERT(!aCache->GetWrapper(), |
7735 | 0 | "You should probably not be using Wrap() directly; use " |
7736 | 0 | "GetOrCreateDOMReflector instead"); |
7737 | 0 |
|
7738 | 0 | MOZ_ASSERT(ToSupportsIsOnPrimaryInheritanceChain(aObject, aCache), |
7739 | 0 | "nsISupports must be on our primary inheritance chain"); |
7740 | 0 |
|
7741 | 0 | JS::Rooted<JSObject*> global(aCx, FindAssociatedGlobal(aCx, aObject->GetParentObject())); |
7742 | 0 | if (!global) { |
7743 | 0 | return false; |
7744 | 0 | } |
7745 | 0 | MOZ_ASSERT(JS_IsGlobalObject(global)); |
7746 | 0 | MOZ_ASSERT(JS::ObjectIsNotGray(global)); |
7747 | 0 |
|
7748 | 0 | // That might have ended up wrapping us already, due to the wonders |
7749 | 0 | // of XBL. Check for that, and bail out as needed. |
7750 | 0 | aReflector.set(aCache->GetWrapper()); |
7751 | 0 | if (aReflector) { |
7752 | | #ifdef DEBUG |
7753 | | AssertReflectorHasGivenProto(aCx, aReflector, aGivenProto); |
7754 | | #endif // DEBUG |
7755 | | return true; |
7756 | 0 | } |
7757 | 0 |
|
7758 | 0 | JSAutoRealm ar(aCx, global); |
7759 | 0 | JS::Handle<JSObject*> canonicalProto = GetProtoObjectHandle(aCx); |
7760 | 0 | if (!canonicalProto) { |
7761 | 0 | return false; |
7762 | 0 | } |
7763 | 0 | JS::Rooted<JSObject*> proto(aCx); |
7764 | 0 | if (aGivenProto) { |
7765 | 0 | proto = aGivenProto; |
7766 | 0 | // Unfortunately, while aGivenProto was in the compartment of aCx |
7767 | 0 | // coming in, we changed compartments to that of "parent" so may need |
7768 | 0 | // to wrap the proto here. |
7769 | 0 | if (js::GetContextCompartment(aCx) != js::GetObjectCompartment(proto)) { |
7770 | 0 | if (!JS_WrapObject(aCx, &proto)) { |
7771 | 0 | return false; |
7772 | 0 | } |
7773 | 0 | } |
7774 | 0 | } else { |
7775 | 0 | proto = canonicalProto; |
7776 | 0 | } |
7777 | 0 |
|
7778 | 0 | BindingJSObjectCreator<mozilla::DOMSVGPathSegLinetoRel> creator(aCx); |
7779 | 0 | creator.CreateObject(aCx, sClass.ToJSClass(), proto, aObject, aReflector); |
7780 | 0 | if (!aReflector) { |
7781 | 0 | return false; |
7782 | 0 | } |
7783 | 0 | |
7784 | 0 | aCache->SetWrapper(aReflector); |
7785 | 0 | creator.InitializationSucceeded(); |
7786 | 0 |
|
7787 | 0 | MOZ_ASSERT(aCache->GetWrapperPreserveColor() && |
7788 | 0 | aCache->GetWrapperPreserveColor() == aReflector); |
7789 | 0 | // If proto != canonicalProto, we have to preserve our wrapper; |
7790 | 0 | // otherwise we won't be able to properly recreate it later, since |
7791 | 0 | // we won't know what proto to use. Note that we don't check |
7792 | 0 | // aGivenProto here, since it's entirely possible (and even |
7793 | 0 | // somewhat common) to have a non-null aGivenProto which is the |
7794 | 0 | // same as canonicalProto. |
7795 | 0 | if (proto != canonicalProto) { |
7796 | 0 | PreserveWrapper(aObject); |
7797 | 0 | } |
7798 | 0 |
|
7799 | 0 | return true; |
7800 | 0 | } |
7801 | | |
7802 | | const NativePropertyHooks sNativePropertyHooks[] = { { |
7803 | | nullptr, |
7804 | | nullptr, |
7805 | | nullptr, |
7806 | | { sNativeProperties.Upcast(), nullptr }, |
7807 | | prototypes::id::SVGPathSegLinetoRel, |
7808 | | constructors::id::_ID_Count, |
7809 | | SVGPathSeg_Binding::sNativePropertyHooks, |
7810 | | &DefaultXrayExpandoObjectClass |
7811 | | } }; |
7812 | | |
7813 | | void |
7814 | | CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, bool aDefineOnGlobal) |
7815 | 0 | { |
7816 | 0 | JS::Handle<JSObject*> parentProto(SVGPathSeg_Binding::GetProtoObjectHandle(aCx)); |
7817 | 0 | if (!parentProto) { |
7818 | 0 | return; |
7819 | 0 | } |
7820 | 0 | |
7821 | 0 | static bool sIdsInited = false; |
7822 | 0 | if (!sIdsInited && NS_IsMainThread()) { |
7823 | 0 | if (!InitIds(aCx, sNativeProperties.Upcast())) { |
7824 | 0 | return; |
7825 | 0 | } |
7826 | 0 | sIdsInited = true; |
7827 | 0 | } |
7828 | 0 |
|
7829 | 0 | JS::Heap<JSObject*>* protoCache = &aProtoAndIfaceCache.EntrySlotOrCreate(prototypes::id::SVGPathSegLinetoRel); |
7830 | 0 | JS::Heap<JSObject*>* interfaceCache = nullptr; |
7831 | 0 | dom::CreateInterfaceObjects(aCx, aGlobal, parentProto, |
7832 | 0 | &sPrototypeClass.mBase, protoCache, |
7833 | 0 | nullptr, |
7834 | 0 | nullptr, nullptr, 0, nullptr, |
7835 | 0 | interfaceCache, |
7836 | 0 | sNativeProperties.Upcast(), |
7837 | 0 | nullptr, |
7838 | 0 | nullptr, aDefineOnGlobal, |
7839 | 0 | nullptr, |
7840 | 0 | false); |
7841 | 0 | } |
7842 | | |
7843 | | } // namespace SVGPathSegLinetoRel_Binding |
7844 | | |
7845 | | |
7846 | | |
7847 | | namespace SVGPathSegLinetoVerticalAbs_Binding { |
7848 | | |
7849 | | static_assert(IsRefcounted<NativeType>::value == IsRefcounted<SVGPathSeg_Binding::NativeType>::value, |
7850 | | "Can't inherit from an interface with a different ownership model."); |
7851 | | |
7852 | | MOZ_CAN_RUN_SCRIPT static bool |
7853 | | get_y(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::DOMSVGPathSegLinetoVerticalAbs* self, JSJitGetterCallArgs args) |
7854 | 0 | { |
7855 | 0 | AUTO_PROFILER_LABEL_FAST("get SVGPathSegLinetoVerticalAbs.y", DOM, cx); |
7856 | 0 |
|
7857 | 0 | float result(self->Y()); |
7858 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
7859 | 0 | args.rval().set(JS_NumberValue(double(result))); |
7860 | 0 | return true; |
7861 | 0 | } |
7862 | | |
7863 | | MOZ_CAN_RUN_SCRIPT static bool |
7864 | | set_y(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::DOMSVGPathSegLinetoVerticalAbs* self, JSJitSetterCallArgs args) |
7865 | 0 | { |
7866 | 0 | AUTO_PROFILER_LABEL_FAST("set SVGPathSegLinetoVerticalAbs.y", DOM, cx); |
7867 | 0 |
|
7868 | 0 | float arg0; |
7869 | 0 | if (!ValueToPrimitive<float, eDefault>(cx, args[0], &arg0)) { |
7870 | 0 | return false; |
7871 | 0 | } else if (!mozilla::IsFinite(arg0)) { |
7872 | 0 | ThrowErrorMessage(cx, MSG_NOT_FINITE, "Value being assigned to SVGPathSegLinetoVerticalAbs.y"); |
7873 | 0 | return false; |
7874 | 0 | } |
7875 | 0 | FastErrorResult rv; |
7876 | 0 | self->SetY(arg0, rv); |
7877 | 0 | if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) { |
7878 | 0 | return false; |
7879 | 0 | } |
7880 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
7881 | 0 |
|
7882 | 0 | return true; |
7883 | 0 | } |
7884 | | |
7885 | | static const JSJitInfo y_getterinfo = { |
7886 | | { (JSJitGetterOp)get_y }, |
7887 | | { prototypes::id::SVGPathSegLinetoVerticalAbs }, |
7888 | | { PrototypeTraits<prototypes::id::SVGPathSegLinetoVerticalAbs>::Depth }, |
7889 | | JSJitInfo::Getter, |
7890 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
7891 | | JSVAL_TYPE_DOUBLE, /* returnType. Not relevant for setters. */ |
7892 | | true, /* isInfallible. False in setters. */ |
7893 | | false, /* isMovable. Not relevant for setters. */ |
7894 | | false, /* isEliminatable. Not relevant for setters. */ |
7895 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
7896 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
7897 | | false, /* isTypedMethod. Only relevant for methods. */ |
7898 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
7899 | | }; |
7900 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
7901 | | static_assert(0 < 1, "There is no slot for us"); |
7902 | | static const JSJitInfo y_setterinfo = { |
7903 | | { (JSJitGetterOp)set_y }, |
7904 | | { prototypes::id::SVGPathSegLinetoVerticalAbs }, |
7905 | | { PrototypeTraits<prototypes::id::SVGPathSegLinetoVerticalAbs>::Depth }, |
7906 | | JSJitInfo::Setter, |
7907 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
7908 | | JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */ |
7909 | | false, /* isInfallible. False in setters. */ |
7910 | | false, /* isMovable. Not relevant for setters. */ |
7911 | | false, /* isEliminatable. Not relevant for setters. */ |
7912 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
7913 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
7914 | | false, /* isTypedMethod. Only relevant for methods. */ |
7915 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
7916 | | }; |
7917 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
7918 | | static_assert(0 < 1, "There is no slot for us"); |
7919 | | |
7920 | | static bool |
7921 | | _addProperty(JSContext* cx, JS::Handle<JSObject*> obj, JS::Handle<jsid> id, JS::Handle<JS::Value> val) |
7922 | 0 | { |
7923 | 0 | mozilla::DOMSVGPathSegLinetoVerticalAbs* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::DOMSVGPathSegLinetoVerticalAbs>(obj); |
7924 | 0 | // We don't want to preserve if we don't have a wrapper, and we |
7925 | 0 | // obviously can't preserve if we're not initialized. |
7926 | 0 | if (self && self->GetWrapperPreserveColor()) { |
7927 | 0 | PreserveWrapper(self); |
7928 | 0 | } |
7929 | 0 | return true; |
7930 | 0 | } |
7931 | | |
7932 | | static void |
7933 | | _finalize(js::FreeOp* fop, JSObject* obj) |
7934 | 0 | { |
7935 | 0 | mozilla::DOMSVGPathSegLinetoVerticalAbs* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::DOMSVGPathSegLinetoVerticalAbs>(obj); |
7936 | 0 | if (self) { |
7937 | 0 | ClearWrapper(self, self, obj); |
7938 | 0 | AddForDeferredFinalization<mozilla::DOMSVGPathSegLinetoVerticalAbs>(self); |
7939 | 0 | } |
7940 | 0 | } |
7941 | | |
7942 | | static size_t |
7943 | | _objectMoved(JSObject* obj, JSObject* old) |
7944 | 0 | { |
7945 | 0 | mozilla::DOMSVGPathSegLinetoVerticalAbs* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::DOMSVGPathSegLinetoVerticalAbs>(obj); |
7946 | 0 | if (self) { |
7947 | 0 | UpdateWrapper(self, self, obj, old); |
7948 | 0 | } |
7949 | 0 |
|
7950 | 0 | return 0; |
7951 | 0 | } |
7952 | | |
7953 | | // We deliberately use brace-elision to make Visual Studio produce better initalization code. |
7954 | | #if defined(__clang__) |
7955 | | #pragma clang diagnostic push |
7956 | | #pragma clang diagnostic ignored "-Wmissing-braces" |
7957 | | #endif |
7958 | | static const JSPropertySpec sAttributes_specs[] = { |
7959 | | { "y", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &y_getterinfo, GenericSetter<NormalThisPolicy>, &y_setterinfo }, |
7960 | | { nullptr, 0, nullptr, nullptr, nullptr, nullptr } |
7961 | | }; |
7962 | | #if defined(__clang__) |
7963 | | #pragma clang diagnostic pop |
7964 | | #endif |
7965 | | |
7966 | | |
7967 | | static const Prefable<const JSPropertySpec> sAttributes[] = { |
7968 | | { nullptr, &sAttributes_specs[0] }, |
7969 | | { nullptr, nullptr } |
7970 | | }; |
7971 | | |
7972 | | static_assert(1 <= 1ull << NUM_BITS_PROPERTY_INFO_PREF_INDEX, |
7973 | | "We have a prefable index that is >= (1 << NUM_BITS_PROPERTY_INFO_PREF_INDEX)"); |
7974 | | static_assert(1 <= 1ull << NUM_BITS_PROPERTY_INFO_SPEC_INDEX, |
7975 | | "We have a spec index that is >= (1 << NUM_BITS_PROPERTY_INFO_SPEC_INDEX)"); |
7976 | | |
7977 | | |
7978 | | static uint16_t sNativeProperties_sortedPropertyIndices[1]; |
7979 | | static PropertyInfo sNativeProperties_propertyInfos[1]; |
7980 | | |
7981 | | static const NativePropertiesN<1> sNativeProperties = { |
7982 | | false, 0, |
7983 | | false, 0, |
7984 | | false, 0, |
7985 | | true, 0 /* sAttributes */, |
7986 | | false, 0, |
7987 | | false, 0, |
7988 | | false, 0, |
7989 | | -1, |
7990 | | 1, |
7991 | | sNativeProperties_sortedPropertyIndices, |
7992 | | { |
7993 | | { sAttributes, &sNativeProperties_propertyInfos[0] } |
7994 | | } |
7995 | | }; |
7996 | | static_assert(1 < 1ull << CHAR_BIT * sizeof(sNativeProperties.propertyInfoCount), |
7997 | | "We have a property info count that is oversized"); |
7998 | | |
7999 | | static const DOMIfaceAndProtoJSClass sPrototypeClass = { |
8000 | | { |
8001 | | "SVGPathSegLinetoVerticalAbsPrototype", |
8002 | | JSCLASS_IS_DOMIFACEANDPROTOJSCLASS | JSCLASS_HAS_RESERVED_SLOTS(DOM_INTERFACE_PROTO_SLOTS_BASE), |
8003 | | JS_NULL_CLASS_OPS, |
8004 | | JS_NULL_CLASS_SPEC, |
8005 | | JS_NULL_CLASS_EXT, |
8006 | | JS_NULL_OBJECT_OPS |
8007 | | }, |
8008 | | eInterfacePrototype, |
8009 | | false, |
8010 | | prototypes::id::SVGPathSegLinetoVerticalAbs, |
8011 | | PrototypeTraits<prototypes::id::SVGPathSegLinetoVerticalAbs>::Depth, |
8012 | | sNativePropertyHooks, |
8013 | | "[object SVGPathSegLinetoVerticalAbsPrototype]", |
8014 | | SVGPathSeg_Binding::GetProtoObject |
8015 | | }; |
8016 | | |
8017 | | static const js::ClassOps sClassOps = { |
8018 | | _addProperty, /* addProperty */ |
8019 | | nullptr, /* delProperty */ |
8020 | | nullptr, /* enumerate */ |
8021 | | nullptr, /* newEnumerate */ |
8022 | | nullptr, /* resolve */ |
8023 | | nullptr, /* mayResolve */ |
8024 | | _finalize, /* finalize */ |
8025 | | nullptr, /* call */ |
8026 | | nullptr, /* hasInstance */ |
8027 | | nullptr, /* construct */ |
8028 | | nullptr, /* trace */ |
8029 | | }; |
8030 | | |
8031 | | static const js::ClassExtension sClassExtension = { |
8032 | | nullptr, /* weakmapKeyDelegateOp */ |
8033 | | _objectMoved /* objectMovedOp */ |
8034 | | }; |
8035 | | |
8036 | | static const DOMJSClass sClass = { |
8037 | | { "SVGPathSegLinetoVerticalAbs", |
8038 | | JSCLASS_IS_DOMJSCLASS | JSCLASS_FOREGROUND_FINALIZE | JSCLASS_HAS_RESERVED_SLOTS(1), |
8039 | | &sClassOps, |
8040 | | JS_NULL_CLASS_SPEC, |
8041 | | &sClassExtension, |
8042 | | JS_NULL_OBJECT_OPS |
8043 | | }, |
8044 | | { prototypes::id::SVGPathSeg, prototypes::id::SVGPathSegLinetoVerticalAbs, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count }, |
8045 | | IsBaseOf<nsISupports, mozilla::DOMSVGPathSegLinetoVerticalAbs >::value, |
8046 | | sNativePropertyHooks, |
8047 | | FindAssociatedGlobalForNative<mozilla::DOMSVGPathSegLinetoVerticalAbs>::Get, |
8048 | | GetProtoObjectHandle, |
8049 | | GetCCParticipant<mozilla::DOMSVGPathSegLinetoVerticalAbs>::Get() |
8050 | | }; |
8051 | | static_assert(1 == DOM_INSTANCE_RESERVED_SLOTS, |
8052 | | "Must have the right minimal number of reserved slots."); |
8053 | | static_assert(1 >= 1, |
8054 | | "Must have enough reserved slots."); |
8055 | | |
8056 | | const JSClass* |
8057 | | GetJSClass() |
8058 | 0 | { |
8059 | 0 | return sClass.ToJSClass(); |
8060 | 0 | } |
8061 | | |
8062 | | bool |
8063 | | Wrap(JSContext* aCx, mozilla::DOMSVGPathSegLinetoVerticalAbs* aObject, nsWrapperCache* aCache, JS::Handle<JSObject*> aGivenProto, JS::MutableHandle<JSObject*> aReflector) |
8064 | 0 | { |
8065 | 0 | static_assert(!IsBaseOf<NonRefcountedDOMObject, mozilla::DOMSVGPathSegLinetoVerticalAbs>::value, |
8066 | 0 | "Shouldn't have wrappercached things that are not refcounted."); |
8067 | 0 | MOZ_ASSERT(static_cast<mozilla::DOMSVGPathSegLinetoVerticalAbs*>(aObject) == |
8068 | 0 | reinterpret_cast<mozilla::DOMSVGPathSegLinetoVerticalAbs*>(aObject), |
8069 | 0 | "Multiple inheritance for mozilla::DOMSVGPathSegLinetoVerticalAbs is broken."); |
8070 | 0 | MOZ_ASSERT(static_cast<mozilla::DOMSVGPathSeg*>(aObject) == |
8071 | 0 | reinterpret_cast<mozilla::DOMSVGPathSeg*>(aObject), |
8072 | 0 | "Multiple inheritance for mozilla::DOMSVGPathSeg is broken."); |
8073 | 0 | MOZ_ASSERT(ToSupportsIsCorrect(aObject)); |
8074 | 0 | MOZ_ASSERT_IF(aGivenProto, js::IsObjectInContextCompartment(aGivenProto, aCx)); |
8075 | 0 | MOZ_ASSERT(!aCache->GetWrapper(), |
8076 | 0 | "You should probably not be using Wrap() directly; use " |
8077 | 0 | "GetOrCreateDOMReflector instead"); |
8078 | 0 |
|
8079 | 0 | MOZ_ASSERT(ToSupportsIsOnPrimaryInheritanceChain(aObject, aCache), |
8080 | 0 | "nsISupports must be on our primary inheritance chain"); |
8081 | 0 |
|
8082 | 0 | JS::Rooted<JSObject*> global(aCx, FindAssociatedGlobal(aCx, aObject->GetParentObject())); |
8083 | 0 | if (!global) { |
8084 | 0 | return false; |
8085 | 0 | } |
8086 | 0 | MOZ_ASSERT(JS_IsGlobalObject(global)); |
8087 | 0 | MOZ_ASSERT(JS::ObjectIsNotGray(global)); |
8088 | 0 |
|
8089 | 0 | // That might have ended up wrapping us already, due to the wonders |
8090 | 0 | // of XBL. Check for that, and bail out as needed. |
8091 | 0 | aReflector.set(aCache->GetWrapper()); |
8092 | 0 | if (aReflector) { |
8093 | | #ifdef DEBUG |
8094 | | AssertReflectorHasGivenProto(aCx, aReflector, aGivenProto); |
8095 | | #endif // DEBUG |
8096 | | return true; |
8097 | 0 | } |
8098 | 0 |
|
8099 | 0 | JSAutoRealm ar(aCx, global); |
8100 | 0 | JS::Handle<JSObject*> canonicalProto = GetProtoObjectHandle(aCx); |
8101 | 0 | if (!canonicalProto) { |
8102 | 0 | return false; |
8103 | 0 | } |
8104 | 0 | JS::Rooted<JSObject*> proto(aCx); |
8105 | 0 | if (aGivenProto) { |
8106 | 0 | proto = aGivenProto; |
8107 | 0 | // Unfortunately, while aGivenProto was in the compartment of aCx |
8108 | 0 | // coming in, we changed compartments to that of "parent" so may need |
8109 | 0 | // to wrap the proto here. |
8110 | 0 | if (js::GetContextCompartment(aCx) != js::GetObjectCompartment(proto)) { |
8111 | 0 | if (!JS_WrapObject(aCx, &proto)) { |
8112 | 0 | return false; |
8113 | 0 | } |
8114 | 0 | } |
8115 | 0 | } else { |
8116 | 0 | proto = canonicalProto; |
8117 | 0 | } |
8118 | 0 |
|
8119 | 0 | BindingJSObjectCreator<mozilla::DOMSVGPathSegLinetoVerticalAbs> creator(aCx); |
8120 | 0 | creator.CreateObject(aCx, sClass.ToJSClass(), proto, aObject, aReflector); |
8121 | 0 | if (!aReflector) { |
8122 | 0 | return false; |
8123 | 0 | } |
8124 | 0 | |
8125 | 0 | aCache->SetWrapper(aReflector); |
8126 | 0 | creator.InitializationSucceeded(); |
8127 | 0 |
|
8128 | 0 | MOZ_ASSERT(aCache->GetWrapperPreserveColor() && |
8129 | 0 | aCache->GetWrapperPreserveColor() == aReflector); |
8130 | 0 | // If proto != canonicalProto, we have to preserve our wrapper; |
8131 | 0 | // otherwise we won't be able to properly recreate it later, since |
8132 | 0 | // we won't know what proto to use. Note that we don't check |
8133 | 0 | // aGivenProto here, since it's entirely possible (and even |
8134 | 0 | // somewhat common) to have a non-null aGivenProto which is the |
8135 | 0 | // same as canonicalProto. |
8136 | 0 | if (proto != canonicalProto) { |
8137 | 0 | PreserveWrapper(aObject); |
8138 | 0 | } |
8139 | 0 |
|
8140 | 0 | return true; |
8141 | 0 | } |
8142 | | |
8143 | | const NativePropertyHooks sNativePropertyHooks[] = { { |
8144 | | nullptr, |
8145 | | nullptr, |
8146 | | nullptr, |
8147 | | { sNativeProperties.Upcast(), nullptr }, |
8148 | | prototypes::id::SVGPathSegLinetoVerticalAbs, |
8149 | | constructors::id::_ID_Count, |
8150 | | SVGPathSeg_Binding::sNativePropertyHooks, |
8151 | | &DefaultXrayExpandoObjectClass |
8152 | | } }; |
8153 | | |
8154 | | void |
8155 | | CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, bool aDefineOnGlobal) |
8156 | 0 | { |
8157 | 0 | JS::Handle<JSObject*> parentProto(SVGPathSeg_Binding::GetProtoObjectHandle(aCx)); |
8158 | 0 | if (!parentProto) { |
8159 | 0 | return; |
8160 | 0 | } |
8161 | 0 | |
8162 | 0 | static bool sIdsInited = false; |
8163 | 0 | if (!sIdsInited && NS_IsMainThread()) { |
8164 | 0 | if (!InitIds(aCx, sNativeProperties.Upcast())) { |
8165 | 0 | return; |
8166 | 0 | } |
8167 | 0 | sIdsInited = true; |
8168 | 0 | } |
8169 | 0 |
|
8170 | 0 | JS::Heap<JSObject*>* protoCache = &aProtoAndIfaceCache.EntrySlotOrCreate(prototypes::id::SVGPathSegLinetoVerticalAbs); |
8171 | 0 | JS::Heap<JSObject*>* interfaceCache = nullptr; |
8172 | 0 | dom::CreateInterfaceObjects(aCx, aGlobal, parentProto, |
8173 | 0 | &sPrototypeClass.mBase, protoCache, |
8174 | 0 | nullptr, |
8175 | 0 | nullptr, nullptr, 0, nullptr, |
8176 | 0 | interfaceCache, |
8177 | 0 | sNativeProperties.Upcast(), |
8178 | 0 | nullptr, |
8179 | 0 | nullptr, aDefineOnGlobal, |
8180 | 0 | nullptr, |
8181 | 0 | false); |
8182 | 0 | } |
8183 | | |
8184 | | } // namespace SVGPathSegLinetoVerticalAbs_Binding |
8185 | | |
8186 | | |
8187 | | |
8188 | | namespace SVGPathSegLinetoVerticalRel_Binding { |
8189 | | |
8190 | | static_assert(IsRefcounted<NativeType>::value == IsRefcounted<SVGPathSeg_Binding::NativeType>::value, |
8191 | | "Can't inherit from an interface with a different ownership model."); |
8192 | | |
8193 | | MOZ_CAN_RUN_SCRIPT static bool |
8194 | | get_y(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::DOMSVGPathSegLinetoVerticalRel* self, JSJitGetterCallArgs args) |
8195 | 0 | { |
8196 | 0 | AUTO_PROFILER_LABEL_FAST("get SVGPathSegLinetoVerticalRel.y", DOM, cx); |
8197 | 0 |
|
8198 | 0 | float result(self->Y()); |
8199 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
8200 | 0 | args.rval().set(JS_NumberValue(double(result))); |
8201 | 0 | return true; |
8202 | 0 | } |
8203 | | |
8204 | | MOZ_CAN_RUN_SCRIPT static bool |
8205 | | set_y(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::DOMSVGPathSegLinetoVerticalRel* self, JSJitSetterCallArgs args) |
8206 | 0 | { |
8207 | 0 | AUTO_PROFILER_LABEL_FAST("set SVGPathSegLinetoVerticalRel.y", DOM, cx); |
8208 | 0 |
|
8209 | 0 | float arg0; |
8210 | 0 | if (!ValueToPrimitive<float, eDefault>(cx, args[0], &arg0)) { |
8211 | 0 | return false; |
8212 | 0 | } else if (!mozilla::IsFinite(arg0)) { |
8213 | 0 | ThrowErrorMessage(cx, MSG_NOT_FINITE, "Value being assigned to SVGPathSegLinetoVerticalRel.y"); |
8214 | 0 | return false; |
8215 | 0 | } |
8216 | 0 | FastErrorResult rv; |
8217 | 0 | self->SetY(arg0, rv); |
8218 | 0 | if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) { |
8219 | 0 | return false; |
8220 | 0 | } |
8221 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
8222 | 0 |
|
8223 | 0 | return true; |
8224 | 0 | } |
8225 | | |
8226 | | static const JSJitInfo y_getterinfo = { |
8227 | | { (JSJitGetterOp)get_y }, |
8228 | | { prototypes::id::SVGPathSegLinetoVerticalRel }, |
8229 | | { PrototypeTraits<prototypes::id::SVGPathSegLinetoVerticalRel>::Depth }, |
8230 | | JSJitInfo::Getter, |
8231 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
8232 | | JSVAL_TYPE_DOUBLE, /* returnType. Not relevant for setters. */ |
8233 | | true, /* isInfallible. False in setters. */ |
8234 | | false, /* isMovable. Not relevant for setters. */ |
8235 | | false, /* isEliminatable. Not relevant for setters. */ |
8236 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
8237 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
8238 | | false, /* isTypedMethod. Only relevant for methods. */ |
8239 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
8240 | | }; |
8241 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
8242 | | static_assert(0 < 1, "There is no slot for us"); |
8243 | | static const JSJitInfo y_setterinfo = { |
8244 | | { (JSJitGetterOp)set_y }, |
8245 | | { prototypes::id::SVGPathSegLinetoVerticalRel }, |
8246 | | { PrototypeTraits<prototypes::id::SVGPathSegLinetoVerticalRel>::Depth }, |
8247 | | JSJitInfo::Setter, |
8248 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
8249 | | JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */ |
8250 | | false, /* isInfallible. False in setters. */ |
8251 | | false, /* isMovable. Not relevant for setters. */ |
8252 | | false, /* isEliminatable. Not relevant for setters. */ |
8253 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
8254 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
8255 | | false, /* isTypedMethod. Only relevant for methods. */ |
8256 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
8257 | | }; |
8258 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
8259 | | static_assert(0 < 1, "There is no slot for us"); |
8260 | | |
8261 | | static bool |
8262 | | _addProperty(JSContext* cx, JS::Handle<JSObject*> obj, JS::Handle<jsid> id, JS::Handle<JS::Value> val) |
8263 | 0 | { |
8264 | 0 | mozilla::DOMSVGPathSegLinetoVerticalRel* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::DOMSVGPathSegLinetoVerticalRel>(obj); |
8265 | 0 | // We don't want to preserve if we don't have a wrapper, and we |
8266 | 0 | // obviously can't preserve if we're not initialized. |
8267 | 0 | if (self && self->GetWrapperPreserveColor()) { |
8268 | 0 | PreserveWrapper(self); |
8269 | 0 | } |
8270 | 0 | return true; |
8271 | 0 | } |
8272 | | |
8273 | | static void |
8274 | | _finalize(js::FreeOp* fop, JSObject* obj) |
8275 | 0 | { |
8276 | 0 | mozilla::DOMSVGPathSegLinetoVerticalRel* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::DOMSVGPathSegLinetoVerticalRel>(obj); |
8277 | 0 | if (self) { |
8278 | 0 | ClearWrapper(self, self, obj); |
8279 | 0 | AddForDeferredFinalization<mozilla::DOMSVGPathSegLinetoVerticalRel>(self); |
8280 | 0 | } |
8281 | 0 | } |
8282 | | |
8283 | | static size_t |
8284 | | _objectMoved(JSObject* obj, JSObject* old) |
8285 | 0 | { |
8286 | 0 | mozilla::DOMSVGPathSegLinetoVerticalRel* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::DOMSVGPathSegLinetoVerticalRel>(obj); |
8287 | 0 | if (self) { |
8288 | 0 | UpdateWrapper(self, self, obj, old); |
8289 | 0 | } |
8290 | 0 |
|
8291 | 0 | return 0; |
8292 | 0 | } |
8293 | | |
8294 | | // We deliberately use brace-elision to make Visual Studio produce better initalization code. |
8295 | | #if defined(__clang__) |
8296 | | #pragma clang diagnostic push |
8297 | | #pragma clang diagnostic ignored "-Wmissing-braces" |
8298 | | #endif |
8299 | | static const JSPropertySpec sAttributes_specs[] = { |
8300 | | { "y", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &y_getterinfo, GenericSetter<NormalThisPolicy>, &y_setterinfo }, |
8301 | | { nullptr, 0, nullptr, nullptr, nullptr, nullptr } |
8302 | | }; |
8303 | | #if defined(__clang__) |
8304 | | #pragma clang diagnostic pop |
8305 | | #endif |
8306 | | |
8307 | | |
8308 | | static const Prefable<const JSPropertySpec> sAttributes[] = { |
8309 | | { nullptr, &sAttributes_specs[0] }, |
8310 | | { nullptr, nullptr } |
8311 | | }; |
8312 | | |
8313 | | static_assert(1 <= 1ull << NUM_BITS_PROPERTY_INFO_PREF_INDEX, |
8314 | | "We have a prefable index that is >= (1 << NUM_BITS_PROPERTY_INFO_PREF_INDEX)"); |
8315 | | static_assert(1 <= 1ull << NUM_BITS_PROPERTY_INFO_SPEC_INDEX, |
8316 | | "We have a spec index that is >= (1 << NUM_BITS_PROPERTY_INFO_SPEC_INDEX)"); |
8317 | | |
8318 | | |
8319 | | static uint16_t sNativeProperties_sortedPropertyIndices[1]; |
8320 | | static PropertyInfo sNativeProperties_propertyInfos[1]; |
8321 | | |
8322 | | static const NativePropertiesN<1> sNativeProperties = { |
8323 | | false, 0, |
8324 | | false, 0, |
8325 | | false, 0, |
8326 | | true, 0 /* sAttributes */, |
8327 | | false, 0, |
8328 | | false, 0, |
8329 | | false, 0, |
8330 | | -1, |
8331 | | 1, |
8332 | | sNativeProperties_sortedPropertyIndices, |
8333 | | { |
8334 | | { sAttributes, &sNativeProperties_propertyInfos[0] } |
8335 | | } |
8336 | | }; |
8337 | | static_assert(1 < 1ull << CHAR_BIT * sizeof(sNativeProperties.propertyInfoCount), |
8338 | | "We have a property info count that is oversized"); |
8339 | | |
8340 | | static const DOMIfaceAndProtoJSClass sPrototypeClass = { |
8341 | | { |
8342 | | "SVGPathSegLinetoVerticalRelPrototype", |
8343 | | JSCLASS_IS_DOMIFACEANDPROTOJSCLASS | JSCLASS_HAS_RESERVED_SLOTS(DOM_INTERFACE_PROTO_SLOTS_BASE), |
8344 | | JS_NULL_CLASS_OPS, |
8345 | | JS_NULL_CLASS_SPEC, |
8346 | | JS_NULL_CLASS_EXT, |
8347 | | JS_NULL_OBJECT_OPS |
8348 | | }, |
8349 | | eInterfacePrototype, |
8350 | | false, |
8351 | | prototypes::id::SVGPathSegLinetoVerticalRel, |
8352 | | PrototypeTraits<prototypes::id::SVGPathSegLinetoVerticalRel>::Depth, |
8353 | | sNativePropertyHooks, |
8354 | | "[object SVGPathSegLinetoVerticalRelPrototype]", |
8355 | | SVGPathSeg_Binding::GetProtoObject |
8356 | | }; |
8357 | | |
8358 | | static const js::ClassOps sClassOps = { |
8359 | | _addProperty, /* addProperty */ |
8360 | | nullptr, /* delProperty */ |
8361 | | nullptr, /* enumerate */ |
8362 | | nullptr, /* newEnumerate */ |
8363 | | nullptr, /* resolve */ |
8364 | | nullptr, /* mayResolve */ |
8365 | | _finalize, /* finalize */ |
8366 | | nullptr, /* call */ |
8367 | | nullptr, /* hasInstance */ |
8368 | | nullptr, /* construct */ |
8369 | | nullptr, /* trace */ |
8370 | | }; |
8371 | | |
8372 | | static const js::ClassExtension sClassExtension = { |
8373 | | nullptr, /* weakmapKeyDelegateOp */ |
8374 | | _objectMoved /* objectMovedOp */ |
8375 | | }; |
8376 | | |
8377 | | static const DOMJSClass sClass = { |
8378 | | { "SVGPathSegLinetoVerticalRel", |
8379 | | JSCLASS_IS_DOMJSCLASS | JSCLASS_FOREGROUND_FINALIZE | JSCLASS_HAS_RESERVED_SLOTS(1), |
8380 | | &sClassOps, |
8381 | | JS_NULL_CLASS_SPEC, |
8382 | | &sClassExtension, |
8383 | | JS_NULL_OBJECT_OPS |
8384 | | }, |
8385 | | { prototypes::id::SVGPathSeg, prototypes::id::SVGPathSegLinetoVerticalRel, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count }, |
8386 | | IsBaseOf<nsISupports, mozilla::DOMSVGPathSegLinetoVerticalRel >::value, |
8387 | | sNativePropertyHooks, |
8388 | | FindAssociatedGlobalForNative<mozilla::DOMSVGPathSegLinetoVerticalRel>::Get, |
8389 | | GetProtoObjectHandle, |
8390 | | GetCCParticipant<mozilla::DOMSVGPathSegLinetoVerticalRel>::Get() |
8391 | | }; |
8392 | | static_assert(1 == DOM_INSTANCE_RESERVED_SLOTS, |
8393 | | "Must have the right minimal number of reserved slots."); |
8394 | | static_assert(1 >= 1, |
8395 | | "Must have enough reserved slots."); |
8396 | | |
8397 | | const JSClass* |
8398 | | GetJSClass() |
8399 | 0 | { |
8400 | 0 | return sClass.ToJSClass(); |
8401 | 0 | } |
8402 | | |
8403 | | bool |
8404 | | Wrap(JSContext* aCx, mozilla::DOMSVGPathSegLinetoVerticalRel* aObject, nsWrapperCache* aCache, JS::Handle<JSObject*> aGivenProto, JS::MutableHandle<JSObject*> aReflector) |
8405 | 0 | { |
8406 | 0 | static_assert(!IsBaseOf<NonRefcountedDOMObject, mozilla::DOMSVGPathSegLinetoVerticalRel>::value, |
8407 | 0 | "Shouldn't have wrappercached things that are not refcounted."); |
8408 | 0 | MOZ_ASSERT(static_cast<mozilla::DOMSVGPathSegLinetoVerticalRel*>(aObject) == |
8409 | 0 | reinterpret_cast<mozilla::DOMSVGPathSegLinetoVerticalRel*>(aObject), |
8410 | 0 | "Multiple inheritance for mozilla::DOMSVGPathSegLinetoVerticalRel is broken."); |
8411 | 0 | MOZ_ASSERT(static_cast<mozilla::DOMSVGPathSeg*>(aObject) == |
8412 | 0 | reinterpret_cast<mozilla::DOMSVGPathSeg*>(aObject), |
8413 | 0 | "Multiple inheritance for mozilla::DOMSVGPathSeg is broken."); |
8414 | 0 | MOZ_ASSERT(ToSupportsIsCorrect(aObject)); |
8415 | 0 | MOZ_ASSERT_IF(aGivenProto, js::IsObjectInContextCompartment(aGivenProto, aCx)); |
8416 | 0 | MOZ_ASSERT(!aCache->GetWrapper(), |
8417 | 0 | "You should probably not be using Wrap() directly; use " |
8418 | 0 | "GetOrCreateDOMReflector instead"); |
8419 | 0 |
|
8420 | 0 | MOZ_ASSERT(ToSupportsIsOnPrimaryInheritanceChain(aObject, aCache), |
8421 | 0 | "nsISupports must be on our primary inheritance chain"); |
8422 | 0 |
|
8423 | 0 | JS::Rooted<JSObject*> global(aCx, FindAssociatedGlobal(aCx, aObject->GetParentObject())); |
8424 | 0 | if (!global) { |
8425 | 0 | return false; |
8426 | 0 | } |
8427 | 0 | MOZ_ASSERT(JS_IsGlobalObject(global)); |
8428 | 0 | MOZ_ASSERT(JS::ObjectIsNotGray(global)); |
8429 | 0 |
|
8430 | 0 | // That might have ended up wrapping us already, due to the wonders |
8431 | 0 | // of XBL. Check for that, and bail out as needed. |
8432 | 0 | aReflector.set(aCache->GetWrapper()); |
8433 | 0 | if (aReflector) { |
8434 | | #ifdef DEBUG |
8435 | | AssertReflectorHasGivenProto(aCx, aReflector, aGivenProto); |
8436 | | #endif // DEBUG |
8437 | | return true; |
8438 | 0 | } |
8439 | 0 |
|
8440 | 0 | JSAutoRealm ar(aCx, global); |
8441 | 0 | JS::Handle<JSObject*> canonicalProto = GetProtoObjectHandle(aCx); |
8442 | 0 | if (!canonicalProto) { |
8443 | 0 | return false; |
8444 | 0 | } |
8445 | 0 | JS::Rooted<JSObject*> proto(aCx); |
8446 | 0 | if (aGivenProto) { |
8447 | 0 | proto = aGivenProto; |
8448 | 0 | // Unfortunately, while aGivenProto was in the compartment of aCx |
8449 | 0 | // coming in, we changed compartments to that of "parent" so may need |
8450 | 0 | // to wrap the proto here. |
8451 | 0 | if (js::GetContextCompartment(aCx) != js::GetObjectCompartment(proto)) { |
8452 | 0 | if (!JS_WrapObject(aCx, &proto)) { |
8453 | 0 | return false; |
8454 | 0 | } |
8455 | 0 | } |
8456 | 0 | } else { |
8457 | 0 | proto = canonicalProto; |
8458 | 0 | } |
8459 | 0 |
|
8460 | 0 | BindingJSObjectCreator<mozilla::DOMSVGPathSegLinetoVerticalRel> creator(aCx); |
8461 | 0 | creator.CreateObject(aCx, sClass.ToJSClass(), proto, aObject, aReflector); |
8462 | 0 | if (!aReflector) { |
8463 | 0 | return false; |
8464 | 0 | } |
8465 | 0 | |
8466 | 0 | aCache->SetWrapper(aReflector); |
8467 | 0 | creator.InitializationSucceeded(); |
8468 | 0 |
|
8469 | 0 | MOZ_ASSERT(aCache->GetWrapperPreserveColor() && |
8470 | 0 | aCache->GetWrapperPreserveColor() == aReflector); |
8471 | 0 | // If proto != canonicalProto, we have to preserve our wrapper; |
8472 | 0 | // otherwise we won't be able to properly recreate it later, since |
8473 | 0 | // we won't know what proto to use. Note that we don't check |
8474 | 0 | // aGivenProto here, since it's entirely possible (and even |
8475 | 0 | // somewhat common) to have a non-null aGivenProto which is the |
8476 | 0 | // same as canonicalProto. |
8477 | 0 | if (proto != canonicalProto) { |
8478 | 0 | PreserveWrapper(aObject); |
8479 | 0 | } |
8480 | 0 |
|
8481 | 0 | return true; |
8482 | 0 | } |
8483 | | |
8484 | | const NativePropertyHooks sNativePropertyHooks[] = { { |
8485 | | nullptr, |
8486 | | nullptr, |
8487 | | nullptr, |
8488 | | { sNativeProperties.Upcast(), nullptr }, |
8489 | | prototypes::id::SVGPathSegLinetoVerticalRel, |
8490 | | constructors::id::_ID_Count, |
8491 | | SVGPathSeg_Binding::sNativePropertyHooks, |
8492 | | &DefaultXrayExpandoObjectClass |
8493 | | } }; |
8494 | | |
8495 | | void |
8496 | | CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, bool aDefineOnGlobal) |
8497 | 0 | { |
8498 | 0 | JS::Handle<JSObject*> parentProto(SVGPathSeg_Binding::GetProtoObjectHandle(aCx)); |
8499 | 0 | if (!parentProto) { |
8500 | 0 | return; |
8501 | 0 | } |
8502 | 0 | |
8503 | 0 | static bool sIdsInited = false; |
8504 | 0 | if (!sIdsInited && NS_IsMainThread()) { |
8505 | 0 | if (!InitIds(aCx, sNativeProperties.Upcast())) { |
8506 | 0 | return; |
8507 | 0 | } |
8508 | 0 | sIdsInited = true; |
8509 | 0 | } |
8510 | 0 |
|
8511 | 0 | JS::Heap<JSObject*>* protoCache = &aProtoAndIfaceCache.EntrySlotOrCreate(prototypes::id::SVGPathSegLinetoVerticalRel); |
8512 | 0 | JS::Heap<JSObject*>* interfaceCache = nullptr; |
8513 | 0 | dom::CreateInterfaceObjects(aCx, aGlobal, parentProto, |
8514 | 0 | &sPrototypeClass.mBase, protoCache, |
8515 | 0 | nullptr, |
8516 | 0 | nullptr, nullptr, 0, nullptr, |
8517 | 0 | interfaceCache, |
8518 | 0 | sNativeProperties.Upcast(), |
8519 | 0 | nullptr, |
8520 | 0 | nullptr, aDefineOnGlobal, |
8521 | 0 | nullptr, |
8522 | 0 | false); |
8523 | 0 | } |
8524 | | |
8525 | | } // namespace SVGPathSegLinetoVerticalRel_Binding |
8526 | | |
8527 | | |
8528 | | |
8529 | | namespace SVGPathSegMovetoAbs_Binding { |
8530 | | |
8531 | | static_assert(IsRefcounted<NativeType>::value == IsRefcounted<SVGPathSeg_Binding::NativeType>::value, |
8532 | | "Can't inherit from an interface with a different ownership model."); |
8533 | | |
8534 | | MOZ_CAN_RUN_SCRIPT static bool |
8535 | | get_x(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::DOMSVGPathSegMovetoAbs* self, JSJitGetterCallArgs args) |
8536 | 0 | { |
8537 | 0 | AUTO_PROFILER_LABEL_FAST("get SVGPathSegMovetoAbs.x", DOM, cx); |
8538 | 0 |
|
8539 | 0 | float result(self->X()); |
8540 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
8541 | 0 | args.rval().set(JS_NumberValue(double(result))); |
8542 | 0 | return true; |
8543 | 0 | } |
8544 | | |
8545 | | MOZ_CAN_RUN_SCRIPT static bool |
8546 | | set_x(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::DOMSVGPathSegMovetoAbs* self, JSJitSetterCallArgs args) |
8547 | 0 | { |
8548 | 0 | AUTO_PROFILER_LABEL_FAST("set SVGPathSegMovetoAbs.x", DOM, cx); |
8549 | 0 |
|
8550 | 0 | float arg0; |
8551 | 0 | if (!ValueToPrimitive<float, eDefault>(cx, args[0], &arg0)) { |
8552 | 0 | return false; |
8553 | 0 | } else if (!mozilla::IsFinite(arg0)) { |
8554 | 0 | ThrowErrorMessage(cx, MSG_NOT_FINITE, "Value being assigned to SVGPathSegMovetoAbs.x"); |
8555 | 0 | return false; |
8556 | 0 | } |
8557 | 0 | FastErrorResult rv; |
8558 | 0 | self->SetX(arg0, rv); |
8559 | 0 | if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) { |
8560 | 0 | return false; |
8561 | 0 | } |
8562 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
8563 | 0 |
|
8564 | 0 | return true; |
8565 | 0 | } |
8566 | | |
8567 | | static const JSJitInfo x_getterinfo = { |
8568 | | { (JSJitGetterOp)get_x }, |
8569 | | { prototypes::id::SVGPathSegMovetoAbs }, |
8570 | | { PrototypeTraits<prototypes::id::SVGPathSegMovetoAbs>::Depth }, |
8571 | | JSJitInfo::Getter, |
8572 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
8573 | | JSVAL_TYPE_DOUBLE, /* returnType. Not relevant for setters. */ |
8574 | | true, /* isInfallible. False in setters. */ |
8575 | | false, /* isMovable. Not relevant for setters. */ |
8576 | | false, /* isEliminatable. Not relevant for setters. */ |
8577 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
8578 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
8579 | | false, /* isTypedMethod. Only relevant for methods. */ |
8580 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
8581 | | }; |
8582 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
8583 | | static_assert(0 < 1, "There is no slot for us"); |
8584 | | static const JSJitInfo x_setterinfo = { |
8585 | | { (JSJitGetterOp)set_x }, |
8586 | | { prototypes::id::SVGPathSegMovetoAbs }, |
8587 | | { PrototypeTraits<prototypes::id::SVGPathSegMovetoAbs>::Depth }, |
8588 | | JSJitInfo::Setter, |
8589 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
8590 | | JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */ |
8591 | | false, /* isInfallible. False in setters. */ |
8592 | | false, /* isMovable. Not relevant for setters. */ |
8593 | | false, /* isEliminatable. Not relevant for setters. */ |
8594 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
8595 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
8596 | | false, /* isTypedMethod. Only relevant for methods. */ |
8597 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
8598 | | }; |
8599 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
8600 | | static_assert(0 < 1, "There is no slot for us"); |
8601 | | |
8602 | | MOZ_CAN_RUN_SCRIPT static bool |
8603 | | get_y(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::DOMSVGPathSegMovetoAbs* self, JSJitGetterCallArgs args) |
8604 | 0 | { |
8605 | 0 | AUTO_PROFILER_LABEL_FAST("get SVGPathSegMovetoAbs.y", DOM, cx); |
8606 | 0 |
|
8607 | 0 | float result(self->Y()); |
8608 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
8609 | 0 | args.rval().set(JS_NumberValue(double(result))); |
8610 | 0 | return true; |
8611 | 0 | } |
8612 | | |
8613 | | MOZ_CAN_RUN_SCRIPT static bool |
8614 | | set_y(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::DOMSVGPathSegMovetoAbs* self, JSJitSetterCallArgs args) |
8615 | 0 | { |
8616 | 0 | AUTO_PROFILER_LABEL_FAST("set SVGPathSegMovetoAbs.y", DOM, cx); |
8617 | 0 |
|
8618 | 0 | float arg0; |
8619 | 0 | if (!ValueToPrimitive<float, eDefault>(cx, args[0], &arg0)) { |
8620 | 0 | return false; |
8621 | 0 | } else if (!mozilla::IsFinite(arg0)) { |
8622 | 0 | ThrowErrorMessage(cx, MSG_NOT_FINITE, "Value being assigned to SVGPathSegMovetoAbs.y"); |
8623 | 0 | return false; |
8624 | 0 | } |
8625 | 0 | FastErrorResult rv; |
8626 | 0 | self->SetY(arg0, rv); |
8627 | 0 | if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) { |
8628 | 0 | return false; |
8629 | 0 | } |
8630 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
8631 | 0 |
|
8632 | 0 | return true; |
8633 | 0 | } |
8634 | | |
8635 | | static const JSJitInfo y_getterinfo = { |
8636 | | { (JSJitGetterOp)get_y }, |
8637 | | { prototypes::id::SVGPathSegMovetoAbs }, |
8638 | | { PrototypeTraits<prototypes::id::SVGPathSegMovetoAbs>::Depth }, |
8639 | | JSJitInfo::Getter, |
8640 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
8641 | | JSVAL_TYPE_DOUBLE, /* returnType. Not relevant for setters. */ |
8642 | | true, /* isInfallible. False in setters. */ |
8643 | | false, /* isMovable. Not relevant for setters. */ |
8644 | | false, /* isEliminatable. Not relevant for setters. */ |
8645 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
8646 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
8647 | | false, /* isTypedMethod. Only relevant for methods. */ |
8648 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
8649 | | }; |
8650 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
8651 | | static_assert(0 < 1, "There is no slot for us"); |
8652 | | static const JSJitInfo y_setterinfo = { |
8653 | | { (JSJitGetterOp)set_y }, |
8654 | | { prototypes::id::SVGPathSegMovetoAbs }, |
8655 | | { PrototypeTraits<prototypes::id::SVGPathSegMovetoAbs>::Depth }, |
8656 | | JSJitInfo::Setter, |
8657 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
8658 | | JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */ |
8659 | | false, /* isInfallible. False in setters. */ |
8660 | | false, /* isMovable. Not relevant for setters. */ |
8661 | | false, /* isEliminatable. Not relevant for setters. */ |
8662 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
8663 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
8664 | | false, /* isTypedMethod. Only relevant for methods. */ |
8665 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
8666 | | }; |
8667 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
8668 | | static_assert(0 < 1, "There is no slot for us"); |
8669 | | |
8670 | | static bool |
8671 | | _addProperty(JSContext* cx, JS::Handle<JSObject*> obj, JS::Handle<jsid> id, JS::Handle<JS::Value> val) |
8672 | 0 | { |
8673 | 0 | mozilla::DOMSVGPathSegMovetoAbs* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::DOMSVGPathSegMovetoAbs>(obj); |
8674 | 0 | // We don't want to preserve if we don't have a wrapper, and we |
8675 | 0 | // obviously can't preserve if we're not initialized. |
8676 | 0 | if (self && self->GetWrapperPreserveColor()) { |
8677 | 0 | PreserveWrapper(self); |
8678 | 0 | } |
8679 | 0 | return true; |
8680 | 0 | } |
8681 | | |
8682 | | static void |
8683 | | _finalize(js::FreeOp* fop, JSObject* obj) |
8684 | 0 | { |
8685 | 0 | mozilla::DOMSVGPathSegMovetoAbs* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::DOMSVGPathSegMovetoAbs>(obj); |
8686 | 0 | if (self) { |
8687 | 0 | ClearWrapper(self, self, obj); |
8688 | 0 | AddForDeferredFinalization<mozilla::DOMSVGPathSegMovetoAbs>(self); |
8689 | 0 | } |
8690 | 0 | } |
8691 | | |
8692 | | static size_t |
8693 | | _objectMoved(JSObject* obj, JSObject* old) |
8694 | 0 | { |
8695 | 0 | mozilla::DOMSVGPathSegMovetoAbs* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::DOMSVGPathSegMovetoAbs>(obj); |
8696 | 0 | if (self) { |
8697 | 0 | UpdateWrapper(self, self, obj, old); |
8698 | 0 | } |
8699 | 0 |
|
8700 | 0 | return 0; |
8701 | 0 | } |
8702 | | |
8703 | | // We deliberately use brace-elision to make Visual Studio produce better initalization code. |
8704 | | #if defined(__clang__) |
8705 | | #pragma clang diagnostic push |
8706 | | #pragma clang diagnostic ignored "-Wmissing-braces" |
8707 | | #endif |
8708 | | static const JSPropertySpec sAttributes_specs[] = { |
8709 | | { "x", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &x_getterinfo, GenericSetter<NormalThisPolicy>, &x_setterinfo }, |
8710 | | { "y", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &y_getterinfo, GenericSetter<NormalThisPolicy>, &y_setterinfo }, |
8711 | | { nullptr, 0, nullptr, nullptr, nullptr, nullptr } |
8712 | | }; |
8713 | | #if defined(__clang__) |
8714 | | #pragma clang diagnostic pop |
8715 | | #endif |
8716 | | |
8717 | | |
8718 | | static const Prefable<const JSPropertySpec> sAttributes[] = { |
8719 | | { nullptr, &sAttributes_specs[0] }, |
8720 | | { nullptr, nullptr } |
8721 | | }; |
8722 | | |
8723 | | static_assert(1 <= 1ull << NUM_BITS_PROPERTY_INFO_PREF_INDEX, |
8724 | | "We have a prefable index that is >= (1 << NUM_BITS_PROPERTY_INFO_PREF_INDEX)"); |
8725 | | static_assert(2 <= 1ull << NUM_BITS_PROPERTY_INFO_SPEC_INDEX, |
8726 | | "We have a spec index that is >= (1 << NUM_BITS_PROPERTY_INFO_SPEC_INDEX)"); |
8727 | | |
8728 | | |
8729 | | static uint16_t sNativeProperties_sortedPropertyIndices[2]; |
8730 | | static PropertyInfo sNativeProperties_propertyInfos[2]; |
8731 | | |
8732 | | static const NativePropertiesN<1> sNativeProperties = { |
8733 | | false, 0, |
8734 | | false, 0, |
8735 | | false, 0, |
8736 | | true, 0 /* sAttributes */, |
8737 | | false, 0, |
8738 | | false, 0, |
8739 | | false, 0, |
8740 | | -1, |
8741 | | 2, |
8742 | | sNativeProperties_sortedPropertyIndices, |
8743 | | { |
8744 | | { sAttributes, &sNativeProperties_propertyInfos[0] } |
8745 | | } |
8746 | | }; |
8747 | | static_assert(2 < 1ull << CHAR_BIT * sizeof(sNativeProperties.propertyInfoCount), |
8748 | | "We have a property info count that is oversized"); |
8749 | | |
8750 | | static const DOMIfaceAndProtoJSClass sPrototypeClass = { |
8751 | | { |
8752 | | "SVGPathSegMovetoAbsPrototype", |
8753 | | JSCLASS_IS_DOMIFACEANDPROTOJSCLASS | JSCLASS_HAS_RESERVED_SLOTS(DOM_INTERFACE_PROTO_SLOTS_BASE), |
8754 | | JS_NULL_CLASS_OPS, |
8755 | | JS_NULL_CLASS_SPEC, |
8756 | | JS_NULL_CLASS_EXT, |
8757 | | JS_NULL_OBJECT_OPS |
8758 | | }, |
8759 | | eInterfacePrototype, |
8760 | | false, |
8761 | | prototypes::id::SVGPathSegMovetoAbs, |
8762 | | PrototypeTraits<prototypes::id::SVGPathSegMovetoAbs>::Depth, |
8763 | | sNativePropertyHooks, |
8764 | | "[object SVGPathSegMovetoAbsPrototype]", |
8765 | | SVGPathSeg_Binding::GetProtoObject |
8766 | | }; |
8767 | | |
8768 | | static const js::ClassOps sClassOps = { |
8769 | | _addProperty, /* addProperty */ |
8770 | | nullptr, /* delProperty */ |
8771 | | nullptr, /* enumerate */ |
8772 | | nullptr, /* newEnumerate */ |
8773 | | nullptr, /* resolve */ |
8774 | | nullptr, /* mayResolve */ |
8775 | | _finalize, /* finalize */ |
8776 | | nullptr, /* call */ |
8777 | | nullptr, /* hasInstance */ |
8778 | | nullptr, /* construct */ |
8779 | | nullptr, /* trace */ |
8780 | | }; |
8781 | | |
8782 | | static const js::ClassExtension sClassExtension = { |
8783 | | nullptr, /* weakmapKeyDelegateOp */ |
8784 | | _objectMoved /* objectMovedOp */ |
8785 | | }; |
8786 | | |
8787 | | static const DOMJSClass sClass = { |
8788 | | { "SVGPathSegMovetoAbs", |
8789 | | JSCLASS_IS_DOMJSCLASS | JSCLASS_FOREGROUND_FINALIZE | JSCLASS_HAS_RESERVED_SLOTS(1), |
8790 | | &sClassOps, |
8791 | | JS_NULL_CLASS_SPEC, |
8792 | | &sClassExtension, |
8793 | | JS_NULL_OBJECT_OPS |
8794 | | }, |
8795 | | { prototypes::id::SVGPathSeg, prototypes::id::SVGPathSegMovetoAbs, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count }, |
8796 | | IsBaseOf<nsISupports, mozilla::DOMSVGPathSegMovetoAbs >::value, |
8797 | | sNativePropertyHooks, |
8798 | | FindAssociatedGlobalForNative<mozilla::DOMSVGPathSegMovetoAbs>::Get, |
8799 | | GetProtoObjectHandle, |
8800 | | GetCCParticipant<mozilla::DOMSVGPathSegMovetoAbs>::Get() |
8801 | | }; |
8802 | | static_assert(1 == DOM_INSTANCE_RESERVED_SLOTS, |
8803 | | "Must have the right minimal number of reserved slots."); |
8804 | | static_assert(1 >= 1, |
8805 | | "Must have enough reserved slots."); |
8806 | | |
8807 | | const JSClass* |
8808 | | GetJSClass() |
8809 | 0 | { |
8810 | 0 | return sClass.ToJSClass(); |
8811 | 0 | } |
8812 | | |
8813 | | bool |
8814 | | Wrap(JSContext* aCx, mozilla::DOMSVGPathSegMovetoAbs* aObject, nsWrapperCache* aCache, JS::Handle<JSObject*> aGivenProto, JS::MutableHandle<JSObject*> aReflector) |
8815 | 0 | { |
8816 | 0 | static_assert(!IsBaseOf<NonRefcountedDOMObject, mozilla::DOMSVGPathSegMovetoAbs>::value, |
8817 | 0 | "Shouldn't have wrappercached things that are not refcounted."); |
8818 | 0 | MOZ_ASSERT(static_cast<mozilla::DOMSVGPathSegMovetoAbs*>(aObject) == |
8819 | 0 | reinterpret_cast<mozilla::DOMSVGPathSegMovetoAbs*>(aObject), |
8820 | 0 | "Multiple inheritance for mozilla::DOMSVGPathSegMovetoAbs is broken."); |
8821 | 0 | MOZ_ASSERT(static_cast<mozilla::DOMSVGPathSeg*>(aObject) == |
8822 | 0 | reinterpret_cast<mozilla::DOMSVGPathSeg*>(aObject), |
8823 | 0 | "Multiple inheritance for mozilla::DOMSVGPathSeg is broken."); |
8824 | 0 | MOZ_ASSERT(ToSupportsIsCorrect(aObject)); |
8825 | 0 | MOZ_ASSERT_IF(aGivenProto, js::IsObjectInContextCompartment(aGivenProto, aCx)); |
8826 | 0 | MOZ_ASSERT(!aCache->GetWrapper(), |
8827 | 0 | "You should probably not be using Wrap() directly; use " |
8828 | 0 | "GetOrCreateDOMReflector instead"); |
8829 | 0 |
|
8830 | 0 | MOZ_ASSERT(ToSupportsIsOnPrimaryInheritanceChain(aObject, aCache), |
8831 | 0 | "nsISupports must be on our primary inheritance chain"); |
8832 | 0 |
|
8833 | 0 | JS::Rooted<JSObject*> global(aCx, FindAssociatedGlobal(aCx, aObject->GetParentObject())); |
8834 | 0 | if (!global) { |
8835 | 0 | return false; |
8836 | 0 | } |
8837 | 0 | MOZ_ASSERT(JS_IsGlobalObject(global)); |
8838 | 0 | MOZ_ASSERT(JS::ObjectIsNotGray(global)); |
8839 | 0 |
|
8840 | 0 | // That might have ended up wrapping us already, due to the wonders |
8841 | 0 | // of XBL. Check for that, and bail out as needed. |
8842 | 0 | aReflector.set(aCache->GetWrapper()); |
8843 | 0 | if (aReflector) { |
8844 | | #ifdef DEBUG |
8845 | | AssertReflectorHasGivenProto(aCx, aReflector, aGivenProto); |
8846 | | #endif // DEBUG |
8847 | | return true; |
8848 | 0 | } |
8849 | 0 |
|
8850 | 0 | JSAutoRealm ar(aCx, global); |
8851 | 0 | JS::Handle<JSObject*> canonicalProto = GetProtoObjectHandle(aCx); |
8852 | 0 | if (!canonicalProto) { |
8853 | 0 | return false; |
8854 | 0 | } |
8855 | 0 | JS::Rooted<JSObject*> proto(aCx); |
8856 | 0 | if (aGivenProto) { |
8857 | 0 | proto = aGivenProto; |
8858 | 0 | // Unfortunately, while aGivenProto was in the compartment of aCx |
8859 | 0 | // coming in, we changed compartments to that of "parent" so may need |
8860 | 0 | // to wrap the proto here. |
8861 | 0 | if (js::GetContextCompartment(aCx) != js::GetObjectCompartment(proto)) { |
8862 | 0 | if (!JS_WrapObject(aCx, &proto)) { |
8863 | 0 | return false; |
8864 | 0 | } |
8865 | 0 | } |
8866 | 0 | } else { |
8867 | 0 | proto = canonicalProto; |
8868 | 0 | } |
8869 | 0 |
|
8870 | 0 | BindingJSObjectCreator<mozilla::DOMSVGPathSegMovetoAbs> creator(aCx); |
8871 | 0 | creator.CreateObject(aCx, sClass.ToJSClass(), proto, aObject, aReflector); |
8872 | 0 | if (!aReflector) { |
8873 | 0 | return false; |
8874 | 0 | } |
8875 | 0 | |
8876 | 0 | aCache->SetWrapper(aReflector); |
8877 | 0 | creator.InitializationSucceeded(); |
8878 | 0 |
|
8879 | 0 | MOZ_ASSERT(aCache->GetWrapperPreserveColor() && |
8880 | 0 | aCache->GetWrapperPreserveColor() == aReflector); |
8881 | 0 | // If proto != canonicalProto, we have to preserve our wrapper; |
8882 | 0 | // otherwise we won't be able to properly recreate it later, since |
8883 | 0 | // we won't know what proto to use. Note that we don't check |
8884 | 0 | // aGivenProto here, since it's entirely possible (and even |
8885 | 0 | // somewhat common) to have a non-null aGivenProto which is the |
8886 | 0 | // same as canonicalProto. |
8887 | 0 | if (proto != canonicalProto) { |
8888 | 0 | PreserveWrapper(aObject); |
8889 | 0 | } |
8890 | 0 |
|
8891 | 0 | return true; |
8892 | 0 | } |
8893 | | |
8894 | | const NativePropertyHooks sNativePropertyHooks[] = { { |
8895 | | nullptr, |
8896 | | nullptr, |
8897 | | nullptr, |
8898 | | { sNativeProperties.Upcast(), nullptr }, |
8899 | | prototypes::id::SVGPathSegMovetoAbs, |
8900 | | constructors::id::_ID_Count, |
8901 | | SVGPathSeg_Binding::sNativePropertyHooks, |
8902 | | &DefaultXrayExpandoObjectClass |
8903 | | } }; |
8904 | | |
8905 | | void |
8906 | | CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, bool aDefineOnGlobal) |
8907 | 0 | { |
8908 | 0 | JS::Handle<JSObject*> parentProto(SVGPathSeg_Binding::GetProtoObjectHandle(aCx)); |
8909 | 0 | if (!parentProto) { |
8910 | 0 | return; |
8911 | 0 | } |
8912 | 0 | |
8913 | 0 | static bool sIdsInited = false; |
8914 | 0 | if (!sIdsInited && NS_IsMainThread()) { |
8915 | 0 | if (!InitIds(aCx, sNativeProperties.Upcast())) { |
8916 | 0 | return; |
8917 | 0 | } |
8918 | 0 | sIdsInited = true; |
8919 | 0 | } |
8920 | 0 |
|
8921 | 0 | JS::Heap<JSObject*>* protoCache = &aProtoAndIfaceCache.EntrySlotOrCreate(prototypes::id::SVGPathSegMovetoAbs); |
8922 | 0 | JS::Heap<JSObject*>* interfaceCache = nullptr; |
8923 | 0 | dom::CreateInterfaceObjects(aCx, aGlobal, parentProto, |
8924 | 0 | &sPrototypeClass.mBase, protoCache, |
8925 | 0 | nullptr, |
8926 | 0 | nullptr, nullptr, 0, nullptr, |
8927 | 0 | interfaceCache, |
8928 | 0 | sNativeProperties.Upcast(), |
8929 | 0 | nullptr, |
8930 | 0 | nullptr, aDefineOnGlobal, |
8931 | 0 | nullptr, |
8932 | 0 | false); |
8933 | 0 | } |
8934 | | |
8935 | | } // namespace SVGPathSegMovetoAbs_Binding |
8936 | | |
8937 | | |
8938 | | |
8939 | | namespace SVGPathSegMovetoRel_Binding { |
8940 | | |
8941 | | static_assert(IsRefcounted<NativeType>::value == IsRefcounted<SVGPathSeg_Binding::NativeType>::value, |
8942 | | "Can't inherit from an interface with a different ownership model."); |
8943 | | |
8944 | | MOZ_CAN_RUN_SCRIPT static bool |
8945 | | get_x(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::DOMSVGPathSegMovetoRel* self, JSJitGetterCallArgs args) |
8946 | 0 | { |
8947 | 0 | AUTO_PROFILER_LABEL_FAST("get SVGPathSegMovetoRel.x", DOM, cx); |
8948 | 0 |
|
8949 | 0 | float result(self->X()); |
8950 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
8951 | 0 | args.rval().set(JS_NumberValue(double(result))); |
8952 | 0 | return true; |
8953 | 0 | } |
8954 | | |
8955 | | MOZ_CAN_RUN_SCRIPT static bool |
8956 | | set_x(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::DOMSVGPathSegMovetoRel* self, JSJitSetterCallArgs args) |
8957 | 0 | { |
8958 | 0 | AUTO_PROFILER_LABEL_FAST("set SVGPathSegMovetoRel.x", DOM, cx); |
8959 | 0 |
|
8960 | 0 | float arg0; |
8961 | 0 | if (!ValueToPrimitive<float, eDefault>(cx, args[0], &arg0)) { |
8962 | 0 | return false; |
8963 | 0 | } else if (!mozilla::IsFinite(arg0)) { |
8964 | 0 | ThrowErrorMessage(cx, MSG_NOT_FINITE, "Value being assigned to SVGPathSegMovetoRel.x"); |
8965 | 0 | return false; |
8966 | 0 | } |
8967 | 0 | FastErrorResult rv; |
8968 | 0 | self->SetX(arg0, rv); |
8969 | 0 | if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) { |
8970 | 0 | return false; |
8971 | 0 | } |
8972 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
8973 | 0 |
|
8974 | 0 | return true; |
8975 | 0 | } |
8976 | | |
8977 | | static const JSJitInfo x_getterinfo = { |
8978 | | { (JSJitGetterOp)get_x }, |
8979 | | { prototypes::id::SVGPathSegMovetoRel }, |
8980 | | { PrototypeTraits<prototypes::id::SVGPathSegMovetoRel>::Depth }, |
8981 | | JSJitInfo::Getter, |
8982 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
8983 | | JSVAL_TYPE_DOUBLE, /* returnType. Not relevant for setters. */ |
8984 | | true, /* isInfallible. False in setters. */ |
8985 | | false, /* isMovable. Not relevant for setters. */ |
8986 | | false, /* isEliminatable. Not relevant for setters. */ |
8987 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
8988 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
8989 | | false, /* isTypedMethod. Only relevant for methods. */ |
8990 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
8991 | | }; |
8992 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
8993 | | static_assert(0 < 1, "There is no slot for us"); |
8994 | | static const JSJitInfo x_setterinfo = { |
8995 | | { (JSJitGetterOp)set_x }, |
8996 | | { prototypes::id::SVGPathSegMovetoRel }, |
8997 | | { PrototypeTraits<prototypes::id::SVGPathSegMovetoRel>::Depth }, |
8998 | | JSJitInfo::Setter, |
8999 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
9000 | | JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */ |
9001 | | false, /* isInfallible. False in setters. */ |
9002 | | false, /* isMovable. Not relevant for setters. */ |
9003 | | false, /* isEliminatable. Not relevant for setters. */ |
9004 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
9005 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
9006 | | false, /* isTypedMethod. Only relevant for methods. */ |
9007 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
9008 | | }; |
9009 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
9010 | | static_assert(0 < 1, "There is no slot for us"); |
9011 | | |
9012 | | MOZ_CAN_RUN_SCRIPT static bool |
9013 | | get_y(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::DOMSVGPathSegMovetoRel* self, JSJitGetterCallArgs args) |
9014 | 0 | { |
9015 | 0 | AUTO_PROFILER_LABEL_FAST("get SVGPathSegMovetoRel.y", DOM, cx); |
9016 | 0 |
|
9017 | 0 | float result(self->Y()); |
9018 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
9019 | 0 | args.rval().set(JS_NumberValue(double(result))); |
9020 | 0 | return true; |
9021 | 0 | } |
9022 | | |
9023 | | MOZ_CAN_RUN_SCRIPT static bool |
9024 | | set_y(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::DOMSVGPathSegMovetoRel* self, JSJitSetterCallArgs args) |
9025 | 0 | { |
9026 | 0 | AUTO_PROFILER_LABEL_FAST("set SVGPathSegMovetoRel.y", DOM, cx); |
9027 | 0 |
|
9028 | 0 | float arg0; |
9029 | 0 | if (!ValueToPrimitive<float, eDefault>(cx, args[0], &arg0)) { |
9030 | 0 | return false; |
9031 | 0 | } else if (!mozilla::IsFinite(arg0)) { |
9032 | 0 | ThrowErrorMessage(cx, MSG_NOT_FINITE, "Value being assigned to SVGPathSegMovetoRel.y"); |
9033 | 0 | return false; |
9034 | 0 | } |
9035 | 0 | FastErrorResult rv; |
9036 | 0 | self->SetY(arg0, rv); |
9037 | 0 | if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) { |
9038 | 0 | return false; |
9039 | 0 | } |
9040 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
9041 | 0 |
|
9042 | 0 | return true; |
9043 | 0 | } |
9044 | | |
9045 | | static const JSJitInfo y_getterinfo = { |
9046 | | { (JSJitGetterOp)get_y }, |
9047 | | { prototypes::id::SVGPathSegMovetoRel }, |
9048 | | { PrototypeTraits<prototypes::id::SVGPathSegMovetoRel>::Depth }, |
9049 | | JSJitInfo::Getter, |
9050 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
9051 | | JSVAL_TYPE_DOUBLE, /* returnType. Not relevant for setters. */ |
9052 | | true, /* isInfallible. False in setters. */ |
9053 | | false, /* isMovable. Not relevant for setters. */ |
9054 | | false, /* isEliminatable. Not relevant for setters. */ |
9055 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
9056 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
9057 | | false, /* isTypedMethod. Only relevant for methods. */ |
9058 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
9059 | | }; |
9060 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
9061 | | static_assert(0 < 1, "There is no slot for us"); |
9062 | | static const JSJitInfo y_setterinfo = { |
9063 | | { (JSJitGetterOp)set_y }, |
9064 | | { prototypes::id::SVGPathSegMovetoRel }, |
9065 | | { PrototypeTraits<prototypes::id::SVGPathSegMovetoRel>::Depth }, |
9066 | | JSJitInfo::Setter, |
9067 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
9068 | | JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */ |
9069 | | false, /* isInfallible. False in setters. */ |
9070 | | false, /* isMovable. Not relevant for setters. */ |
9071 | | false, /* isEliminatable. Not relevant for setters. */ |
9072 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
9073 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
9074 | | false, /* isTypedMethod. Only relevant for methods. */ |
9075 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
9076 | | }; |
9077 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
9078 | | static_assert(0 < 1, "There is no slot for us"); |
9079 | | |
9080 | | static bool |
9081 | | _addProperty(JSContext* cx, JS::Handle<JSObject*> obj, JS::Handle<jsid> id, JS::Handle<JS::Value> val) |
9082 | 0 | { |
9083 | 0 | mozilla::DOMSVGPathSegMovetoRel* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::DOMSVGPathSegMovetoRel>(obj); |
9084 | 0 | // We don't want to preserve if we don't have a wrapper, and we |
9085 | 0 | // obviously can't preserve if we're not initialized. |
9086 | 0 | if (self && self->GetWrapperPreserveColor()) { |
9087 | 0 | PreserveWrapper(self); |
9088 | 0 | } |
9089 | 0 | return true; |
9090 | 0 | } |
9091 | | |
9092 | | static void |
9093 | | _finalize(js::FreeOp* fop, JSObject* obj) |
9094 | 0 | { |
9095 | 0 | mozilla::DOMSVGPathSegMovetoRel* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::DOMSVGPathSegMovetoRel>(obj); |
9096 | 0 | if (self) { |
9097 | 0 | ClearWrapper(self, self, obj); |
9098 | 0 | AddForDeferredFinalization<mozilla::DOMSVGPathSegMovetoRel>(self); |
9099 | 0 | } |
9100 | 0 | } |
9101 | | |
9102 | | static size_t |
9103 | | _objectMoved(JSObject* obj, JSObject* old) |
9104 | 0 | { |
9105 | 0 | mozilla::DOMSVGPathSegMovetoRel* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::DOMSVGPathSegMovetoRel>(obj); |
9106 | 0 | if (self) { |
9107 | 0 | UpdateWrapper(self, self, obj, old); |
9108 | 0 | } |
9109 | 0 |
|
9110 | 0 | return 0; |
9111 | 0 | } |
9112 | | |
9113 | | // We deliberately use brace-elision to make Visual Studio produce better initalization code. |
9114 | | #if defined(__clang__) |
9115 | | #pragma clang diagnostic push |
9116 | | #pragma clang diagnostic ignored "-Wmissing-braces" |
9117 | | #endif |
9118 | | static const JSPropertySpec sAttributes_specs[] = { |
9119 | | { "x", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &x_getterinfo, GenericSetter<NormalThisPolicy>, &x_setterinfo }, |
9120 | | { "y", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &y_getterinfo, GenericSetter<NormalThisPolicy>, &y_setterinfo }, |
9121 | | { nullptr, 0, nullptr, nullptr, nullptr, nullptr } |
9122 | | }; |
9123 | | #if defined(__clang__) |
9124 | | #pragma clang diagnostic pop |
9125 | | #endif |
9126 | | |
9127 | | |
9128 | | static const Prefable<const JSPropertySpec> sAttributes[] = { |
9129 | | { nullptr, &sAttributes_specs[0] }, |
9130 | | { nullptr, nullptr } |
9131 | | }; |
9132 | | |
9133 | | static_assert(1 <= 1ull << NUM_BITS_PROPERTY_INFO_PREF_INDEX, |
9134 | | "We have a prefable index that is >= (1 << NUM_BITS_PROPERTY_INFO_PREF_INDEX)"); |
9135 | | static_assert(2 <= 1ull << NUM_BITS_PROPERTY_INFO_SPEC_INDEX, |
9136 | | "We have a spec index that is >= (1 << NUM_BITS_PROPERTY_INFO_SPEC_INDEX)"); |
9137 | | |
9138 | | |
9139 | | static uint16_t sNativeProperties_sortedPropertyIndices[2]; |
9140 | | static PropertyInfo sNativeProperties_propertyInfos[2]; |
9141 | | |
9142 | | static const NativePropertiesN<1> sNativeProperties = { |
9143 | | false, 0, |
9144 | | false, 0, |
9145 | | false, 0, |
9146 | | true, 0 /* sAttributes */, |
9147 | | false, 0, |
9148 | | false, 0, |
9149 | | false, 0, |
9150 | | -1, |
9151 | | 2, |
9152 | | sNativeProperties_sortedPropertyIndices, |
9153 | | { |
9154 | | { sAttributes, &sNativeProperties_propertyInfos[0] } |
9155 | | } |
9156 | | }; |
9157 | | static_assert(2 < 1ull << CHAR_BIT * sizeof(sNativeProperties.propertyInfoCount), |
9158 | | "We have a property info count that is oversized"); |
9159 | | |
9160 | | static const DOMIfaceAndProtoJSClass sPrototypeClass = { |
9161 | | { |
9162 | | "SVGPathSegMovetoRelPrototype", |
9163 | | JSCLASS_IS_DOMIFACEANDPROTOJSCLASS | JSCLASS_HAS_RESERVED_SLOTS(DOM_INTERFACE_PROTO_SLOTS_BASE), |
9164 | | JS_NULL_CLASS_OPS, |
9165 | | JS_NULL_CLASS_SPEC, |
9166 | | JS_NULL_CLASS_EXT, |
9167 | | JS_NULL_OBJECT_OPS |
9168 | | }, |
9169 | | eInterfacePrototype, |
9170 | | false, |
9171 | | prototypes::id::SVGPathSegMovetoRel, |
9172 | | PrototypeTraits<prototypes::id::SVGPathSegMovetoRel>::Depth, |
9173 | | sNativePropertyHooks, |
9174 | | "[object SVGPathSegMovetoRelPrototype]", |
9175 | | SVGPathSeg_Binding::GetProtoObject |
9176 | | }; |
9177 | | |
9178 | | static const js::ClassOps sClassOps = { |
9179 | | _addProperty, /* addProperty */ |
9180 | | nullptr, /* delProperty */ |
9181 | | nullptr, /* enumerate */ |
9182 | | nullptr, /* newEnumerate */ |
9183 | | nullptr, /* resolve */ |
9184 | | nullptr, /* mayResolve */ |
9185 | | _finalize, /* finalize */ |
9186 | | nullptr, /* call */ |
9187 | | nullptr, /* hasInstance */ |
9188 | | nullptr, /* construct */ |
9189 | | nullptr, /* trace */ |
9190 | | }; |
9191 | | |
9192 | | static const js::ClassExtension sClassExtension = { |
9193 | | nullptr, /* weakmapKeyDelegateOp */ |
9194 | | _objectMoved /* objectMovedOp */ |
9195 | | }; |
9196 | | |
9197 | | static const DOMJSClass sClass = { |
9198 | | { "SVGPathSegMovetoRel", |
9199 | | JSCLASS_IS_DOMJSCLASS | JSCLASS_FOREGROUND_FINALIZE | JSCLASS_HAS_RESERVED_SLOTS(1), |
9200 | | &sClassOps, |
9201 | | JS_NULL_CLASS_SPEC, |
9202 | | &sClassExtension, |
9203 | | JS_NULL_OBJECT_OPS |
9204 | | }, |
9205 | | { prototypes::id::SVGPathSeg, prototypes::id::SVGPathSegMovetoRel, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count }, |
9206 | | IsBaseOf<nsISupports, mozilla::DOMSVGPathSegMovetoRel >::value, |
9207 | | sNativePropertyHooks, |
9208 | | FindAssociatedGlobalForNative<mozilla::DOMSVGPathSegMovetoRel>::Get, |
9209 | | GetProtoObjectHandle, |
9210 | | GetCCParticipant<mozilla::DOMSVGPathSegMovetoRel>::Get() |
9211 | | }; |
9212 | | static_assert(1 == DOM_INSTANCE_RESERVED_SLOTS, |
9213 | | "Must have the right minimal number of reserved slots."); |
9214 | | static_assert(1 >= 1, |
9215 | | "Must have enough reserved slots."); |
9216 | | |
9217 | | const JSClass* |
9218 | | GetJSClass() |
9219 | 0 | { |
9220 | 0 | return sClass.ToJSClass(); |
9221 | 0 | } |
9222 | | |
9223 | | bool |
9224 | | Wrap(JSContext* aCx, mozilla::DOMSVGPathSegMovetoRel* aObject, nsWrapperCache* aCache, JS::Handle<JSObject*> aGivenProto, JS::MutableHandle<JSObject*> aReflector) |
9225 | 0 | { |
9226 | 0 | static_assert(!IsBaseOf<NonRefcountedDOMObject, mozilla::DOMSVGPathSegMovetoRel>::value, |
9227 | 0 | "Shouldn't have wrappercached things that are not refcounted."); |
9228 | 0 | MOZ_ASSERT(static_cast<mozilla::DOMSVGPathSegMovetoRel*>(aObject) == |
9229 | 0 | reinterpret_cast<mozilla::DOMSVGPathSegMovetoRel*>(aObject), |
9230 | 0 | "Multiple inheritance for mozilla::DOMSVGPathSegMovetoRel is broken."); |
9231 | 0 | MOZ_ASSERT(static_cast<mozilla::DOMSVGPathSeg*>(aObject) == |
9232 | 0 | reinterpret_cast<mozilla::DOMSVGPathSeg*>(aObject), |
9233 | 0 | "Multiple inheritance for mozilla::DOMSVGPathSeg is broken."); |
9234 | 0 | MOZ_ASSERT(ToSupportsIsCorrect(aObject)); |
9235 | 0 | MOZ_ASSERT_IF(aGivenProto, js::IsObjectInContextCompartment(aGivenProto, aCx)); |
9236 | 0 | MOZ_ASSERT(!aCache->GetWrapper(), |
9237 | 0 | "You should probably not be using Wrap() directly; use " |
9238 | 0 | "GetOrCreateDOMReflector instead"); |
9239 | 0 |
|
9240 | 0 | MOZ_ASSERT(ToSupportsIsOnPrimaryInheritanceChain(aObject, aCache), |
9241 | 0 | "nsISupports must be on our primary inheritance chain"); |
9242 | 0 |
|
9243 | 0 | JS::Rooted<JSObject*> global(aCx, FindAssociatedGlobal(aCx, aObject->GetParentObject())); |
9244 | 0 | if (!global) { |
9245 | 0 | return false; |
9246 | 0 | } |
9247 | 0 | MOZ_ASSERT(JS_IsGlobalObject(global)); |
9248 | 0 | MOZ_ASSERT(JS::ObjectIsNotGray(global)); |
9249 | 0 |
|
9250 | 0 | // That might have ended up wrapping us already, due to the wonders |
9251 | 0 | // of XBL. Check for that, and bail out as needed. |
9252 | 0 | aReflector.set(aCache->GetWrapper()); |
9253 | 0 | if (aReflector) { |
9254 | | #ifdef DEBUG |
9255 | | AssertReflectorHasGivenProto(aCx, aReflector, aGivenProto); |
9256 | | #endif // DEBUG |
9257 | | return true; |
9258 | 0 | } |
9259 | 0 |
|
9260 | 0 | JSAutoRealm ar(aCx, global); |
9261 | 0 | JS::Handle<JSObject*> canonicalProto = GetProtoObjectHandle(aCx); |
9262 | 0 | if (!canonicalProto) { |
9263 | 0 | return false; |
9264 | 0 | } |
9265 | 0 | JS::Rooted<JSObject*> proto(aCx); |
9266 | 0 | if (aGivenProto) { |
9267 | 0 | proto = aGivenProto; |
9268 | 0 | // Unfortunately, while aGivenProto was in the compartment of aCx |
9269 | 0 | // coming in, we changed compartments to that of "parent" so may need |
9270 | 0 | // to wrap the proto here. |
9271 | 0 | if (js::GetContextCompartment(aCx) != js::GetObjectCompartment(proto)) { |
9272 | 0 | if (!JS_WrapObject(aCx, &proto)) { |
9273 | 0 | return false; |
9274 | 0 | } |
9275 | 0 | } |
9276 | 0 | } else { |
9277 | 0 | proto = canonicalProto; |
9278 | 0 | } |
9279 | 0 |
|
9280 | 0 | BindingJSObjectCreator<mozilla::DOMSVGPathSegMovetoRel> creator(aCx); |
9281 | 0 | creator.CreateObject(aCx, sClass.ToJSClass(), proto, aObject, aReflector); |
9282 | 0 | if (!aReflector) { |
9283 | 0 | return false; |
9284 | 0 | } |
9285 | 0 | |
9286 | 0 | aCache->SetWrapper(aReflector); |
9287 | 0 | creator.InitializationSucceeded(); |
9288 | 0 |
|
9289 | 0 | MOZ_ASSERT(aCache->GetWrapperPreserveColor() && |
9290 | 0 | aCache->GetWrapperPreserveColor() == aReflector); |
9291 | 0 | // If proto != canonicalProto, we have to preserve our wrapper; |
9292 | 0 | // otherwise we won't be able to properly recreate it later, since |
9293 | 0 | // we won't know what proto to use. Note that we don't check |
9294 | 0 | // aGivenProto here, since it's entirely possible (and even |
9295 | 0 | // somewhat common) to have a non-null aGivenProto which is the |
9296 | 0 | // same as canonicalProto. |
9297 | 0 | if (proto != canonicalProto) { |
9298 | 0 | PreserveWrapper(aObject); |
9299 | 0 | } |
9300 | 0 |
|
9301 | 0 | return true; |
9302 | 0 | } |
9303 | | |
9304 | | const NativePropertyHooks sNativePropertyHooks[] = { { |
9305 | | nullptr, |
9306 | | nullptr, |
9307 | | nullptr, |
9308 | | { sNativeProperties.Upcast(), nullptr }, |
9309 | | prototypes::id::SVGPathSegMovetoRel, |
9310 | | constructors::id::_ID_Count, |
9311 | | SVGPathSeg_Binding::sNativePropertyHooks, |
9312 | | &DefaultXrayExpandoObjectClass |
9313 | | } }; |
9314 | | |
9315 | | void |
9316 | | CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, bool aDefineOnGlobal) |
9317 | 0 | { |
9318 | 0 | JS::Handle<JSObject*> parentProto(SVGPathSeg_Binding::GetProtoObjectHandle(aCx)); |
9319 | 0 | if (!parentProto) { |
9320 | 0 | return; |
9321 | 0 | } |
9322 | 0 | |
9323 | 0 | static bool sIdsInited = false; |
9324 | 0 | if (!sIdsInited && NS_IsMainThread()) { |
9325 | 0 | if (!InitIds(aCx, sNativeProperties.Upcast())) { |
9326 | 0 | return; |
9327 | 0 | } |
9328 | 0 | sIdsInited = true; |
9329 | 0 | } |
9330 | 0 |
|
9331 | 0 | JS::Heap<JSObject*>* protoCache = &aProtoAndIfaceCache.EntrySlotOrCreate(prototypes::id::SVGPathSegMovetoRel); |
9332 | 0 | JS::Heap<JSObject*>* interfaceCache = nullptr; |
9333 | 0 | dom::CreateInterfaceObjects(aCx, aGlobal, parentProto, |
9334 | 0 | &sPrototypeClass.mBase, protoCache, |
9335 | 0 | nullptr, |
9336 | 0 | nullptr, nullptr, 0, nullptr, |
9337 | 0 | interfaceCache, |
9338 | 0 | sNativeProperties.Upcast(), |
9339 | 0 | nullptr, |
9340 | 0 | nullptr, aDefineOnGlobal, |
9341 | 0 | nullptr, |
9342 | 0 | false); |
9343 | 0 | } |
9344 | | |
9345 | | } // namespace SVGPathSegMovetoRel_Binding |
9346 | | |
9347 | | |
9348 | | |
9349 | | } // namespace dom |
9350 | | } // namespace mozilla |