/work/obj-fuzz/dom/bindings/SVGAElementBinding.cpp
Line | Count | Source (jump to first uncovered line) |
1 | | /* THIS FILE IS AUTOGENERATED FROM SVGAElement.webidl BY Codegen.py - DO NOT EDIT */ |
2 | | |
3 | | #include "SVGAElementBinding.h" |
4 | | #include "SVGGraphicsElementBinding.h" |
5 | | #include "WrapperFactory.h" |
6 | | #include "mozilla/OwningNonNull.h" |
7 | | #include "mozilla/dom/BindingUtils.h" |
8 | | #include "mozilla/dom/DOMJSClass.h" |
9 | | #include "mozilla/dom/NonRefcountedDOMObject.h" |
10 | | #include "mozilla/dom/SVGAElement.h" |
11 | | #include "mozilla/dom/SVGAnimatedString.h" |
12 | | #include "mozilla/dom/XrayExpandoClass.h" |
13 | | #include "nsDOMTokenList.h" |
14 | | |
15 | | namespace mozilla { |
16 | | namespace dom { |
17 | | |
18 | | namespace binding_detail {}; // Just to make sure it's known as a namespace |
19 | | using namespace mozilla::dom::binding_detail; |
20 | | |
21 | | |
22 | | namespace SVGAElement_Binding { |
23 | | |
24 | | static_assert(IsRefcounted<NativeType>::value == IsRefcounted<SVGGraphicsElement_Binding::NativeType>::value, |
25 | | "Can't inherit from an interface with a different ownership model."); |
26 | | |
27 | | MOZ_CAN_RUN_SCRIPT static bool |
28 | | get_target(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SVGAElement* self, JSJitGetterCallArgs args) |
29 | 0 | { |
30 | 0 | AUTO_PROFILER_LABEL_FAST("get SVGAElement.target", DOM, cx); |
31 | 0 |
|
32 | 0 | auto result(StrongOrRawPtr<mozilla::dom::SVGAnimatedString>(self->Target())); |
33 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
34 | 0 | if (!GetOrCreateDOMReflector(cx, result, args.rval())) { |
35 | 0 | MOZ_ASSERT(JS_IsExceptionPending(cx)); |
36 | 0 | return false; |
37 | 0 | } |
38 | 0 | return true; |
39 | 0 | } |
40 | | |
41 | | static const JSJitInfo target_getterinfo = { |
42 | | { (JSJitGetterOp)get_target }, |
43 | | { prototypes::id::SVGAElement }, |
44 | | { PrototypeTraits<prototypes::id::SVGAElement>::Depth }, |
45 | | JSJitInfo::Getter, |
46 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
47 | | JSVAL_TYPE_OBJECT, /* returnType. Not relevant for setters. */ |
48 | | false, /* isInfallible. False in setters. */ |
49 | | false, /* isMovable. Not relevant for setters. */ |
50 | | false, /* isEliminatable. Not relevant for setters. */ |
51 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
52 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
53 | | false, /* isTypedMethod. Only relevant for methods. */ |
54 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
55 | | }; |
56 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
57 | | static_assert(0 < 1, "There is no slot for us"); |
58 | | |
59 | | MOZ_CAN_RUN_SCRIPT static bool |
60 | | get_download(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SVGAElement* self, JSJitGetterCallArgs args) |
61 | 0 | { |
62 | 0 | AUTO_PROFILER_LABEL_FAST("get SVGAElement.download", DOM, cx); |
63 | 0 |
|
64 | 0 | DOMString result; |
65 | 0 | self->GetDownload(result); |
66 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
67 | 0 | if (!xpc::NonVoidStringToJsval(cx, result, args.rval())) { |
68 | 0 | return false; |
69 | 0 | } |
70 | 0 | return true; |
71 | 0 | } |
72 | | |
73 | | MOZ_CAN_RUN_SCRIPT static bool |
74 | | set_download(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SVGAElement* self, JSJitSetterCallArgs args) |
75 | 0 | { |
76 | 0 | AUTO_PROFILER_LABEL_FAST("set SVGAElement.download", DOM, cx); |
77 | 0 |
|
78 | 0 | binding_detail::FakeString arg0; |
79 | 0 | if (!ConvertJSValueToString(cx, args[0], eStringify, eStringify, arg0)) { |
80 | 0 | return false; |
81 | 0 | } |
82 | 0 | FastErrorResult rv; |
83 | 0 | self->SetDownload(NonNullHelper(Constify(arg0)), rv); |
84 | 0 | if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) { |
85 | 0 | return false; |
86 | 0 | } |
87 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
88 | 0 |
|
89 | 0 | return true; |
90 | 0 | } |
91 | | |
92 | | static const JSJitInfo download_getterinfo = { |
93 | | { (JSJitGetterOp)get_download }, |
94 | | { prototypes::id::SVGAElement }, |
95 | | { PrototypeTraits<prototypes::id::SVGAElement>::Depth }, |
96 | | JSJitInfo::Getter, |
97 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
98 | | JSVAL_TYPE_STRING, /* returnType. Not relevant for setters. */ |
99 | | false, /* isInfallible. False in setters. */ |
100 | | false, /* isMovable. Not relevant for setters. */ |
101 | | false, /* isEliminatable. Not relevant for setters. */ |
102 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
103 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
104 | | false, /* isTypedMethod. Only relevant for methods. */ |
105 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
106 | | }; |
107 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
108 | | static_assert(0 < 1, "There is no slot for us"); |
109 | | static const JSJitInfo download_setterinfo = { |
110 | | { (JSJitGetterOp)set_download }, |
111 | | { prototypes::id::SVGAElement }, |
112 | | { PrototypeTraits<prototypes::id::SVGAElement>::Depth }, |
113 | | JSJitInfo::Setter, |
114 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
115 | | JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */ |
116 | | false, /* isInfallible. False in setters. */ |
117 | | false, /* isMovable. Not relevant for setters. */ |
118 | | false, /* isEliminatable. Not relevant for setters. */ |
119 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
120 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
121 | | false, /* isTypedMethod. Only relevant for methods. */ |
122 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
123 | | }; |
124 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
125 | | static_assert(0 < 1, "There is no slot for us"); |
126 | | |
127 | | MOZ_CAN_RUN_SCRIPT static bool |
128 | | get_ping(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SVGAElement* self, JSJitGetterCallArgs args) |
129 | 0 | { |
130 | 0 | AUTO_PROFILER_LABEL_FAST("get SVGAElement.ping", DOM, cx); |
131 | 0 |
|
132 | 0 | DOMString result; |
133 | 0 | self->GetPing(result); |
134 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
135 | 0 | if (!xpc::NonVoidStringToJsval(cx, result, args.rval())) { |
136 | 0 | return false; |
137 | 0 | } |
138 | 0 | return true; |
139 | 0 | } |
140 | | |
141 | | MOZ_CAN_RUN_SCRIPT static bool |
142 | | set_ping(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SVGAElement* self, JSJitSetterCallArgs args) |
143 | 0 | { |
144 | 0 | AUTO_PROFILER_LABEL_FAST("set SVGAElement.ping", DOM, cx); |
145 | 0 |
|
146 | 0 | binding_detail::FakeString arg0; |
147 | 0 | if (!ConvertJSValueToString(cx, args[0], eStringify, eStringify, arg0)) { |
148 | 0 | return false; |
149 | 0 | } |
150 | 0 | FastErrorResult rv; |
151 | 0 | self->SetPing(NonNullHelper(Constify(arg0)), rv); |
152 | 0 | if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) { |
153 | 0 | return false; |
154 | 0 | } |
155 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
156 | 0 |
|
157 | 0 | return true; |
158 | 0 | } |
159 | | |
160 | | static const JSJitInfo ping_getterinfo = { |
161 | | { (JSJitGetterOp)get_ping }, |
162 | | { prototypes::id::SVGAElement }, |
163 | | { PrototypeTraits<prototypes::id::SVGAElement>::Depth }, |
164 | | JSJitInfo::Getter, |
165 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
166 | | JSVAL_TYPE_STRING, /* returnType. Not relevant for setters. */ |
167 | | false, /* isInfallible. False in setters. */ |
168 | | false, /* isMovable. Not relevant for setters. */ |
169 | | false, /* isEliminatable. Not relevant for setters. */ |
170 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
171 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
172 | | false, /* isTypedMethod. Only relevant for methods. */ |
173 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
174 | | }; |
175 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
176 | | static_assert(0 < 1, "There is no slot for us"); |
177 | | static const JSJitInfo ping_setterinfo = { |
178 | | { (JSJitGetterOp)set_ping }, |
179 | | { prototypes::id::SVGAElement }, |
180 | | { PrototypeTraits<prototypes::id::SVGAElement>::Depth }, |
181 | | JSJitInfo::Setter, |
182 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
183 | | JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */ |
184 | | false, /* isInfallible. False in setters. */ |
185 | | false, /* isMovable. Not relevant for setters. */ |
186 | | false, /* isEliminatable. Not relevant for setters. */ |
187 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
188 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
189 | | false, /* isTypedMethod. Only relevant for methods. */ |
190 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
191 | | }; |
192 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
193 | | static_assert(0 < 1, "There is no slot for us"); |
194 | | |
195 | | MOZ_CAN_RUN_SCRIPT static bool |
196 | | get_rel(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SVGAElement* self, JSJitGetterCallArgs args) |
197 | 0 | { |
198 | 0 | AUTO_PROFILER_LABEL_FAST("get SVGAElement.rel", DOM, cx); |
199 | 0 |
|
200 | 0 | DOMString result; |
201 | 0 | self->GetRel(result); |
202 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
203 | 0 | if (!xpc::NonVoidStringToJsval(cx, result, args.rval())) { |
204 | 0 | return false; |
205 | 0 | } |
206 | 0 | return true; |
207 | 0 | } |
208 | | |
209 | | MOZ_CAN_RUN_SCRIPT static bool |
210 | | set_rel(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SVGAElement* self, JSJitSetterCallArgs args) |
211 | 0 | { |
212 | 0 | AUTO_PROFILER_LABEL_FAST("set SVGAElement.rel", DOM, cx); |
213 | 0 |
|
214 | 0 | binding_detail::FakeString arg0; |
215 | 0 | if (!ConvertJSValueToString(cx, args[0], eStringify, eStringify, arg0)) { |
216 | 0 | return false; |
217 | 0 | } |
218 | 0 | FastErrorResult rv; |
219 | 0 | self->SetRel(NonNullHelper(Constify(arg0)), rv); |
220 | 0 | if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) { |
221 | 0 | return false; |
222 | 0 | } |
223 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
224 | 0 |
|
225 | 0 | return true; |
226 | 0 | } |
227 | | |
228 | | static const JSJitInfo rel_getterinfo = { |
229 | | { (JSJitGetterOp)get_rel }, |
230 | | { prototypes::id::SVGAElement }, |
231 | | { PrototypeTraits<prototypes::id::SVGAElement>::Depth }, |
232 | | JSJitInfo::Getter, |
233 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
234 | | JSVAL_TYPE_STRING, /* returnType. Not relevant for setters. */ |
235 | | false, /* isInfallible. False in setters. */ |
236 | | false, /* isMovable. Not relevant for setters. */ |
237 | | false, /* isEliminatable. Not relevant for setters. */ |
238 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
239 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
240 | | false, /* isTypedMethod. Only relevant for methods. */ |
241 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
242 | | }; |
243 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
244 | | static_assert(0 < 1, "There is no slot for us"); |
245 | | static const JSJitInfo rel_setterinfo = { |
246 | | { (JSJitGetterOp)set_rel }, |
247 | | { prototypes::id::SVGAElement }, |
248 | | { PrototypeTraits<prototypes::id::SVGAElement>::Depth }, |
249 | | JSJitInfo::Setter, |
250 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
251 | | JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */ |
252 | | false, /* isInfallible. False in setters. */ |
253 | | false, /* isMovable. Not relevant for setters. */ |
254 | | false, /* isEliminatable. Not relevant for setters. */ |
255 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
256 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
257 | | false, /* isTypedMethod. Only relevant for methods. */ |
258 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
259 | | }; |
260 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
261 | | static_assert(0 < 1, "There is no slot for us"); |
262 | | |
263 | | MOZ_CAN_RUN_SCRIPT static bool |
264 | | get_referrerPolicy(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SVGAElement* self, JSJitGetterCallArgs args) |
265 | 0 | { |
266 | 0 | AUTO_PROFILER_LABEL_FAST("get SVGAElement.referrerPolicy", DOM, cx); |
267 | 0 |
|
268 | 0 | DOMString result; |
269 | 0 | self->GetReferrerPolicy(result); |
270 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
271 | 0 | if (!xpc::NonVoidStringToJsval(cx, result, args.rval())) { |
272 | 0 | return false; |
273 | 0 | } |
274 | 0 | return true; |
275 | 0 | } |
276 | | |
277 | | MOZ_CAN_RUN_SCRIPT static bool |
278 | | set_referrerPolicy(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SVGAElement* self, JSJitSetterCallArgs args) |
279 | 0 | { |
280 | 0 | AUTO_PROFILER_LABEL_FAST("set SVGAElement.referrerPolicy", DOM, cx); |
281 | 0 |
|
282 | 0 | binding_detail::FakeString arg0; |
283 | 0 | if (!ConvertJSValueToString(cx, args[0], eStringify, eStringify, arg0)) { |
284 | 0 | return false; |
285 | 0 | } |
286 | 0 | FastErrorResult rv; |
287 | 0 | self->SetReferrerPolicy(NonNullHelper(Constify(arg0)), rv); |
288 | 0 | if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) { |
289 | 0 | return false; |
290 | 0 | } |
291 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
292 | 0 |
|
293 | 0 | return true; |
294 | 0 | } |
295 | | |
296 | | static const JSJitInfo referrerPolicy_getterinfo = { |
297 | | { (JSJitGetterOp)get_referrerPolicy }, |
298 | | { prototypes::id::SVGAElement }, |
299 | | { PrototypeTraits<prototypes::id::SVGAElement>::Depth }, |
300 | | JSJitInfo::Getter, |
301 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
302 | | JSVAL_TYPE_STRING, /* returnType. Not relevant for setters. */ |
303 | | false, /* isInfallible. False in setters. */ |
304 | | false, /* isMovable. Not relevant for setters. */ |
305 | | false, /* isEliminatable. Not relevant for setters. */ |
306 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
307 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
308 | | false, /* isTypedMethod. Only relevant for methods. */ |
309 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
310 | | }; |
311 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
312 | | static_assert(0 < 1, "There is no slot for us"); |
313 | | static const JSJitInfo referrerPolicy_setterinfo = { |
314 | | { (JSJitGetterOp)set_referrerPolicy }, |
315 | | { prototypes::id::SVGAElement }, |
316 | | { PrototypeTraits<prototypes::id::SVGAElement>::Depth }, |
317 | | JSJitInfo::Setter, |
318 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
319 | | JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */ |
320 | | false, /* isInfallible. False in setters. */ |
321 | | false, /* isMovable. Not relevant for setters. */ |
322 | | false, /* isEliminatable. Not relevant for setters. */ |
323 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
324 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
325 | | false, /* isTypedMethod. Only relevant for methods. */ |
326 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
327 | | }; |
328 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
329 | | static_assert(0 < 1, "There is no slot for us"); |
330 | | |
331 | | MOZ_CAN_RUN_SCRIPT static bool |
332 | | get_relList(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SVGAElement* self, JSJitGetterCallArgs args) |
333 | 0 | { |
334 | 0 | AUTO_PROFILER_LABEL_FAST("get SVGAElement.relList", DOM, cx); |
335 | 0 |
|
336 | 0 | auto result(StrongOrRawPtr<nsDOMTokenList>(self->RelList())); |
337 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
338 | 0 | if (!GetOrCreateDOMReflector(cx, result, args.rval())) { |
339 | 0 | MOZ_ASSERT(JS_IsExceptionPending(cx)); |
340 | 0 | return false; |
341 | 0 | } |
342 | 0 | return true; |
343 | 0 | } |
344 | | |
345 | | MOZ_CAN_RUN_SCRIPT static bool |
346 | | set_relList(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SVGAElement* self, JSJitSetterCallArgs args) |
347 | 0 | { |
348 | 0 | AUTO_PROFILER_LABEL_FAST("set SVGAElement.relList", DOM, cx); |
349 | 0 |
|
350 | 0 | JS::Rooted<JS::Value> v(cx); |
351 | 0 | if (!JS_GetProperty(cx, obj, "relList", &v)) { |
352 | 0 | return false; |
353 | 0 | } |
354 | 0 | |
355 | 0 | if (!v.isObject()) { |
356 | 0 | return ThrowErrorMessage(cx, MSG_NOT_OBJECT, "SVGAElement.relList"); |
357 | 0 | } |
358 | 0 | |
359 | 0 | JS::Rooted<JSObject*> targetObj(cx, &v.toObject()); |
360 | 0 | return JS_SetProperty(cx, targetObj, "value", args[0]); |
361 | 0 | } |
362 | | |
363 | | static const JSJitInfo relList_getterinfo = { |
364 | | { (JSJitGetterOp)get_relList }, |
365 | | { prototypes::id::SVGAElement }, |
366 | | { PrototypeTraits<prototypes::id::SVGAElement>::Depth }, |
367 | | JSJitInfo::Getter, |
368 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
369 | | JSVAL_TYPE_OBJECT, /* returnType. Not relevant for setters. */ |
370 | | false, /* isInfallible. False in setters. */ |
371 | | false, /* isMovable. Not relevant for setters. */ |
372 | | false, /* isEliminatable. Not relevant for setters. */ |
373 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
374 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
375 | | false, /* isTypedMethod. Only relevant for methods. */ |
376 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
377 | | }; |
378 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
379 | | static_assert(0 < 1, "There is no slot for us"); |
380 | | static const JSJitInfo relList_setterinfo = { |
381 | | { (JSJitGetterOp)set_relList }, |
382 | | { prototypes::id::SVGAElement }, |
383 | | { PrototypeTraits<prototypes::id::SVGAElement>::Depth }, |
384 | | JSJitInfo::Setter, |
385 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
386 | | JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */ |
387 | | false, /* isInfallible. False in setters. */ |
388 | | false, /* isMovable. Not relevant for setters. */ |
389 | | false, /* isEliminatable. Not relevant for setters. */ |
390 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
391 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
392 | | false, /* isTypedMethod. Only relevant for methods. */ |
393 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
394 | | }; |
395 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
396 | | static_assert(0 < 1, "There is no slot for us"); |
397 | | |
398 | | MOZ_CAN_RUN_SCRIPT static bool |
399 | | get_hreflang(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SVGAElement* self, JSJitGetterCallArgs args) |
400 | 0 | { |
401 | 0 | AUTO_PROFILER_LABEL_FAST("get SVGAElement.hreflang", DOM, cx); |
402 | 0 |
|
403 | 0 | DOMString result; |
404 | 0 | self->GetHreflang(result); |
405 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
406 | 0 | if (!xpc::NonVoidStringToJsval(cx, result, args.rval())) { |
407 | 0 | return false; |
408 | 0 | } |
409 | 0 | return true; |
410 | 0 | } |
411 | | |
412 | | MOZ_CAN_RUN_SCRIPT static bool |
413 | | set_hreflang(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SVGAElement* self, JSJitSetterCallArgs args) |
414 | 0 | { |
415 | 0 | AUTO_PROFILER_LABEL_FAST("set SVGAElement.hreflang", DOM, cx); |
416 | 0 |
|
417 | 0 | binding_detail::FakeString arg0; |
418 | 0 | if (!ConvertJSValueToString(cx, args[0], eStringify, eStringify, arg0)) { |
419 | 0 | return false; |
420 | 0 | } |
421 | 0 | FastErrorResult rv; |
422 | 0 | self->SetHreflang(NonNullHelper(Constify(arg0)), rv); |
423 | 0 | if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) { |
424 | 0 | return false; |
425 | 0 | } |
426 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
427 | 0 |
|
428 | 0 | return true; |
429 | 0 | } |
430 | | |
431 | | static const JSJitInfo hreflang_getterinfo = { |
432 | | { (JSJitGetterOp)get_hreflang }, |
433 | | { prototypes::id::SVGAElement }, |
434 | | { PrototypeTraits<prototypes::id::SVGAElement>::Depth }, |
435 | | JSJitInfo::Getter, |
436 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
437 | | JSVAL_TYPE_STRING, /* returnType. Not relevant for setters. */ |
438 | | false, /* isInfallible. False in setters. */ |
439 | | false, /* isMovable. Not relevant for setters. */ |
440 | | false, /* isEliminatable. Not relevant for setters. */ |
441 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
442 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
443 | | false, /* isTypedMethod. Only relevant for methods. */ |
444 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
445 | | }; |
446 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
447 | | static_assert(0 < 1, "There is no slot for us"); |
448 | | static const JSJitInfo hreflang_setterinfo = { |
449 | | { (JSJitGetterOp)set_hreflang }, |
450 | | { prototypes::id::SVGAElement }, |
451 | | { PrototypeTraits<prototypes::id::SVGAElement>::Depth }, |
452 | | JSJitInfo::Setter, |
453 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
454 | | JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */ |
455 | | false, /* isInfallible. False in setters. */ |
456 | | false, /* isMovable. Not relevant for setters. */ |
457 | | false, /* isEliminatable. Not relevant for setters. */ |
458 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
459 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
460 | | false, /* isTypedMethod. Only relevant for methods. */ |
461 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
462 | | }; |
463 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
464 | | static_assert(0 < 1, "There is no slot for us"); |
465 | | |
466 | | MOZ_CAN_RUN_SCRIPT static bool |
467 | | get_type(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SVGAElement* self, JSJitGetterCallArgs args) |
468 | 0 | { |
469 | 0 | AUTO_PROFILER_LABEL_FAST("get SVGAElement.type", DOM, cx); |
470 | 0 |
|
471 | 0 | DOMString result; |
472 | 0 | self->GetType(result); |
473 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
474 | 0 | if (!xpc::NonVoidStringToJsval(cx, result, args.rval())) { |
475 | 0 | return false; |
476 | 0 | } |
477 | 0 | return true; |
478 | 0 | } |
479 | | |
480 | | MOZ_CAN_RUN_SCRIPT static bool |
481 | | set_type(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SVGAElement* self, JSJitSetterCallArgs args) |
482 | 0 | { |
483 | 0 | AUTO_PROFILER_LABEL_FAST("set SVGAElement.type", DOM, cx); |
484 | 0 |
|
485 | 0 | binding_detail::FakeString arg0; |
486 | 0 | if (!ConvertJSValueToString(cx, args[0], eStringify, eStringify, arg0)) { |
487 | 0 | return false; |
488 | 0 | } |
489 | 0 | FastErrorResult rv; |
490 | 0 | self->SetType(NonNullHelper(Constify(arg0)), rv); |
491 | 0 | if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) { |
492 | 0 | return false; |
493 | 0 | } |
494 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
495 | 0 |
|
496 | 0 | return true; |
497 | 0 | } |
498 | | |
499 | | static const JSJitInfo type_getterinfo = { |
500 | | { (JSJitGetterOp)get_type }, |
501 | | { prototypes::id::SVGAElement }, |
502 | | { PrototypeTraits<prototypes::id::SVGAElement>::Depth }, |
503 | | JSJitInfo::Getter, |
504 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
505 | | JSVAL_TYPE_STRING, /* returnType. Not relevant for setters. */ |
506 | | false, /* isInfallible. False in setters. */ |
507 | | false, /* isMovable. Not relevant for setters. */ |
508 | | false, /* isEliminatable. Not relevant for setters. */ |
509 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
510 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
511 | | false, /* isTypedMethod. Only relevant for methods. */ |
512 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
513 | | }; |
514 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
515 | | static_assert(0 < 1, "There is no slot for us"); |
516 | | static const JSJitInfo type_setterinfo = { |
517 | | { (JSJitGetterOp)set_type }, |
518 | | { prototypes::id::SVGAElement }, |
519 | | { PrototypeTraits<prototypes::id::SVGAElement>::Depth }, |
520 | | JSJitInfo::Setter, |
521 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
522 | | JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */ |
523 | | false, /* isInfallible. False in setters. */ |
524 | | false, /* isMovable. Not relevant for setters. */ |
525 | | false, /* isEliminatable. Not relevant for setters. */ |
526 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
527 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
528 | | false, /* isTypedMethod. Only relevant for methods. */ |
529 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
530 | | }; |
531 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
532 | | static_assert(0 < 1, "There is no slot for us"); |
533 | | |
534 | | MOZ_CAN_RUN_SCRIPT static bool |
535 | | get_text(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SVGAElement* self, JSJitGetterCallArgs args) |
536 | 0 | { |
537 | 0 | AUTO_PROFILER_LABEL_FAST("get SVGAElement.text", DOM, cx); |
538 | 0 |
|
539 | 0 | FastErrorResult rv; |
540 | 0 | DOMString result; |
541 | 0 | self->GetText(result, rv); |
542 | 0 | if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) { |
543 | 0 | return false; |
544 | 0 | } |
545 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
546 | 0 | if (!xpc::NonVoidStringToJsval(cx, result, args.rval())) { |
547 | 0 | return false; |
548 | 0 | } |
549 | 0 | return true; |
550 | 0 | } |
551 | | |
552 | | MOZ_CAN_RUN_SCRIPT static bool |
553 | | set_text(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SVGAElement* self, JSJitSetterCallArgs args) |
554 | 0 | { |
555 | 0 | AUTO_PROFILER_LABEL_FAST("set SVGAElement.text", DOM, cx); |
556 | 0 |
|
557 | 0 | binding_detail::FakeString arg0; |
558 | 0 | if (!ConvertJSValueToString(cx, args[0], eStringify, eStringify, arg0)) { |
559 | 0 | return false; |
560 | 0 | } |
561 | 0 | FastErrorResult rv; |
562 | 0 | self->SetText(NonNullHelper(Constify(arg0)), rv); |
563 | 0 | if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) { |
564 | 0 | return false; |
565 | 0 | } |
566 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
567 | 0 |
|
568 | 0 | return true; |
569 | 0 | } |
570 | | |
571 | | static const JSJitInfo text_getterinfo = { |
572 | | { (JSJitGetterOp)get_text }, |
573 | | { prototypes::id::SVGAElement }, |
574 | | { PrototypeTraits<prototypes::id::SVGAElement>::Depth }, |
575 | | JSJitInfo::Getter, |
576 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
577 | | JSVAL_TYPE_STRING, /* 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 | | static const JSJitInfo text_setterinfo = { |
589 | | { (JSJitGetterOp)set_text }, |
590 | | { prototypes::id::SVGAElement }, |
591 | | { PrototypeTraits<prototypes::id::SVGAElement>::Depth }, |
592 | | JSJitInfo::Setter, |
593 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
594 | | JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */ |
595 | | false, /* isInfallible. False in setters. */ |
596 | | false, /* isMovable. Not relevant for setters. */ |
597 | | false, /* isEliminatable. Not relevant for setters. */ |
598 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
599 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
600 | | false, /* isTypedMethod. Only relevant for methods. */ |
601 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
602 | | }; |
603 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
604 | | static_assert(0 < 1, "There is no slot for us"); |
605 | | |
606 | | MOZ_CAN_RUN_SCRIPT static bool |
607 | | get_href(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SVGAElement* self, JSJitGetterCallArgs args) |
608 | 0 | { |
609 | 0 | AUTO_PROFILER_LABEL_FAST("get SVGAElement.href", DOM, cx); |
610 | 0 |
|
611 | 0 | auto result(StrongOrRawPtr<mozilla::dom::SVGAnimatedString>(self->Href())); |
612 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
613 | 0 | if (!GetOrCreateDOMReflector(cx, result, args.rval())) { |
614 | 0 | MOZ_ASSERT(JS_IsExceptionPending(cx)); |
615 | 0 | return false; |
616 | 0 | } |
617 | 0 | return true; |
618 | 0 | } |
619 | | |
620 | | static const JSJitInfo href_getterinfo = { |
621 | | { (JSJitGetterOp)get_href }, |
622 | | { prototypes::id::SVGAElement }, |
623 | | { PrototypeTraits<prototypes::id::SVGAElement>::Depth }, |
624 | | JSJitInfo::Getter, |
625 | | JSJitInfo::AliasNone, /* aliasSet. Not relevant for setters. */ |
626 | | JSVAL_TYPE_OBJECT, /* returnType. Not relevant for setters. */ |
627 | | false, /* isInfallible. False in setters. */ |
628 | | true, /* isMovable. Not relevant for setters. */ |
629 | | true, /* isEliminatable. Not relevant for setters. */ |
630 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
631 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
632 | | false, /* isTypedMethod. Only relevant for methods. */ |
633 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
634 | | }; |
635 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
636 | | static_assert(0 < 1, "There is no slot for us"); |
637 | | |
638 | | static bool |
639 | | _addProperty(JSContext* cx, JS::Handle<JSObject*> obj, JS::Handle<jsid> id, JS::Handle<JS::Value> val) |
640 | 0 | { |
641 | 0 | mozilla::dom::SVGAElement* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::dom::SVGAElement>(obj); |
642 | 0 | // We don't want to preserve if we don't have a wrapper, and we |
643 | 0 | // obviously can't preserve if we're not initialized. |
644 | 0 | if (self && self->GetWrapperPreserveColor()) { |
645 | 0 | PreserveWrapper(self); |
646 | 0 | } |
647 | 0 | return true; |
648 | 0 | } |
649 | | |
650 | | static void |
651 | | _finalize(js::FreeOp* fop, JSObject* obj) |
652 | 0 | { |
653 | 0 | mozilla::dom::SVGAElement* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::dom::SVGAElement>(obj); |
654 | 0 | if (self) { |
655 | 0 | ClearWrapper(self, self, obj); |
656 | 0 | AddForDeferredFinalization<mozilla::dom::SVGAElement>(self); |
657 | 0 | } |
658 | 0 | } |
659 | | |
660 | | static size_t |
661 | | _objectMoved(JSObject* obj, JSObject* old) |
662 | 0 | { |
663 | 0 | mozilla::dom::SVGAElement* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::dom::SVGAElement>(obj); |
664 | 0 | if (self) { |
665 | 0 | UpdateWrapper(self, self, obj, old); |
666 | 0 | } |
667 | 0 |
|
668 | 0 | return 0; |
669 | 0 | } |
670 | | |
671 | | // We deliberately use brace-elision to make Visual Studio produce better initalization code. |
672 | | #if defined(__clang__) |
673 | | #pragma clang diagnostic push |
674 | | #pragma clang diagnostic ignored "-Wmissing-braces" |
675 | | #endif |
676 | | static const JSPropertySpec sAttributes_specs[] = { |
677 | | { "target", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &target_getterinfo, nullptr, nullptr }, |
678 | | { "download", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &download_getterinfo, GenericSetter<NormalThisPolicy>, &download_setterinfo }, |
679 | | { "ping", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &ping_getterinfo, GenericSetter<NormalThisPolicy>, &ping_setterinfo }, |
680 | | { "rel", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &rel_getterinfo, GenericSetter<NormalThisPolicy>, &rel_setterinfo }, |
681 | | { "referrerPolicy", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &referrerPolicy_getterinfo, GenericSetter<NormalThisPolicy>, &referrerPolicy_setterinfo }, |
682 | | { "relList", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &relList_getterinfo, GenericSetter<NormalThisPolicy>, &relList_setterinfo }, |
683 | | { "hreflang", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &hreflang_getterinfo, GenericSetter<NormalThisPolicy>, &hreflang_setterinfo }, |
684 | | { "type", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &type_getterinfo, GenericSetter<NormalThisPolicy>, &type_setterinfo }, |
685 | | { "text", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &text_getterinfo, GenericSetter<NormalThisPolicy>, &text_setterinfo }, |
686 | | { "href", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &href_getterinfo, nullptr, nullptr }, |
687 | | { nullptr, 0, nullptr, nullptr, nullptr, nullptr } |
688 | | }; |
689 | | #if defined(__clang__) |
690 | | #pragma clang diagnostic pop |
691 | | #endif |
692 | | |
693 | | |
694 | | static const Prefable<const JSPropertySpec> sAttributes[] = { |
695 | | { nullptr, &sAttributes_specs[0] }, |
696 | | { nullptr, nullptr } |
697 | | }; |
698 | | |
699 | | static_assert(1 <= 1ull << NUM_BITS_PROPERTY_INFO_PREF_INDEX, |
700 | | "We have a prefable index that is >= (1 << NUM_BITS_PROPERTY_INFO_PREF_INDEX)"); |
701 | | static_assert(10 <= 1ull << NUM_BITS_PROPERTY_INFO_SPEC_INDEX, |
702 | | "We have a spec index that is >= (1 << NUM_BITS_PROPERTY_INFO_SPEC_INDEX)"); |
703 | | |
704 | | |
705 | | static uint16_t sNativeProperties_sortedPropertyIndices[10]; |
706 | | static PropertyInfo sNativeProperties_propertyInfos[10]; |
707 | | |
708 | | static const NativePropertiesN<1> sNativeProperties = { |
709 | | false, 0, |
710 | | false, 0, |
711 | | false, 0, |
712 | | true, 0 /* sAttributes */, |
713 | | false, 0, |
714 | | false, 0, |
715 | | false, 0, |
716 | | -1, |
717 | | 10, |
718 | | sNativeProperties_sortedPropertyIndices, |
719 | | { |
720 | | { sAttributes, &sNativeProperties_propertyInfos[0] } |
721 | | } |
722 | | }; |
723 | | static_assert(10 < 1ull << CHAR_BIT * sizeof(sNativeProperties.propertyInfoCount), |
724 | | "We have a property info count that is oversized"); |
725 | | |
726 | | static const DOMIfaceAndProtoJSClass sInterfaceObjectClass = { |
727 | | { |
728 | | "Function", |
729 | | JSCLASS_IS_DOMIFACEANDPROTOJSCLASS | JSCLASS_HAS_RESERVED_SLOTS(DOM_INTERFACE_SLOTS_BASE), |
730 | | &sBoringInterfaceObjectClassClassOps, |
731 | | JS_NULL_CLASS_SPEC, |
732 | | JS_NULL_CLASS_EXT, |
733 | | &sInterfaceObjectClassObjectOps |
734 | | }, |
735 | | eInterface, |
736 | | true, |
737 | | prototypes::id::SVGAElement, |
738 | | PrototypeTraits<prototypes::id::SVGAElement>::Depth, |
739 | | sNativePropertyHooks, |
740 | | "function SVGAElement() {\n [native code]\n}", |
741 | | SVGGraphicsElement_Binding::GetConstructorObject |
742 | | }; |
743 | | |
744 | | static const DOMIfaceAndProtoJSClass sPrototypeClass = { |
745 | | { |
746 | | "SVGAElementPrototype", |
747 | | JSCLASS_IS_DOMIFACEANDPROTOJSCLASS | JSCLASS_HAS_RESERVED_SLOTS(DOM_INTERFACE_PROTO_SLOTS_BASE), |
748 | | JS_NULL_CLASS_OPS, |
749 | | JS_NULL_CLASS_SPEC, |
750 | | JS_NULL_CLASS_EXT, |
751 | | JS_NULL_OBJECT_OPS |
752 | | }, |
753 | | eInterfacePrototype, |
754 | | false, |
755 | | prototypes::id::SVGAElement, |
756 | | PrototypeTraits<prototypes::id::SVGAElement>::Depth, |
757 | | sNativePropertyHooks, |
758 | | "[object SVGAElementPrototype]", |
759 | | SVGGraphicsElement_Binding::GetProtoObject |
760 | | }; |
761 | | |
762 | | static const js::ClassOps sClassOps = { |
763 | | _addProperty, /* addProperty */ |
764 | | nullptr, /* delProperty */ |
765 | | nullptr, /* enumerate */ |
766 | | nullptr, /* newEnumerate */ |
767 | | nullptr, /* resolve */ |
768 | | nullptr, /* mayResolve */ |
769 | | _finalize, /* finalize */ |
770 | | nullptr, /* call */ |
771 | | nullptr, /* hasInstance */ |
772 | | nullptr, /* construct */ |
773 | | nullptr, /* trace */ |
774 | | }; |
775 | | |
776 | | static const js::ClassExtension sClassExtension = { |
777 | | nullptr, /* weakmapKeyDelegateOp */ |
778 | | _objectMoved /* objectMovedOp */ |
779 | | }; |
780 | | |
781 | | static const DOMJSClass sClass = { |
782 | | { "SVGAElement", |
783 | | JSCLASS_IS_DOMJSCLASS | JSCLASS_FOREGROUND_FINALIZE | JSCLASS_HAS_RESERVED_SLOTS(1), |
784 | | &sClassOps, |
785 | | JS_NULL_CLASS_SPEC, |
786 | | &sClassExtension, |
787 | | JS_NULL_OBJECT_OPS |
788 | | }, |
789 | | { prototypes::id::EventTarget, prototypes::id::Node, prototypes::id::Element, prototypes::id::SVGElement, prototypes::id::SVGGraphicsElement, prototypes::id::SVGAElement, prototypes::id::_ID_Count, prototypes::id::_ID_Count }, |
790 | | IsBaseOf<nsISupports, mozilla::dom::SVGAElement >::value, |
791 | | sNativePropertyHooks, |
792 | | FindAssociatedGlobalForNative<mozilla::dom::SVGAElement>::Get, |
793 | | GetProtoObjectHandle, |
794 | | GetCCParticipant<mozilla::dom::SVGAElement>::Get() |
795 | | }; |
796 | | static_assert(1 == DOM_INSTANCE_RESERVED_SLOTS, |
797 | | "Must have the right minimal number of reserved slots."); |
798 | | static_assert(1 >= 1, |
799 | | "Must have enough reserved slots."); |
800 | | |
801 | | const JSClass* |
802 | | GetJSClass() |
803 | 0 | { |
804 | 0 | return sClass.ToJSClass(); |
805 | 0 | } |
806 | | |
807 | | bool |
808 | | Wrap(JSContext* aCx, mozilla::dom::SVGAElement* aObject, nsWrapperCache* aCache, JS::Handle<JSObject*> aGivenProto, JS::MutableHandle<JSObject*> aReflector) |
809 | 0 | { |
810 | 0 | static_assert(!IsBaseOf<NonRefcountedDOMObject, mozilla::dom::SVGAElement>::value, |
811 | 0 | "Shouldn't have wrappercached things that are not refcounted."); |
812 | 0 | MOZ_ASSERT(static_cast<mozilla::dom::SVGAElement*>(aObject) == |
813 | 0 | reinterpret_cast<mozilla::dom::SVGAElement*>(aObject), |
814 | 0 | "Multiple inheritance for mozilla::dom::SVGAElement is broken."); |
815 | 0 | MOZ_ASSERT(static_cast<mozilla::dom::SVGGraphicsElement*>(aObject) == |
816 | 0 | reinterpret_cast<mozilla::dom::SVGGraphicsElement*>(aObject), |
817 | 0 | "Multiple inheritance for mozilla::dom::SVGGraphicsElement is broken."); |
818 | 0 | MOZ_ASSERT(static_cast<nsSVGElement*>(aObject) == |
819 | 0 | reinterpret_cast<nsSVGElement*>(aObject), |
820 | 0 | "Multiple inheritance for nsSVGElement is broken."); |
821 | 0 | MOZ_ASSERT(static_cast<mozilla::dom::Element*>(aObject) == |
822 | 0 | reinterpret_cast<mozilla::dom::Element*>(aObject), |
823 | 0 | "Multiple inheritance for mozilla::dom::Element is broken."); |
824 | 0 | MOZ_ASSERT(static_cast<nsINode*>(aObject) == |
825 | 0 | reinterpret_cast<nsINode*>(aObject), |
826 | 0 | "Multiple inheritance for nsINode is broken."); |
827 | 0 | MOZ_ASSERT(static_cast<mozilla::dom::EventTarget*>(aObject) == |
828 | 0 | reinterpret_cast<mozilla::dom::EventTarget*>(aObject), |
829 | 0 | "Multiple inheritance for mozilla::dom::EventTarget is broken."); |
830 | 0 | MOZ_ASSERT(ToSupportsIsCorrect(aObject)); |
831 | 0 | MOZ_ASSERT_IF(aGivenProto, js::IsObjectInContextCompartment(aGivenProto, aCx)); |
832 | 0 | MOZ_ASSERT(!aCache->GetWrapper(), |
833 | 0 | "You should probably not be using Wrap() directly; use " |
834 | 0 | "GetOrCreateDOMReflector instead"); |
835 | 0 |
|
836 | 0 | MOZ_ASSERT(ToSupportsIsOnPrimaryInheritanceChain(aObject, aCache), |
837 | 0 | "nsISupports must be on our primary inheritance chain"); |
838 | 0 |
|
839 | 0 | JS::Rooted<JSObject*> global(aCx, FindAssociatedGlobal(aCx, aObject->GetParentObject())); |
840 | 0 | if (!global) { |
841 | 0 | return false; |
842 | 0 | } |
843 | 0 | MOZ_ASSERT(JS_IsGlobalObject(global)); |
844 | 0 | MOZ_ASSERT(JS::ObjectIsNotGray(global)); |
845 | 0 |
|
846 | 0 | // That might have ended up wrapping us already, due to the wonders |
847 | 0 | // of XBL. Check for that, and bail out as needed. |
848 | 0 | aReflector.set(aCache->GetWrapper()); |
849 | 0 | if (aReflector) { |
850 | | #ifdef DEBUG |
851 | | AssertReflectorHasGivenProto(aCx, aReflector, aGivenProto); |
852 | | #endif // DEBUG |
853 | | return true; |
854 | 0 | } |
855 | 0 |
|
856 | 0 | JSAutoRealm ar(aCx, global); |
857 | 0 | JS::Handle<JSObject*> canonicalProto = GetProtoObjectHandle(aCx); |
858 | 0 | if (!canonicalProto) { |
859 | 0 | return false; |
860 | 0 | } |
861 | 0 | JS::Rooted<JSObject*> proto(aCx); |
862 | 0 | if (aGivenProto) { |
863 | 0 | proto = aGivenProto; |
864 | 0 | // Unfortunately, while aGivenProto was in the compartment of aCx |
865 | 0 | // coming in, we changed compartments to that of "parent" so may need |
866 | 0 | // to wrap the proto here. |
867 | 0 | if (js::GetContextCompartment(aCx) != js::GetObjectCompartment(proto)) { |
868 | 0 | if (!JS_WrapObject(aCx, &proto)) { |
869 | 0 | return false; |
870 | 0 | } |
871 | 0 | } |
872 | 0 | } else { |
873 | 0 | proto = canonicalProto; |
874 | 0 | } |
875 | 0 |
|
876 | 0 | BindingJSObjectCreator<mozilla::dom::SVGAElement> creator(aCx); |
877 | 0 | creator.CreateObject(aCx, sClass.ToJSClass(), proto, aObject, aReflector); |
878 | 0 | if (!aReflector) { |
879 | 0 | return false; |
880 | 0 | } |
881 | 0 | |
882 | 0 | aCache->SetWrapper(aReflector); |
883 | 0 | creator.InitializationSucceeded(); |
884 | 0 |
|
885 | 0 | MOZ_ASSERT(aCache->GetWrapperPreserveColor() && |
886 | 0 | aCache->GetWrapperPreserveColor() == aReflector); |
887 | 0 | // If proto != canonicalProto, we have to preserve our wrapper; |
888 | 0 | // otherwise we won't be able to properly recreate it later, since |
889 | 0 | // we won't know what proto to use. Note that we don't check |
890 | 0 | // aGivenProto here, since it's entirely possible (and even |
891 | 0 | // somewhat common) to have a non-null aGivenProto which is the |
892 | 0 | // same as canonicalProto. |
893 | 0 | if (proto != canonicalProto) { |
894 | 0 | PreserveWrapper(aObject); |
895 | 0 | } |
896 | 0 |
|
897 | 0 | return true; |
898 | 0 | } |
899 | | |
900 | | const NativePropertyHooks sNativePropertyHooks[] = { { |
901 | | nullptr, |
902 | | nullptr, |
903 | | nullptr, |
904 | | { sNativeProperties.Upcast(), nullptr }, |
905 | | prototypes::id::SVGAElement, |
906 | | constructors::id::SVGAElement, |
907 | | SVGGraphicsElement_Binding::sNativePropertyHooks, |
908 | | &DefaultXrayExpandoObjectClass |
909 | | } }; |
910 | | |
911 | | void |
912 | | CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, bool aDefineOnGlobal) |
913 | 0 | { |
914 | 0 | JS::Handle<JSObject*> parentProto(SVGGraphicsElement_Binding::GetProtoObjectHandle(aCx)); |
915 | 0 | if (!parentProto) { |
916 | 0 | return; |
917 | 0 | } |
918 | 0 | |
919 | 0 | JS::Handle<JSObject*> constructorProto(SVGGraphicsElement_Binding::GetConstructorObjectHandle(aCx)); |
920 | 0 | if (!constructorProto) { |
921 | 0 | return; |
922 | 0 | } |
923 | 0 | |
924 | 0 | static bool sIdsInited = false; |
925 | 0 | if (!sIdsInited && NS_IsMainThread()) { |
926 | 0 | if (!InitIds(aCx, sNativeProperties.Upcast())) { |
927 | 0 | return; |
928 | 0 | } |
929 | 0 | sIdsInited = true; |
930 | 0 | } |
931 | 0 |
|
932 | 0 | JS::Heap<JSObject*>* protoCache = &aProtoAndIfaceCache.EntrySlotOrCreate(prototypes::id::SVGAElement); |
933 | 0 | JS::Heap<JSObject*>* interfaceCache = &aProtoAndIfaceCache.EntrySlotOrCreate(constructors::id::SVGAElement); |
934 | 0 | dom::CreateInterfaceObjects(aCx, aGlobal, parentProto, |
935 | 0 | &sPrototypeClass.mBase, protoCache, |
936 | 0 | nullptr, |
937 | 0 | constructorProto, &sInterfaceObjectClass.mBase, 0, nullptr, |
938 | 0 | interfaceCache, |
939 | 0 | sNativeProperties.Upcast(), |
940 | 0 | nullptr, |
941 | 0 | "SVGAElement", aDefineOnGlobal, |
942 | 0 | nullptr, |
943 | 0 | false); |
944 | 0 | } |
945 | | |
946 | | JSObject* |
947 | | GetConstructorObject(JSContext* aCx) |
948 | 0 | { |
949 | 0 | return GetConstructorObjectHandle(aCx); |
950 | 0 | } |
951 | | |
952 | | } // namespace SVGAElement_Binding |
953 | | |
954 | | |
955 | | |
956 | | } // namespace dom |
957 | | } // namespace mozilla |