/work/obj-fuzz/dom/bindings/SVGMatrixBinding.cpp
Line | Count | Source (jump to first uncovered line) |
1 | | /* THIS FILE IS AUTOGENERATED FROM SVGMatrix.webidl BY Codegen.py - DO NOT EDIT */ |
2 | | |
3 | | #include "SVGMatrixBinding.h" |
4 | | #include "WrapperFactory.h" |
5 | | #include "mozilla/FloatingPoint.h" |
6 | | #include "mozilla/OwningNonNull.h" |
7 | | #include "mozilla/dom/BindingUtils.h" |
8 | | #include "mozilla/dom/DOMJSClass.h" |
9 | | #include "mozilla/dom/NonRefcountedDOMObject.h" |
10 | | #include "mozilla/dom/PrimitiveConversions.h" |
11 | | #include "mozilla/dom/SVGMatrix.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 SVGMatrix_Binding { |
22 | | |
23 | | MOZ_CAN_RUN_SCRIPT static bool |
24 | | get_a(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SVGMatrix* self, JSJitGetterCallArgs args) |
25 | 0 | { |
26 | 0 | AUTO_PROFILER_LABEL_FAST("get SVGMatrix.a", DOM, cx); |
27 | 0 |
|
28 | 0 | float result(self->A()); |
29 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
30 | 0 | args.rval().set(JS_NumberValue(double(result))); |
31 | 0 | return true; |
32 | 0 | } |
33 | | |
34 | | MOZ_CAN_RUN_SCRIPT static bool |
35 | | set_a(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SVGMatrix* self, JSJitSetterCallArgs args) |
36 | 0 | { |
37 | 0 | AUTO_PROFILER_LABEL_FAST("set SVGMatrix.a", DOM, cx); |
38 | 0 |
|
39 | 0 | float arg0; |
40 | 0 | if (!ValueToPrimitive<float, eDefault>(cx, args[0], &arg0)) { |
41 | 0 | return false; |
42 | 0 | } else if (!mozilla::IsFinite(arg0)) { |
43 | 0 | ThrowErrorMessage(cx, MSG_NOT_FINITE, "Value being assigned to SVGMatrix.a"); |
44 | 0 | return false; |
45 | 0 | } |
46 | 0 | FastErrorResult rv; |
47 | 0 | self->SetA(arg0, rv); |
48 | 0 | if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) { |
49 | 0 | return false; |
50 | 0 | } |
51 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
52 | 0 |
|
53 | 0 | return true; |
54 | 0 | } |
55 | | |
56 | | static const JSJitInfo a_getterinfo = { |
57 | | { (JSJitGetterOp)get_a }, |
58 | | { prototypes::id::SVGMatrix }, |
59 | | { PrototypeTraits<prototypes::id::SVGMatrix>::Depth }, |
60 | | JSJitInfo::Getter, |
61 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
62 | | JSVAL_TYPE_DOUBLE, /* returnType. Not relevant for setters. */ |
63 | | true, /* isInfallible. False in setters. */ |
64 | | false, /* isMovable. Not relevant for setters. */ |
65 | | false, /* isEliminatable. Not relevant for setters. */ |
66 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
67 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
68 | | false, /* isTypedMethod. Only relevant for methods. */ |
69 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
70 | | }; |
71 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
72 | | static_assert(0 < 1, "There is no slot for us"); |
73 | | static const JSJitInfo a_setterinfo = { |
74 | | { (JSJitGetterOp)set_a }, |
75 | | { prototypes::id::SVGMatrix }, |
76 | | { PrototypeTraits<prototypes::id::SVGMatrix>::Depth }, |
77 | | JSJitInfo::Setter, |
78 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
79 | | JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */ |
80 | | false, /* isInfallible. False in setters. */ |
81 | | false, /* isMovable. Not relevant for setters. */ |
82 | | false, /* isEliminatable. Not relevant for setters. */ |
83 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
84 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
85 | | false, /* isTypedMethod. Only relevant for methods. */ |
86 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
87 | | }; |
88 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
89 | | static_assert(0 < 1, "There is no slot for us"); |
90 | | |
91 | | MOZ_CAN_RUN_SCRIPT static bool |
92 | | get_b(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SVGMatrix* self, JSJitGetterCallArgs args) |
93 | 0 | { |
94 | 0 | AUTO_PROFILER_LABEL_FAST("get SVGMatrix.b", DOM, cx); |
95 | 0 |
|
96 | 0 | float result(self->B()); |
97 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
98 | 0 | args.rval().set(JS_NumberValue(double(result))); |
99 | 0 | return true; |
100 | 0 | } |
101 | | |
102 | | MOZ_CAN_RUN_SCRIPT static bool |
103 | | set_b(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SVGMatrix* self, JSJitSetterCallArgs args) |
104 | 0 | { |
105 | 0 | AUTO_PROFILER_LABEL_FAST("set SVGMatrix.b", DOM, cx); |
106 | 0 |
|
107 | 0 | float arg0; |
108 | 0 | if (!ValueToPrimitive<float, eDefault>(cx, args[0], &arg0)) { |
109 | 0 | return false; |
110 | 0 | } else if (!mozilla::IsFinite(arg0)) { |
111 | 0 | ThrowErrorMessage(cx, MSG_NOT_FINITE, "Value being assigned to SVGMatrix.b"); |
112 | 0 | return false; |
113 | 0 | } |
114 | 0 | FastErrorResult rv; |
115 | 0 | self->SetB(arg0, rv); |
116 | 0 | if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) { |
117 | 0 | return false; |
118 | 0 | } |
119 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
120 | 0 |
|
121 | 0 | return true; |
122 | 0 | } |
123 | | |
124 | | static const JSJitInfo b_getterinfo = { |
125 | | { (JSJitGetterOp)get_b }, |
126 | | { prototypes::id::SVGMatrix }, |
127 | | { PrototypeTraits<prototypes::id::SVGMatrix>::Depth }, |
128 | | JSJitInfo::Getter, |
129 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
130 | | JSVAL_TYPE_DOUBLE, /* returnType. Not relevant for setters. */ |
131 | | true, /* isInfallible. False in setters. */ |
132 | | false, /* isMovable. Not relevant for setters. */ |
133 | | false, /* isEliminatable. Not relevant for setters. */ |
134 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
135 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
136 | | false, /* isTypedMethod. Only relevant for methods. */ |
137 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
138 | | }; |
139 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
140 | | static_assert(0 < 1, "There is no slot for us"); |
141 | | static const JSJitInfo b_setterinfo = { |
142 | | { (JSJitGetterOp)set_b }, |
143 | | { prototypes::id::SVGMatrix }, |
144 | | { PrototypeTraits<prototypes::id::SVGMatrix>::Depth }, |
145 | | JSJitInfo::Setter, |
146 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
147 | | JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */ |
148 | | false, /* isInfallible. False in setters. */ |
149 | | false, /* isMovable. Not relevant for setters. */ |
150 | | false, /* isEliminatable. Not relevant for setters. */ |
151 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
152 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
153 | | false, /* isTypedMethod. Only relevant for methods. */ |
154 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
155 | | }; |
156 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
157 | | static_assert(0 < 1, "There is no slot for us"); |
158 | | |
159 | | MOZ_CAN_RUN_SCRIPT static bool |
160 | | get_c(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SVGMatrix* self, JSJitGetterCallArgs args) |
161 | 0 | { |
162 | 0 | AUTO_PROFILER_LABEL_FAST("get SVGMatrix.c", DOM, cx); |
163 | 0 |
|
164 | 0 | float result(self->C()); |
165 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
166 | 0 | args.rval().set(JS_NumberValue(double(result))); |
167 | 0 | return true; |
168 | 0 | } |
169 | | |
170 | | MOZ_CAN_RUN_SCRIPT static bool |
171 | | set_c(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SVGMatrix* self, JSJitSetterCallArgs args) |
172 | 0 | { |
173 | 0 | AUTO_PROFILER_LABEL_FAST("set SVGMatrix.c", DOM, cx); |
174 | 0 |
|
175 | 0 | float arg0; |
176 | 0 | if (!ValueToPrimitive<float, eDefault>(cx, args[0], &arg0)) { |
177 | 0 | return false; |
178 | 0 | } else if (!mozilla::IsFinite(arg0)) { |
179 | 0 | ThrowErrorMessage(cx, MSG_NOT_FINITE, "Value being assigned to SVGMatrix.c"); |
180 | 0 | return false; |
181 | 0 | } |
182 | 0 | FastErrorResult rv; |
183 | 0 | self->SetC(arg0, rv); |
184 | 0 | if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) { |
185 | 0 | return false; |
186 | 0 | } |
187 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
188 | 0 |
|
189 | 0 | return true; |
190 | 0 | } |
191 | | |
192 | | static const JSJitInfo c_getterinfo = { |
193 | | { (JSJitGetterOp)get_c }, |
194 | | { prototypes::id::SVGMatrix }, |
195 | | { PrototypeTraits<prototypes::id::SVGMatrix>::Depth }, |
196 | | JSJitInfo::Getter, |
197 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
198 | | JSVAL_TYPE_DOUBLE, /* returnType. Not relevant for setters. */ |
199 | | true, /* isInfallible. False in setters. */ |
200 | | false, /* isMovable. Not relevant for setters. */ |
201 | | false, /* isEliminatable. Not relevant for setters. */ |
202 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
203 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
204 | | false, /* isTypedMethod. Only relevant for methods. */ |
205 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
206 | | }; |
207 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
208 | | static_assert(0 < 1, "There is no slot for us"); |
209 | | static const JSJitInfo c_setterinfo = { |
210 | | { (JSJitGetterOp)set_c }, |
211 | | { prototypes::id::SVGMatrix }, |
212 | | { PrototypeTraits<prototypes::id::SVGMatrix>::Depth }, |
213 | | JSJitInfo::Setter, |
214 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
215 | | JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */ |
216 | | false, /* isInfallible. False in setters. */ |
217 | | false, /* isMovable. Not relevant for setters. */ |
218 | | false, /* isEliminatable. Not relevant for setters. */ |
219 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
220 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
221 | | false, /* isTypedMethod. Only relevant for methods. */ |
222 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
223 | | }; |
224 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
225 | | static_assert(0 < 1, "There is no slot for us"); |
226 | | |
227 | | MOZ_CAN_RUN_SCRIPT static bool |
228 | | get_d(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SVGMatrix* self, JSJitGetterCallArgs args) |
229 | 0 | { |
230 | 0 | AUTO_PROFILER_LABEL_FAST("get SVGMatrix.d", DOM, cx); |
231 | 0 |
|
232 | 0 | float result(self->D()); |
233 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
234 | 0 | args.rval().set(JS_NumberValue(double(result))); |
235 | 0 | return true; |
236 | 0 | } |
237 | | |
238 | | MOZ_CAN_RUN_SCRIPT static bool |
239 | | set_d(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SVGMatrix* self, JSJitSetterCallArgs args) |
240 | 0 | { |
241 | 0 | AUTO_PROFILER_LABEL_FAST("set SVGMatrix.d", DOM, cx); |
242 | 0 |
|
243 | 0 | float arg0; |
244 | 0 | if (!ValueToPrimitive<float, eDefault>(cx, args[0], &arg0)) { |
245 | 0 | return false; |
246 | 0 | } else if (!mozilla::IsFinite(arg0)) { |
247 | 0 | ThrowErrorMessage(cx, MSG_NOT_FINITE, "Value being assigned to SVGMatrix.d"); |
248 | 0 | return false; |
249 | 0 | } |
250 | 0 | FastErrorResult rv; |
251 | 0 | self->SetD(arg0, rv); |
252 | 0 | if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) { |
253 | 0 | return false; |
254 | 0 | } |
255 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
256 | 0 |
|
257 | 0 | return true; |
258 | 0 | } |
259 | | |
260 | | static const JSJitInfo d_getterinfo = { |
261 | | { (JSJitGetterOp)get_d }, |
262 | | { prototypes::id::SVGMatrix }, |
263 | | { PrototypeTraits<prototypes::id::SVGMatrix>::Depth }, |
264 | | JSJitInfo::Getter, |
265 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
266 | | JSVAL_TYPE_DOUBLE, /* returnType. Not relevant for setters. */ |
267 | | true, /* isInfallible. False in setters. */ |
268 | | false, /* isMovable. Not relevant for setters. */ |
269 | | false, /* isEliminatable. Not relevant for setters. */ |
270 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
271 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
272 | | false, /* isTypedMethod. Only relevant for methods. */ |
273 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
274 | | }; |
275 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
276 | | static_assert(0 < 1, "There is no slot for us"); |
277 | | static const JSJitInfo d_setterinfo = { |
278 | | { (JSJitGetterOp)set_d }, |
279 | | { prototypes::id::SVGMatrix }, |
280 | | { PrototypeTraits<prototypes::id::SVGMatrix>::Depth }, |
281 | | JSJitInfo::Setter, |
282 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
283 | | JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */ |
284 | | false, /* isInfallible. False in setters. */ |
285 | | false, /* isMovable. Not relevant for setters. */ |
286 | | false, /* isEliminatable. Not relevant for setters. */ |
287 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
288 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
289 | | false, /* isTypedMethod. Only relevant for methods. */ |
290 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
291 | | }; |
292 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
293 | | static_assert(0 < 1, "There is no slot for us"); |
294 | | |
295 | | MOZ_CAN_RUN_SCRIPT static bool |
296 | | get_e(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SVGMatrix* self, JSJitGetterCallArgs args) |
297 | 0 | { |
298 | 0 | AUTO_PROFILER_LABEL_FAST("get SVGMatrix.e", DOM, cx); |
299 | 0 |
|
300 | 0 | float result(self->E()); |
301 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
302 | 0 | args.rval().set(JS_NumberValue(double(result))); |
303 | 0 | return true; |
304 | 0 | } |
305 | | |
306 | | MOZ_CAN_RUN_SCRIPT static bool |
307 | | set_e(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SVGMatrix* self, JSJitSetterCallArgs args) |
308 | 0 | { |
309 | 0 | AUTO_PROFILER_LABEL_FAST("set SVGMatrix.e", DOM, cx); |
310 | 0 |
|
311 | 0 | float arg0; |
312 | 0 | if (!ValueToPrimitive<float, eDefault>(cx, args[0], &arg0)) { |
313 | 0 | return false; |
314 | 0 | } else if (!mozilla::IsFinite(arg0)) { |
315 | 0 | ThrowErrorMessage(cx, MSG_NOT_FINITE, "Value being assigned to SVGMatrix.e"); |
316 | 0 | return false; |
317 | 0 | } |
318 | 0 | FastErrorResult rv; |
319 | 0 | self->SetE(arg0, rv); |
320 | 0 | if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) { |
321 | 0 | return false; |
322 | 0 | } |
323 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
324 | 0 |
|
325 | 0 | return true; |
326 | 0 | } |
327 | | |
328 | | static const JSJitInfo e_getterinfo = { |
329 | | { (JSJitGetterOp)get_e }, |
330 | | { prototypes::id::SVGMatrix }, |
331 | | { PrototypeTraits<prototypes::id::SVGMatrix>::Depth }, |
332 | | JSJitInfo::Getter, |
333 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
334 | | JSVAL_TYPE_DOUBLE, /* returnType. Not relevant for setters. */ |
335 | | true, /* isInfallible. False in setters. */ |
336 | | false, /* isMovable. Not relevant for setters. */ |
337 | | false, /* isEliminatable. Not relevant for setters. */ |
338 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
339 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
340 | | false, /* isTypedMethod. Only relevant for methods. */ |
341 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
342 | | }; |
343 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
344 | | static_assert(0 < 1, "There is no slot for us"); |
345 | | static const JSJitInfo e_setterinfo = { |
346 | | { (JSJitGetterOp)set_e }, |
347 | | { prototypes::id::SVGMatrix }, |
348 | | { PrototypeTraits<prototypes::id::SVGMatrix>::Depth }, |
349 | | JSJitInfo::Setter, |
350 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
351 | | JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */ |
352 | | false, /* isInfallible. False in setters. */ |
353 | | false, /* isMovable. Not relevant for setters. */ |
354 | | false, /* isEliminatable. Not relevant for setters. */ |
355 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
356 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
357 | | false, /* isTypedMethod. Only relevant for methods. */ |
358 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
359 | | }; |
360 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
361 | | static_assert(0 < 1, "There is no slot for us"); |
362 | | |
363 | | MOZ_CAN_RUN_SCRIPT static bool |
364 | | get_f(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SVGMatrix* self, JSJitGetterCallArgs args) |
365 | 0 | { |
366 | 0 | AUTO_PROFILER_LABEL_FAST("get SVGMatrix.f", DOM, cx); |
367 | 0 |
|
368 | 0 | float result(self->F()); |
369 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
370 | 0 | args.rval().set(JS_NumberValue(double(result))); |
371 | 0 | return true; |
372 | 0 | } |
373 | | |
374 | | MOZ_CAN_RUN_SCRIPT static bool |
375 | | set_f(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SVGMatrix* self, JSJitSetterCallArgs args) |
376 | 0 | { |
377 | 0 | AUTO_PROFILER_LABEL_FAST("set SVGMatrix.f", DOM, cx); |
378 | 0 |
|
379 | 0 | float arg0; |
380 | 0 | if (!ValueToPrimitive<float, eDefault>(cx, args[0], &arg0)) { |
381 | 0 | return false; |
382 | 0 | } else if (!mozilla::IsFinite(arg0)) { |
383 | 0 | ThrowErrorMessage(cx, MSG_NOT_FINITE, "Value being assigned to SVGMatrix.f"); |
384 | 0 | return false; |
385 | 0 | } |
386 | 0 | FastErrorResult rv; |
387 | 0 | self->SetF(arg0, rv); |
388 | 0 | if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) { |
389 | 0 | return false; |
390 | 0 | } |
391 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
392 | 0 |
|
393 | 0 | return true; |
394 | 0 | } |
395 | | |
396 | | static const JSJitInfo f_getterinfo = { |
397 | | { (JSJitGetterOp)get_f }, |
398 | | { prototypes::id::SVGMatrix }, |
399 | | { PrototypeTraits<prototypes::id::SVGMatrix>::Depth }, |
400 | | JSJitInfo::Getter, |
401 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
402 | | JSVAL_TYPE_DOUBLE, /* returnType. Not relevant for setters. */ |
403 | | true, /* isInfallible. False in setters. */ |
404 | | false, /* isMovable. Not relevant for setters. */ |
405 | | false, /* isEliminatable. Not relevant for setters. */ |
406 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
407 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
408 | | false, /* isTypedMethod. Only relevant for methods. */ |
409 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
410 | | }; |
411 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
412 | | static_assert(0 < 1, "There is no slot for us"); |
413 | | static const JSJitInfo f_setterinfo = { |
414 | | { (JSJitGetterOp)set_f }, |
415 | | { prototypes::id::SVGMatrix }, |
416 | | { PrototypeTraits<prototypes::id::SVGMatrix>::Depth }, |
417 | | JSJitInfo::Setter, |
418 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
419 | | JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */ |
420 | | false, /* isInfallible. False in setters. */ |
421 | | false, /* isMovable. Not relevant for setters. */ |
422 | | false, /* isEliminatable. Not relevant for setters. */ |
423 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
424 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
425 | | false, /* isTypedMethod. Only relevant for methods. */ |
426 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
427 | | }; |
428 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
429 | | static_assert(0 < 1, "There is no slot for us"); |
430 | | |
431 | | MOZ_CAN_RUN_SCRIPT static bool |
432 | | multiply(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SVGMatrix* self, const JSJitMethodCallArgs& args) |
433 | 0 | { |
434 | 0 | AUTO_PROFILER_LABEL_FAST("SVGMatrix.multiply", DOM, cx); |
435 | 0 |
|
436 | 0 | if (MOZ_UNLIKELY(args.length() < 1)) { |
437 | 0 | return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "SVGMatrix.multiply"); |
438 | 0 | } |
439 | 0 | NonNull<mozilla::dom::SVGMatrix> arg0; |
440 | 0 | if (args[0].isObject()) { |
441 | 0 | { |
442 | 0 | nsresult rv = UnwrapObject<prototypes::id::SVGMatrix, mozilla::dom::SVGMatrix>(args[0], arg0); |
443 | 0 | if (NS_FAILED(rv)) { |
444 | 0 | ThrowErrorMessage(cx, MSG_DOES_NOT_IMPLEMENT_INTERFACE, "Argument 1 of SVGMatrix.multiply", "SVGMatrix"); |
445 | 0 | return false; |
446 | 0 | } |
447 | 0 | } |
448 | 0 | } else { |
449 | 0 | ThrowErrorMessage(cx, MSG_NOT_OBJECT, "Argument 1 of SVGMatrix.multiply"); |
450 | 0 | return false; |
451 | 0 | } |
452 | 0 | auto result(StrongOrRawPtr<mozilla::dom::SVGMatrix>(self->Multiply(MOZ_KnownLive(NonNullHelper(arg0))))); |
453 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
454 | 0 | static_assert(!IsPointer<decltype(result)>::value, |
455 | 0 | "NewObject implies that we need to keep the object alive with a strong reference."); |
456 | 0 | if (!GetOrCreateDOMReflector(cx, result, args.rval())) { |
457 | 0 | MOZ_ASSERT(JS_IsExceptionPending(cx)); |
458 | 0 | return false; |
459 | 0 | } |
460 | 0 | return true; |
461 | 0 | } |
462 | | |
463 | | static const JSJitInfo multiply_methodinfo = { |
464 | | { (JSJitGetterOp)multiply }, |
465 | | { prototypes::id::SVGMatrix }, |
466 | | { PrototypeTraits<prototypes::id::SVGMatrix>::Depth }, |
467 | | JSJitInfo::Method, |
468 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
469 | | JSVAL_TYPE_OBJECT, /* returnType. Not relevant for setters. */ |
470 | | false, /* isInfallible. False in setters. */ |
471 | | false, /* isMovable. Not relevant for setters. */ |
472 | | false, /* isEliminatable. Not relevant for setters. */ |
473 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
474 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
475 | | false, /* isTypedMethod. Only relevant for methods. */ |
476 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
477 | | }; |
478 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
479 | | static_assert(0 < 1, "There is no slot for us"); |
480 | | |
481 | | MOZ_CAN_RUN_SCRIPT static bool |
482 | | inverse(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SVGMatrix* self, const JSJitMethodCallArgs& args) |
483 | 0 | { |
484 | 0 | AUTO_PROFILER_LABEL_FAST("SVGMatrix.inverse", DOM, cx); |
485 | 0 |
|
486 | 0 | FastErrorResult rv; |
487 | 0 | auto result(StrongOrRawPtr<mozilla::dom::SVGMatrix>(self->Inverse(rv))); |
488 | 0 | if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) { |
489 | 0 | return false; |
490 | 0 | } |
491 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
492 | 0 | static_assert(!IsPointer<decltype(result)>::value, |
493 | 0 | "NewObject implies that we need to keep the object alive with a strong reference."); |
494 | 0 | if (!GetOrCreateDOMReflector(cx, result, args.rval())) { |
495 | 0 | MOZ_ASSERT(JS_IsExceptionPending(cx)); |
496 | 0 | return false; |
497 | 0 | } |
498 | 0 | return true; |
499 | 0 | } |
500 | | |
501 | | static const JSJitInfo inverse_methodinfo = { |
502 | | { (JSJitGetterOp)inverse }, |
503 | | { prototypes::id::SVGMatrix }, |
504 | | { PrototypeTraits<prototypes::id::SVGMatrix>::Depth }, |
505 | | JSJitInfo::Method, |
506 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
507 | | JSVAL_TYPE_OBJECT, /* returnType. Not relevant for setters. */ |
508 | | false, /* isInfallible. False in setters. */ |
509 | | false, /* isMovable. Not relevant for setters. */ |
510 | | false, /* isEliminatable. Not relevant for setters. */ |
511 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
512 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
513 | | false, /* isTypedMethod. Only relevant for methods. */ |
514 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
515 | | }; |
516 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
517 | | static_assert(0 < 1, "There is no slot for us"); |
518 | | |
519 | | MOZ_CAN_RUN_SCRIPT static bool |
520 | | translate(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SVGMatrix* self, const JSJitMethodCallArgs& args) |
521 | 0 | { |
522 | 0 | AUTO_PROFILER_LABEL_FAST("SVGMatrix.translate", DOM, cx); |
523 | 0 |
|
524 | 0 | if (MOZ_UNLIKELY(args.length() < 2)) { |
525 | 0 | return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "SVGMatrix.translate"); |
526 | 0 | } |
527 | 0 | float arg0; |
528 | 0 | if (!ValueToPrimitive<float, eDefault>(cx, args[0], &arg0)) { |
529 | 0 | return false; |
530 | 0 | } else if (!mozilla::IsFinite(arg0)) { |
531 | 0 | ThrowErrorMessage(cx, MSG_NOT_FINITE, "Argument 1 of SVGMatrix.translate"); |
532 | 0 | return false; |
533 | 0 | } |
534 | 0 | float arg1; |
535 | 0 | if (!ValueToPrimitive<float, eDefault>(cx, args[1], &arg1)) { |
536 | 0 | return false; |
537 | 0 | } else if (!mozilla::IsFinite(arg1)) { |
538 | 0 | ThrowErrorMessage(cx, MSG_NOT_FINITE, "Argument 2 of SVGMatrix.translate"); |
539 | 0 | return false; |
540 | 0 | } |
541 | 0 | auto result(StrongOrRawPtr<mozilla::dom::SVGMatrix>(self->Translate(arg0, arg1))); |
542 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
543 | 0 | static_assert(!IsPointer<decltype(result)>::value, |
544 | 0 | "NewObject implies that we need to keep the object alive with a strong reference."); |
545 | 0 | if (!GetOrCreateDOMReflector(cx, result, args.rval())) { |
546 | 0 | MOZ_ASSERT(JS_IsExceptionPending(cx)); |
547 | 0 | return false; |
548 | 0 | } |
549 | 0 | return true; |
550 | 0 | } |
551 | | |
552 | | static const JSJitInfo translate_methodinfo = { |
553 | | { (JSJitGetterOp)translate }, |
554 | | { prototypes::id::SVGMatrix }, |
555 | | { PrototypeTraits<prototypes::id::SVGMatrix>::Depth }, |
556 | | JSJitInfo::Method, |
557 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
558 | | JSVAL_TYPE_OBJECT, /* returnType. Not relevant for setters. */ |
559 | | false, /* isInfallible. False in setters. */ |
560 | | false, /* isMovable. Not relevant for setters. */ |
561 | | false, /* isEliminatable. Not relevant for setters. */ |
562 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
563 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
564 | | false, /* isTypedMethod. Only relevant for methods. */ |
565 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
566 | | }; |
567 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
568 | | static_assert(0 < 1, "There is no slot for us"); |
569 | | |
570 | | MOZ_CAN_RUN_SCRIPT static bool |
571 | | scale(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SVGMatrix* self, const JSJitMethodCallArgs& args) |
572 | 0 | { |
573 | 0 | AUTO_PROFILER_LABEL_FAST("SVGMatrix.scale", DOM, cx); |
574 | 0 |
|
575 | 0 | if (MOZ_UNLIKELY(args.length() < 1)) { |
576 | 0 | return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "SVGMatrix.scale"); |
577 | 0 | } |
578 | 0 | float arg0; |
579 | 0 | if (!ValueToPrimitive<float, eDefault>(cx, args[0], &arg0)) { |
580 | 0 | return false; |
581 | 0 | } else if (!mozilla::IsFinite(arg0)) { |
582 | 0 | ThrowErrorMessage(cx, MSG_NOT_FINITE, "Argument 1 of SVGMatrix.scale"); |
583 | 0 | return false; |
584 | 0 | } |
585 | 0 | auto result(StrongOrRawPtr<mozilla::dom::SVGMatrix>(self->Scale(arg0))); |
586 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
587 | 0 | static_assert(!IsPointer<decltype(result)>::value, |
588 | 0 | "NewObject implies that we need to keep the object alive with a strong reference."); |
589 | 0 | if (!GetOrCreateDOMReflector(cx, result, args.rval())) { |
590 | 0 | MOZ_ASSERT(JS_IsExceptionPending(cx)); |
591 | 0 | return false; |
592 | 0 | } |
593 | 0 | return true; |
594 | 0 | } |
595 | | |
596 | | static const JSJitInfo scale_methodinfo = { |
597 | | { (JSJitGetterOp)scale }, |
598 | | { prototypes::id::SVGMatrix }, |
599 | | { PrototypeTraits<prototypes::id::SVGMatrix>::Depth }, |
600 | | JSJitInfo::Method, |
601 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
602 | | JSVAL_TYPE_OBJECT, /* returnType. Not relevant for setters. */ |
603 | | false, /* isInfallible. False in setters. */ |
604 | | false, /* isMovable. Not relevant for setters. */ |
605 | | false, /* isEliminatable. Not relevant for setters. */ |
606 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
607 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
608 | | false, /* isTypedMethod. Only relevant for methods. */ |
609 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
610 | | }; |
611 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
612 | | static_assert(0 < 1, "There is no slot for us"); |
613 | | |
614 | | MOZ_CAN_RUN_SCRIPT static bool |
615 | | scaleNonUniform(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SVGMatrix* self, const JSJitMethodCallArgs& args) |
616 | 0 | { |
617 | 0 | AUTO_PROFILER_LABEL_FAST("SVGMatrix.scaleNonUniform", DOM, cx); |
618 | 0 |
|
619 | 0 | if (MOZ_UNLIKELY(args.length() < 2)) { |
620 | 0 | return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "SVGMatrix.scaleNonUniform"); |
621 | 0 | } |
622 | 0 | float arg0; |
623 | 0 | if (!ValueToPrimitive<float, eDefault>(cx, args[0], &arg0)) { |
624 | 0 | return false; |
625 | 0 | } else if (!mozilla::IsFinite(arg0)) { |
626 | 0 | ThrowErrorMessage(cx, MSG_NOT_FINITE, "Argument 1 of SVGMatrix.scaleNonUniform"); |
627 | 0 | return false; |
628 | 0 | } |
629 | 0 | float arg1; |
630 | 0 | if (!ValueToPrimitive<float, eDefault>(cx, args[1], &arg1)) { |
631 | 0 | return false; |
632 | 0 | } else if (!mozilla::IsFinite(arg1)) { |
633 | 0 | ThrowErrorMessage(cx, MSG_NOT_FINITE, "Argument 2 of SVGMatrix.scaleNonUniform"); |
634 | 0 | return false; |
635 | 0 | } |
636 | 0 | auto result(StrongOrRawPtr<mozilla::dom::SVGMatrix>(self->ScaleNonUniform(arg0, arg1))); |
637 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
638 | 0 | static_assert(!IsPointer<decltype(result)>::value, |
639 | 0 | "NewObject implies that we need to keep the object alive with a strong reference."); |
640 | 0 | if (!GetOrCreateDOMReflector(cx, result, args.rval())) { |
641 | 0 | MOZ_ASSERT(JS_IsExceptionPending(cx)); |
642 | 0 | return false; |
643 | 0 | } |
644 | 0 | return true; |
645 | 0 | } |
646 | | |
647 | | static const JSJitInfo scaleNonUniform_methodinfo = { |
648 | | { (JSJitGetterOp)scaleNonUniform }, |
649 | | { prototypes::id::SVGMatrix }, |
650 | | { PrototypeTraits<prototypes::id::SVGMatrix>::Depth }, |
651 | | JSJitInfo::Method, |
652 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
653 | | JSVAL_TYPE_OBJECT, /* returnType. Not relevant for setters. */ |
654 | | false, /* isInfallible. False in setters. */ |
655 | | false, /* isMovable. Not relevant for setters. */ |
656 | | false, /* isEliminatable. Not relevant for setters. */ |
657 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
658 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
659 | | false, /* isTypedMethod. Only relevant for methods. */ |
660 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
661 | | }; |
662 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
663 | | static_assert(0 < 1, "There is no slot for us"); |
664 | | |
665 | | MOZ_CAN_RUN_SCRIPT static bool |
666 | | rotate(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SVGMatrix* self, const JSJitMethodCallArgs& args) |
667 | 0 | { |
668 | 0 | AUTO_PROFILER_LABEL_FAST("SVGMatrix.rotate", DOM, cx); |
669 | 0 |
|
670 | 0 | if (MOZ_UNLIKELY(args.length() < 1)) { |
671 | 0 | return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "SVGMatrix.rotate"); |
672 | 0 | } |
673 | 0 | float arg0; |
674 | 0 | if (!ValueToPrimitive<float, eDefault>(cx, args[0], &arg0)) { |
675 | 0 | return false; |
676 | 0 | } else if (!mozilla::IsFinite(arg0)) { |
677 | 0 | ThrowErrorMessage(cx, MSG_NOT_FINITE, "Argument 1 of SVGMatrix.rotate"); |
678 | 0 | return false; |
679 | 0 | } |
680 | 0 | auto result(StrongOrRawPtr<mozilla::dom::SVGMatrix>(self->Rotate(arg0))); |
681 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
682 | 0 | static_assert(!IsPointer<decltype(result)>::value, |
683 | 0 | "NewObject implies that we need to keep the object alive with a strong reference."); |
684 | 0 | if (!GetOrCreateDOMReflector(cx, result, args.rval())) { |
685 | 0 | MOZ_ASSERT(JS_IsExceptionPending(cx)); |
686 | 0 | return false; |
687 | 0 | } |
688 | 0 | return true; |
689 | 0 | } |
690 | | |
691 | | static const JSJitInfo rotate_methodinfo = { |
692 | | { (JSJitGetterOp)rotate }, |
693 | | { prototypes::id::SVGMatrix }, |
694 | | { PrototypeTraits<prototypes::id::SVGMatrix>::Depth }, |
695 | | JSJitInfo::Method, |
696 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
697 | | JSVAL_TYPE_OBJECT, /* returnType. Not relevant for setters. */ |
698 | | false, /* isInfallible. False in setters. */ |
699 | | false, /* isMovable. Not relevant for setters. */ |
700 | | false, /* isEliminatable. Not relevant for setters. */ |
701 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
702 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
703 | | false, /* isTypedMethod. Only relevant for methods. */ |
704 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
705 | | }; |
706 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
707 | | static_assert(0 < 1, "There is no slot for us"); |
708 | | |
709 | | MOZ_CAN_RUN_SCRIPT static bool |
710 | | rotateFromVector(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SVGMatrix* self, const JSJitMethodCallArgs& args) |
711 | 0 | { |
712 | 0 | AUTO_PROFILER_LABEL_FAST("SVGMatrix.rotateFromVector", DOM, cx); |
713 | 0 |
|
714 | 0 | if (MOZ_UNLIKELY(args.length() < 2)) { |
715 | 0 | return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "SVGMatrix.rotateFromVector"); |
716 | 0 | } |
717 | 0 | float arg0; |
718 | 0 | if (!ValueToPrimitive<float, eDefault>(cx, args[0], &arg0)) { |
719 | 0 | return false; |
720 | 0 | } else if (!mozilla::IsFinite(arg0)) { |
721 | 0 | ThrowErrorMessage(cx, MSG_NOT_FINITE, "Argument 1 of SVGMatrix.rotateFromVector"); |
722 | 0 | return false; |
723 | 0 | } |
724 | 0 | float arg1; |
725 | 0 | if (!ValueToPrimitive<float, eDefault>(cx, args[1], &arg1)) { |
726 | 0 | return false; |
727 | 0 | } else if (!mozilla::IsFinite(arg1)) { |
728 | 0 | ThrowErrorMessage(cx, MSG_NOT_FINITE, "Argument 2 of SVGMatrix.rotateFromVector"); |
729 | 0 | return false; |
730 | 0 | } |
731 | 0 | FastErrorResult rv; |
732 | 0 | auto result(StrongOrRawPtr<mozilla::dom::SVGMatrix>(self->RotateFromVector(arg0, arg1, rv))); |
733 | 0 | if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) { |
734 | 0 | return false; |
735 | 0 | } |
736 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
737 | 0 | static_assert(!IsPointer<decltype(result)>::value, |
738 | 0 | "NewObject implies that we need to keep the object alive with a strong reference."); |
739 | 0 | if (!GetOrCreateDOMReflector(cx, result, args.rval())) { |
740 | 0 | MOZ_ASSERT(JS_IsExceptionPending(cx)); |
741 | 0 | return false; |
742 | 0 | } |
743 | 0 | return true; |
744 | 0 | } |
745 | | |
746 | | static const JSJitInfo rotateFromVector_methodinfo = { |
747 | | { (JSJitGetterOp)rotateFromVector }, |
748 | | { prototypes::id::SVGMatrix }, |
749 | | { PrototypeTraits<prototypes::id::SVGMatrix>::Depth }, |
750 | | JSJitInfo::Method, |
751 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
752 | | JSVAL_TYPE_OBJECT, /* returnType. Not relevant for setters. */ |
753 | | false, /* isInfallible. False in setters. */ |
754 | | false, /* isMovable. Not relevant for setters. */ |
755 | | false, /* isEliminatable. Not relevant for setters. */ |
756 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
757 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
758 | | false, /* isTypedMethod. Only relevant for methods. */ |
759 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
760 | | }; |
761 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
762 | | static_assert(0 < 1, "There is no slot for us"); |
763 | | |
764 | | MOZ_CAN_RUN_SCRIPT static bool |
765 | | flipX(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SVGMatrix* self, const JSJitMethodCallArgs& args) |
766 | 0 | { |
767 | 0 | AUTO_PROFILER_LABEL_FAST("SVGMatrix.flipX", DOM, cx); |
768 | 0 |
|
769 | 0 | auto result(StrongOrRawPtr<mozilla::dom::SVGMatrix>(self->FlipX())); |
770 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
771 | 0 | static_assert(!IsPointer<decltype(result)>::value, |
772 | 0 | "NewObject implies that we need to keep the object alive with a strong reference."); |
773 | 0 | if (!GetOrCreateDOMReflector(cx, result, args.rval())) { |
774 | 0 | MOZ_ASSERT(JS_IsExceptionPending(cx)); |
775 | 0 | return false; |
776 | 0 | } |
777 | 0 | return true; |
778 | 0 | } |
779 | | |
780 | | static const JSJitInfo flipX_methodinfo = { |
781 | | { (JSJitGetterOp)flipX }, |
782 | | { prototypes::id::SVGMatrix }, |
783 | | { PrototypeTraits<prototypes::id::SVGMatrix>::Depth }, |
784 | | JSJitInfo::Method, |
785 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
786 | | JSVAL_TYPE_OBJECT, /* returnType. Not relevant for setters. */ |
787 | | false, /* isInfallible. False in setters. */ |
788 | | false, /* isMovable. Not relevant for setters. */ |
789 | | false, /* isEliminatable. Not relevant for setters. */ |
790 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
791 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
792 | | false, /* isTypedMethod. Only relevant for methods. */ |
793 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
794 | | }; |
795 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
796 | | static_assert(0 < 1, "There is no slot for us"); |
797 | | |
798 | | MOZ_CAN_RUN_SCRIPT static bool |
799 | | flipY(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SVGMatrix* self, const JSJitMethodCallArgs& args) |
800 | 0 | { |
801 | 0 | AUTO_PROFILER_LABEL_FAST("SVGMatrix.flipY", DOM, cx); |
802 | 0 |
|
803 | 0 | auto result(StrongOrRawPtr<mozilla::dom::SVGMatrix>(self->FlipY())); |
804 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
805 | 0 | static_assert(!IsPointer<decltype(result)>::value, |
806 | 0 | "NewObject implies that we need to keep the object alive with a strong reference."); |
807 | 0 | if (!GetOrCreateDOMReflector(cx, result, args.rval())) { |
808 | 0 | MOZ_ASSERT(JS_IsExceptionPending(cx)); |
809 | 0 | return false; |
810 | 0 | } |
811 | 0 | return true; |
812 | 0 | } |
813 | | |
814 | | static const JSJitInfo flipY_methodinfo = { |
815 | | { (JSJitGetterOp)flipY }, |
816 | | { prototypes::id::SVGMatrix }, |
817 | | { PrototypeTraits<prototypes::id::SVGMatrix>::Depth }, |
818 | | JSJitInfo::Method, |
819 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
820 | | JSVAL_TYPE_OBJECT, /* returnType. Not relevant for setters. */ |
821 | | false, /* isInfallible. False in setters. */ |
822 | | false, /* isMovable. Not relevant for setters. */ |
823 | | false, /* isEliminatable. Not relevant for setters. */ |
824 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
825 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
826 | | false, /* isTypedMethod. Only relevant for methods. */ |
827 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
828 | | }; |
829 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
830 | | static_assert(0 < 1, "There is no slot for us"); |
831 | | |
832 | | MOZ_CAN_RUN_SCRIPT static bool |
833 | | skewX(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SVGMatrix* self, const JSJitMethodCallArgs& args) |
834 | 0 | { |
835 | 0 | AUTO_PROFILER_LABEL_FAST("SVGMatrix.skewX", DOM, cx); |
836 | 0 |
|
837 | 0 | if (MOZ_UNLIKELY(args.length() < 1)) { |
838 | 0 | return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "SVGMatrix.skewX"); |
839 | 0 | } |
840 | 0 | float arg0; |
841 | 0 | if (!ValueToPrimitive<float, eDefault>(cx, args[0], &arg0)) { |
842 | 0 | return false; |
843 | 0 | } else if (!mozilla::IsFinite(arg0)) { |
844 | 0 | ThrowErrorMessage(cx, MSG_NOT_FINITE, "Argument 1 of SVGMatrix.skewX"); |
845 | 0 | return false; |
846 | 0 | } |
847 | 0 | FastErrorResult rv; |
848 | 0 | auto result(StrongOrRawPtr<mozilla::dom::SVGMatrix>(self->SkewX(arg0, rv))); |
849 | 0 | if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) { |
850 | 0 | return false; |
851 | 0 | } |
852 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
853 | 0 | static_assert(!IsPointer<decltype(result)>::value, |
854 | 0 | "NewObject implies that we need to keep the object alive with a strong reference."); |
855 | 0 | if (!GetOrCreateDOMReflector(cx, result, args.rval())) { |
856 | 0 | MOZ_ASSERT(JS_IsExceptionPending(cx)); |
857 | 0 | return false; |
858 | 0 | } |
859 | 0 | return true; |
860 | 0 | } |
861 | | |
862 | | static const JSJitInfo skewX_methodinfo = { |
863 | | { (JSJitGetterOp)skewX }, |
864 | | { prototypes::id::SVGMatrix }, |
865 | | { PrototypeTraits<prototypes::id::SVGMatrix>::Depth }, |
866 | | JSJitInfo::Method, |
867 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
868 | | JSVAL_TYPE_OBJECT, /* returnType. Not relevant for setters. */ |
869 | | false, /* isInfallible. False in setters. */ |
870 | | false, /* isMovable. Not relevant for setters. */ |
871 | | false, /* isEliminatable. Not relevant for setters. */ |
872 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
873 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
874 | | false, /* isTypedMethod. Only relevant for methods. */ |
875 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
876 | | }; |
877 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
878 | | static_assert(0 < 1, "There is no slot for us"); |
879 | | |
880 | | MOZ_CAN_RUN_SCRIPT static bool |
881 | | skewY(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SVGMatrix* self, const JSJitMethodCallArgs& args) |
882 | 0 | { |
883 | 0 | AUTO_PROFILER_LABEL_FAST("SVGMatrix.skewY", DOM, cx); |
884 | 0 |
|
885 | 0 | if (MOZ_UNLIKELY(args.length() < 1)) { |
886 | 0 | return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "SVGMatrix.skewY"); |
887 | 0 | } |
888 | 0 | float arg0; |
889 | 0 | if (!ValueToPrimitive<float, eDefault>(cx, args[0], &arg0)) { |
890 | 0 | return false; |
891 | 0 | } else if (!mozilla::IsFinite(arg0)) { |
892 | 0 | ThrowErrorMessage(cx, MSG_NOT_FINITE, "Argument 1 of SVGMatrix.skewY"); |
893 | 0 | return false; |
894 | 0 | } |
895 | 0 | FastErrorResult rv; |
896 | 0 | auto result(StrongOrRawPtr<mozilla::dom::SVGMatrix>(self->SkewY(arg0, rv))); |
897 | 0 | if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) { |
898 | 0 | return false; |
899 | 0 | } |
900 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
901 | 0 | static_assert(!IsPointer<decltype(result)>::value, |
902 | 0 | "NewObject implies that we need to keep the object alive with a strong reference."); |
903 | 0 | if (!GetOrCreateDOMReflector(cx, result, args.rval())) { |
904 | 0 | MOZ_ASSERT(JS_IsExceptionPending(cx)); |
905 | 0 | return false; |
906 | 0 | } |
907 | 0 | return true; |
908 | 0 | } |
909 | | |
910 | | static const JSJitInfo skewY_methodinfo = { |
911 | | { (JSJitGetterOp)skewY }, |
912 | | { prototypes::id::SVGMatrix }, |
913 | | { PrototypeTraits<prototypes::id::SVGMatrix>::Depth }, |
914 | | JSJitInfo::Method, |
915 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
916 | | JSVAL_TYPE_OBJECT, /* returnType. Not relevant for setters. */ |
917 | | false, /* isInfallible. False in setters. */ |
918 | | false, /* isMovable. Not relevant for setters. */ |
919 | | false, /* isEliminatable. Not relevant for setters. */ |
920 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
921 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
922 | | false, /* isTypedMethod. Only relevant for methods. */ |
923 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
924 | | }; |
925 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
926 | | static_assert(0 < 1, "There is no slot for us"); |
927 | | |
928 | | static bool |
929 | | _addProperty(JSContext* cx, JS::Handle<JSObject*> obj, JS::Handle<jsid> id, JS::Handle<JS::Value> val) |
930 | 0 | { |
931 | 0 | mozilla::dom::SVGMatrix* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::dom::SVGMatrix>(obj); |
932 | 0 | // We don't want to preserve if we don't have a wrapper, and we |
933 | 0 | // obviously can't preserve if we're not initialized. |
934 | 0 | if (self && self->GetWrapperPreserveColor()) { |
935 | 0 | PreserveWrapper(self); |
936 | 0 | } |
937 | 0 | return true; |
938 | 0 | } |
939 | | |
940 | | static void |
941 | | _finalize(js::FreeOp* fop, JSObject* obj) |
942 | 0 | { |
943 | 0 | mozilla::dom::SVGMatrix* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::dom::SVGMatrix>(obj); |
944 | 0 | if (self) { |
945 | 0 | ClearWrapper(self, self, obj); |
946 | 0 | AddForDeferredFinalization<mozilla::dom::SVGMatrix>(self); |
947 | 0 | } |
948 | 0 | } |
949 | | |
950 | | static size_t |
951 | | _objectMoved(JSObject* obj, JSObject* old) |
952 | 0 | { |
953 | 0 | mozilla::dom::SVGMatrix* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::dom::SVGMatrix>(obj); |
954 | 0 | if (self) { |
955 | 0 | UpdateWrapper(self, self, obj, old); |
956 | 0 | } |
957 | 0 |
|
958 | 0 | return 0; |
959 | 0 | } |
960 | | |
961 | | // We deliberately use brace-elision to make Visual Studio produce better initalization code. |
962 | | #if defined(__clang__) |
963 | | #pragma clang diagnostic push |
964 | | #pragma clang diagnostic ignored "-Wmissing-braces" |
965 | | #endif |
966 | | static const JSFunctionSpec sMethods_specs[] = { |
967 | | JS_FNSPEC("multiply", (GenericMethod<NormalThisPolicy, ThrowExceptions>), reinterpret_cast<const JSJitInfo*>(&multiply_methodinfo), 1, JSPROP_ENUMERATE, nullptr), |
968 | | JS_FNSPEC("inverse", (GenericMethod<NormalThisPolicy, ThrowExceptions>), reinterpret_cast<const JSJitInfo*>(&inverse_methodinfo), 0, JSPROP_ENUMERATE, nullptr), |
969 | | JS_FNSPEC("translate", (GenericMethod<NormalThisPolicy, ThrowExceptions>), reinterpret_cast<const JSJitInfo*>(&translate_methodinfo), 2, JSPROP_ENUMERATE, nullptr), |
970 | | JS_FNSPEC("scale", (GenericMethod<NormalThisPolicy, ThrowExceptions>), reinterpret_cast<const JSJitInfo*>(&scale_methodinfo), 1, JSPROP_ENUMERATE, nullptr), |
971 | | JS_FNSPEC("scaleNonUniform", (GenericMethod<NormalThisPolicy, ThrowExceptions>), reinterpret_cast<const JSJitInfo*>(&scaleNonUniform_methodinfo), 2, JSPROP_ENUMERATE, nullptr), |
972 | | JS_FNSPEC("rotate", (GenericMethod<NormalThisPolicy, ThrowExceptions>), reinterpret_cast<const JSJitInfo*>(&rotate_methodinfo), 1, JSPROP_ENUMERATE, nullptr), |
973 | | JS_FNSPEC("rotateFromVector", (GenericMethod<NormalThisPolicy, ThrowExceptions>), reinterpret_cast<const JSJitInfo*>(&rotateFromVector_methodinfo), 2, JSPROP_ENUMERATE, nullptr), |
974 | | JS_FNSPEC("flipX", (GenericMethod<NormalThisPolicy, ThrowExceptions>), reinterpret_cast<const JSJitInfo*>(&flipX_methodinfo), 0, JSPROP_ENUMERATE, nullptr), |
975 | | JS_FNSPEC("flipY", (GenericMethod<NormalThisPolicy, ThrowExceptions>), reinterpret_cast<const JSJitInfo*>(&flipY_methodinfo), 0, JSPROP_ENUMERATE, nullptr), |
976 | | JS_FNSPEC("skewX", (GenericMethod<NormalThisPolicy, ThrowExceptions>), reinterpret_cast<const JSJitInfo*>(&skewX_methodinfo), 1, JSPROP_ENUMERATE, nullptr), |
977 | | JS_FNSPEC("skewY", (GenericMethod<NormalThisPolicy, ThrowExceptions>), reinterpret_cast<const JSJitInfo*>(&skewY_methodinfo), 1, JSPROP_ENUMERATE, nullptr), |
978 | | JS_FS_END |
979 | | }; |
980 | | #if defined(__clang__) |
981 | | #pragma clang diagnostic pop |
982 | | #endif |
983 | | |
984 | | |
985 | | static const Prefable<const JSFunctionSpec> sMethods[] = { |
986 | | { nullptr, &sMethods_specs[0] }, |
987 | | { nullptr, nullptr } |
988 | | }; |
989 | | |
990 | | static_assert(1 <= 1ull << NUM_BITS_PROPERTY_INFO_PREF_INDEX, |
991 | | "We have a prefable index that is >= (1 << NUM_BITS_PROPERTY_INFO_PREF_INDEX)"); |
992 | | static_assert(11 <= 1ull << NUM_BITS_PROPERTY_INFO_SPEC_INDEX, |
993 | | "We have a spec index that is >= (1 << NUM_BITS_PROPERTY_INFO_SPEC_INDEX)"); |
994 | | |
995 | | // We deliberately use brace-elision to make Visual Studio produce better initalization code. |
996 | | #if defined(__clang__) |
997 | | #pragma clang diagnostic push |
998 | | #pragma clang diagnostic ignored "-Wmissing-braces" |
999 | | #endif |
1000 | | static const JSPropertySpec sAttributes_specs[] = { |
1001 | | { "a", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &a_getterinfo, GenericSetter<NormalThisPolicy>, &a_setterinfo }, |
1002 | | { "b", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &b_getterinfo, GenericSetter<NormalThisPolicy>, &b_setterinfo }, |
1003 | | { "c", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &c_getterinfo, GenericSetter<NormalThisPolicy>, &c_setterinfo }, |
1004 | | { "d", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &d_getterinfo, GenericSetter<NormalThisPolicy>, &d_setterinfo }, |
1005 | | { "e", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &e_getterinfo, GenericSetter<NormalThisPolicy>, &e_setterinfo }, |
1006 | | { "f", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &f_getterinfo, GenericSetter<NormalThisPolicy>, &f_setterinfo }, |
1007 | | { nullptr, 0, nullptr, nullptr, nullptr, nullptr } |
1008 | | }; |
1009 | | #if defined(__clang__) |
1010 | | #pragma clang diagnostic pop |
1011 | | #endif |
1012 | | |
1013 | | |
1014 | | static const Prefable<const JSPropertySpec> sAttributes[] = { |
1015 | | { nullptr, &sAttributes_specs[0] }, |
1016 | | { nullptr, nullptr } |
1017 | | }; |
1018 | | |
1019 | | static_assert(1 <= 1ull << NUM_BITS_PROPERTY_INFO_PREF_INDEX, |
1020 | | "We have a prefable index that is >= (1 << NUM_BITS_PROPERTY_INFO_PREF_INDEX)"); |
1021 | | static_assert(6 <= 1ull << NUM_BITS_PROPERTY_INFO_SPEC_INDEX, |
1022 | | "We have a spec index that is >= (1 << NUM_BITS_PROPERTY_INFO_SPEC_INDEX)"); |
1023 | | |
1024 | | |
1025 | | static uint16_t sNativeProperties_sortedPropertyIndices[17]; |
1026 | | static PropertyInfo sNativeProperties_propertyInfos[17]; |
1027 | | |
1028 | | static const NativePropertiesN<2> sNativeProperties = { |
1029 | | false, 0, |
1030 | | false, 0, |
1031 | | true, 0 /* sMethods */, |
1032 | | true, 1 /* sAttributes */, |
1033 | | false, 0, |
1034 | | false, 0, |
1035 | | false, 0, |
1036 | | -1, |
1037 | | 17, |
1038 | | sNativeProperties_sortedPropertyIndices, |
1039 | | { |
1040 | | { sMethods, &sNativeProperties_propertyInfos[0] }, |
1041 | | { sAttributes, &sNativeProperties_propertyInfos[11] } |
1042 | | } |
1043 | | }; |
1044 | | static_assert(17 < 1ull << CHAR_BIT * sizeof(sNativeProperties.propertyInfoCount), |
1045 | | "We have a property info count that is oversized"); |
1046 | | |
1047 | | static const DOMIfaceAndProtoJSClass sInterfaceObjectClass = { |
1048 | | { |
1049 | | "Function", |
1050 | | JSCLASS_IS_DOMIFACEANDPROTOJSCLASS | JSCLASS_HAS_RESERVED_SLOTS(DOM_INTERFACE_SLOTS_BASE), |
1051 | | &sBoringInterfaceObjectClassClassOps, |
1052 | | JS_NULL_CLASS_SPEC, |
1053 | | JS_NULL_CLASS_EXT, |
1054 | | &sInterfaceObjectClassObjectOps |
1055 | | }, |
1056 | | eInterface, |
1057 | | true, |
1058 | | prototypes::id::SVGMatrix, |
1059 | | PrototypeTraits<prototypes::id::SVGMatrix>::Depth, |
1060 | | sNativePropertyHooks, |
1061 | | "function SVGMatrix() {\n [native code]\n}", |
1062 | | JS::GetRealmFunctionPrototype |
1063 | | }; |
1064 | | |
1065 | | static const DOMIfaceAndProtoJSClass sPrototypeClass = { |
1066 | | { |
1067 | | "SVGMatrixPrototype", |
1068 | | JSCLASS_IS_DOMIFACEANDPROTOJSCLASS | JSCLASS_HAS_RESERVED_SLOTS(DOM_INTERFACE_PROTO_SLOTS_BASE), |
1069 | | JS_NULL_CLASS_OPS, |
1070 | | JS_NULL_CLASS_SPEC, |
1071 | | JS_NULL_CLASS_EXT, |
1072 | | JS_NULL_OBJECT_OPS |
1073 | | }, |
1074 | | eInterfacePrototype, |
1075 | | false, |
1076 | | prototypes::id::SVGMatrix, |
1077 | | PrototypeTraits<prototypes::id::SVGMatrix>::Depth, |
1078 | | sNativePropertyHooks, |
1079 | | "[object SVGMatrixPrototype]", |
1080 | | JS::GetRealmObjectPrototype |
1081 | | }; |
1082 | | |
1083 | | static const js::ClassOps sClassOps = { |
1084 | | _addProperty, /* addProperty */ |
1085 | | nullptr, /* delProperty */ |
1086 | | nullptr, /* enumerate */ |
1087 | | nullptr, /* newEnumerate */ |
1088 | | nullptr, /* resolve */ |
1089 | | nullptr, /* mayResolve */ |
1090 | | _finalize, /* finalize */ |
1091 | | nullptr, /* call */ |
1092 | | nullptr, /* hasInstance */ |
1093 | | nullptr, /* construct */ |
1094 | | nullptr, /* trace */ |
1095 | | }; |
1096 | | |
1097 | | static const js::ClassExtension sClassExtension = { |
1098 | | nullptr, /* weakmapKeyDelegateOp */ |
1099 | | _objectMoved /* objectMovedOp */ |
1100 | | }; |
1101 | | |
1102 | | static const DOMJSClass sClass = { |
1103 | | { "SVGMatrix", |
1104 | | JSCLASS_IS_DOMJSCLASS | JSCLASS_FOREGROUND_FINALIZE | JSCLASS_HAS_RESERVED_SLOTS(1), |
1105 | | &sClassOps, |
1106 | | JS_NULL_CLASS_SPEC, |
1107 | | &sClassExtension, |
1108 | | JS_NULL_OBJECT_OPS |
1109 | | }, |
1110 | | { prototypes::id::SVGMatrix, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count }, |
1111 | | IsBaseOf<nsISupports, mozilla::dom::SVGMatrix >::value, |
1112 | | sNativePropertyHooks, |
1113 | | FindAssociatedGlobalForNative<mozilla::dom::SVGMatrix>::Get, |
1114 | | GetProtoObjectHandle, |
1115 | | GetCCParticipant<mozilla::dom::SVGMatrix>::Get() |
1116 | | }; |
1117 | | static_assert(1 == DOM_INSTANCE_RESERVED_SLOTS, |
1118 | | "Must have the right minimal number of reserved slots."); |
1119 | | static_assert(1 >= 1, |
1120 | | "Must have enough reserved slots."); |
1121 | | |
1122 | | const JSClass* |
1123 | | GetJSClass() |
1124 | 0 | { |
1125 | 0 | return sClass.ToJSClass(); |
1126 | 0 | } |
1127 | | |
1128 | | bool |
1129 | | Wrap(JSContext* aCx, mozilla::dom::SVGMatrix* aObject, nsWrapperCache* aCache, JS::Handle<JSObject*> aGivenProto, JS::MutableHandle<JSObject*> aReflector) |
1130 | 0 | { |
1131 | 0 | static_assert(!IsBaseOf<NonRefcountedDOMObject, mozilla::dom::SVGMatrix>::value, |
1132 | 0 | "Shouldn't have wrappercached things that are not refcounted."); |
1133 | 0 | MOZ_ASSERT(static_cast<mozilla::dom::SVGMatrix*>(aObject) == |
1134 | 0 | reinterpret_cast<mozilla::dom::SVGMatrix*>(aObject), |
1135 | 0 | "Multiple inheritance for mozilla::dom::SVGMatrix is broken."); |
1136 | 0 | MOZ_ASSERT(ToSupportsIsCorrect(aObject)); |
1137 | 0 | MOZ_ASSERT_IF(aGivenProto, js::IsObjectInContextCompartment(aGivenProto, aCx)); |
1138 | 0 | MOZ_ASSERT(!aCache->GetWrapper(), |
1139 | 0 | "You should probably not be using Wrap() directly; use " |
1140 | 0 | "GetOrCreateDOMReflector instead"); |
1141 | 0 |
|
1142 | 0 | MOZ_ASSERT(ToSupportsIsOnPrimaryInheritanceChain(aObject, aCache), |
1143 | 0 | "nsISupports must be on our primary inheritance chain"); |
1144 | 0 |
|
1145 | 0 | JS::Rooted<JSObject*> global(aCx, FindAssociatedGlobal(aCx, aObject->GetParentObject())); |
1146 | 0 | if (!global) { |
1147 | 0 | return false; |
1148 | 0 | } |
1149 | 0 | MOZ_ASSERT(JS_IsGlobalObject(global)); |
1150 | 0 | MOZ_ASSERT(JS::ObjectIsNotGray(global)); |
1151 | 0 |
|
1152 | 0 | // That might have ended up wrapping us already, due to the wonders |
1153 | 0 | // of XBL. Check for that, and bail out as needed. |
1154 | 0 | aReflector.set(aCache->GetWrapper()); |
1155 | 0 | if (aReflector) { |
1156 | | #ifdef DEBUG |
1157 | | AssertReflectorHasGivenProto(aCx, aReflector, aGivenProto); |
1158 | | #endif // DEBUG |
1159 | | return true; |
1160 | 0 | } |
1161 | 0 |
|
1162 | 0 | JSAutoRealm ar(aCx, global); |
1163 | 0 | JS::Handle<JSObject*> canonicalProto = GetProtoObjectHandle(aCx); |
1164 | 0 | if (!canonicalProto) { |
1165 | 0 | return false; |
1166 | 0 | } |
1167 | 0 | JS::Rooted<JSObject*> proto(aCx); |
1168 | 0 | if (aGivenProto) { |
1169 | 0 | proto = aGivenProto; |
1170 | 0 | // Unfortunately, while aGivenProto was in the compartment of aCx |
1171 | 0 | // coming in, we changed compartments to that of "parent" so may need |
1172 | 0 | // to wrap the proto here. |
1173 | 0 | if (js::GetContextCompartment(aCx) != js::GetObjectCompartment(proto)) { |
1174 | 0 | if (!JS_WrapObject(aCx, &proto)) { |
1175 | 0 | return false; |
1176 | 0 | } |
1177 | 0 | } |
1178 | 0 | } else { |
1179 | 0 | proto = canonicalProto; |
1180 | 0 | } |
1181 | 0 |
|
1182 | 0 | BindingJSObjectCreator<mozilla::dom::SVGMatrix> creator(aCx); |
1183 | 0 | creator.CreateObject(aCx, sClass.ToJSClass(), proto, aObject, aReflector); |
1184 | 0 | if (!aReflector) { |
1185 | 0 | return false; |
1186 | 0 | } |
1187 | 0 | |
1188 | 0 | aCache->SetWrapper(aReflector); |
1189 | 0 | creator.InitializationSucceeded(); |
1190 | 0 |
|
1191 | 0 | MOZ_ASSERT(aCache->GetWrapperPreserveColor() && |
1192 | 0 | aCache->GetWrapperPreserveColor() == aReflector); |
1193 | 0 | // If proto != canonicalProto, we have to preserve our wrapper; |
1194 | 0 | // otherwise we won't be able to properly recreate it later, since |
1195 | 0 | // we won't know what proto to use. Note that we don't check |
1196 | 0 | // aGivenProto here, since it's entirely possible (and even |
1197 | 0 | // somewhat common) to have a non-null aGivenProto which is the |
1198 | 0 | // same as canonicalProto. |
1199 | 0 | if (proto != canonicalProto) { |
1200 | 0 | PreserveWrapper(aObject); |
1201 | 0 | } |
1202 | 0 |
|
1203 | 0 | return true; |
1204 | 0 | } |
1205 | | |
1206 | | const NativePropertyHooks sNativePropertyHooks[] = { { |
1207 | | nullptr, |
1208 | | nullptr, |
1209 | | nullptr, |
1210 | | { sNativeProperties.Upcast(), nullptr }, |
1211 | | prototypes::id::SVGMatrix, |
1212 | | constructors::id::SVGMatrix, |
1213 | | nullptr, |
1214 | | &DefaultXrayExpandoObjectClass |
1215 | | } }; |
1216 | | |
1217 | | void |
1218 | | CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, bool aDefineOnGlobal) |
1219 | 0 | { |
1220 | 0 | JS::Rooted<JSObject*> parentProto(aCx, JS::GetRealmObjectPrototype(aCx)); |
1221 | 0 | if (!parentProto) { |
1222 | 0 | return; |
1223 | 0 | } |
1224 | 0 | |
1225 | 0 | JS::Rooted<JSObject*> constructorProto(aCx, JS::GetRealmFunctionPrototype(aCx)); |
1226 | 0 | if (!constructorProto) { |
1227 | 0 | return; |
1228 | 0 | } |
1229 | 0 | |
1230 | 0 | static bool sIdsInited = false; |
1231 | 0 | if (!sIdsInited && NS_IsMainThread()) { |
1232 | 0 | if (!InitIds(aCx, sNativeProperties.Upcast())) { |
1233 | 0 | return; |
1234 | 0 | } |
1235 | 0 | sIdsInited = true; |
1236 | 0 | } |
1237 | 0 |
|
1238 | 0 | JS::Heap<JSObject*>* protoCache = &aProtoAndIfaceCache.EntrySlotOrCreate(prototypes::id::SVGMatrix); |
1239 | 0 | JS::Heap<JSObject*>* interfaceCache = &aProtoAndIfaceCache.EntrySlotOrCreate(constructors::id::SVGMatrix); |
1240 | 0 | dom::CreateInterfaceObjects(aCx, aGlobal, parentProto, |
1241 | 0 | &sPrototypeClass.mBase, protoCache, |
1242 | 0 | nullptr, |
1243 | 0 | constructorProto, &sInterfaceObjectClass.mBase, 0, nullptr, |
1244 | 0 | interfaceCache, |
1245 | 0 | sNativeProperties.Upcast(), |
1246 | 0 | nullptr, |
1247 | 0 | "SVGMatrix", aDefineOnGlobal, |
1248 | 0 | nullptr, |
1249 | 0 | false); |
1250 | 0 | } |
1251 | | |
1252 | | JSObject* |
1253 | | GetConstructorObject(JSContext* aCx) |
1254 | 0 | { |
1255 | 0 | return GetConstructorObjectHandle(aCx); |
1256 | 0 | } |
1257 | | |
1258 | | } // namespace SVGMatrix_Binding |
1259 | | |
1260 | | |
1261 | | |
1262 | | } // namespace dom |
1263 | | } // namespace mozilla |