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