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