/work/obj-fuzz/dom/bindings/HTMLTableElementBinding.cpp
Line | Count | Source (jump to first uncovered line) |
1 | | /* THIS FILE IS AUTOGENERATED FROM HTMLTableElement.webidl BY Codegen.py - DO NOT EDIT */ |
2 | | |
3 | | #include "HTMLElementBinding.h" |
4 | | #include "HTMLTableElementBinding.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/HTMLTableCaptionElement.h" |
12 | | #include "mozilla/dom/HTMLTableElement.h" |
13 | | #include "mozilla/dom/HTMLTableSectionElement.h" |
14 | | #include "mozilla/dom/NonRefcountedDOMObject.h" |
15 | | #include "mozilla/dom/Nullable.h" |
16 | | #include "mozilla/dom/PrimitiveConversions.h" |
17 | | #include "mozilla/dom/XrayExpandoClass.h" |
18 | | #include "nsContentList.h" |
19 | | #include "nsGenericHTMLElement.h" |
20 | | |
21 | | namespace mozilla { |
22 | | namespace dom { |
23 | | |
24 | | namespace binding_detail {}; // Just to make sure it's known as a namespace |
25 | | using namespace mozilla::dom::binding_detail; |
26 | | |
27 | | |
28 | | namespace HTMLTableElement_Binding { |
29 | | |
30 | | static_assert(IsRefcounted<NativeType>::value == IsRefcounted<HTMLElement_Binding::NativeType>::value, |
31 | | "Can't inherit from an interface with a different ownership model."); |
32 | | |
33 | | MOZ_CAN_RUN_SCRIPT static bool |
34 | | get_caption(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLTableElement* self, JSJitGetterCallArgs args) |
35 | 0 | { |
36 | 0 | AUTO_PROFILER_LABEL_FAST("get HTMLTableElement.caption", DOM, cx); |
37 | 0 |
|
38 | 0 | auto result(StrongOrRawPtr<mozilla::dom::HTMLTableCaptionElement>(self->GetCaption())); |
39 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
40 | 0 | if (!result) { |
41 | 0 | args.rval().setNull(); |
42 | 0 | return true; |
43 | 0 | } |
44 | 0 | if (!GetOrCreateDOMReflector(cx, result, args.rval())) { |
45 | 0 | MOZ_ASSERT(JS_IsExceptionPending(cx)); |
46 | 0 | return false; |
47 | 0 | } |
48 | 0 | return true; |
49 | 0 | } |
50 | | |
51 | | MOZ_CAN_RUN_SCRIPT static bool |
52 | | set_caption(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLTableElement* self, JSJitSetterCallArgs args) |
53 | 0 | { |
54 | 0 | AUTO_PROFILER_LABEL_FAST("set HTMLTableElement.caption", DOM, cx); |
55 | 0 |
|
56 | 0 | mozilla::dom::HTMLTableCaptionElement* arg0; |
57 | 0 | if (args[0].isObject()) { |
58 | 0 | { |
59 | 0 | nsresult rv = UnwrapObject<prototypes::id::HTMLTableCaptionElement, mozilla::dom::HTMLTableCaptionElement>(args[0], arg0); |
60 | 0 | if (NS_FAILED(rv)) { |
61 | 0 | ThrowErrorMessage(cx, MSG_DOES_NOT_IMPLEMENT_INTERFACE, "Value being assigned to HTMLTableElement.caption", "HTMLTableCaptionElement"); |
62 | 0 | return false; |
63 | 0 | } |
64 | 0 | } |
65 | 0 | } else if (args[0].isNullOrUndefined()) { |
66 | 0 | arg0 = nullptr; |
67 | 0 | } else { |
68 | 0 | ThrowErrorMessage(cx, MSG_NOT_OBJECT, "Value being assigned to HTMLTableElement.caption"); |
69 | 0 | return false; |
70 | 0 | } |
71 | 0 | Maybe<AutoCEReaction> ceReaction; |
72 | 0 | if (CustomElementRegistry::IsCustomElementEnabled(cx, obj)) { |
73 | 0 | DocGroup* docGroup = self->GetDocGroup(); |
74 | 0 | if (docGroup) { |
75 | 0 | ceReaction.emplace(docGroup->CustomElementReactionsStack(), cx); |
76 | 0 | } |
77 | 0 | } |
78 | 0 | FastErrorResult rv; |
79 | 0 | self->SetCaption(MOZ_KnownLive(Constify(arg0)), rv); |
80 | 0 | if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) { |
81 | 0 | return false; |
82 | 0 | } |
83 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
84 | 0 |
|
85 | 0 | return true; |
86 | 0 | } |
87 | | |
88 | | static const JSJitInfo caption_getterinfo = { |
89 | | { (JSJitGetterOp)get_caption }, |
90 | | { prototypes::id::HTMLTableElement }, |
91 | | { PrototypeTraits<prototypes::id::HTMLTableElement>::Depth }, |
92 | | JSJitInfo::Getter, |
93 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
94 | | JSVAL_TYPE_UNKNOWN, /* returnType. Not relevant for setters. */ |
95 | | false, /* isInfallible. False in setters. */ |
96 | | false, /* isMovable. Not relevant for setters. */ |
97 | | false, /* isEliminatable. Not relevant for setters. */ |
98 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
99 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
100 | | false, /* isTypedMethod. Only relevant for methods. */ |
101 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
102 | | }; |
103 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
104 | | static_assert(0 < 1, "There is no slot for us"); |
105 | | static const JSJitInfo caption_setterinfo = { |
106 | | { (JSJitGetterOp)set_caption }, |
107 | | { prototypes::id::HTMLTableElement }, |
108 | | { PrototypeTraits<prototypes::id::HTMLTableElement>::Depth }, |
109 | | JSJitInfo::Setter, |
110 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
111 | | JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */ |
112 | | false, /* isInfallible. False in setters. */ |
113 | | false, /* isMovable. Not relevant for setters. */ |
114 | | false, /* isEliminatable. Not relevant for setters. */ |
115 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
116 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
117 | | false, /* isTypedMethod. Only relevant for methods. */ |
118 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
119 | | }; |
120 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
121 | | static_assert(0 < 1, "There is no slot for us"); |
122 | | |
123 | | MOZ_CAN_RUN_SCRIPT static bool |
124 | | createCaption(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLTableElement* self, const JSJitMethodCallArgs& args) |
125 | 0 | { |
126 | 0 | AUTO_PROFILER_LABEL_FAST("HTMLTableElement.createCaption", DOM, cx); |
127 | 0 |
|
128 | 0 | auto result(StrongOrRawPtr<nsGenericHTMLElement>(self->CreateCaption())); |
129 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
130 | 0 | if (!GetOrCreateDOMReflector(cx, result, args.rval())) { |
131 | 0 | MOZ_ASSERT(JS_IsExceptionPending(cx)); |
132 | 0 | return false; |
133 | 0 | } |
134 | 0 | return true; |
135 | 0 | } |
136 | | |
137 | | static const JSJitInfo createCaption_methodinfo = { |
138 | | { (JSJitGetterOp)createCaption }, |
139 | | { prototypes::id::HTMLTableElement }, |
140 | | { PrototypeTraits<prototypes::id::HTMLTableElement>::Depth }, |
141 | | JSJitInfo::Method, |
142 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
143 | | JSVAL_TYPE_OBJECT, /* returnType. Not relevant for setters. */ |
144 | | false, /* isInfallible. False in setters. */ |
145 | | false, /* isMovable. Not relevant for setters. */ |
146 | | false, /* isEliminatable. Not relevant for setters. */ |
147 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
148 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
149 | | false, /* isTypedMethod. Only relevant for methods. */ |
150 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
151 | | }; |
152 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
153 | | static_assert(0 < 1, "There is no slot for us"); |
154 | | |
155 | | MOZ_CAN_RUN_SCRIPT static bool |
156 | | deleteCaption(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLTableElement* self, const JSJitMethodCallArgs& args) |
157 | 0 | { |
158 | 0 | AUTO_PROFILER_LABEL_FAST("HTMLTableElement.deleteCaption", DOM, cx); |
159 | 0 |
|
160 | 0 | Maybe<AutoCEReaction> ceReaction; |
161 | 0 | if (CustomElementRegistry::IsCustomElementEnabled(cx, obj)) { |
162 | 0 | DocGroup* docGroup = self->GetDocGroup(); |
163 | 0 | if (docGroup) { |
164 | 0 | ceReaction.emplace(docGroup->CustomElementReactionsStack(), cx); |
165 | 0 | } |
166 | 0 | } |
167 | 0 | self->DeleteCaption(); |
168 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
169 | 0 | args.rval().setUndefined(); |
170 | 0 | return true; |
171 | 0 | } |
172 | | |
173 | | static const JSJitInfo deleteCaption_methodinfo = { |
174 | | { (JSJitGetterOp)deleteCaption }, |
175 | | { prototypes::id::HTMLTableElement }, |
176 | | { PrototypeTraits<prototypes::id::HTMLTableElement>::Depth }, |
177 | | JSJitInfo::Method, |
178 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
179 | | JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */ |
180 | | true, /* isInfallible. False in setters. */ |
181 | | false, /* isMovable. Not relevant for setters. */ |
182 | | false, /* isEliminatable. Not relevant for setters. */ |
183 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
184 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
185 | | false, /* isTypedMethod. Only relevant for methods. */ |
186 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
187 | | }; |
188 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
189 | | static_assert(0 < 1, "There is no slot for us"); |
190 | | |
191 | | MOZ_CAN_RUN_SCRIPT static bool |
192 | | get_tHead(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLTableElement* self, JSJitGetterCallArgs args) |
193 | 0 | { |
194 | 0 | AUTO_PROFILER_LABEL_FAST("get HTMLTableElement.tHead", DOM, cx); |
195 | 0 |
|
196 | 0 | auto result(StrongOrRawPtr<mozilla::dom::HTMLTableSectionElement>(self->GetTHead())); |
197 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
198 | 0 | if (!result) { |
199 | 0 | args.rval().setNull(); |
200 | 0 | return true; |
201 | 0 | } |
202 | 0 | if (!GetOrCreateDOMReflector(cx, result, args.rval())) { |
203 | 0 | MOZ_ASSERT(JS_IsExceptionPending(cx)); |
204 | 0 | return false; |
205 | 0 | } |
206 | 0 | return true; |
207 | 0 | } |
208 | | |
209 | | MOZ_CAN_RUN_SCRIPT static bool |
210 | | set_tHead(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLTableElement* self, JSJitSetterCallArgs args) |
211 | 0 | { |
212 | 0 | AUTO_PROFILER_LABEL_FAST("set HTMLTableElement.tHead", DOM, cx); |
213 | 0 |
|
214 | 0 | mozilla::dom::HTMLTableSectionElement* arg0; |
215 | 0 | if (args[0].isObject()) { |
216 | 0 | { |
217 | 0 | nsresult rv = UnwrapObject<prototypes::id::HTMLTableSectionElement, mozilla::dom::HTMLTableSectionElement>(args[0], arg0); |
218 | 0 | if (NS_FAILED(rv)) { |
219 | 0 | ThrowErrorMessage(cx, MSG_DOES_NOT_IMPLEMENT_INTERFACE, "Value being assigned to HTMLTableElement.tHead", "HTMLTableSectionElement"); |
220 | 0 | return false; |
221 | 0 | } |
222 | 0 | } |
223 | 0 | } else if (args[0].isNullOrUndefined()) { |
224 | 0 | arg0 = nullptr; |
225 | 0 | } else { |
226 | 0 | ThrowErrorMessage(cx, MSG_NOT_OBJECT, "Value being assigned to HTMLTableElement.tHead"); |
227 | 0 | return false; |
228 | 0 | } |
229 | 0 | Maybe<AutoCEReaction> ceReaction; |
230 | 0 | if (CustomElementRegistry::IsCustomElementEnabled(cx, obj)) { |
231 | 0 | DocGroup* docGroup = self->GetDocGroup(); |
232 | 0 | if (docGroup) { |
233 | 0 | ceReaction.emplace(docGroup->CustomElementReactionsStack(), cx); |
234 | 0 | } |
235 | 0 | } |
236 | 0 | FastErrorResult rv; |
237 | 0 | self->SetTHead(MOZ_KnownLive(Constify(arg0)), rv); |
238 | 0 | if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) { |
239 | 0 | return false; |
240 | 0 | } |
241 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
242 | 0 |
|
243 | 0 | return true; |
244 | 0 | } |
245 | | |
246 | | static const JSJitInfo tHead_getterinfo = { |
247 | | { (JSJitGetterOp)get_tHead }, |
248 | | { prototypes::id::HTMLTableElement }, |
249 | | { PrototypeTraits<prototypes::id::HTMLTableElement>::Depth }, |
250 | | JSJitInfo::Getter, |
251 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
252 | | JSVAL_TYPE_UNKNOWN, /* returnType. Not relevant for setters. */ |
253 | | false, /* isInfallible. False in setters. */ |
254 | | false, /* isMovable. Not relevant for setters. */ |
255 | | false, /* isEliminatable. Not relevant for setters. */ |
256 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
257 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
258 | | false, /* isTypedMethod. Only relevant for methods. */ |
259 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
260 | | }; |
261 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
262 | | static_assert(0 < 1, "There is no slot for us"); |
263 | | static const JSJitInfo tHead_setterinfo = { |
264 | | { (JSJitGetterOp)set_tHead }, |
265 | | { prototypes::id::HTMLTableElement }, |
266 | | { PrototypeTraits<prototypes::id::HTMLTableElement>::Depth }, |
267 | | JSJitInfo::Setter, |
268 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
269 | | JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */ |
270 | | false, /* isInfallible. False in setters. */ |
271 | | false, /* isMovable. Not relevant for setters. */ |
272 | | false, /* isEliminatable. Not relevant for setters. */ |
273 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
274 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
275 | | false, /* isTypedMethod. Only relevant for methods. */ |
276 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
277 | | }; |
278 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
279 | | static_assert(0 < 1, "There is no slot for us"); |
280 | | |
281 | | MOZ_CAN_RUN_SCRIPT static bool |
282 | | createTHead(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLTableElement* self, const JSJitMethodCallArgs& args) |
283 | 0 | { |
284 | 0 | AUTO_PROFILER_LABEL_FAST("HTMLTableElement.createTHead", DOM, cx); |
285 | 0 |
|
286 | 0 | auto result(StrongOrRawPtr<nsGenericHTMLElement>(self->CreateTHead())); |
287 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
288 | 0 | if (!GetOrCreateDOMReflector(cx, result, args.rval())) { |
289 | 0 | MOZ_ASSERT(JS_IsExceptionPending(cx)); |
290 | 0 | return false; |
291 | 0 | } |
292 | 0 | return true; |
293 | 0 | } |
294 | | |
295 | | static const JSJitInfo createTHead_methodinfo = { |
296 | | { (JSJitGetterOp)createTHead }, |
297 | | { prototypes::id::HTMLTableElement }, |
298 | | { PrototypeTraits<prototypes::id::HTMLTableElement>::Depth }, |
299 | | JSJitInfo::Method, |
300 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
301 | | JSVAL_TYPE_OBJECT, /* returnType. Not relevant for setters. */ |
302 | | false, /* isInfallible. False in setters. */ |
303 | | false, /* isMovable. Not relevant for setters. */ |
304 | | false, /* isEliminatable. Not relevant for setters. */ |
305 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
306 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
307 | | false, /* isTypedMethod. Only relevant for methods. */ |
308 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
309 | | }; |
310 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
311 | | static_assert(0 < 1, "There is no slot for us"); |
312 | | |
313 | | MOZ_CAN_RUN_SCRIPT static bool |
314 | | deleteTHead(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLTableElement* self, const JSJitMethodCallArgs& args) |
315 | 0 | { |
316 | 0 | AUTO_PROFILER_LABEL_FAST("HTMLTableElement.deleteTHead", DOM, cx); |
317 | 0 |
|
318 | 0 | Maybe<AutoCEReaction> ceReaction; |
319 | 0 | if (CustomElementRegistry::IsCustomElementEnabled(cx, obj)) { |
320 | 0 | DocGroup* docGroup = self->GetDocGroup(); |
321 | 0 | if (docGroup) { |
322 | 0 | ceReaction.emplace(docGroup->CustomElementReactionsStack(), cx); |
323 | 0 | } |
324 | 0 | } |
325 | 0 | self->DeleteTHead(); |
326 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
327 | 0 | args.rval().setUndefined(); |
328 | 0 | return true; |
329 | 0 | } |
330 | | |
331 | | static const JSJitInfo deleteTHead_methodinfo = { |
332 | | { (JSJitGetterOp)deleteTHead }, |
333 | | { prototypes::id::HTMLTableElement }, |
334 | | { PrototypeTraits<prototypes::id::HTMLTableElement>::Depth }, |
335 | | JSJitInfo::Method, |
336 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
337 | | JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */ |
338 | | true, /* isInfallible. False in setters. */ |
339 | | false, /* isMovable. Not relevant for setters. */ |
340 | | false, /* isEliminatable. Not relevant for setters. */ |
341 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
342 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
343 | | false, /* isTypedMethod. Only relevant for methods. */ |
344 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
345 | | }; |
346 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
347 | | static_assert(0 < 1, "There is no slot for us"); |
348 | | |
349 | | MOZ_CAN_RUN_SCRIPT static bool |
350 | | get_tFoot(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLTableElement* self, JSJitGetterCallArgs args) |
351 | 0 | { |
352 | 0 | AUTO_PROFILER_LABEL_FAST("get HTMLTableElement.tFoot", DOM, cx); |
353 | 0 |
|
354 | 0 | auto result(StrongOrRawPtr<mozilla::dom::HTMLTableSectionElement>(self->GetTFoot())); |
355 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
356 | 0 | if (!result) { |
357 | 0 | args.rval().setNull(); |
358 | 0 | return true; |
359 | 0 | } |
360 | 0 | if (!GetOrCreateDOMReflector(cx, result, args.rval())) { |
361 | 0 | MOZ_ASSERT(JS_IsExceptionPending(cx)); |
362 | 0 | return false; |
363 | 0 | } |
364 | 0 | return true; |
365 | 0 | } |
366 | | |
367 | | MOZ_CAN_RUN_SCRIPT static bool |
368 | | set_tFoot(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLTableElement* self, JSJitSetterCallArgs args) |
369 | 0 | { |
370 | 0 | AUTO_PROFILER_LABEL_FAST("set HTMLTableElement.tFoot", DOM, cx); |
371 | 0 |
|
372 | 0 | mozilla::dom::HTMLTableSectionElement* arg0; |
373 | 0 | if (args[0].isObject()) { |
374 | 0 | { |
375 | 0 | nsresult rv = UnwrapObject<prototypes::id::HTMLTableSectionElement, mozilla::dom::HTMLTableSectionElement>(args[0], arg0); |
376 | 0 | if (NS_FAILED(rv)) { |
377 | 0 | ThrowErrorMessage(cx, MSG_DOES_NOT_IMPLEMENT_INTERFACE, "Value being assigned to HTMLTableElement.tFoot", "HTMLTableSectionElement"); |
378 | 0 | return false; |
379 | 0 | } |
380 | 0 | } |
381 | 0 | } else if (args[0].isNullOrUndefined()) { |
382 | 0 | arg0 = nullptr; |
383 | 0 | } else { |
384 | 0 | ThrowErrorMessage(cx, MSG_NOT_OBJECT, "Value being assigned to HTMLTableElement.tFoot"); |
385 | 0 | return false; |
386 | 0 | } |
387 | 0 | Maybe<AutoCEReaction> ceReaction; |
388 | 0 | if (CustomElementRegistry::IsCustomElementEnabled(cx, obj)) { |
389 | 0 | DocGroup* docGroup = self->GetDocGroup(); |
390 | 0 | if (docGroup) { |
391 | 0 | ceReaction.emplace(docGroup->CustomElementReactionsStack(), cx); |
392 | 0 | } |
393 | 0 | } |
394 | 0 | FastErrorResult rv; |
395 | 0 | self->SetTFoot(MOZ_KnownLive(Constify(arg0)), rv); |
396 | 0 | if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) { |
397 | 0 | return false; |
398 | 0 | } |
399 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
400 | 0 |
|
401 | 0 | return true; |
402 | 0 | } |
403 | | |
404 | | static const JSJitInfo tFoot_getterinfo = { |
405 | | { (JSJitGetterOp)get_tFoot }, |
406 | | { prototypes::id::HTMLTableElement }, |
407 | | { PrototypeTraits<prototypes::id::HTMLTableElement>::Depth }, |
408 | | JSJitInfo::Getter, |
409 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
410 | | JSVAL_TYPE_UNKNOWN, /* returnType. Not relevant for setters. */ |
411 | | false, /* isInfallible. False in setters. */ |
412 | | false, /* isMovable. Not relevant for setters. */ |
413 | | false, /* isEliminatable. Not relevant for setters. */ |
414 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
415 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
416 | | false, /* isTypedMethod. Only relevant for methods. */ |
417 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
418 | | }; |
419 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
420 | | static_assert(0 < 1, "There is no slot for us"); |
421 | | static const JSJitInfo tFoot_setterinfo = { |
422 | | { (JSJitGetterOp)set_tFoot }, |
423 | | { prototypes::id::HTMLTableElement }, |
424 | | { PrototypeTraits<prototypes::id::HTMLTableElement>::Depth }, |
425 | | JSJitInfo::Setter, |
426 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
427 | | JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */ |
428 | | false, /* isInfallible. False in setters. */ |
429 | | false, /* isMovable. Not relevant for setters. */ |
430 | | false, /* isEliminatable. Not relevant for setters. */ |
431 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
432 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
433 | | false, /* isTypedMethod. Only relevant for methods. */ |
434 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
435 | | }; |
436 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
437 | | static_assert(0 < 1, "There is no slot for us"); |
438 | | |
439 | | MOZ_CAN_RUN_SCRIPT static bool |
440 | | createTFoot(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLTableElement* self, const JSJitMethodCallArgs& args) |
441 | 0 | { |
442 | 0 | AUTO_PROFILER_LABEL_FAST("HTMLTableElement.createTFoot", DOM, cx); |
443 | 0 |
|
444 | 0 | auto result(StrongOrRawPtr<nsGenericHTMLElement>(self->CreateTFoot())); |
445 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
446 | 0 | if (!GetOrCreateDOMReflector(cx, result, args.rval())) { |
447 | 0 | MOZ_ASSERT(JS_IsExceptionPending(cx)); |
448 | 0 | return false; |
449 | 0 | } |
450 | 0 | return true; |
451 | 0 | } |
452 | | |
453 | | static const JSJitInfo createTFoot_methodinfo = { |
454 | | { (JSJitGetterOp)createTFoot }, |
455 | | { prototypes::id::HTMLTableElement }, |
456 | | { PrototypeTraits<prototypes::id::HTMLTableElement>::Depth }, |
457 | | JSJitInfo::Method, |
458 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
459 | | JSVAL_TYPE_OBJECT, /* returnType. Not relevant for setters. */ |
460 | | false, /* isInfallible. False in setters. */ |
461 | | false, /* isMovable. Not relevant for setters. */ |
462 | | false, /* isEliminatable. Not relevant for setters. */ |
463 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
464 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
465 | | false, /* isTypedMethod. Only relevant for methods. */ |
466 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
467 | | }; |
468 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
469 | | static_assert(0 < 1, "There is no slot for us"); |
470 | | |
471 | | MOZ_CAN_RUN_SCRIPT static bool |
472 | | deleteTFoot(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLTableElement* self, const JSJitMethodCallArgs& args) |
473 | 0 | { |
474 | 0 | AUTO_PROFILER_LABEL_FAST("HTMLTableElement.deleteTFoot", DOM, cx); |
475 | 0 |
|
476 | 0 | Maybe<AutoCEReaction> ceReaction; |
477 | 0 | if (CustomElementRegistry::IsCustomElementEnabled(cx, obj)) { |
478 | 0 | DocGroup* docGroup = self->GetDocGroup(); |
479 | 0 | if (docGroup) { |
480 | 0 | ceReaction.emplace(docGroup->CustomElementReactionsStack(), cx); |
481 | 0 | } |
482 | 0 | } |
483 | 0 | self->DeleteTFoot(); |
484 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
485 | 0 | args.rval().setUndefined(); |
486 | 0 | return true; |
487 | 0 | } |
488 | | |
489 | | static const JSJitInfo deleteTFoot_methodinfo = { |
490 | | { (JSJitGetterOp)deleteTFoot }, |
491 | | { prototypes::id::HTMLTableElement }, |
492 | | { PrototypeTraits<prototypes::id::HTMLTableElement>::Depth }, |
493 | | JSJitInfo::Method, |
494 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
495 | | JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */ |
496 | | true, /* isInfallible. False in setters. */ |
497 | | false, /* isMovable. Not relevant for setters. */ |
498 | | false, /* isEliminatable. Not relevant for setters. */ |
499 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
500 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
501 | | false, /* isTypedMethod. Only relevant for methods. */ |
502 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
503 | | }; |
504 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
505 | | static_assert(0 < 1, "There is no slot for us"); |
506 | | |
507 | | MOZ_CAN_RUN_SCRIPT static bool |
508 | | get_tBodies(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLTableElement* self, JSJitGetterCallArgs args) |
509 | 0 | { |
510 | 0 | AUTO_PROFILER_LABEL_FAST("get HTMLTableElement.tBodies", DOM, cx); |
511 | 0 |
|
512 | 0 | auto result(StrongOrRawPtr<nsIHTMLCollection>(self->TBodies())); |
513 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
514 | 0 | if (!GetOrCreateDOMReflector(cx, result, args.rval())) { |
515 | 0 | MOZ_ASSERT(JS_IsExceptionPending(cx)); |
516 | 0 | return false; |
517 | 0 | } |
518 | 0 | return true; |
519 | 0 | } |
520 | | |
521 | | static const JSJitInfo tBodies_getterinfo = { |
522 | | { (JSJitGetterOp)get_tBodies }, |
523 | | { prototypes::id::HTMLTableElement }, |
524 | | { PrototypeTraits<prototypes::id::HTMLTableElement>::Depth }, |
525 | | JSJitInfo::Getter, |
526 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
527 | | JSVAL_TYPE_OBJECT, /* returnType. Not relevant for setters. */ |
528 | | false, /* isInfallible. False in setters. */ |
529 | | false, /* isMovable. Not relevant for setters. */ |
530 | | false, /* isEliminatable. Not relevant for setters. */ |
531 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
532 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
533 | | false, /* isTypedMethod. Only relevant for methods. */ |
534 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
535 | | }; |
536 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
537 | | static_assert(0 < 1, "There is no slot for us"); |
538 | | |
539 | | MOZ_CAN_RUN_SCRIPT static bool |
540 | | createTBody(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLTableElement* self, const JSJitMethodCallArgs& args) |
541 | 0 | { |
542 | 0 | AUTO_PROFILER_LABEL_FAST("HTMLTableElement.createTBody", DOM, cx); |
543 | 0 |
|
544 | 0 | auto result(StrongOrRawPtr<nsGenericHTMLElement>(self->CreateTBody())); |
545 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
546 | 0 | if (!GetOrCreateDOMReflector(cx, result, args.rval())) { |
547 | 0 | MOZ_ASSERT(JS_IsExceptionPending(cx)); |
548 | 0 | return false; |
549 | 0 | } |
550 | 0 | return true; |
551 | 0 | } |
552 | | |
553 | | static const JSJitInfo createTBody_methodinfo = { |
554 | | { (JSJitGetterOp)createTBody }, |
555 | | { prototypes::id::HTMLTableElement }, |
556 | | { PrototypeTraits<prototypes::id::HTMLTableElement>::Depth }, |
557 | | JSJitInfo::Method, |
558 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
559 | | JSVAL_TYPE_OBJECT, /* returnType. Not relevant for setters. */ |
560 | | false, /* isInfallible. False in setters. */ |
561 | | false, /* isMovable. Not relevant for setters. */ |
562 | | false, /* isEliminatable. Not relevant for setters. */ |
563 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
564 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
565 | | false, /* isTypedMethod. Only relevant for methods. */ |
566 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
567 | | }; |
568 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
569 | | static_assert(0 < 1, "There is no slot for us"); |
570 | | |
571 | | MOZ_CAN_RUN_SCRIPT static bool |
572 | | get_rows(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLTableElement* self, JSJitGetterCallArgs args) |
573 | 0 | { |
574 | 0 | AUTO_PROFILER_LABEL_FAST("get HTMLTableElement.rows", DOM, cx); |
575 | 0 |
|
576 | 0 | auto result(StrongOrRawPtr<nsIHTMLCollection>(self->Rows())); |
577 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
578 | 0 | if (!GetOrCreateDOMReflector(cx, result, args.rval())) { |
579 | 0 | MOZ_ASSERT(JS_IsExceptionPending(cx)); |
580 | 0 | return false; |
581 | 0 | } |
582 | 0 | return true; |
583 | 0 | } |
584 | | |
585 | | static const JSJitInfo rows_getterinfo = { |
586 | | { (JSJitGetterOp)get_rows }, |
587 | | { prototypes::id::HTMLTableElement }, |
588 | | { PrototypeTraits<prototypes::id::HTMLTableElement>::Depth }, |
589 | | JSJitInfo::Getter, |
590 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
591 | | JSVAL_TYPE_OBJECT, /* returnType. Not relevant for setters. */ |
592 | | false, /* isInfallible. False in setters. */ |
593 | | false, /* isMovable. Not relevant for setters. */ |
594 | | false, /* isEliminatable. Not relevant for setters. */ |
595 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
596 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
597 | | false, /* isTypedMethod. Only relevant for methods. */ |
598 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
599 | | }; |
600 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
601 | | static_assert(0 < 1, "There is no slot for us"); |
602 | | |
603 | | MOZ_CAN_RUN_SCRIPT static bool |
604 | | insertRow(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLTableElement* self, const JSJitMethodCallArgs& args) |
605 | 0 | { |
606 | 0 | AUTO_PROFILER_LABEL_FAST("HTMLTableElement.insertRow", DOM, cx); |
607 | 0 |
|
608 | 0 | int32_t arg0; |
609 | 0 | if (args.hasDefined(0)) { |
610 | 0 | if (!ValueToPrimitive<int32_t, eDefault>(cx, args[0], &arg0)) { |
611 | 0 | return false; |
612 | 0 | } |
613 | 0 | } else { |
614 | 0 | arg0 = -1; |
615 | 0 | } |
616 | 0 | FastErrorResult rv; |
617 | 0 | auto result(StrongOrRawPtr<nsGenericHTMLElement>(self->InsertRow(arg0, rv))); |
618 | 0 | if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) { |
619 | 0 | return false; |
620 | 0 | } |
621 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
622 | 0 | if (!GetOrCreateDOMReflector(cx, result, args.rval())) { |
623 | 0 | MOZ_ASSERT(JS_IsExceptionPending(cx)); |
624 | 0 | return false; |
625 | 0 | } |
626 | 0 | return true; |
627 | 0 | } |
628 | | |
629 | | static const JSJitInfo insertRow_methodinfo = { |
630 | | { (JSJitGetterOp)insertRow }, |
631 | | { prototypes::id::HTMLTableElement }, |
632 | | { PrototypeTraits<prototypes::id::HTMLTableElement>::Depth }, |
633 | | JSJitInfo::Method, |
634 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
635 | | JSVAL_TYPE_OBJECT, /* returnType. Not relevant for setters. */ |
636 | | false, /* isInfallible. False in setters. */ |
637 | | false, /* isMovable. Not relevant for setters. */ |
638 | | false, /* isEliminatable. Not relevant for setters. */ |
639 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
640 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
641 | | false, /* isTypedMethod. Only relevant for methods. */ |
642 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
643 | | }; |
644 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
645 | | static_assert(0 < 1, "There is no slot for us"); |
646 | | |
647 | | MOZ_CAN_RUN_SCRIPT static bool |
648 | | deleteRow(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLTableElement* self, const JSJitMethodCallArgs& args) |
649 | 0 | { |
650 | 0 | AUTO_PROFILER_LABEL_FAST("HTMLTableElement.deleteRow", DOM, cx); |
651 | 0 |
|
652 | 0 | if (MOZ_UNLIKELY(args.length() < 1)) { |
653 | 0 | return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "HTMLTableElement.deleteRow"); |
654 | 0 | } |
655 | 0 | int32_t arg0; |
656 | 0 | if (!ValueToPrimitive<int32_t, eDefault>(cx, args[0], &arg0)) { |
657 | 0 | return false; |
658 | 0 | } |
659 | 0 | Maybe<AutoCEReaction> ceReaction; |
660 | 0 | if (CustomElementRegistry::IsCustomElementEnabled(cx, obj)) { |
661 | 0 | DocGroup* docGroup = self->GetDocGroup(); |
662 | 0 | if (docGroup) { |
663 | 0 | ceReaction.emplace(docGroup->CustomElementReactionsStack(), cx); |
664 | 0 | } |
665 | 0 | } |
666 | 0 | FastErrorResult rv; |
667 | 0 | self->DeleteRow(arg0, rv); |
668 | 0 | if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) { |
669 | 0 | return false; |
670 | 0 | } |
671 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
672 | 0 | args.rval().setUndefined(); |
673 | 0 | return true; |
674 | 0 | } |
675 | | |
676 | | static const JSJitInfo deleteRow_methodinfo = { |
677 | | { (JSJitGetterOp)deleteRow }, |
678 | | { prototypes::id::HTMLTableElement }, |
679 | | { PrototypeTraits<prototypes::id::HTMLTableElement>::Depth }, |
680 | | JSJitInfo::Method, |
681 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
682 | | JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */ |
683 | | false, /* isInfallible. False in setters. */ |
684 | | false, /* isMovable. Not relevant for setters. */ |
685 | | false, /* isEliminatable. Not relevant for setters. */ |
686 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
687 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
688 | | false, /* isTypedMethod. Only relevant for methods. */ |
689 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
690 | | }; |
691 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
692 | | static_assert(0 < 1, "There is no slot for us"); |
693 | | |
694 | | MOZ_CAN_RUN_SCRIPT static bool |
695 | | get_align(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLTableElement* self, JSJitGetterCallArgs args) |
696 | 0 | { |
697 | 0 | AUTO_PROFILER_LABEL_FAST("get HTMLTableElement.align", DOM, cx); |
698 | 0 |
|
699 | 0 | DOMString result; |
700 | 0 | self->GetAlign(result); |
701 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
702 | 0 | if (!xpc::NonVoidStringToJsval(cx, result, args.rval())) { |
703 | 0 | return false; |
704 | 0 | } |
705 | 0 | return true; |
706 | 0 | } |
707 | | |
708 | | MOZ_CAN_RUN_SCRIPT static bool |
709 | | set_align(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLTableElement* self, JSJitSetterCallArgs args) |
710 | 0 | { |
711 | 0 | AUTO_PROFILER_LABEL_FAST("set HTMLTableElement.align", DOM, cx); |
712 | 0 |
|
713 | 0 | binding_detail::FakeString arg0; |
714 | 0 | if (!ConvertJSValueToString(cx, args[0], eStringify, eStringify, arg0)) { |
715 | 0 | return false; |
716 | 0 | } |
717 | 0 | Maybe<AutoCEReaction> ceReaction; |
718 | 0 | if (CustomElementRegistry::IsCustomElementEnabled(cx, obj)) { |
719 | 0 | DocGroup* docGroup = self->GetDocGroup(); |
720 | 0 | if (docGroup) { |
721 | 0 | ceReaction.emplace(docGroup->CustomElementReactionsStack(), cx); |
722 | 0 | } |
723 | 0 | } |
724 | 0 | FastErrorResult rv; |
725 | 0 | self->SetAlign(NonNullHelper(Constify(arg0)), rv); |
726 | 0 | if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) { |
727 | 0 | return false; |
728 | 0 | } |
729 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
730 | 0 |
|
731 | 0 | return true; |
732 | 0 | } |
733 | | |
734 | | static const JSJitInfo align_getterinfo = { |
735 | | { (JSJitGetterOp)get_align }, |
736 | | { prototypes::id::HTMLTableElement }, |
737 | | { PrototypeTraits<prototypes::id::HTMLTableElement>::Depth }, |
738 | | JSJitInfo::Getter, |
739 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
740 | | JSVAL_TYPE_STRING, /* returnType. Not relevant for setters. */ |
741 | | false, /* isInfallible. False in setters. */ |
742 | | false, /* isMovable. Not relevant for setters. */ |
743 | | false, /* isEliminatable. Not relevant for setters. */ |
744 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
745 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
746 | | false, /* isTypedMethod. Only relevant for methods. */ |
747 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
748 | | }; |
749 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
750 | | static_assert(0 < 1, "There is no slot for us"); |
751 | | static const JSJitInfo align_setterinfo = { |
752 | | { (JSJitGetterOp)set_align }, |
753 | | { prototypes::id::HTMLTableElement }, |
754 | | { PrototypeTraits<prototypes::id::HTMLTableElement>::Depth }, |
755 | | JSJitInfo::Setter, |
756 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
757 | | JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */ |
758 | | false, /* isInfallible. False in setters. */ |
759 | | false, /* isMovable. Not relevant for setters. */ |
760 | | false, /* isEliminatable. Not relevant for setters. */ |
761 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
762 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
763 | | false, /* isTypedMethod. Only relevant for methods. */ |
764 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
765 | | }; |
766 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
767 | | static_assert(0 < 1, "There is no slot for us"); |
768 | | |
769 | | MOZ_CAN_RUN_SCRIPT static bool |
770 | | get_border(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLTableElement* self, JSJitGetterCallArgs args) |
771 | 0 | { |
772 | 0 | AUTO_PROFILER_LABEL_FAST("get HTMLTableElement.border", DOM, cx); |
773 | 0 |
|
774 | 0 | DOMString result; |
775 | 0 | self->GetBorder(result); |
776 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
777 | 0 | if (!xpc::NonVoidStringToJsval(cx, result, args.rval())) { |
778 | 0 | return false; |
779 | 0 | } |
780 | 0 | return true; |
781 | 0 | } |
782 | | |
783 | | MOZ_CAN_RUN_SCRIPT static bool |
784 | | set_border(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLTableElement* self, JSJitSetterCallArgs args) |
785 | 0 | { |
786 | 0 | AUTO_PROFILER_LABEL_FAST("set HTMLTableElement.border", DOM, cx); |
787 | 0 |
|
788 | 0 | binding_detail::FakeString arg0; |
789 | 0 | if (!ConvertJSValueToString(cx, args[0], eStringify, eStringify, arg0)) { |
790 | 0 | return false; |
791 | 0 | } |
792 | 0 | Maybe<AutoCEReaction> ceReaction; |
793 | 0 | if (CustomElementRegistry::IsCustomElementEnabled(cx, obj)) { |
794 | 0 | DocGroup* docGroup = self->GetDocGroup(); |
795 | 0 | if (docGroup) { |
796 | 0 | ceReaction.emplace(docGroup->CustomElementReactionsStack(), cx); |
797 | 0 | } |
798 | 0 | } |
799 | 0 | FastErrorResult rv; |
800 | 0 | self->SetBorder(NonNullHelper(Constify(arg0)), rv); |
801 | 0 | if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) { |
802 | 0 | return false; |
803 | 0 | } |
804 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
805 | 0 |
|
806 | 0 | return true; |
807 | 0 | } |
808 | | |
809 | | static const JSJitInfo border_getterinfo = { |
810 | | { (JSJitGetterOp)get_border }, |
811 | | { prototypes::id::HTMLTableElement }, |
812 | | { PrototypeTraits<prototypes::id::HTMLTableElement>::Depth }, |
813 | | JSJitInfo::Getter, |
814 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
815 | | JSVAL_TYPE_STRING, /* returnType. Not relevant for setters. */ |
816 | | false, /* isInfallible. False in setters. */ |
817 | | false, /* isMovable. Not relevant for setters. */ |
818 | | false, /* isEliminatable. Not relevant for setters. */ |
819 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
820 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
821 | | false, /* isTypedMethod. Only relevant for methods. */ |
822 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
823 | | }; |
824 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
825 | | static_assert(0 < 1, "There is no slot for us"); |
826 | | static const JSJitInfo border_setterinfo = { |
827 | | { (JSJitGetterOp)set_border }, |
828 | | { prototypes::id::HTMLTableElement }, |
829 | | { PrototypeTraits<prototypes::id::HTMLTableElement>::Depth }, |
830 | | JSJitInfo::Setter, |
831 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
832 | | JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */ |
833 | | false, /* isInfallible. False in setters. */ |
834 | | false, /* isMovable. Not relevant for setters. */ |
835 | | false, /* isEliminatable. Not relevant for setters. */ |
836 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
837 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
838 | | false, /* isTypedMethod. Only relevant for methods. */ |
839 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
840 | | }; |
841 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
842 | | static_assert(0 < 1, "There is no slot for us"); |
843 | | |
844 | | MOZ_CAN_RUN_SCRIPT static bool |
845 | | get_frame(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLTableElement* self, JSJitGetterCallArgs args) |
846 | 0 | { |
847 | 0 | AUTO_PROFILER_LABEL_FAST("get HTMLTableElement.frame", DOM, cx); |
848 | 0 |
|
849 | 0 | DOMString result; |
850 | 0 | self->GetFrame(result); |
851 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
852 | 0 | if (!xpc::NonVoidStringToJsval(cx, result, args.rval())) { |
853 | 0 | return false; |
854 | 0 | } |
855 | 0 | return true; |
856 | 0 | } |
857 | | |
858 | | MOZ_CAN_RUN_SCRIPT static bool |
859 | | set_frame(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLTableElement* self, JSJitSetterCallArgs args) |
860 | 0 | { |
861 | 0 | AUTO_PROFILER_LABEL_FAST("set HTMLTableElement.frame", DOM, cx); |
862 | 0 |
|
863 | 0 | binding_detail::FakeString arg0; |
864 | 0 | if (!ConvertJSValueToString(cx, args[0], eStringify, eStringify, arg0)) { |
865 | 0 | return false; |
866 | 0 | } |
867 | 0 | Maybe<AutoCEReaction> ceReaction; |
868 | 0 | if (CustomElementRegistry::IsCustomElementEnabled(cx, obj)) { |
869 | 0 | DocGroup* docGroup = self->GetDocGroup(); |
870 | 0 | if (docGroup) { |
871 | 0 | ceReaction.emplace(docGroup->CustomElementReactionsStack(), cx); |
872 | 0 | } |
873 | 0 | } |
874 | 0 | FastErrorResult rv; |
875 | 0 | self->SetFrame(NonNullHelper(Constify(arg0)), rv); |
876 | 0 | if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) { |
877 | 0 | return false; |
878 | 0 | } |
879 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
880 | 0 |
|
881 | 0 | return true; |
882 | 0 | } |
883 | | |
884 | | static const JSJitInfo frame_getterinfo = { |
885 | | { (JSJitGetterOp)get_frame }, |
886 | | { prototypes::id::HTMLTableElement }, |
887 | | { PrototypeTraits<prototypes::id::HTMLTableElement>::Depth }, |
888 | | JSJitInfo::Getter, |
889 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
890 | | JSVAL_TYPE_STRING, /* returnType. Not relevant for setters. */ |
891 | | false, /* isInfallible. False in setters. */ |
892 | | false, /* isMovable. Not relevant for setters. */ |
893 | | false, /* isEliminatable. Not relevant for setters. */ |
894 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
895 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
896 | | false, /* isTypedMethod. Only relevant for methods. */ |
897 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
898 | | }; |
899 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
900 | | static_assert(0 < 1, "There is no slot for us"); |
901 | | static const JSJitInfo frame_setterinfo = { |
902 | | { (JSJitGetterOp)set_frame }, |
903 | | { prototypes::id::HTMLTableElement }, |
904 | | { PrototypeTraits<prototypes::id::HTMLTableElement>::Depth }, |
905 | | JSJitInfo::Setter, |
906 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
907 | | JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */ |
908 | | false, /* isInfallible. False in setters. */ |
909 | | false, /* isMovable. Not relevant for setters. */ |
910 | | false, /* isEliminatable. Not relevant for setters. */ |
911 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
912 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
913 | | false, /* isTypedMethod. Only relevant for methods. */ |
914 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
915 | | }; |
916 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
917 | | static_assert(0 < 1, "There is no slot for us"); |
918 | | |
919 | | MOZ_CAN_RUN_SCRIPT static bool |
920 | | get_rules(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLTableElement* self, JSJitGetterCallArgs args) |
921 | 0 | { |
922 | 0 | AUTO_PROFILER_LABEL_FAST("get HTMLTableElement.rules", DOM, cx); |
923 | 0 |
|
924 | 0 | DOMString result; |
925 | 0 | self->GetRules(result); |
926 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
927 | 0 | if (!xpc::NonVoidStringToJsval(cx, result, args.rval())) { |
928 | 0 | return false; |
929 | 0 | } |
930 | 0 | return true; |
931 | 0 | } |
932 | | |
933 | | MOZ_CAN_RUN_SCRIPT static bool |
934 | | set_rules(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLTableElement* self, JSJitSetterCallArgs args) |
935 | 0 | { |
936 | 0 | AUTO_PROFILER_LABEL_FAST("set HTMLTableElement.rules", DOM, cx); |
937 | 0 |
|
938 | 0 | binding_detail::FakeString arg0; |
939 | 0 | if (!ConvertJSValueToString(cx, args[0], eStringify, eStringify, arg0)) { |
940 | 0 | return false; |
941 | 0 | } |
942 | 0 | Maybe<AutoCEReaction> ceReaction; |
943 | 0 | if (CustomElementRegistry::IsCustomElementEnabled(cx, obj)) { |
944 | 0 | DocGroup* docGroup = self->GetDocGroup(); |
945 | 0 | if (docGroup) { |
946 | 0 | ceReaction.emplace(docGroup->CustomElementReactionsStack(), cx); |
947 | 0 | } |
948 | 0 | } |
949 | 0 | FastErrorResult rv; |
950 | 0 | self->SetRules(NonNullHelper(Constify(arg0)), rv); |
951 | 0 | if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) { |
952 | 0 | return false; |
953 | 0 | } |
954 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
955 | 0 |
|
956 | 0 | return true; |
957 | 0 | } |
958 | | |
959 | | static const JSJitInfo rules_getterinfo = { |
960 | | { (JSJitGetterOp)get_rules }, |
961 | | { prototypes::id::HTMLTableElement }, |
962 | | { PrototypeTraits<prototypes::id::HTMLTableElement>::Depth }, |
963 | | JSJitInfo::Getter, |
964 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
965 | | JSVAL_TYPE_STRING, /* returnType. Not relevant for setters. */ |
966 | | false, /* isInfallible. False in setters. */ |
967 | | false, /* isMovable. Not relevant for setters. */ |
968 | | false, /* isEliminatable. Not relevant for setters. */ |
969 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
970 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
971 | | false, /* isTypedMethod. Only relevant for methods. */ |
972 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
973 | | }; |
974 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
975 | | static_assert(0 < 1, "There is no slot for us"); |
976 | | static const JSJitInfo rules_setterinfo = { |
977 | | { (JSJitGetterOp)set_rules }, |
978 | | { prototypes::id::HTMLTableElement }, |
979 | | { PrototypeTraits<prototypes::id::HTMLTableElement>::Depth }, |
980 | | JSJitInfo::Setter, |
981 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
982 | | JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */ |
983 | | false, /* isInfallible. False in setters. */ |
984 | | false, /* isMovable. Not relevant for setters. */ |
985 | | false, /* isEliminatable. Not relevant for setters. */ |
986 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
987 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
988 | | false, /* isTypedMethod. Only relevant for methods. */ |
989 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
990 | | }; |
991 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
992 | | static_assert(0 < 1, "There is no slot for us"); |
993 | | |
994 | | MOZ_CAN_RUN_SCRIPT static bool |
995 | | get_summary(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLTableElement* self, JSJitGetterCallArgs args) |
996 | 0 | { |
997 | 0 | AUTO_PROFILER_LABEL_FAST("get HTMLTableElement.summary", DOM, cx); |
998 | 0 |
|
999 | 0 | DOMString result; |
1000 | 0 | self->GetSummary(result); |
1001 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
1002 | 0 | if (!xpc::NonVoidStringToJsval(cx, result, args.rval())) { |
1003 | 0 | return false; |
1004 | 0 | } |
1005 | 0 | return true; |
1006 | 0 | } |
1007 | | |
1008 | | MOZ_CAN_RUN_SCRIPT static bool |
1009 | | set_summary(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLTableElement* self, JSJitSetterCallArgs args) |
1010 | 0 | { |
1011 | 0 | AUTO_PROFILER_LABEL_FAST("set HTMLTableElement.summary", DOM, cx); |
1012 | 0 |
|
1013 | 0 | binding_detail::FakeString arg0; |
1014 | 0 | if (!ConvertJSValueToString(cx, args[0], eStringify, eStringify, arg0)) { |
1015 | 0 | return false; |
1016 | 0 | } |
1017 | 0 | Maybe<AutoCEReaction> ceReaction; |
1018 | 0 | if (CustomElementRegistry::IsCustomElementEnabled(cx, obj)) { |
1019 | 0 | DocGroup* docGroup = self->GetDocGroup(); |
1020 | 0 | if (docGroup) { |
1021 | 0 | ceReaction.emplace(docGroup->CustomElementReactionsStack(), cx); |
1022 | 0 | } |
1023 | 0 | } |
1024 | 0 | FastErrorResult rv; |
1025 | 0 | self->SetSummary(NonNullHelper(Constify(arg0)), rv); |
1026 | 0 | if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) { |
1027 | 0 | return false; |
1028 | 0 | } |
1029 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
1030 | 0 |
|
1031 | 0 | return true; |
1032 | 0 | } |
1033 | | |
1034 | | static const JSJitInfo summary_getterinfo = { |
1035 | | { (JSJitGetterOp)get_summary }, |
1036 | | { prototypes::id::HTMLTableElement }, |
1037 | | { PrototypeTraits<prototypes::id::HTMLTableElement>::Depth }, |
1038 | | JSJitInfo::Getter, |
1039 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
1040 | | JSVAL_TYPE_STRING, /* returnType. Not relevant for setters. */ |
1041 | | false, /* isInfallible. False in setters. */ |
1042 | | false, /* isMovable. Not relevant for setters. */ |
1043 | | false, /* isEliminatable. Not relevant for setters. */ |
1044 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
1045 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
1046 | | false, /* isTypedMethod. Only relevant for methods. */ |
1047 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
1048 | | }; |
1049 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
1050 | | static_assert(0 < 1, "There is no slot for us"); |
1051 | | static const JSJitInfo summary_setterinfo = { |
1052 | | { (JSJitGetterOp)set_summary }, |
1053 | | { prototypes::id::HTMLTableElement }, |
1054 | | { PrototypeTraits<prototypes::id::HTMLTableElement>::Depth }, |
1055 | | JSJitInfo::Setter, |
1056 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
1057 | | JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */ |
1058 | | false, /* isInfallible. False in setters. */ |
1059 | | false, /* isMovable. Not relevant for setters. */ |
1060 | | false, /* isEliminatable. Not relevant for setters. */ |
1061 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
1062 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
1063 | | false, /* isTypedMethod. Only relevant for methods. */ |
1064 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
1065 | | }; |
1066 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
1067 | | static_assert(0 < 1, "There is no slot for us"); |
1068 | | |
1069 | | MOZ_CAN_RUN_SCRIPT static bool |
1070 | | get_width(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLTableElement* self, JSJitGetterCallArgs args) |
1071 | 0 | { |
1072 | 0 | AUTO_PROFILER_LABEL_FAST("get HTMLTableElement.width", DOM, cx); |
1073 | 0 |
|
1074 | 0 | DOMString result; |
1075 | 0 | self->GetWidth(result); |
1076 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
1077 | 0 | if (!xpc::NonVoidStringToJsval(cx, result, args.rval())) { |
1078 | 0 | return false; |
1079 | 0 | } |
1080 | 0 | return true; |
1081 | 0 | } |
1082 | | |
1083 | | MOZ_CAN_RUN_SCRIPT static bool |
1084 | | set_width(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLTableElement* self, JSJitSetterCallArgs args) |
1085 | 0 | { |
1086 | 0 | AUTO_PROFILER_LABEL_FAST("set HTMLTableElement.width", DOM, cx); |
1087 | 0 |
|
1088 | 0 | binding_detail::FakeString arg0; |
1089 | 0 | if (!ConvertJSValueToString(cx, args[0], eStringify, eStringify, arg0)) { |
1090 | 0 | return false; |
1091 | 0 | } |
1092 | 0 | Maybe<AutoCEReaction> ceReaction; |
1093 | 0 | if (CustomElementRegistry::IsCustomElementEnabled(cx, obj)) { |
1094 | 0 | DocGroup* docGroup = self->GetDocGroup(); |
1095 | 0 | if (docGroup) { |
1096 | 0 | ceReaction.emplace(docGroup->CustomElementReactionsStack(), cx); |
1097 | 0 | } |
1098 | 0 | } |
1099 | 0 | FastErrorResult rv; |
1100 | 0 | self->SetWidth(NonNullHelper(Constify(arg0)), rv); |
1101 | 0 | if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) { |
1102 | 0 | return false; |
1103 | 0 | } |
1104 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
1105 | 0 |
|
1106 | 0 | return true; |
1107 | 0 | } |
1108 | | |
1109 | | static const JSJitInfo width_getterinfo = { |
1110 | | { (JSJitGetterOp)get_width }, |
1111 | | { prototypes::id::HTMLTableElement }, |
1112 | | { PrototypeTraits<prototypes::id::HTMLTableElement>::Depth }, |
1113 | | JSJitInfo::Getter, |
1114 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
1115 | | JSVAL_TYPE_STRING, /* returnType. Not relevant for setters. */ |
1116 | | false, /* isInfallible. False in setters. */ |
1117 | | false, /* isMovable. Not relevant for setters. */ |
1118 | | false, /* isEliminatable. Not relevant for setters. */ |
1119 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
1120 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
1121 | | false, /* isTypedMethod. Only relevant for methods. */ |
1122 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
1123 | | }; |
1124 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
1125 | | static_assert(0 < 1, "There is no slot for us"); |
1126 | | static const JSJitInfo width_setterinfo = { |
1127 | | { (JSJitGetterOp)set_width }, |
1128 | | { prototypes::id::HTMLTableElement }, |
1129 | | { PrototypeTraits<prototypes::id::HTMLTableElement>::Depth }, |
1130 | | JSJitInfo::Setter, |
1131 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
1132 | | JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */ |
1133 | | false, /* isInfallible. False in setters. */ |
1134 | | false, /* isMovable. Not relevant for setters. */ |
1135 | | false, /* isEliminatable. Not relevant for setters. */ |
1136 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
1137 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
1138 | | false, /* isTypedMethod. Only relevant for methods. */ |
1139 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
1140 | | }; |
1141 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
1142 | | static_assert(0 < 1, "There is no slot for us"); |
1143 | | |
1144 | | MOZ_CAN_RUN_SCRIPT static bool |
1145 | | get_bgColor(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLTableElement* self, JSJitGetterCallArgs args) |
1146 | 0 | { |
1147 | 0 | AUTO_PROFILER_LABEL_FAST("get HTMLTableElement.bgColor", DOM, cx); |
1148 | 0 |
|
1149 | 0 | DOMString result; |
1150 | 0 | self->GetBgColor(result); |
1151 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
1152 | 0 | if (!xpc::NonVoidStringToJsval(cx, result, args.rval())) { |
1153 | 0 | return false; |
1154 | 0 | } |
1155 | 0 | return true; |
1156 | 0 | } |
1157 | | |
1158 | | MOZ_CAN_RUN_SCRIPT static bool |
1159 | | set_bgColor(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLTableElement* self, JSJitSetterCallArgs args) |
1160 | 0 | { |
1161 | 0 | AUTO_PROFILER_LABEL_FAST("set HTMLTableElement.bgColor", DOM, cx); |
1162 | 0 |
|
1163 | 0 | binding_detail::FakeString arg0; |
1164 | 0 | if (!ConvertJSValueToString(cx, args[0], eEmpty, eStringify, arg0)) { |
1165 | 0 | return false; |
1166 | 0 | } |
1167 | 0 | Maybe<AutoCEReaction> ceReaction; |
1168 | 0 | if (CustomElementRegistry::IsCustomElementEnabled(cx, obj)) { |
1169 | 0 | DocGroup* docGroup = self->GetDocGroup(); |
1170 | 0 | if (docGroup) { |
1171 | 0 | ceReaction.emplace(docGroup->CustomElementReactionsStack(), cx); |
1172 | 0 | } |
1173 | 0 | } |
1174 | 0 | FastErrorResult rv; |
1175 | 0 | self->SetBgColor(NonNullHelper(Constify(arg0)), rv); |
1176 | 0 | if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) { |
1177 | 0 | return false; |
1178 | 0 | } |
1179 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
1180 | 0 |
|
1181 | 0 | return true; |
1182 | 0 | } |
1183 | | |
1184 | | static const JSJitInfo bgColor_getterinfo = { |
1185 | | { (JSJitGetterOp)get_bgColor }, |
1186 | | { prototypes::id::HTMLTableElement }, |
1187 | | { PrototypeTraits<prototypes::id::HTMLTableElement>::Depth }, |
1188 | | JSJitInfo::Getter, |
1189 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
1190 | | JSVAL_TYPE_STRING, /* returnType. Not relevant for setters. */ |
1191 | | false, /* isInfallible. False in setters. */ |
1192 | | false, /* isMovable. Not relevant for setters. */ |
1193 | | false, /* isEliminatable. Not relevant for setters. */ |
1194 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
1195 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
1196 | | false, /* isTypedMethod. Only relevant for methods. */ |
1197 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
1198 | | }; |
1199 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
1200 | | static_assert(0 < 1, "There is no slot for us"); |
1201 | | static const JSJitInfo bgColor_setterinfo = { |
1202 | | { (JSJitGetterOp)set_bgColor }, |
1203 | | { prototypes::id::HTMLTableElement }, |
1204 | | { PrototypeTraits<prototypes::id::HTMLTableElement>::Depth }, |
1205 | | JSJitInfo::Setter, |
1206 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
1207 | | JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */ |
1208 | | false, /* isInfallible. False in setters. */ |
1209 | | false, /* isMovable. Not relevant for setters. */ |
1210 | | false, /* isEliminatable. Not relevant for setters. */ |
1211 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
1212 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
1213 | | false, /* isTypedMethod. Only relevant for methods. */ |
1214 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
1215 | | }; |
1216 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
1217 | | static_assert(0 < 1, "There is no slot for us"); |
1218 | | |
1219 | | MOZ_CAN_RUN_SCRIPT static bool |
1220 | | get_cellPadding(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLTableElement* self, JSJitGetterCallArgs args) |
1221 | 0 | { |
1222 | 0 | AUTO_PROFILER_LABEL_FAST("get HTMLTableElement.cellPadding", DOM, cx); |
1223 | 0 |
|
1224 | 0 | DOMString result; |
1225 | 0 | self->GetCellPadding(result); |
1226 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
1227 | 0 | if (!xpc::NonVoidStringToJsval(cx, result, args.rval())) { |
1228 | 0 | return false; |
1229 | 0 | } |
1230 | 0 | return true; |
1231 | 0 | } |
1232 | | |
1233 | | MOZ_CAN_RUN_SCRIPT static bool |
1234 | | set_cellPadding(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLTableElement* self, JSJitSetterCallArgs args) |
1235 | 0 | { |
1236 | 0 | AUTO_PROFILER_LABEL_FAST("set HTMLTableElement.cellPadding", DOM, cx); |
1237 | 0 |
|
1238 | 0 | binding_detail::FakeString arg0; |
1239 | 0 | if (!ConvertJSValueToString(cx, args[0], eEmpty, eStringify, arg0)) { |
1240 | 0 | return false; |
1241 | 0 | } |
1242 | 0 | Maybe<AutoCEReaction> ceReaction; |
1243 | 0 | if (CustomElementRegistry::IsCustomElementEnabled(cx, obj)) { |
1244 | 0 | DocGroup* docGroup = self->GetDocGroup(); |
1245 | 0 | if (docGroup) { |
1246 | 0 | ceReaction.emplace(docGroup->CustomElementReactionsStack(), cx); |
1247 | 0 | } |
1248 | 0 | } |
1249 | 0 | FastErrorResult rv; |
1250 | 0 | self->SetCellPadding(NonNullHelper(Constify(arg0)), rv); |
1251 | 0 | if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) { |
1252 | 0 | return false; |
1253 | 0 | } |
1254 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
1255 | 0 |
|
1256 | 0 | return true; |
1257 | 0 | } |
1258 | | |
1259 | | static const JSJitInfo cellPadding_getterinfo = { |
1260 | | { (JSJitGetterOp)get_cellPadding }, |
1261 | | { prototypes::id::HTMLTableElement }, |
1262 | | { PrototypeTraits<prototypes::id::HTMLTableElement>::Depth }, |
1263 | | JSJitInfo::Getter, |
1264 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
1265 | | JSVAL_TYPE_STRING, /* returnType. Not relevant for setters. */ |
1266 | | false, /* isInfallible. False in setters. */ |
1267 | | false, /* isMovable. Not relevant for setters. */ |
1268 | | false, /* isEliminatable. Not relevant for setters. */ |
1269 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
1270 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
1271 | | false, /* isTypedMethod. Only relevant for methods. */ |
1272 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
1273 | | }; |
1274 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
1275 | | static_assert(0 < 1, "There is no slot for us"); |
1276 | | static const JSJitInfo cellPadding_setterinfo = { |
1277 | | { (JSJitGetterOp)set_cellPadding }, |
1278 | | { prototypes::id::HTMLTableElement }, |
1279 | | { PrototypeTraits<prototypes::id::HTMLTableElement>::Depth }, |
1280 | | JSJitInfo::Setter, |
1281 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
1282 | | JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */ |
1283 | | false, /* isInfallible. False in setters. */ |
1284 | | false, /* isMovable. Not relevant for setters. */ |
1285 | | false, /* isEliminatable. Not relevant for setters. */ |
1286 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
1287 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
1288 | | false, /* isTypedMethod. Only relevant for methods. */ |
1289 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
1290 | | }; |
1291 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
1292 | | static_assert(0 < 1, "There is no slot for us"); |
1293 | | |
1294 | | MOZ_CAN_RUN_SCRIPT static bool |
1295 | | get_cellSpacing(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLTableElement* self, JSJitGetterCallArgs args) |
1296 | 0 | { |
1297 | 0 | AUTO_PROFILER_LABEL_FAST("get HTMLTableElement.cellSpacing", DOM, cx); |
1298 | 0 |
|
1299 | 0 | DOMString result; |
1300 | 0 | self->GetCellSpacing(result); |
1301 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
1302 | 0 | if (!xpc::NonVoidStringToJsval(cx, result, args.rval())) { |
1303 | 0 | return false; |
1304 | 0 | } |
1305 | 0 | return true; |
1306 | 0 | } |
1307 | | |
1308 | | MOZ_CAN_RUN_SCRIPT static bool |
1309 | | set_cellSpacing(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLTableElement* self, JSJitSetterCallArgs args) |
1310 | 0 | { |
1311 | 0 | AUTO_PROFILER_LABEL_FAST("set HTMLTableElement.cellSpacing", DOM, cx); |
1312 | 0 |
|
1313 | 0 | binding_detail::FakeString arg0; |
1314 | 0 | if (!ConvertJSValueToString(cx, args[0], eEmpty, eStringify, arg0)) { |
1315 | 0 | return false; |
1316 | 0 | } |
1317 | 0 | Maybe<AutoCEReaction> ceReaction; |
1318 | 0 | if (CustomElementRegistry::IsCustomElementEnabled(cx, obj)) { |
1319 | 0 | DocGroup* docGroup = self->GetDocGroup(); |
1320 | 0 | if (docGroup) { |
1321 | 0 | ceReaction.emplace(docGroup->CustomElementReactionsStack(), cx); |
1322 | 0 | } |
1323 | 0 | } |
1324 | 0 | FastErrorResult rv; |
1325 | 0 | self->SetCellSpacing(NonNullHelper(Constify(arg0)), rv); |
1326 | 0 | if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) { |
1327 | 0 | return false; |
1328 | 0 | } |
1329 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
1330 | 0 |
|
1331 | 0 | return true; |
1332 | 0 | } |
1333 | | |
1334 | | static const JSJitInfo cellSpacing_getterinfo = { |
1335 | | { (JSJitGetterOp)get_cellSpacing }, |
1336 | | { prototypes::id::HTMLTableElement }, |
1337 | | { PrototypeTraits<prototypes::id::HTMLTableElement>::Depth }, |
1338 | | JSJitInfo::Getter, |
1339 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
1340 | | JSVAL_TYPE_STRING, /* returnType. Not relevant for setters. */ |
1341 | | false, /* isInfallible. False in setters. */ |
1342 | | false, /* isMovable. Not relevant for setters. */ |
1343 | | false, /* isEliminatable. Not relevant for setters. */ |
1344 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
1345 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
1346 | | false, /* isTypedMethod. Only relevant for methods. */ |
1347 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
1348 | | }; |
1349 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
1350 | | static_assert(0 < 1, "There is no slot for us"); |
1351 | | static const JSJitInfo cellSpacing_setterinfo = { |
1352 | | { (JSJitGetterOp)set_cellSpacing }, |
1353 | | { prototypes::id::HTMLTableElement }, |
1354 | | { PrototypeTraits<prototypes::id::HTMLTableElement>::Depth }, |
1355 | | JSJitInfo::Setter, |
1356 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
1357 | | JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */ |
1358 | | false, /* isInfallible. False in setters. */ |
1359 | | false, /* isMovable. Not relevant for setters. */ |
1360 | | false, /* isEliminatable. Not relevant for setters. */ |
1361 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
1362 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
1363 | | false, /* isTypedMethod. Only relevant for methods. */ |
1364 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
1365 | | }; |
1366 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
1367 | | static_assert(0 < 1, "There is no slot for us"); |
1368 | | |
1369 | | static bool |
1370 | | _addProperty(JSContext* cx, JS::Handle<JSObject*> obj, JS::Handle<jsid> id, JS::Handle<JS::Value> val) |
1371 | 0 | { |
1372 | 0 | mozilla::dom::HTMLTableElement* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::dom::HTMLTableElement>(obj); |
1373 | 0 | // We don't want to preserve if we don't have a wrapper, and we |
1374 | 0 | // obviously can't preserve if we're not initialized. |
1375 | 0 | if (self && self->GetWrapperPreserveColor()) { |
1376 | 0 | PreserveWrapper(self); |
1377 | 0 | } |
1378 | 0 | return true; |
1379 | 0 | } |
1380 | | |
1381 | | static void |
1382 | | _finalize(js::FreeOp* fop, JSObject* obj) |
1383 | 0 | { |
1384 | 0 | mozilla::dom::HTMLTableElement* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::dom::HTMLTableElement>(obj); |
1385 | 0 | if (self) { |
1386 | 0 | ClearWrapper(self, self, obj); |
1387 | 0 | AddForDeferredFinalization<mozilla::dom::HTMLTableElement>(self); |
1388 | 0 | } |
1389 | 0 | } |
1390 | | |
1391 | | static size_t |
1392 | | _objectMoved(JSObject* obj, JSObject* old) |
1393 | 0 | { |
1394 | 0 | mozilla::dom::HTMLTableElement* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::dom::HTMLTableElement>(obj); |
1395 | 0 | if (self) { |
1396 | 0 | UpdateWrapper(self, self, obj, old); |
1397 | 0 | } |
1398 | 0 |
|
1399 | 0 | return 0; |
1400 | 0 | } |
1401 | | |
1402 | | // We deliberately use brace-elision to make Visual Studio produce better initalization code. |
1403 | | #if defined(__clang__) |
1404 | | #pragma clang diagnostic push |
1405 | | #pragma clang diagnostic ignored "-Wmissing-braces" |
1406 | | #endif |
1407 | | static const JSFunctionSpec sMethods_specs[] = { |
1408 | | JS_FNSPEC("createCaption", (GenericMethod<NormalThisPolicy, ThrowExceptions>), reinterpret_cast<const JSJitInfo*>(&createCaption_methodinfo), 0, JSPROP_ENUMERATE, nullptr), |
1409 | | JS_FNSPEC("deleteCaption", (GenericMethod<NormalThisPolicy, ThrowExceptions>), reinterpret_cast<const JSJitInfo*>(&deleteCaption_methodinfo), 0, JSPROP_ENUMERATE, nullptr), |
1410 | | JS_FNSPEC("createTHead", (GenericMethod<NormalThisPolicy, ThrowExceptions>), reinterpret_cast<const JSJitInfo*>(&createTHead_methodinfo), 0, JSPROP_ENUMERATE, nullptr), |
1411 | | JS_FNSPEC("deleteTHead", (GenericMethod<NormalThisPolicy, ThrowExceptions>), reinterpret_cast<const JSJitInfo*>(&deleteTHead_methodinfo), 0, JSPROP_ENUMERATE, nullptr), |
1412 | | JS_FNSPEC("createTFoot", (GenericMethod<NormalThisPolicy, ThrowExceptions>), reinterpret_cast<const JSJitInfo*>(&createTFoot_methodinfo), 0, JSPROP_ENUMERATE, nullptr), |
1413 | | JS_FNSPEC("deleteTFoot", (GenericMethod<NormalThisPolicy, ThrowExceptions>), reinterpret_cast<const JSJitInfo*>(&deleteTFoot_methodinfo), 0, JSPROP_ENUMERATE, nullptr), |
1414 | | JS_FNSPEC("createTBody", (GenericMethod<NormalThisPolicy, ThrowExceptions>), reinterpret_cast<const JSJitInfo*>(&createTBody_methodinfo), 0, JSPROP_ENUMERATE, nullptr), |
1415 | | JS_FNSPEC("insertRow", (GenericMethod<NormalThisPolicy, ThrowExceptions>), reinterpret_cast<const JSJitInfo*>(&insertRow_methodinfo), 0, JSPROP_ENUMERATE, nullptr), |
1416 | | JS_FNSPEC("deleteRow", (GenericMethod<NormalThisPolicy, ThrowExceptions>), reinterpret_cast<const JSJitInfo*>(&deleteRow_methodinfo), 1, JSPROP_ENUMERATE, nullptr), |
1417 | | JS_FS_END |
1418 | | }; |
1419 | | #if defined(__clang__) |
1420 | | #pragma clang diagnostic pop |
1421 | | #endif |
1422 | | |
1423 | | |
1424 | | static const Prefable<const JSFunctionSpec> sMethods[] = { |
1425 | | { nullptr, &sMethods_specs[0] }, |
1426 | | { nullptr, nullptr } |
1427 | | }; |
1428 | | |
1429 | | static_assert(1 <= 1ull << NUM_BITS_PROPERTY_INFO_PREF_INDEX, |
1430 | | "We have a prefable index that is >= (1 << NUM_BITS_PROPERTY_INFO_PREF_INDEX)"); |
1431 | | static_assert(9 <= 1ull << NUM_BITS_PROPERTY_INFO_SPEC_INDEX, |
1432 | | "We have a spec index that is >= (1 << NUM_BITS_PROPERTY_INFO_SPEC_INDEX)"); |
1433 | | |
1434 | | // We deliberately use brace-elision to make Visual Studio produce better initalization code. |
1435 | | #if defined(__clang__) |
1436 | | #pragma clang diagnostic push |
1437 | | #pragma clang diagnostic ignored "-Wmissing-braces" |
1438 | | #endif |
1439 | | static const JSPropertySpec sAttributes_specs[] = { |
1440 | | { "caption", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &caption_getterinfo, GenericSetter<NormalThisPolicy>, &caption_setterinfo }, |
1441 | | { "tHead", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &tHead_getterinfo, GenericSetter<NormalThisPolicy>, &tHead_setterinfo }, |
1442 | | { "tFoot", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &tFoot_getterinfo, GenericSetter<NormalThisPolicy>, &tFoot_setterinfo }, |
1443 | | { "tBodies", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &tBodies_getterinfo, nullptr, nullptr }, |
1444 | | { "rows", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &rows_getterinfo, nullptr, nullptr }, |
1445 | | { "align", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &align_getterinfo, GenericSetter<NormalThisPolicy>, &align_setterinfo }, |
1446 | | { "border", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &border_getterinfo, GenericSetter<NormalThisPolicy>, &border_setterinfo }, |
1447 | | { "frame", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &frame_getterinfo, GenericSetter<NormalThisPolicy>, &frame_setterinfo }, |
1448 | | { "rules", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &rules_getterinfo, GenericSetter<NormalThisPolicy>, &rules_setterinfo }, |
1449 | | { "summary", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &summary_getterinfo, GenericSetter<NormalThisPolicy>, &summary_setterinfo }, |
1450 | | { "width", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &width_getterinfo, GenericSetter<NormalThisPolicy>, &width_setterinfo }, |
1451 | | { "bgColor", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &bgColor_getterinfo, GenericSetter<NormalThisPolicy>, &bgColor_setterinfo }, |
1452 | | { "cellPadding", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &cellPadding_getterinfo, GenericSetter<NormalThisPolicy>, &cellPadding_setterinfo }, |
1453 | | { "cellSpacing", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &cellSpacing_getterinfo, GenericSetter<NormalThisPolicy>, &cellSpacing_setterinfo }, |
1454 | | { nullptr, 0, nullptr, nullptr, nullptr, nullptr } |
1455 | | }; |
1456 | | #if defined(__clang__) |
1457 | | #pragma clang diagnostic pop |
1458 | | #endif |
1459 | | |
1460 | | |
1461 | | static const Prefable<const JSPropertySpec> sAttributes[] = { |
1462 | | { nullptr, &sAttributes_specs[0] }, |
1463 | | { nullptr, nullptr } |
1464 | | }; |
1465 | | |
1466 | | static_assert(1 <= 1ull << NUM_BITS_PROPERTY_INFO_PREF_INDEX, |
1467 | | "We have a prefable index that is >= (1 << NUM_BITS_PROPERTY_INFO_PREF_INDEX)"); |
1468 | | static_assert(14 <= 1ull << NUM_BITS_PROPERTY_INFO_SPEC_INDEX, |
1469 | | "We have a spec index that is >= (1 << NUM_BITS_PROPERTY_INFO_SPEC_INDEX)"); |
1470 | | |
1471 | | |
1472 | | static uint16_t sNativeProperties_sortedPropertyIndices[23]; |
1473 | | static PropertyInfo sNativeProperties_propertyInfos[23]; |
1474 | | |
1475 | | static const NativePropertiesN<2> sNativeProperties = { |
1476 | | false, 0, |
1477 | | false, 0, |
1478 | | true, 0 /* sMethods */, |
1479 | | true, 1 /* sAttributes */, |
1480 | | false, 0, |
1481 | | false, 0, |
1482 | | false, 0, |
1483 | | -1, |
1484 | | 23, |
1485 | | sNativeProperties_sortedPropertyIndices, |
1486 | | { |
1487 | | { sMethods, &sNativeProperties_propertyInfos[0] }, |
1488 | | { sAttributes, &sNativeProperties_propertyInfos[9] } |
1489 | | } |
1490 | | }; |
1491 | | static_assert(23 < 1ull << CHAR_BIT * sizeof(sNativeProperties.propertyInfoCount), |
1492 | | "We have a property info count that is oversized"); |
1493 | | |
1494 | | static bool |
1495 | | _constructor(JSContext* cx, unsigned argc, JS::Value* vp) |
1496 | 0 | { |
1497 | 0 | AUTO_PROFILER_LABEL_FAST("HTMLTableElement constructor", DOM, cx); |
1498 | 0 |
|
1499 | 0 | return HTMLConstructor(cx, argc, vp, |
1500 | 0 | constructors::id::HTMLTableElement, |
1501 | 0 | prototypes::id::HTMLTableElement, |
1502 | 0 | CreateInterfaceObjects); |
1503 | 0 | } |
1504 | | |
1505 | | static const js::ClassOps sInterfaceObjectClassOps = { |
1506 | | nullptr, /* addProperty */ |
1507 | | nullptr, /* delProperty */ |
1508 | | nullptr, /* enumerate */ |
1509 | | nullptr, /* newEnumerate */ |
1510 | | nullptr, /* resolve */ |
1511 | | nullptr, /* mayResolve */ |
1512 | | nullptr, /* finalize */ |
1513 | | _constructor, /* call */ |
1514 | | nullptr, /* hasInstance */ |
1515 | | _constructor, /* construct */ |
1516 | | nullptr, /* trace */ |
1517 | | }; |
1518 | | |
1519 | | static const DOMIfaceAndProtoJSClass sInterfaceObjectClass = { |
1520 | | { |
1521 | | "Function", |
1522 | | JSCLASS_IS_DOMIFACEANDPROTOJSCLASS | JSCLASS_HAS_RESERVED_SLOTS(DOM_INTERFACE_SLOTS_BASE), |
1523 | | &sInterfaceObjectClassOps, |
1524 | | JS_NULL_CLASS_SPEC, |
1525 | | JS_NULL_CLASS_EXT, |
1526 | | &sInterfaceObjectClassObjectOps |
1527 | | }, |
1528 | | eInterface, |
1529 | | true, |
1530 | | prototypes::id::HTMLTableElement, |
1531 | | PrototypeTraits<prototypes::id::HTMLTableElement>::Depth, |
1532 | | sNativePropertyHooks, |
1533 | | "function HTMLTableElement() {\n [native code]\n}", |
1534 | | HTMLElement_Binding::GetConstructorObject |
1535 | | }; |
1536 | | |
1537 | | static const DOMIfaceAndProtoJSClass sPrototypeClass = { |
1538 | | { |
1539 | | "HTMLTableElementPrototype", |
1540 | | JSCLASS_IS_DOMIFACEANDPROTOJSCLASS | JSCLASS_HAS_RESERVED_SLOTS(DOM_INTERFACE_PROTO_SLOTS_BASE), |
1541 | | JS_NULL_CLASS_OPS, |
1542 | | JS_NULL_CLASS_SPEC, |
1543 | | JS_NULL_CLASS_EXT, |
1544 | | JS_NULL_OBJECT_OPS |
1545 | | }, |
1546 | | eInterfacePrototype, |
1547 | | false, |
1548 | | prototypes::id::HTMLTableElement, |
1549 | | PrototypeTraits<prototypes::id::HTMLTableElement>::Depth, |
1550 | | sNativePropertyHooks, |
1551 | | "[object HTMLTableElementPrototype]", |
1552 | | HTMLElement_Binding::GetProtoObject |
1553 | | }; |
1554 | | |
1555 | | static const js::ClassOps sClassOps = { |
1556 | | _addProperty, /* addProperty */ |
1557 | | nullptr, /* delProperty */ |
1558 | | nullptr, /* enumerate */ |
1559 | | nullptr, /* newEnumerate */ |
1560 | | nullptr, /* resolve */ |
1561 | | nullptr, /* mayResolve */ |
1562 | | _finalize, /* finalize */ |
1563 | | nullptr, /* call */ |
1564 | | nullptr, /* hasInstance */ |
1565 | | nullptr, /* construct */ |
1566 | | nullptr, /* trace */ |
1567 | | }; |
1568 | | |
1569 | | static const js::ClassExtension sClassExtension = { |
1570 | | nullptr, /* weakmapKeyDelegateOp */ |
1571 | | _objectMoved /* objectMovedOp */ |
1572 | | }; |
1573 | | |
1574 | | static const DOMJSClass sClass = { |
1575 | | { "HTMLTableElement", |
1576 | | JSCLASS_IS_DOMJSCLASS | JSCLASS_FOREGROUND_FINALIZE | JSCLASS_HAS_RESERVED_SLOTS(1), |
1577 | | &sClassOps, |
1578 | | JS_NULL_CLASS_SPEC, |
1579 | | &sClassExtension, |
1580 | | JS_NULL_OBJECT_OPS |
1581 | | }, |
1582 | | { prototypes::id::EventTarget, prototypes::id::Node, prototypes::id::Element, prototypes::id::HTMLElement, prototypes::id::HTMLTableElement, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count }, |
1583 | | IsBaseOf<nsISupports, mozilla::dom::HTMLTableElement >::value, |
1584 | | sNativePropertyHooks, |
1585 | | FindAssociatedGlobalForNative<mozilla::dom::HTMLTableElement>::Get, |
1586 | | GetProtoObjectHandle, |
1587 | | GetCCParticipant<mozilla::dom::HTMLTableElement>::Get() |
1588 | | }; |
1589 | | static_assert(1 == DOM_INSTANCE_RESERVED_SLOTS, |
1590 | | "Must have the right minimal number of reserved slots."); |
1591 | | static_assert(1 >= 1, |
1592 | | "Must have enough reserved slots."); |
1593 | | |
1594 | | const JSClass* |
1595 | | GetJSClass() |
1596 | 0 | { |
1597 | 0 | return sClass.ToJSClass(); |
1598 | 0 | } |
1599 | | |
1600 | | bool |
1601 | | Wrap(JSContext* aCx, mozilla::dom::HTMLTableElement* aObject, nsWrapperCache* aCache, JS::Handle<JSObject*> aGivenProto, JS::MutableHandle<JSObject*> aReflector) |
1602 | 0 | { |
1603 | 0 | static_assert(!IsBaseOf<NonRefcountedDOMObject, mozilla::dom::HTMLTableElement>::value, |
1604 | 0 | "Shouldn't have wrappercached things that are not refcounted."); |
1605 | 0 | MOZ_ASSERT(static_cast<mozilla::dom::HTMLTableElement*>(aObject) == |
1606 | 0 | reinterpret_cast<mozilla::dom::HTMLTableElement*>(aObject), |
1607 | 0 | "Multiple inheritance for mozilla::dom::HTMLTableElement is broken."); |
1608 | 0 | MOZ_ASSERT(static_cast<nsGenericHTMLElement*>(aObject) == |
1609 | 0 | reinterpret_cast<nsGenericHTMLElement*>(aObject), |
1610 | 0 | "Multiple inheritance for nsGenericHTMLElement is broken."); |
1611 | 0 | MOZ_ASSERT(static_cast<mozilla::dom::Element*>(aObject) == |
1612 | 0 | reinterpret_cast<mozilla::dom::Element*>(aObject), |
1613 | 0 | "Multiple inheritance for mozilla::dom::Element is broken."); |
1614 | 0 | MOZ_ASSERT(static_cast<nsINode*>(aObject) == |
1615 | 0 | reinterpret_cast<nsINode*>(aObject), |
1616 | 0 | "Multiple inheritance for nsINode is broken."); |
1617 | 0 | MOZ_ASSERT(static_cast<mozilla::dom::EventTarget*>(aObject) == |
1618 | 0 | reinterpret_cast<mozilla::dom::EventTarget*>(aObject), |
1619 | 0 | "Multiple inheritance for mozilla::dom::EventTarget is broken."); |
1620 | 0 | MOZ_ASSERT(ToSupportsIsCorrect(aObject)); |
1621 | 0 | MOZ_ASSERT_IF(aGivenProto, js::IsObjectInContextCompartment(aGivenProto, aCx)); |
1622 | 0 | MOZ_ASSERT(!aCache->GetWrapper(), |
1623 | 0 | "You should probably not be using Wrap() directly; use " |
1624 | 0 | "GetOrCreateDOMReflector instead"); |
1625 | 0 |
|
1626 | 0 | MOZ_ASSERT(ToSupportsIsOnPrimaryInheritanceChain(aObject, aCache), |
1627 | 0 | "nsISupports must be on our primary inheritance chain"); |
1628 | 0 |
|
1629 | 0 | JS::Rooted<JSObject*> global(aCx, FindAssociatedGlobal(aCx, aObject->GetParentObject())); |
1630 | 0 | if (!global) { |
1631 | 0 | return false; |
1632 | 0 | } |
1633 | 0 | MOZ_ASSERT(JS_IsGlobalObject(global)); |
1634 | 0 | MOZ_ASSERT(JS::ObjectIsNotGray(global)); |
1635 | 0 |
|
1636 | 0 | // That might have ended up wrapping us already, due to the wonders |
1637 | 0 | // of XBL. Check for that, and bail out as needed. |
1638 | 0 | aReflector.set(aCache->GetWrapper()); |
1639 | 0 | if (aReflector) { |
1640 | | #ifdef DEBUG |
1641 | | AssertReflectorHasGivenProto(aCx, aReflector, aGivenProto); |
1642 | | #endif // DEBUG |
1643 | | return true; |
1644 | 0 | } |
1645 | 0 |
|
1646 | 0 | JSAutoRealm ar(aCx, global); |
1647 | 0 | JS::Handle<JSObject*> canonicalProto = GetProtoObjectHandle(aCx); |
1648 | 0 | if (!canonicalProto) { |
1649 | 0 | return false; |
1650 | 0 | } |
1651 | 0 | JS::Rooted<JSObject*> proto(aCx); |
1652 | 0 | if (aGivenProto) { |
1653 | 0 | proto = aGivenProto; |
1654 | 0 | // Unfortunately, while aGivenProto was in the compartment of aCx |
1655 | 0 | // coming in, we changed compartments to that of "parent" so may need |
1656 | 0 | // to wrap the proto here. |
1657 | 0 | if (js::GetContextCompartment(aCx) != js::GetObjectCompartment(proto)) { |
1658 | 0 | if (!JS_WrapObject(aCx, &proto)) { |
1659 | 0 | return false; |
1660 | 0 | } |
1661 | 0 | } |
1662 | 0 | } else { |
1663 | 0 | proto = canonicalProto; |
1664 | 0 | } |
1665 | 0 |
|
1666 | 0 | BindingJSObjectCreator<mozilla::dom::HTMLTableElement> creator(aCx); |
1667 | 0 | creator.CreateObject(aCx, sClass.ToJSClass(), proto, aObject, aReflector); |
1668 | 0 | if (!aReflector) { |
1669 | 0 | return false; |
1670 | 0 | } |
1671 | 0 | |
1672 | 0 | aCache->SetWrapper(aReflector); |
1673 | 0 | creator.InitializationSucceeded(); |
1674 | 0 |
|
1675 | 0 | MOZ_ASSERT(aCache->GetWrapperPreserveColor() && |
1676 | 0 | aCache->GetWrapperPreserveColor() == aReflector); |
1677 | 0 | // If proto != canonicalProto, we have to preserve our wrapper; |
1678 | 0 | // otherwise we won't be able to properly recreate it later, since |
1679 | 0 | // we won't know what proto to use. Note that we don't check |
1680 | 0 | // aGivenProto here, since it's entirely possible (and even |
1681 | 0 | // somewhat common) to have a non-null aGivenProto which is the |
1682 | 0 | // same as canonicalProto. |
1683 | 0 | if (proto != canonicalProto) { |
1684 | 0 | PreserveWrapper(aObject); |
1685 | 0 | } |
1686 | 0 |
|
1687 | 0 | return true; |
1688 | 0 | } |
1689 | | |
1690 | | const NativePropertyHooks sNativePropertyHooks[] = { { |
1691 | | nullptr, |
1692 | | nullptr, |
1693 | | nullptr, |
1694 | | { sNativeProperties.Upcast(), nullptr }, |
1695 | | prototypes::id::HTMLTableElement, |
1696 | | constructors::id::HTMLTableElement, |
1697 | | HTMLElement_Binding::sNativePropertyHooks, |
1698 | | &DefaultXrayExpandoObjectClass |
1699 | | } }; |
1700 | | |
1701 | | void |
1702 | | CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, bool aDefineOnGlobal) |
1703 | 0 | { |
1704 | 0 | JS::Handle<JSObject*> parentProto(HTMLElement_Binding::GetProtoObjectHandle(aCx)); |
1705 | 0 | if (!parentProto) { |
1706 | 0 | return; |
1707 | 0 | } |
1708 | 0 | |
1709 | 0 | JS::Handle<JSObject*> constructorProto(HTMLElement_Binding::GetConstructorObjectHandle(aCx)); |
1710 | 0 | if (!constructorProto) { |
1711 | 0 | return; |
1712 | 0 | } |
1713 | 0 | |
1714 | 0 | static bool sIdsInited = false; |
1715 | 0 | if (!sIdsInited && NS_IsMainThread()) { |
1716 | 0 | if (!InitIds(aCx, sNativeProperties.Upcast())) { |
1717 | 0 | return; |
1718 | 0 | } |
1719 | 0 | sIdsInited = true; |
1720 | 0 | } |
1721 | 0 |
|
1722 | 0 | JS::Heap<JSObject*>* protoCache = &aProtoAndIfaceCache.EntrySlotOrCreate(prototypes::id::HTMLTableElement); |
1723 | 0 | JS::Heap<JSObject*>* interfaceCache = &aProtoAndIfaceCache.EntrySlotOrCreate(constructors::id::HTMLTableElement); |
1724 | 0 | dom::CreateInterfaceObjects(aCx, aGlobal, parentProto, |
1725 | 0 | &sPrototypeClass.mBase, protoCache, |
1726 | 0 | nullptr, |
1727 | 0 | constructorProto, &sInterfaceObjectClass.mBase, 0, nullptr, |
1728 | 0 | interfaceCache, |
1729 | 0 | sNativeProperties.Upcast(), |
1730 | 0 | nullptr, |
1731 | 0 | "HTMLTableElement", aDefineOnGlobal, |
1732 | 0 | nullptr, |
1733 | 0 | false); |
1734 | 0 | } |
1735 | | |
1736 | | JSObject* |
1737 | | GetConstructorObject(JSContext* aCx) |
1738 | 0 | { |
1739 | 0 | return GetConstructorObjectHandle(aCx); |
1740 | 0 | } |
1741 | | |
1742 | | } // namespace HTMLTableElement_Binding |
1743 | | |
1744 | | |
1745 | | |
1746 | | } // namespace dom |
1747 | | } // namespace mozilla |