Line data Source code
1 : /* THIS FILE IS AUTOGENERATED FROM HTMLBodyElement.webidl BY Codegen.py - DO NOT EDIT */
2 :
3 : #include "EventHandlerBinding.h"
4 : #include "HTMLBodyElementBinding.h"
5 : #include "HTMLElementBinding.h"
6 : #include "WrapperFactory.h"
7 : #include "mozilla/OwningNonNull.h"
8 : #include "mozilla/dom/BindingUtils.h"
9 : #include "mozilla/dom/CustomElementRegistry.h"
10 : #include "mozilla/dom/DOMJSClass.h"
11 : #include "mozilla/dom/HTMLBodyElement.h"
12 : #include "mozilla/dom/NonRefcountedDOMObject.h"
13 : #include "mozilla/dom/Nullable.h"
14 : #include "mozilla/dom/XrayExpandoClass.h"
15 :
16 : namespace mozilla {
17 : namespace dom {
18 :
19 : namespace HTMLBodyElementBinding {
20 :
21 : static_assert(IsRefcounted<NativeType>::value == IsRefcounted<HTMLElementBinding::NativeType>::value,
22 : "Can't inherit from an interface with a different ownership model.");
23 :
24 : static bool
25 0 : get_text(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLBodyElement* self, JSJitGetterCallArgs args)
26 : {
27 0 : DOMString result;
28 0 : self->GetText(result);
29 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
30 0 : if (!xpc::NonVoidStringToJsval(cx, result, args.rval())) {
31 0 : return false;
32 : }
33 0 : return true;
34 : }
35 :
36 : static bool
37 0 : set_text(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLBodyElement* self, JSJitSetterCallArgs args)
38 : {
39 0 : binding_detail::FakeString arg0;
40 0 : if (!ConvertJSValueToString(cx, args[0], eEmpty, eStringify, arg0)) {
41 0 : return false;
42 : }
43 0 : CustomElementReactionsStack* reactionsStack = GetCustomElementReactionsStack(obj);
44 0 : Maybe<AutoCEReaction> ceReaction;
45 0 : if (reactionsStack) {
46 0 : ceReaction.emplace(reactionsStack);
47 : }
48 0 : binding_detail::FastErrorResult rv;
49 0 : self->SetText(NonNullHelper(Constify(arg0)), rv);
50 0 : if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
51 0 : return false;
52 : }
53 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
54 :
55 0 : return true;
56 : }
57 :
58 : static const JSJitInfo text_getterinfo = {
59 : { (JSJitGetterOp)get_text },
60 : { prototypes::id::HTMLBodyElement },
61 : { PrototypeTraits<prototypes::id::HTMLBodyElement>::Depth },
62 : JSJitInfo::Getter,
63 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
64 : JSVAL_TYPE_STRING, /* returnType. Not relevant for setters. */
65 : false, /* isInfallible. False in setters. */
66 : false, /* isMovable. Not relevant for setters. */
67 : false, /* isEliminatable. Not relevant for setters. */
68 : false, /* isAlwaysInSlot. Only relevant for getters. */
69 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
70 : false, /* isTypedMethod. Only relevant for methods. */
71 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
72 : };
73 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
74 : static_assert(0 < 1, "There is no slot for us");
75 : static const JSJitInfo text_setterinfo = {
76 : { (JSJitGetterOp)set_text },
77 : { prototypes::id::HTMLBodyElement },
78 : { PrototypeTraits<prototypes::id::HTMLBodyElement>::Depth },
79 : JSJitInfo::Setter,
80 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
81 : JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */
82 : false, /* isInfallible. False in setters. */
83 : false, /* isMovable. Not relevant for setters. */
84 : false, /* isEliminatable. Not relevant for setters. */
85 : false, /* isAlwaysInSlot. Only relevant for getters. */
86 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
87 : false, /* isTypedMethod. Only relevant for methods. */
88 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
89 : };
90 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
91 : static_assert(0 < 1, "There is no slot for us");
92 :
93 : static bool
94 0 : get_link(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLBodyElement* self, JSJitGetterCallArgs args)
95 : {
96 0 : DOMString result;
97 0 : self->GetLink(result);
98 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
99 0 : if (!xpc::NonVoidStringToJsval(cx, result, args.rval())) {
100 0 : return false;
101 : }
102 0 : return true;
103 : }
104 :
105 : static bool
106 0 : set_link(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLBodyElement* self, JSJitSetterCallArgs args)
107 : {
108 0 : binding_detail::FakeString arg0;
109 0 : if (!ConvertJSValueToString(cx, args[0], eEmpty, eStringify, arg0)) {
110 0 : return false;
111 : }
112 0 : CustomElementReactionsStack* reactionsStack = GetCustomElementReactionsStack(obj);
113 0 : Maybe<AutoCEReaction> ceReaction;
114 0 : if (reactionsStack) {
115 0 : ceReaction.emplace(reactionsStack);
116 : }
117 0 : binding_detail::FastErrorResult rv;
118 0 : self->SetLink(NonNullHelper(Constify(arg0)), rv);
119 0 : if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
120 0 : return false;
121 : }
122 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
123 :
124 0 : return true;
125 : }
126 :
127 : static const JSJitInfo link_getterinfo = {
128 : { (JSJitGetterOp)get_link },
129 : { prototypes::id::HTMLBodyElement },
130 : { PrototypeTraits<prototypes::id::HTMLBodyElement>::Depth },
131 : JSJitInfo::Getter,
132 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
133 : JSVAL_TYPE_STRING, /* returnType. Not relevant for setters. */
134 : false, /* isInfallible. False in setters. */
135 : false, /* isMovable. Not relevant for setters. */
136 : false, /* isEliminatable. Not relevant for setters. */
137 : false, /* isAlwaysInSlot. Only relevant for getters. */
138 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
139 : false, /* isTypedMethod. Only relevant for methods. */
140 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
141 : };
142 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
143 : static_assert(0 < 1, "There is no slot for us");
144 : static const JSJitInfo link_setterinfo = {
145 : { (JSJitGetterOp)set_link },
146 : { prototypes::id::HTMLBodyElement },
147 : { PrototypeTraits<prototypes::id::HTMLBodyElement>::Depth },
148 : JSJitInfo::Setter,
149 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
150 : JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */
151 : false, /* isInfallible. False in setters. */
152 : false, /* isMovable. Not relevant for setters. */
153 : false, /* isEliminatable. Not relevant for setters. */
154 : false, /* isAlwaysInSlot. Only relevant for getters. */
155 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
156 : false, /* isTypedMethod. Only relevant for methods. */
157 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
158 : };
159 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
160 : static_assert(0 < 1, "There is no slot for us");
161 :
162 : static bool
163 0 : get_vLink(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLBodyElement* self, JSJitGetterCallArgs args)
164 : {
165 0 : DOMString result;
166 0 : self->GetVLink(result);
167 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
168 0 : if (!xpc::NonVoidStringToJsval(cx, result, args.rval())) {
169 0 : return false;
170 : }
171 0 : return true;
172 : }
173 :
174 : static bool
175 0 : set_vLink(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLBodyElement* self, JSJitSetterCallArgs args)
176 : {
177 0 : binding_detail::FakeString arg0;
178 0 : if (!ConvertJSValueToString(cx, args[0], eEmpty, eStringify, arg0)) {
179 0 : return false;
180 : }
181 0 : CustomElementReactionsStack* reactionsStack = GetCustomElementReactionsStack(obj);
182 0 : Maybe<AutoCEReaction> ceReaction;
183 0 : if (reactionsStack) {
184 0 : ceReaction.emplace(reactionsStack);
185 : }
186 0 : binding_detail::FastErrorResult rv;
187 0 : self->SetVLink(NonNullHelper(Constify(arg0)), rv);
188 0 : if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
189 0 : return false;
190 : }
191 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
192 :
193 0 : return true;
194 : }
195 :
196 : static const JSJitInfo vLink_getterinfo = {
197 : { (JSJitGetterOp)get_vLink },
198 : { prototypes::id::HTMLBodyElement },
199 : { PrototypeTraits<prototypes::id::HTMLBodyElement>::Depth },
200 : JSJitInfo::Getter,
201 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
202 : JSVAL_TYPE_STRING, /* returnType. Not relevant for setters. */
203 : false, /* isInfallible. False in setters. */
204 : false, /* isMovable. Not relevant for setters. */
205 : false, /* isEliminatable. Not relevant for setters. */
206 : false, /* isAlwaysInSlot. Only relevant for getters. */
207 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
208 : false, /* isTypedMethod. Only relevant for methods. */
209 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
210 : };
211 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
212 : static_assert(0 < 1, "There is no slot for us");
213 : static const JSJitInfo vLink_setterinfo = {
214 : { (JSJitGetterOp)set_vLink },
215 : { prototypes::id::HTMLBodyElement },
216 : { PrototypeTraits<prototypes::id::HTMLBodyElement>::Depth },
217 : JSJitInfo::Setter,
218 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
219 : JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */
220 : false, /* isInfallible. False in setters. */
221 : false, /* isMovable. Not relevant for setters. */
222 : false, /* isEliminatable. Not relevant for setters. */
223 : false, /* isAlwaysInSlot. Only relevant for getters. */
224 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
225 : false, /* isTypedMethod. Only relevant for methods. */
226 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
227 : };
228 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
229 : static_assert(0 < 1, "There is no slot for us");
230 :
231 : static bool
232 0 : get_aLink(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLBodyElement* self, JSJitGetterCallArgs args)
233 : {
234 0 : DOMString result;
235 0 : self->GetALink(result);
236 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
237 0 : if (!xpc::NonVoidStringToJsval(cx, result, args.rval())) {
238 0 : return false;
239 : }
240 0 : return true;
241 : }
242 :
243 : static bool
244 0 : set_aLink(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLBodyElement* self, JSJitSetterCallArgs args)
245 : {
246 0 : binding_detail::FakeString arg0;
247 0 : if (!ConvertJSValueToString(cx, args[0], eEmpty, eStringify, arg0)) {
248 0 : return false;
249 : }
250 0 : CustomElementReactionsStack* reactionsStack = GetCustomElementReactionsStack(obj);
251 0 : Maybe<AutoCEReaction> ceReaction;
252 0 : if (reactionsStack) {
253 0 : ceReaction.emplace(reactionsStack);
254 : }
255 0 : binding_detail::FastErrorResult rv;
256 0 : self->SetALink(NonNullHelper(Constify(arg0)), rv);
257 0 : if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
258 0 : return false;
259 : }
260 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
261 :
262 0 : return true;
263 : }
264 :
265 : static const JSJitInfo aLink_getterinfo = {
266 : { (JSJitGetterOp)get_aLink },
267 : { prototypes::id::HTMLBodyElement },
268 : { PrototypeTraits<prototypes::id::HTMLBodyElement>::Depth },
269 : JSJitInfo::Getter,
270 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
271 : JSVAL_TYPE_STRING, /* returnType. Not relevant for setters. */
272 : false, /* isInfallible. False in setters. */
273 : false, /* isMovable. Not relevant for setters. */
274 : false, /* isEliminatable. Not relevant for setters. */
275 : false, /* isAlwaysInSlot. Only relevant for getters. */
276 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
277 : false, /* isTypedMethod. Only relevant for methods. */
278 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
279 : };
280 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
281 : static_assert(0 < 1, "There is no slot for us");
282 : static const JSJitInfo aLink_setterinfo = {
283 : { (JSJitGetterOp)set_aLink },
284 : { prototypes::id::HTMLBodyElement },
285 : { PrototypeTraits<prototypes::id::HTMLBodyElement>::Depth },
286 : JSJitInfo::Setter,
287 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
288 : JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */
289 : false, /* isInfallible. False in setters. */
290 : false, /* isMovable. Not relevant for setters. */
291 : false, /* isEliminatable. Not relevant for setters. */
292 : false, /* isAlwaysInSlot. Only relevant for getters. */
293 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
294 : false, /* isTypedMethod. Only relevant for methods. */
295 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
296 : };
297 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
298 : static_assert(0 < 1, "There is no slot for us");
299 :
300 : static bool
301 0 : get_bgColor(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLBodyElement* self, JSJitGetterCallArgs args)
302 : {
303 0 : DOMString result;
304 0 : self->GetBgColor(result);
305 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
306 0 : if (!xpc::NonVoidStringToJsval(cx, result, args.rval())) {
307 0 : return false;
308 : }
309 0 : return true;
310 : }
311 :
312 : static bool
313 0 : set_bgColor(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLBodyElement* self, JSJitSetterCallArgs args)
314 : {
315 0 : binding_detail::FakeString arg0;
316 0 : if (!ConvertJSValueToString(cx, args[0], eEmpty, eStringify, arg0)) {
317 0 : return false;
318 : }
319 0 : CustomElementReactionsStack* reactionsStack = GetCustomElementReactionsStack(obj);
320 0 : Maybe<AutoCEReaction> ceReaction;
321 0 : if (reactionsStack) {
322 0 : ceReaction.emplace(reactionsStack);
323 : }
324 0 : binding_detail::FastErrorResult rv;
325 0 : self->SetBgColor(NonNullHelper(Constify(arg0)), rv);
326 0 : if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
327 0 : return false;
328 : }
329 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
330 :
331 0 : return true;
332 : }
333 :
334 : static const JSJitInfo bgColor_getterinfo = {
335 : { (JSJitGetterOp)get_bgColor },
336 : { prototypes::id::HTMLBodyElement },
337 : { PrototypeTraits<prototypes::id::HTMLBodyElement>::Depth },
338 : JSJitInfo::Getter,
339 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
340 : JSVAL_TYPE_STRING, /* returnType. Not relevant for setters. */
341 : false, /* isInfallible. False in setters. */
342 : false, /* isMovable. Not relevant for setters. */
343 : false, /* isEliminatable. Not relevant for setters. */
344 : false, /* isAlwaysInSlot. Only relevant for getters. */
345 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
346 : false, /* isTypedMethod. Only relevant for methods. */
347 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
348 : };
349 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
350 : static_assert(0 < 1, "There is no slot for us");
351 : static const JSJitInfo bgColor_setterinfo = {
352 : { (JSJitGetterOp)set_bgColor },
353 : { prototypes::id::HTMLBodyElement },
354 : { PrototypeTraits<prototypes::id::HTMLBodyElement>::Depth },
355 : JSJitInfo::Setter,
356 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
357 : JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */
358 : false, /* isInfallible. False in setters. */
359 : false, /* isMovable. Not relevant for setters. */
360 : false, /* isEliminatable. Not relevant for setters. */
361 : false, /* isAlwaysInSlot. Only relevant for getters. */
362 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
363 : false, /* isTypedMethod. Only relevant for methods. */
364 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
365 : };
366 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
367 : static_assert(0 < 1, "There is no slot for us");
368 :
369 : static bool
370 0 : get_background(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLBodyElement* self, JSJitGetterCallArgs args)
371 : {
372 0 : DOMString result;
373 0 : self->GetBackground(result);
374 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
375 0 : if (!xpc::NonVoidStringToJsval(cx, result, args.rval())) {
376 0 : return false;
377 : }
378 0 : return true;
379 : }
380 :
381 : static bool
382 0 : set_background(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLBodyElement* self, JSJitSetterCallArgs args)
383 : {
384 0 : binding_detail::FakeString arg0;
385 0 : if (!ConvertJSValueToString(cx, args[0], eStringify, eStringify, arg0)) {
386 0 : return false;
387 : }
388 0 : CustomElementReactionsStack* reactionsStack = GetCustomElementReactionsStack(obj);
389 0 : Maybe<AutoCEReaction> ceReaction;
390 0 : if (reactionsStack) {
391 0 : ceReaction.emplace(reactionsStack);
392 : }
393 0 : binding_detail::FastErrorResult rv;
394 0 : self->SetBackground(NonNullHelper(Constify(arg0)), rv);
395 0 : if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
396 0 : return false;
397 : }
398 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
399 :
400 0 : return true;
401 : }
402 :
403 : static const JSJitInfo background_getterinfo = {
404 : { (JSJitGetterOp)get_background },
405 : { prototypes::id::HTMLBodyElement },
406 : { PrototypeTraits<prototypes::id::HTMLBodyElement>::Depth },
407 : JSJitInfo::Getter,
408 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
409 : JSVAL_TYPE_STRING, /* returnType. Not relevant for setters. */
410 : false, /* isInfallible. False in setters. */
411 : false, /* isMovable. Not relevant for setters. */
412 : false, /* isEliminatable. Not relevant for setters. */
413 : false, /* isAlwaysInSlot. Only relevant for getters. */
414 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
415 : false, /* isTypedMethod. Only relevant for methods. */
416 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
417 : };
418 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
419 : static_assert(0 < 1, "There is no slot for us");
420 : static const JSJitInfo background_setterinfo = {
421 : { (JSJitGetterOp)set_background },
422 : { prototypes::id::HTMLBodyElement },
423 : { PrototypeTraits<prototypes::id::HTMLBodyElement>::Depth },
424 : JSJitInfo::Setter,
425 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
426 : JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */
427 : false, /* isInfallible. False in setters. */
428 : false, /* isMovable. Not relevant for setters. */
429 : false, /* isEliminatable. Not relevant for setters. */
430 : false, /* isAlwaysInSlot. Only relevant for getters. */
431 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
432 : false, /* isTypedMethod. Only relevant for methods. */
433 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
434 : };
435 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
436 : static_assert(0 < 1, "There is no slot for us");
437 :
438 : static bool
439 0 : get_onafterprint(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLBodyElement* self, JSJitGetterCallArgs args)
440 : {
441 0 : RefPtr<EventHandlerNonNull> result(self->GetOnafterprint());
442 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
443 0 : if (result) {
444 0 : args.rval().setObjectOrNull(GetCallbackFromCallbackObject(result));
445 0 : if (!MaybeWrapObjectOrNullValue(cx, args.rval())) {
446 0 : return false;
447 : }
448 0 : return true;
449 : } else {
450 0 : args.rval().setNull();
451 0 : return true;
452 : }
453 : }
454 :
455 : static bool
456 0 : set_onafterprint(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLBodyElement* self, JSJitSetterCallArgs args)
457 : {
458 0 : RootedCallback<RefPtr<binding_detail::FastEventHandlerNonNull>> arg0(cx);
459 0 : if (args[0].isObject()) {
460 : { // scope for tempRoot
461 0 : JS::Rooted<JSObject*> tempRoot(cx, &args[0].toObject());
462 0 : arg0 = new binding_detail::FastEventHandlerNonNull(tempRoot);
463 : }
464 : } else {
465 0 : arg0 = nullptr;
466 : }
467 0 : self->SetOnafterprint(Constify(arg0));
468 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
469 :
470 0 : return true;
471 : }
472 :
473 : static const JSJitInfo onafterprint_getterinfo = {
474 : { (JSJitGetterOp)get_onafterprint },
475 : { prototypes::id::HTMLBodyElement },
476 : { PrototypeTraits<prototypes::id::HTMLBodyElement>::Depth },
477 : JSJitInfo::Getter,
478 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
479 : JSVAL_TYPE_UNKNOWN, /* returnType. Not relevant for setters. */
480 : false, /* isInfallible. False in setters. */
481 : false, /* isMovable. Not relevant for setters. */
482 : false, /* isEliminatable. Not relevant for setters. */
483 : false, /* isAlwaysInSlot. Only relevant for getters. */
484 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
485 : false, /* isTypedMethod. Only relevant for methods. */
486 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
487 : };
488 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
489 : static_assert(0 < 1, "There is no slot for us");
490 : static const JSJitInfo onafterprint_setterinfo = {
491 : { (JSJitGetterOp)set_onafterprint },
492 : { prototypes::id::HTMLBodyElement },
493 : { PrototypeTraits<prototypes::id::HTMLBodyElement>::Depth },
494 : JSJitInfo::Setter,
495 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
496 : JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */
497 : false, /* isInfallible. False in setters. */
498 : false, /* isMovable. Not relevant for setters. */
499 : false, /* isEliminatable. Not relevant for setters. */
500 : false, /* isAlwaysInSlot. Only relevant for getters. */
501 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
502 : false, /* isTypedMethod. Only relevant for methods. */
503 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
504 : };
505 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
506 : static_assert(0 < 1, "There is no slot for us");
507 :
508 : static bool
509 0 : get_onbeforeprint(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLBodyElement* self, JSJitGetterCallArgs args)
510 : {
511 0 : RefPtr<EventHandlerNonNull> result(self->GetOnbeforeprint());
512 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
513 0 : if (result) {
514 0 : args.rval().setObjectOrNull(GetCallbackFromCallbackObject(result));
515 0 : if (!MaybeWrapObjectOrNullValue(cx, args.rval())) {
516 0 : return false;
517 : }
518 0 : return true;
519 : } else {
520 0 : args.rval().setNull();
521 0 : return true;
522 : }
523 : }
524 :
525 : static bool
526 0 : set_onbeforeprint(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLBodyElement* self, JSJitSetterCallArgs args)
527 : {
528 0 : RootedCallback<RefPtr<binding_detail::FastEventHandlerNonNull>> arg0(cx);
529 0 : if (args[0].isObject()) {
530 : { // scope for tempRoot
531 0 : JS::Rooted<JSObject*> tempRoot(cx, &args[0].toObject());
532 0 : arg0 = new binding_detail::FastEventHandlerNonNull(tempRoot);
533 : }
534 : } else {
535 0 : arg0 = nullptr;
536 : }
537 0 : self->SetOnbeforeprint(Constify(arg0));
538 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
539 :
540 0 : return true;
541 : }
542 :
543 : static const JSJitInfo onbeforeprint_getterinfo = {
544 : { (JSJitGetterOp)get_onbeforeprint },
545 : { prototypes::id::HTMLBodyElement },
546 : { PrototypeTraits<prototypes::id::HTMLBodyElement>::Depth },
547 : JSJitInfo::Getter,
548 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
549 : JSVAL_TYPE_UNKNOWN, /* returnType. Not relevant for setters. */
550 : false, /* isInfallible. False in setters. */
551 : false, /* isMovable. Not relevant for setters. */
552 : false, /* isEliminatable. Not relevant for setters. */
553 : false, /* isAlwaysInSlot. Only relevant for getters. */
554 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
555 : false, /* isTypedMethod. Only relevant for methods. */
556 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
557 : };
558 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
559 : static_assert(0 < 1, "There is no slot for us");
560 : static const JSJitInfo onbeforeprint_setterinfo = {
561 : { (JSJitGetterOp)set_onbeforeprint },
562 : { prototypes::id::HTMLBodyElement },
563 : { PrototypeTraits<prototypes::id::HTMLBodyElement>::Depth },
564 : JSJitInfo::Setter,
565 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
566 : JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */
567 : false, /* isInfallible. False in setters. */
568 : false, /* isMovable. Not relevant for setters. */
569 : false, /* isEliminatable. Not relevant for setters. */
570 : false, /* isAlwaysInSlot. Only relevant for getters. */
571 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
572 : false, /* isTypedMethod. Only relevant for methods. */
573 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
574 : };
575 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
576 : static_assert(0 < 1, "There is no slot for us");
577 :
578 : static bool
579 0 : get_onbeforeunload(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLBodyElement* self, JSJitGetterCallArgs args)
580 : {
581 0 : RefPtr<OnBeforeUnloadEventHandlerNonNull> result(self->GetOnbeforeunload());
582 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
583 0 : if (result) {
584 0 : args.rval().setObjectOrNull(GetCallbackFromCallbackObject(result));
585 0 : if (!MaybeWrapObjectOrNullValue(cx, args.rval())) {
586 0 : return false;
587 : }
588 0 : return true;
589 : } else {
590 0 : args.rval().setNull();
591 0 : return true;
592 : }
593 : }
594 :
595 : static bool
596 0 : set_onbeforeunload(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLBodyElement* self, JSJitSetterCallArgs args)
597 : {
598 0 : RootedCallback<RefPtr<binding_detail::FastOnBeforeUnloadEventHandlerNonNull>> arg0(cx);
599 0 : if (args[0].isObject()) {
600 : { // scope for tempRoot
601 0 : JS::Rooted<JSObject*> tempRoot(cx, &args[0].toObject());
602 0 : arg0 = new binding_detail::FastOnBeforeUnloadEventHandlerNonNull(tempRoot);
603 : }
604 : } else {
605 0 : arg0 = nullptr;
606 : }
607 0 : self->SetOnbeforeunload(Constify(arg0));
608 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
609 :
610 0 : return true;
611 : }
612 :
613 : static const JSJitInfo onbeforeunload_getterinfo = {
614 : { (JSJitGetterOp)get_onbeforeunload },
615 : { prototypes::id::HTMLBodyElement },
616 : { PrototypeTraits<prototypes::id::HTMLBodyElement>::Depth },
617 : JSJitInfo::Getter,
618 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
619 : JSVAL_TYPE_UNKNOWN, /* returnType. Not relevant for setters. */
620 : false, /* isInfallible. False in setters. */
621 : false, /* isMovable. Not relevant for setters. */
622 : false, /* isEliminatable. Not relevant for setters. */
623 : false, /* isAlwaysInSlot. Only relevant for getters. */
624 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
625 : false, /* isTypedMethod. Only relevant for methods. */
626 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
627 : };
628 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
629 : static_assert(0 < 1, "There is no slot for us");
630 : static const JSJitInfo onbeforeunload_setterinfo = {
631 : { (JSJitGetterOp)set_onbeforeunload },
632 : { prototypes::id::HTMLBodyElement },
633 : { PrototypeTraits<prototypes::id::HTMLBodyElement>::Depth },
634 : JSJitInfo::Setter,
635 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
636 : JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */
637 : false, /* isInfallible. False in setters. */
638 : false, /* isMovable. Not relevant for setters. */
639 : false, /* isEliminatable. Not relevant for setters. */
640 : false, /* isAlwaysInSlot. Only relevant for getters. */
641 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
642 : false, /* isTypedMethod. Only relevant for methods. */
643 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
644 : };
645 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
646 : static_assert(0 < 1, "There is no slot for us");
647 :
648 : static bool
649 0 : get_onhashchange(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLBodyElement* self, JSJitGetterCallArgs args)
650 : {
651 0 : RefPtr<EventHandlerNonNull> result(self->GetOnhashchange());
652 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
653 0 : if (result) {
654 0 : args.rval().setObjectOrNull(GetCallbackFromCallbackObject(result));
655 0 : if (!MaybeWrapObjectOrNullValue(cx, args.rval())) {
656 0 : return false;
657 : }
658 0 : return true;
659 : } else {
660 0 : args.rval().setNull();
661 0 : return true;
662 : }
663 : }
664 :
665 : static bool
666 0 : set_onhashchange(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLBodyElement* self, JSJitSetterCallArgs args)
667 : {
668 0 : RootedCallback<RefPtr<binding_detail::FastEventHandlerNonNull>> arg0(cx);
669 0 : if (args[0].isObject()) {
670 : { // scope for tempRoot
671 0 : JS::Rooted<JSObject*> tempRoot(cx, &args[0].toObject());
672 0 : arg0 = new binding_detail::FastEventHandlerNonNull(tempRoot);
673 : }
674 : } else {
675 0 : arg0 = nullptr;
676 : }
677 0 : self->SetOnhashchange(Constify(arg0));
678 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
679 :
680 0 : return true;
681 : }
682 :
683 : static const JSJitInfo onhashchange_getterinfo = {
684 : { (JSJitGetterOp)get_onhashchange },
685 : { prototypes::id::HTMLBodyElement },
686 : { PrototypeTraits<prototypes::id::HTMLBodyElement>::Depth },
687 : JSJitInfo::Getter,
688 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
689 : JSVAL_TYPE_UNKNOWN, /* returnType. Not relevant for setters. */
690 : false, /* isInfallible. False in setters. */
691 : false, /* isMovable. Not relevant for setters. */
692 : false, /* isEliminatable. Not relevant for setters. */
693 : false, /* isAlwaysInSlot. Only relevant for getters. */
694 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
695 : false, /* isTypedMethod. Only relevant for methods. */
696 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
697 : };
698 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
699 : static_assert(0 < 1, "There is no slot for us");
700 : static const JSJitInfo onhashchange_setterinfo = {
701 : { (JSJitGetterOp)set_onhashchange },
702 : { prototypes::id::HTMLBodyElement },
703 : { PrototypeTraits<prototypes::id::HTMLBodyElement>::Depth },
704 : JSJitInfo::Setter,
705 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
706 : JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */
707 : false, /* isInfallible. False in setters. */
708 : false, /* isMovable. Not relevant for setters. */
709 : false, /* isEliminatable. Not relevant for setters. */
710 : false, /* isAlwaysInSlot. Only relevant for getters. */
711 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
712 : false, /* isTypedMethod. Only relevant for methods. */
713 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
714 : };
715 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
716 : static_assert(0 < 1, "There is no slot for us");
717 :
718 : static bool
719 0 : get_onlanguagechange(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLBodyElement* self, JSJitGetterCallArgs args)
720 : {
721 0 : RefPtr<EventHandlerNonNull> result(self->GetOnlanguagechange());
722 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
723 0 : if (result) {
724 0 : args.rval().setObjectOrNull(GetCallbackFromCallbackObject(result));
725 0 : if (!MaybeWrapObjectOrNullValue(cx, args.rval())) {
726 0 : return false;
727 : }
728 0 : return true;
729 : } else {
730 0 : args.rval().setNull();
731 0 : return true;
732 : }
733 : }
734 :
735 : static bool
736 0 : set_onlanguagechange(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLBodyElement* self, JSJitSetterCallArgs args)
737 : {
738 0 : RootedCallback<RefPtr<binding_detail::FastEventHandlerNonNull>> arg0(cx);
739 0 : if (args[0].isObject()) {
740 : { // scope for tempRoot
741 0 : JS::Rooted<JSObject*> tempRoot(cx, &args[0].toObject());
742 0 : arg0 = new binding_detail::FastEventHandlerNonNull(tempRoot);
743 : }
744 : } else {
745 0 : arg0 = nullptr;
746 : }
747 0 : self->SetOnlanguagechange(Constify(arg0));
748 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
749 :
750 0 : return true;
751 : }
752 :
753 : static const JSJitInfo onlanguagechange_getterinfo = {
754 : { (JSJitGetterOp)get_onlanguagechange },
755 : { prototypes::id::HTMLBodyElement },
756 : { PrototypeTraits<prototypes::id::HTMLBodyElement>::Depth },
757 : JSJitInfo::Getter,
758 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
759 : JSVAL_TYPE_UNKNOWN, /* returnType. Not relevant for setters. */
760 : false, /* isInfallible. False in setters. */
761 : false, /* isMovable. Not relevant for setters. */
762 : false, /* isEliminatable. Not relevant for setters. */
763 : false, /* isAlwaysInSlot. Only relevant for getters. */
764 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
765 : false, /* isTypedMethod. Only relevant for methods. */
766 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
767 : };
768 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
769 : static_assert(0 < 1, "There is no slot for us");
770 : static const JSJitInfo onlanguagechange_setterinfo = {
771 : { (JSJitGetterOp)set_onlanguagechange },
772 : { prototypes::id::HTMLBodyElement },
773 : { PrototypeTraits<prototypes::id::HTMLBodyElement>::Depth },
774 : JSJitInfo::Setter,
775 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
776 : JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */
777 : false, /* isInfallible. False in setters. */
778 : false, /* isMovable. Not relevant for setters. */
779 : false, /* isEliminatable. Not relevant for setters. */
780 : false, /* isAlwaysInSlot. Only relevant for getters. */
781 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
782 : false, /* isTypedMethod. Only relevant for methods. */
783 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
784 : };
785 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
786 : static_assert(0 < 1, "There is no slot for us");
787 :
788 : static bool
789 0 : get_onmessage(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLBodyElement* self, JSJitGetterCallArgs args)
790 : {
791 0 : RefPtr<EventHandlerNonNull> result(self->GetOnmessage());
792 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
793 0 : if (result) {
794 0 : args.rval().setObjectOrNull(GetCallbackFromCallbackObject(result));
795 0 : if (!MaybeWrapObjectOrNullValue(cx, args.rval())) {
796 0 : return false;
797 : }
798 0 : return true;
799 : } else {
800 0 : args.rval().setNull();
801 0 : return true;
802 : }
803 : }
804 :
805 : static bool
806 0 : set_onmessage(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLBodyElement* self, JSJitSetterCallArgs args)
807 : {
808 0 : RootedCallback<RefPtr<binding_detail::FastEventHandlerNonNull>> arg0(cx);
809 0 : if (args[0].isObject()) {
810 : { // scope for tempRoot
811 0 : JS::Rooted<JSObject*> tempRoot(cx, &args[0].toObject());
812 0 : arg0 = new binding_detail::FastEventHandlerNonNull(tempRoot);
813 : }
814 : } else {
815 0 : arg0 = nullptr;
816 : }
817 0 : self->SetOnmessage(Constify(arg0));
818 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
819 :
820 0 : return true;
821 : }
822 :
823 : static const JSJitInfo onmessage_getterinfo = {
824 : { (JSJitGetterOp)get_onmessage },
825 : { prototypes::id::HTMLBodyElement },
826 : { PrototypeTraits<prototypes::id::HTMLBodyElement>::Depth },
827 : JSJitInfo::Getter,
828 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
829 : JSVAL_TYPE_UNKNOWN, /* returnType. Not relevant for setters. */
830 : false, /* isInfallible. False in setters. */
831 : false, /* isMovable. Not relevant for setters. */
832 : false, /* isEliminatable. Not relevant for setters. */
833 : false, /* isAlwaysInSlot. Only relevant for getters. */
834 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
835 : false, /* isTypedMethod. Only relevant for methods. */
836 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
837 : };
838 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
839 : static_assert(0 < 1, "There is no slot for us");
840 : static const JSJitInfo onmessage_setterinfo = {
841 : { (JSJitGetterOp)set_onmessage },
842 : { prototypes::id::HTMLBodyElement },
843 : { PrototypeTraits<prototypes::id::HTMLBodyElement>::Depth },
844 : JSJitInfo::Setter,
845 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
846 : JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */
847 : false, /* isInfallible. False in setters. */
848 : false, /* isMovable. Not relevant for setters. */
849 : false, /* isEliminatable. Not relevant for setters. */
850 : false, /* isAlwaysInSlot. Only relevant for getters. */
851 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
852 : false, /* isTypedMethod. Only relevant for methods. */
853 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
854 : };
855 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
856 : static_assert(0 < 1, "There is no slot for us");
857 :
858 : static bool
859 0 : get_onoffline(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLBodyElement* self, JSJitGetterCallArgs args)
860 : {
861 0 : RefPtr<EventHandlerNonNull> result(self->GetOnoffline());
862 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
863 0 : if (result) {
864 0 : args.rval().setObjectOrNull(GetCallbackFromCallbackObject(result));
865 0 : if (!MaybeWrapObjectOrNullValue(cx, args.rval())) {
866 0 : return false;
867 : }
868 0 : return true;
869 : } else {
870 0 : args.rval().setNull();
871 0 : return true;
872 : }
873 : }
874 :
875 : static bool
876 0 : set_onoffline(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLBodyElement* self, JSJitSetterCallArgs args)
877 : {
878 0 : RootedCallback<RefPtr<binding_detail::FastEventHandlerNonNull>> arg0(cx);
879 0 : if (args[0].isObject()) {
880 : { // scope for tempRoot
881 0 : JS::Rooted<JSObject*> tempRoot(cx, &args[0].toObject());
882 0 : arg0 = new binding_detail::FastEventHandlerNonNull(tempRoot);
883 : }
884 : } else {
885 0 : arg0 = nullptr;
886 : }
887 0 : self->SetOnoffline(Constify(arg0));
888 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
889 :
890 0 : return true;
891 : }
892 :
893 : static const JSJitInfo onoffline_getterinfo = {
894 : { (JSJitGetterOp)get_onoffline },
895 : { prototypes::id::HTMLBodyElement },
896 : { PrototypeTraits<prototypes::id::HTMLBodyElement>::Depth },
897 : JSJitInfo::Getter,
898 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
899 : JSVAL_TYPE_UNKNOWN, /* returnType. Not relevant for setters. */
900 : false, /* isInfallible. False in setters. */
901 : false, /* isMovable. Not relevant for setters. */
902 : false, /* isEliminatable. Not relevant for setters. */
903 : false, /* isAlwaysInSlot. Only relevant for getters. */
904 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
905 : false, /* isTypedMethod. Only relevant for methods. */
906 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
907 : };
908 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
909 : static_assert(0 < 1, "There is no slot for us");
910 : static const JSJitInfo onoffline_setterinfo = {
911 : { (JSJitGetterOp)set_onoffline },
912 : { prototypes::id::HTMLBodyElement },
913 : { PrototypeTraits<prototypes::id::HTMLBodyElement>::Depth },
914 : JSJitInfo::Setter,
915 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
916 : JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */
917 : false, /* isInfallible. False in setters. */
918 : false, /* isMovable. Not relevant for setters. */
919 : false, /* isEliminatable. Not relevant for setters. */
920 : false, /* isAlwaysInSlot. Only relevant for getters. */
921 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
922 : false, /* isTypedMethod. Only relevant for methods. */
923 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
924 : };
925 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
926 : static_assert(0 < 1, "There is no slot for us");
927 :
928 : static bool
929 0 : get_ononline(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLBodyElement* self, JSJitGetterCallArgs args)
930 : {
931 0 : RefPtr<EventHandlerNonNull> result(self->GetOnonline());
932 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
933 0 : if (result) {
934 0 : args.rval().setObjectOrNull(GetCallbackFromCallbackObject(result));
935 0 : if (!MaybeWrapObjectOrNullValue(cx, args.rval())) {
936 0 : return false;
937 : }
938 0 : return true;
939 : } else {
940 0 : args.rval().setNull();
941 0 : return true;
942 : }
943 : }
944 :
945 : static bool
946 0 : set_ononline(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLBodyElement* self, JSJitSetterCallArgs args)
947 : {
948 0 : RootedCallback<RefPtr<binding_detail::FastEventHandlerNonNull>> arg0(cx);
949 0 : if (args[0].isObject()) {
950 : { // scope for tempRoot
951 0 : JS::Rooted<JSObject*> tempRoot(cx, &args[0].toObject());
952 0 : arg0 = new binding_detail::FastEventHandlerNonNull(tempRoot);
953 : }
954 : } else {
955 0 : arg0 = nullptr;
956 : }
957 0 : self->SetOnonline(Constify(arg0));
958 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
959 :
960 0 : return true;
961 : }
962 :
963 : static const JSJitInfo ononline_getterinfo = {
964 : { (JSJitGetterOp)get_ononline },
965 : { prototypes::id::HTMLBodyElement },
966 : { PrototypeTraits<prototypes::id::HTMLBodyElement>::Depth },
967 : JSJitInfo::Getter,
968 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
969 : JSVAL_TYPE_UNKNOWN, /* returnType. Not relevant for setters. */
970 : false, /* isInfallible. False in setters. */
971 : false, /* isMovable. Not relevant for setters. */
972 : false, /* isEliminatable. Not relevant for setters. */
973 : false, /* isAlwaysInSlot. Only relevant for getters. */
974 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
975 : false, /* isTypedMethod. Only relevant for methods. */
976 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
977 : };
978 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
979 : static_assert(0 < 1, "There is no slot for us");
980 : static const JSJitInfo ononline_setterinfo = {
981 : { (JSJitGetterOp)set_ononline },
982 : { prototypes::id::HTMLBodyElement },
983 : { PrototypeTraits<prototypes::id::HTMLBodyElement>::Depth },
984 : JSJitInfo::Setter,
985 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
986 : JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */
987 : false, /* isInfallible. False in setters. */
988 : false, /* isMovable. Not relevant for setters. */
989 : false, /* isEliminatable. Not relevant for setters. */
990 : false, /* isAlwaysInSlot. Only relevant for getters. */
991 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
992 : false, /* isTypedMethod. Only relevant for methods. */
993 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
994 : };
995 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
996 : static_assert(0 < 1, "There is no slot for us");
997 :
998 : static bool
999 0 : get_onpagehide(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLBodyElement* self, JSJitGetterCallArgs args)
1000 : {
1001 0 : RefPtr<EventHandlerNonNull> result(self->GetOnpagehide());
1002 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
1003 0 : if (result) {
1004 0 : args.rval().setObjectOrNull(GetCallbackFromCallbackObject(result));
1005 0 : if (!MaybeWrapObjectOrNullValue(cx, args.rval())) {
1006 0 : return false;
1007 : }
1008 0 : return true;
1009 : } else {
1010 0 : args.rval().setNull();
1011 0 : return true;
1012 : }
1013 : }
1014 :
1015 : static bool
1016 0 : set_onpagehide(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLBodyElement* self, JSJitSetterCallArgs args)
1017 : {
1018 0 : RootedCallback<RefPtr<binding_detail::FastEventHandlerNonNull>> arg0(cx);
1019 0 : if (args[0].isObject()) {
1020 : { // scope for tempRoot
1021 0 : JS::Rooted<JSObject*> tempRoot(cx, &args[0].toObject());
1022 0 : arg0 = new binding_detail::FastEventHandlerNonNull(tempRoot);
1023 : }
1024 : } else {
1025 0 : arg0 = nullptr;
1026 : }
1027 0 : self->SetOnpagehide(Constify(arg0));
1028 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
1029 :
1030 0 : return true;
1031 : }
1032 :
1033 : static const JSJitInfo onpagehide_getterinfo = {
1034 : { (JSJitGetterOp)get_onpagehide },
1035 : { prototypes::id::HTMLBodyElement },
1036 : { PrototypeTraits<prototypes::id::HTMLBodyElement>::Depth },
1037 : JSJitInfo::Getter,
1038 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
1039 : JSVAL_TYPE_UNKNOWN, /* returnType. Not relevant for setters. */
1040 : false, /* isInfallible. False in setters. */
1041 : false, /* isMovable. Not relevant for setters. */
1042 : false, /* isEliminatable. Not relevant for setters. */
1043 : false, /* isAlwaysInSlot. Only relevant for getters. */
1044 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
1045 : false, /* isTypedMethod. Only relevant for methods. */
1046 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
1047 : };
1048 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
1049 : static_assert(0 < 1, "There is no slot for us");
1050 : static const JSJitInfo onpagehide_setterinfo = {
1051 : { (JSJitGetterOp)set_onpagehide },
1052 : { prototypes::id::HTMLBodyElement },
1053 : { PrototypeTraits<prototypes::id::HTMLBodyElement>::Depth },
1054 : JSJitInfo::Setter,
1055 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
1056 : JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */
1057 : false, /* isInfallible. False in setters. */
1058 : false, /* isMovable. Not relevant for setters. */
1059 : false, /* isEliminatable. Not relevant for setters. */
1060 : false, /* isAlwaysInSlot. Only relevant for getters. */
1061 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
1062 : false, /* isTypedMethod. Only relevant for methods. */
1063 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
1064 : };
1065 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
1066 : static_assert(0 < 1, "There is no slot for us");
1067 :
1068 : static bool
1069 0 : get_onpageshow(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLBodyElement* self, JSJitGetterCallArgs args)
1070 : {
1071 0 : RefPtr<EventHandlerNonNull> result(self->GetOnpageshow());
1072 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
1073 0 : if (result) {
1074 0 : args.rval().setObjectOrNull(GetCallbackFromCallbackObject(result));
1075 0 : if (!MaybeWrapObjectOrNullValue(cx, args.rval())) {
1076 0 : return false;
1077 : }
1078 0 : return true;
1079 : } else {
1080 0 : args.rval().setNull();
1081 0 : return true;
1082 : }
1083 : }
1084 :
1085 : static bool
1086 0 : set_onpageshow(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLBodyElement* self, JSJitSetterCallArgs args)
1087 : {
1088 0 : RootedCallback<RefPtr<binding_detail::FastEventHandlerNonNull>> arg0(cx);
1089 0 : if (args[0].isObject()) {
1090 : { // scope for tempRoot
1091 0 : JS::Rooted<JSObject*> tempRoot(cx, &args[0].toObject());
1092 0 : arg0 = new binding_detail::FastEventHandlerNonNull(tempRoot);
1093 : }
1094 : } else {
1095 0 : arg0 = nullptr;
1096 : }
1097 0 : self->SetOnpageshow(Constify(arg0));
1098 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
1099 :
1100 0 : return true;
1101 : }
1102 :
1103 : static const JSJitInfo onpageshow_getterinfo = {
1104 : { (JSJitGetterOp)get_onpageshow },
1105 : { prototypes::id::HTMLBodyElement },
1106 : { PrototypeTraits<prototypes::id::HTMLBodyElement>::Depth },
1107 : JSJitInfo::Getter,
1108 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
1109 : JSVAL_TYPE_UNKNOWN, /* returnType. Not relevant for setters. */
1110 : false, /* isInfallible. False in setters. */
1111 : false, /* isMovable. Not relevant for setters. */
1112 : false, /* isEliminatable. Not relevant for setters. */
1113 : false, /* isAlwaysInSlot. Only relevant for getters. */
1114 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
1115 : false, /* isTypedMethod. Only relevant for methods. */
1116 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
1117 : };
1118 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
1119 : static_assert(0 < 1, "There is no slot for us");
1120 : static const JSJitInfo onpageshow_setterinfo = {
1121 : { (JSJitGetterOp)set_onpageshow },
1122 : { prototypes::id::HTMLBodyElement },
1123 : { PrototypeTraits<prototypes::id::HTMLBodyElement>::Depth },
1124 : JSJitInfo::Setter,
1125 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
1126 : JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */
1127 : false, /* isInfallible. False in setters. */
1128 : false, /* isMovable. Not relevant for setters. */
1129 : false, /* isEliminatable. Not relevant for setters. */
1130 : false, /* isAlwaysInSlot. Only relevant for getters. */
1131 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
1132 : false, /* isTypedMethod. Only relevant for methods. */
1133 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
1134 : };
1135 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
1136 : static_assert(0 < 1, "There is no slot for us");
1137 :
1138 : static bool
1139 0 : get_onpopstate(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLBodyElement* self, JSJitGetterCallArgs args)
1140 : {
1141 0 : RefPtr<EventHandlerNonNull> result(self->GetOnpopstate());
1142 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
1143 0 : if (result) {
1144 0 : args.rval().setObjectOrNull(GetCallbackFromCallbackObject(result));
1145 0 : if (!MaybeWrapObjectOrNullValue(cx, args.rval())) {
1146 0 : return false;
1147 : }
1148 0 : return true;
1149 : } else {
1150 0 : args.rval().setNull();
1151 0 : return true;
1152 : }
1153 : }
1154 :
1155 : static bool
1156 0 : set_onpopstate(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLBodyElement* self, JSJitSetterCallArgs args)
1157 : {
1158 0 : RootedCallback<RefPtr<binding_detail::FastEventHandlerNonNull>> arg0(cx);
1159 0 : if (args[0].isObject()) {
1160 : { // scope for tempRoot
1161 0 : JS::Rooted<JSObject*> tempRoot(cx, &args[0].toObject());
1162 0 : arg0 = new binding_detail::FastEventHandlerNonNull(tempRoot);
1163 : }
1164 : } else {
1165 0 : arg0 = nullptr;
1166 : }
1167 0 : self->SetOnpopstate(Constify(arg0));
1168 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
1169 :
1170 0 : return true;
1171 : }
1172 :
1173 : static const JSJitInfo onpopstate_getterinfo = {
1174 : { (JSJitGetterOp)get_onpopstate },
1175 : { prototypes::id::HTMLBodyElement },
1176 : { PrototypeTraits<prototypes::id::HTMLBodyElement>::Depth },
1177 : JSJitInfo::Getter,
1178 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
1179 : JSVAL_TYPE_UNKNOWN, /* returnType. Not relevant for setters. */
1180 : false, /* isInfallible. False in setters. */
1181 : false, /* isMovable. Not relevant for setters. */
1182 : false, /* isEliminatable. Not relevant for setters. */
1183 : false, /* isAlwaysInSlot. Only relevant for getters. */
1184 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
1185 : false, /* isTypedMethod. Only relevant for methods. */
1186 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
1187 : };
1188 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
1189 : static_assert(0 < 1, "There is no slot for us");
1190 : static const JSJitInfo onpopstate_setterinfo = {
1191 : { (JSJitGetterOp)set_onpopstate },
1192 : { prototypes::id::HTMLBodyElement },
1193 : { PrototypeTraits<prototypes::id::HTMLBodyElement>::Depth },
1194 : JSJitInfo::Setter,
1195 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
1196 : JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */
1197 : false, /* isInfallible. False in setters. */
1198 : false, /* isMovable. Not relevant for setters. */
1199 : false, /* isEliminatable. Not relevant for setters. */
1200 : false, /* isAlwaysInSlot. Only relevant for getters. */
1201 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
1202 : false, /* isTypedMethod. Only relevant for methods. */
1203 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
1204 : };
1205 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
1206 : static_assert(0 < 1, "There is no slot for us");
1207 :
1208 : static bool
1209 0 : get_onstorage(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLBodyElement* self, JSJitGetterCallArgs args)
1210 : {
1211 0 : RefPtr<EventHandlerNonNull> result(self->GetOnstorage());
1212 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
1213 0 : if (result) {
1214 0 : args.rval().setObjectOrNull(GetCallbackFromCallbackObject(result));
1215 0 : if (!MaybeWrapObjectOrNullValue(cx, args.rval())) {
1216 0 : return false;
1217 : }
1218 0 : return true;
1219 : } else {
1220 0 : args.rval().setNull();
1221 0 : return true;
1222 : }
1223 : }
1224 :
1225 : static bool
1226 0 : set_onstorage(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLBodyElement* self, JSJitSetterCallArgs args)
1227 : {
1228 0 : RootedCallback<RefPtr<binding_detail::FastEventHandlerNonNull>> arg0(cx);
1229 0 : if (args[0].isObject()) {
1230 : { // scope for tempRoot
1231 0 : JS::Rooted<JSObject*> tempRoot(cx, &args[0].toObject());
1232 0 : arg0 = new binding_detail::FastEventHandlerNonNull(tempRoot);
1233 : }
1234 : } else {
1235 0 : arg0 = nullptr;
1236 : }
1237 0 : self->SetOnstorage(Constify(arg0));
1238 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
1239 :
1240 0 : return true;
1241 : }
1242 :
1243 : static const JSJitInfo onstorage_getterinfo = {
1244 : { (JSJitGetterOp)get_onstorage },
1245 : { prototypes::id::HTMLBodyElement },
1246 : { PrototypeTraits<prototypes::id::HTMLBodyElement>::Depth },
1247 : JSJitInfo::Getter,
1248 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
1249 : JSVAL_TYPE_UNKNOWN, /* returnType. Not relevant for setters. */
1250 : false, /* isInfallible. False in setters. */
1251 : false, /* isMovable. Not relevant for setters. */
1252 : false, /* isEliminatable. Not relevant for setters. */
1253 : false, /* isAlwaysInSlot. Only relevant for getters. */
1254 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
1255 : false, /* isTypedMethod. Only relevant for methods. */
1256 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
1257 : };
1258 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
1259 : static_assert(0 < 1, "There is no slot for us");
1260 : static const JSJitInfo onstorage_setterinfo = {
1261 : { (JSJitGetterOp)set_onstorage },
1262 : { prototypes::id::HTMLBodyElement },
1263 : { PrototypeTraits<prototypes::id::HTMLBodyElement>::Depth },
1264 : JSJitInfo::Setter,
1265 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
1266 : JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */
1267 : false, /* isInfallible. False in setters. */
1268 : false, /* isMovable. Not relevant for setters. */
1269 : false, /* isEliminatable. Not relevant for setters. */
1270 : false, /* isAlwaysInSlot. Only relevant for getters. */
1271 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
1272 : false, /* isTypedMethod. Only relevant for methods. */
1273 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
1274 : };
1275 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
1276 : static_assert(0 < 1, "There is no slot for us");
1277 :
1278 : static bool
1279 0 : get_onunload(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLBodyElement* self, JSJitGetterCallArgs args)
1280 : {
1281 0 : RefPtr<EventHandlerNonNull> result(self->GetOnunload());
1282 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
1283 0 : if (result) {
1284 0 : args.rval().setObjectOrNull(GetCallbackFromCallbackObject(result));
1285 0 : if (!MaybeWrapObjectOrNullValue(cx, args.rval())) {
1286 0 : return false;
1287 : }
1288 0 : return true;
1289 : } else {
1290 0 : args.rval().setNull();
1291 0 : return true;
1292 : }
1293 : }
1294 :
1295 : static bool
1296 0 : set_onunload(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLBodyElement* self, JSJitSetterCallArgs args)
1297 : {
1298 0 : RootedCallback<RefPtr<binding_detail::FastEventHandlerNonNull>> arg0(cx);
1299 0 : if (args[0].isObject()) {
1300 : { // scope for tempRoot
1301 0 : JS::Rooted<JSObject*> tempRoot(cx, &args[0].toObject());
1302 0 : arg0 = new binding_detail::FastEventHandlerNonNull(tempRoot);
1303 : }
1304 : } else {
1305 0 : arg0 = nullptr;
1306 : }
1307 0 : self->SetOnunload(Constify(arg0));
1308 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
1309 :
1310 0 : return true;
1311 : }
1312 :
1313 : static const JSJitInfo onunload_getterinfo = {
1314 : { (JSJitGetterOp)get_onunload },
1315 : { prototypes::id::HTMLBodyElement },
1316 : { PrototypeTraits<prototypes::id::HTMLBodyElement>::Depth },
1317 : JSJitInfo::Getter,
1318 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
1319 : JSVAL_TYPE_UNKNOWN, /* returnType. Not relevant for setters. */
1320 : false, /* isInfallible. False in setters. */
1321 : false, /* isMovable. Not relevant for setters. */
1322 : false, /* isEliminatable. Not relevant for setters. */
1323 : false, /* isAlwaysInSlot. Only relevant for getters. */
1324 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
1325 : false, /* isTypedMethod. Only relevant for methods. */
1326 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
1327 : };
1328 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
1329 : static_assert(0 < 1, "There is no slot for us");
1330 : static const JSJitInfo onunload_setterinfo = {
1331 : { (JSJitGetterOp)set_onunload },
1332 : { prototypes::id::HTMLBodyElement },
1333 : { PrototypeTraits<prototypes::id::HTMLBodyElement>::Depth },
1334 : JSJitInfo::Setter,
1335 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
1336 : JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */
1337 : false, /* isInfallible. False in setters. */
1338 : false, /* isMovable. Not relevant for setters. */
1339 : false, /* isEliminatable. Not relevant for setters. */
1340 : false, /* isAlwaysInSlot. Only relevant for getters. */
1341 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
1342 : false, /* isTypedMethod. Only relevant for methods. */
1343 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
1344 : };
1345 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
1346 : static_assert(0 < 1, "There is no slot for us");
1347 :
1348 : static bool
1349 0 : _addProperty(JSContext* cx, JS::Handle<JSObject*> obj, JS::Handle<jsid> id, JS::Handle<JS::Value> val)
1350 : {
1351 0 : mozilla::dom::HTMLBodyElement* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::dom::HTMLBodyElement>(obj);
1352 : // We don't want to preserve if we don't have a wrapper, and we
1353 : // obviously can't preserve if we're not initialized.
1354 0 : if (self && self->GetWrapperPreserveColor()) {
1355 0 : PreserveWrapper(self);
1356 : }
1357 0 : return true;
1358 : }
1359 :
1360 : static void
1361 0 : _finalize(js::FreeOp* fop, JSObject* obj)
1362 : {
1363 0 : mozilla::dom::HTMLBodyElement* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::dom::HTMLBodyElement>(obj);
1364 0 : if (self) {
1365 0 : ClearWrapper(self, self, obj);
1366 0 : AddForDeferredFinalization<mozilla::dom::HTMLBodyElement>(self);
1367 : }
1368 0 : }
1369 :
1370 : static void
1371 0 : _objectMoved(JSObject* obj, const JSObject* old)
1372 : {
1373 0 : mozilla::dom::HTMLBodyElement* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::dom::HTMLBodyElement>(obj);
1374 0 : if (self) {
1375 0 : UpdateWrapper(self, self, obj, old);
1376 : }
1377 0 : }
1378 :
1379 : // We deliberately use brace-elision to make Visual Studio produce better initalization code.
1380 : #if defined(__clang__)
1381 : #pragma clang diagnostic push
1382 : #pragma clang diagnostic ignored "-Wmissing-braces"
1383 : #endif
1384 : static const JSPropertySpec sAttributes_specs[] = {
1385 : { "text", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &text_getterinfo, GenericBindingSetter, &text_setterinfo },
1386 : { "link", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &link_getterinfo, GenericBindingSetter, &link_setterinfo },
1387 : { "vLink", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &vLink_getterinfo, GenericBindingSetter, &vLink_setterinfo },
1388 : { "aLink", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &aLink_getterinfo, GenericBindingSetter, &aLink_setterinfo },
1389 : { "bgColor", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &bgColor_getterinfo, GenericBindingSetter, &bgColor_setterinfo },
1390 : { "background", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &background_getterinfo, GenericBindingSetter, &background_setterinfo },
1391 : { "onafterprint", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &onafterprint_getterinfo, GenericBindingSetter, &onafterprint_setterinfo },
1392 : { "onbeforeprint", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &onbeforeprint_getterinfo, GenericBindingSetter, &onbeforeprint_setterinfo },
1393 : { "onbeforeunload", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &onbeforeunload_getterinfo, GenericBindingSetter, &onbeforeunload_setterinfo },
1394 : { "onhashchange", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &onhashchange_getterinfo, GenericBindingSetter, &onhashchange_setterinfo },
1395 : { "onlanguagechange", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &onlanguagechange_getterinfo, GenericBindingSetter, &onlanguagechange_setterinfo },
1396 : { "onmessage", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &onmessage_getterinfo, GenericBindingSetter, &onmessage_setterinfo },
1397 : { "onoffline", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &onoffline_getterinfo, GenericBindingSetter, &onoffline_setterinfo },
1398 : { "ononline", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &ononline_getterinfo, GenericBindingSetter, &ononline_setterinfo },
1399 : { "onpagehide", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &onpagehide_getterinfo, GenericBindingSetter, &onpagehide_setterinfo },
1400 : { "onpageshow", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &onpageshow_getterinfo, GenericBindingSetter, &onpageshow_setterinfo },
1401 : { "onpopstate", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &onpopstate_getterinfo, GenericBindingSetter, &onpopstate_setterinfo },
1402 : { "onstorage", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &onstorage_getterinfo, GenericBindingSetter, &onstorage_setterinfo },
1403 : { "onunload", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &onunload_getterinfo, GenericBindingSetter, &onunload_setterinfo },
1404 : { nullptr, 0, nullptr, nullptr, nullptr, nullptr }
1405 : };
1406 : #if defined(__clang__)
1407 : #pragma clang diagnostic pop
1408 : #endif
1409 :
1410 :
1411 : // Can't be const because the pref-enabled boolean needs to be writable
1412 : static Prefable<const JSPropertySpec> sAttributes[] = {
1413 : { nullptr, &sAttributes_specs[0] },
1414 : { nullptr, nullptr }
1415 : };
1416 :
1417 : static_assert(1 <= 1ull << NUM_BITS_PROPERTY_INFO_PREF_INDEX,
1418 : "We have a prefable index that is >= (1 << NUM_BITS_PROPERTY_INFO_PREF_INDEX)");
1419 : static_assert(19 <= 1ull << NUM_BITS_PROPERTY_INFO_SPEC_INDEX,
1420 : "We have a spec index that is >= (1 << NUM_BITS_PROPERTY_INFO_SPEC_INDEX)");
1421 :
1422 :
1423 : static uint16_t sNativeProperties_sortedPropertyIndices[19];
1424 : static PropertyInfo sNativeProperties_propertyInfos[19];
1425 :
1426 : static const NativePropertiesN<1> sNativeProperties = {
1427 : false, 0,
1428 : false, 0,
1429 : false, 0,
1430 : true, 0 /* sAttributes */,
1431 : false, 0,
1432 : false, 0,
1433 : false, 0,
1434 : -1,
1435 : 19,
1436 : sNativeProperties_sortedPropertyIndices,
1437 : {
1438 : { sAttributes, &sNativeProperties_propertyInfos[0] }
1439 : }
1440 : };
1441 : static_assert(19 < 1ull << CHAR_BIT * sizeof(sNativeProperties.propertyInfoCount),
1442 : "We have a property info count that is oversized");
1443 :
1444 : static bool
1445 0 : _constructor(JSContext* cx, unsigned argc, JS::Value* vp)
1446 : {
1447 0 : JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
1448 0 : JS::Rooted<JSObject*> obj(cx, &args.callee());
1449 0 : if (!args.isConstructing()) {
1450 : // XXXbz wish I could get the name from the callee instead of
1451 : // Adding more relocations
1452 0 : return ThrowConstructorWithoutNew(cx, "HTMLBodyElement");
1453 : }
1454 :
1455 0 : GlobalObject global(cx, obj);
1456 0 : if (global.Failed()) {
1457 0 : return false;
1458 : }
1459 :
1460 : // The newTarget might be a cross-compartment wrapper. Get the underlying object
1461 : // so we can do the spec's object-identity checks.
1462 0 : JS::Rooted<JSObject*> newTarget(cx, js::CheckedUnwrap(&args.newTarget().toObject()));
1463 0 : if (!newTarget) {
1464 0 : return ThrowErrorMessage(cx, MSG_ILLEGAL_CONSTRUCTOR);
1465 : }
1466 :
1467 : // Step 2 of https://html.spec.whatwg.org/multipage/dom.html#htmlconstructor.
1468 : // Enter the compartment of our underlying newTarget object, so we end
1469 : // up comparing to the constructor object for our interface from that global.
1470 : {
1471 0 : JSAutoCompartment ac(cx, newTarget);
1472 0 : JS::Handle<JSObject*> constructor(GetConstructorObjectHandle(cx));
1473 0 : if (!constructor) {
1474 0 : return false;
1475 : }
1476 0 : if (newTarget == constructor) {
1477 0 : return ThrowErrorMessage(cx, MSG_ILLEGAL_CONSTRUCTOR);
1478 : }
1479 : }
1480 :
1481 0 : JS::Rooted<JSObject*> desiredProto(cx);
1482 0 : if (!GetDesiredProto(cx, args, &desiredProto)) {
1483 0 : return false;
1484 : }
1485 0 : if (!desiredProto) {
1486 : // Step 7 of https://html.spec.whatwg.org/multipage/dom.html#htmlconstructor.
1487 : // This fallback behavior is designed to match analogous behavior for the
1488 : // JavaScript built-ins. So we enter the compartment of our underlying
1489 : // newTarget object and fall back to the prototype object from that global.
1490 : // XXX The spec says to use GetFunctionRealm(), which is not actually
1491 : // the same thing as what we have here (e.g. in the case of scripted callable proxies
1492 : // whose target is not same-compartment with the proxy, or bound functions, etc).
1493 : // https://bugzilla.mozilla.org/show_bug.cgi?id=1317658
1494 : {
1495 0 : JSAutoCompartment ac(cx, newTarget);
1496 0 : desiredProto = GetProtoObjectHandle(cx);
1497 0 : if (!desiredProto) {
1498 0 : return false;
1499 : }
1500 : }
1501 :
1502 : // desiredProto is in the compartment of the underlying newTarget object.
1503 : // Wrap it into the context compartment.
1504 0 : if (!JS_WrapObject(cx, &desiredProto)) {
1505 0 : return false;
1506 : }
1507 : }
1508 :
1509 0 : bool objIsXray = xpc::WrapperFactory::IsXrayWrapper(obj);
1510 0 : Maybe<JSAutoCompartment> ac;
1511 0 : if (objIsXray) {
1512 0 : obj = js::CheckedUnwrap(obj);
1513 0 : if (!obj) {
1514 0 : return false;
1515 : }
1516 0 : ac.emplace(cx, obj);
1517 0 : if (!JS_WrapObject(cx, &desiredProto)) {
1518 0 : return false;
1519 : }
1520 : }
1521 0 : binding_detail::FastErrorResult rv;
1522 0 : auto result(StrongOrRawPtr<mozilla::dom::HTMLBodyElement>(CreateHTMLElement(global, args, rv)));
1523 0 : if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
1524 0 : return false;
1525 : }
1526 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
1527 : static_assert(!IsPointer<decltype(result)>::value,
1528 : "NewObject implies that we need to keep the object alive with a strong reference.");
1529 0 : if (!GetOrCreateDOMReflector(cx, result, args.rval(), desiredProto)) {
1530 0 : MOZ_ASSERT(true || JS_IsExceptionPending(cx));
1531 0 : return false;
1532 : }
1533 0 : return true;
1534 : }
1535 :
1536 : static const js::ClassOps sInterfaceObjectClassOps = {
1537 : nullptr, /* addProperty */
1538 : nullptr, /* delProperty */
1539 : nullptr, /* getProperty */
1540 : nullptr, /* setProperty */
1541 : nullptr, /* enumerate */
1542 : nullptr, /* newEnumerate */
1543 : nullptr, /* resolve */
1544 : nullptr, /* mayResolve */
1545 : nullptr, /* finalize */
1546 : _constructor, /* call */
1547 : nullptr, /* hasInstance */
1548 : _constructor, /* construct */
1549 : nullptr, /* trace */
1550 : };
1551 :
1552 : static const DOMIfaceAndProtoJSClass sInterfaceObjectClass = {
1553 : {
1554 : "Function",
1555 : JSCLASS_IS_DOMIFACEANDPROTOJSCLASS | JSCLASS_HAS_RESERVED_SLOTS(DOM_INTERFACE_SLOTS_BASE),
1556 : &sInterfaceObjectClassOps,
1557 : JS_NULL_CLASS_SPEC,
1558 : JS_NULL_CLASS_EXT,
1559 : &sInterfaceObjectClassObjectOps
1560 : },
1561 : eInterface,
1562 : true,
1563 : prototypes::id::HTMLBodyElement,
1564 : PrototypeTraits<prototypes::id::HTMLBodyElement>::Depth,
1565 : sNativePropertyHooks,
1566 : "function HTMLBodyElement() {\n [native code]\n}",
1567 : HTMLElementBinding::GetConstructorObject
1568 : };
1569 :
1570 : static const DOMIfaceAndProtoJSClass sPrototypeClass = {
1571 : {
1572 : "HTMLBodyElementPrototype",
1573 : JSCLASS_IS_DOMIFACEANDPROTOJSCLASS | JSCLASS_HAS_RESERVED_SLOTS(DOM_INTERFACE_PROTO_SLOTS_BASE),
1574 : JS_NULL_CLASS_OPS,
1575 : JS_NULL_CLASS_SPEC,
1576 : JS_NULL_CLASS_EXT,
1577 : JS_NULL_OBJECT_OPS
1578 : },
1579 : eInterfacePrototype,
1580 : false,
1581 : prototypes::id::HTMLBodyElement,
1582 : PrototypeTraits<prototypes::id::HTMLBodyElement>::Depth,
1583 : sNativePropertyHooks,
1584 : "[object HTMLBodyElementPrototype]",
1585 : HTMLElementBinding::GetProtoObject
1586 : };
1587 :
1588 : JSObject*
1589 0 : DefineDOMInterface(JSContext* aCx, JS::Handle<JSObject*> aGlobal, JS::Handle<jsid> id, bool aDefineOnGlobal)
1590 : {
1591 0 : return GetConstructorObjectHandle(aCx, aDefineOnGlobal);
1592 : }
1593 :
1594 : static const js::ClassOps sClassOps = {
1595 : _addProperty, /* addProperty */
1596 : nullptr, /* delProperty */
1597 : nullptr, /* getProperty */
1598 : nullptr, /* setProperty */
1599 : nullptr, /* enumerate */
1600 : nullptr, /* newEnumerate */
1601 : nullptr, /* resolve */
1602 : nullptr, /* mayResolve */
1603 : _finalize, /* finalize */
1604 : nullptr, /* call */
1605 : nullptr, /* hasInstance */
1606 : nullptr, /* construct */
1607 : nullptr, /* trace */
1608 : };
1609 :
1610 : static const js::ClassExtension sClassExtension = {
1611 : nullptr, /* weakmapKeyDelegateOp */
1612 : _objectMoved /* objectMovedOp */
1613 : };
1614 :
1615 : static const DOMJSClass sClass = {
1616 : { "HTMLBodyElement",
1617 : JSCLASS_IS_DOMJSCLASS | JSCLASS_FOREGROUND_FINALIZE | JSCLASS_HAS_RESERVED_SLOTS(1),
1618 : &sClassOps,
1619 : JS_NULL_CLASS_SPEC,
1620 : &sClassExtension,
1621 : JS_NULL_OBJECT_OPS
1622 : },
1623 : { prototypes::id::EventTarget, prototypes::id::Node, prototypes::id::Element, prototypes::id::HTMLElement, prototypes::id::HTMLBodyElement, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count },
1624 : IsBaseOf<nsISupports, mozilla::dom::HTMLBodyElement >::value,
1625 : sNativePropertyHooks,
1626 : FindAssociatedGlobalForNative<mozilla::dom::HTMLBodyElement>::Get,
1627 : GetProtoObjectHandle,
1628 : GetCCParticipant<mozilla::dom::HTMLBodyElement>::Get()
1629 : };
1630 : static_assert(1 == DOM_INSTANCE_RESERVED_SLOTS,
1631 : "Must have the right minimal number of reserved slots.");
1632 : static_assert(1 >= 1,
1633 : "Must have enough reserved slots.");
1634 :
1635 : const JSClass*
1636 0 : GetJSClass()
1637 : {
1638 0 : return sClass.ToJSClass();
1639 : }
1640 :
1641 : bool
1642 1 : Wrap(JSContext* aCx, mozilla::dom::HTMLBodyElement* aObject, nsWrapperCache* aCache, JS::Handle<JSObject*> aGivenProto, JS::MutableHandle<JSObject*> aReflector)
1643 : {
1644 : MOZ_ASSERT(static_cast<mozilla::dom::HTMLBodyElement*>(aObject) ==
1645 : reinterpret_cast<mozilla::dom::HTMLBodyElement*>(aObject),
1646 : "Multiple inheritance for mozilla::dom::HTMLBodyElement is broken.");
1647 : MOZ_ASSERT(static_cast<nsGenericHTMLElement*>(aObject) ==
1648 : reinterpret_cast<nsGenericHTMLElement*>(aObject),
1649 : "Multiple inheritance for nsGenericHTMLElement is broken.");
1650 : MOZ_ASSERT(static_cast<mozilla::dom::Element*>(aObject) ==
1651 : reinterpret_cast<mozilla::dom::Element*>(aObject),
1652 : "Multiple inheritance for mozilla::dom::Element is broken.");
1653 : MOZ_ASSERT(static_cast<nsINode*>(aObject) ==
1654 : reinterpret_cast<nsINode*>(aObject),
1655 : "Multiple inheritance for nsINode is broken.");
1656 : MOZ_ASSERT(static_cast<mozilla::dom::EventTarget*>(aObject) ==
1657 : reinterpret_cast<mozilla::dom::EventTarget*>(aObject),
1658 : "Multiple inheritance for mozilla::dom::EventTarget is broken.");
1659 1 : MOZ_ASSERT(ToSupportsIsCorrect(aObject));
1660 1 : MOZ_ASSERT_IF(aGivenProto, js::IsObjectInContextCompartment(aGivenProto, aCx));
1661 1 : MOZ_ASSERT(!aCache->GetWrapper(),
1662 : "You should probably not be using Wrap() directly; use "
1663 : "GetOrCreateDOMReflector instead");
1664 :
1665 1 : MOZ_ASSERT(ToSupportsIsOnPrimaryInheritanceChain(aObject, aCache),
1666 : "nsISupports must be on our primary inheritance chain");
1667 :
1668 2 : JS::Rooted<JSObject*> global(aCx, FindAssociatedGlobal(aCx, aObject->GetParentObject()));
1669 1 : if (!global) {
1670 0 : return false;
1671 : }
1672 1 : MOZ_ASSERT(JS_IsGlobalObject(global));
1673 1 : MOZ_ASSERT(JS::ObjectIsNotGray(global));
1674 :
1675 : // That might have ended up wrapping us already, due to the wonders
1676 : // of XBL. Check for that, and bail out as needed.
1677 1 : aReflector.set(aCache->GetWrapper());
1678 1 : if (aReflector) {
1679 : #ifdef DEBUG
1680 0 : binding_detail::AssertReflectorHasGivenProto(aCx, aReflector, aGivenProto);
1681 : #endif // DEBUG
1682 0 : return true;
1683 : }
1684 :
1685 2 : JSAutoCompartment ac(aCx, global);
1686 1 : JS::Handle<JSObject*> canonicalProto = GetProtoObjectHandle(aCx);
1687 1 : if (!canonicalProto) {
1688 0 : return false;
1689 : }
1690 2 : JS::Rooted<JSObject*> proto(aCx);
1691 1 : if (aGivenProto) {
1692 0 : proto = aGivenProto;
1693 : // Unfortunately, while aGivenProto was in the compartment of aCx
1694 : // coming in, we changed compartments to that of "parent" so may need
1695 : // to wrap the proto here.
1696 0 : if (js::GetContextCompartment(aCx) != js::GetObjectCompartment(proto)) {
1697 0 : if (!JS_WrapObject(aCx, &proto)) {
1698 0 : return false;
1699 : }
1700 : }
1701 : } else {
1702 1 : proto = canonicalProto;
1703 : }
1704 :
1705 2 : BindingJSObjectCreator<mozilla::dom::HTMLBodyElement> creator(aCx);
1706 1 : creator.CreateObject(aCx, sClass.ToJSClass(), proto, aObject, aReflector);
1707 1 : if (!aReflector) {
1708 0 : return false;
1709 : }
1710 :
1711 1 : aCache->SetWrapper(aReflector);
1712 1 : creator.InitializationSucceeded();
1713 :
1714 1 : MOZ_ASSERT(aCache->GetWrapperPreserveColor() &&
1715 : aCache->GetWrapperPreserveColor() == aReflector);
1716 : // If proto != canonicalProto, we have to preserve our wrapper;
1717 : // otherwise we won't be able to properly recreate it later, since
1718 : // we won't know what proto to use. Note that we don't check
1719 : // aGivenProto here, since it's entirely possible (and even
1720 : // somewhat common) to have a non-null aGivenProto which is the
1721 : // same as canonicalProto.
1722 1 : if (proto != canonicalProto) {
1723 0 : PreserveWrapper(aObject);
1724 : }
1725 :
1726 1 : return true;
1727 : }
1728 :
1729 : const NativePropertyHooks sNativePropertyHooks[] = { {
1730 : nullptr,
1731 : nullptr,
1732 : nullptr,
1733 : { sNativeProperties.Upcast(), nullptr },
1734 : prototypes::id::HTMLBodyElement,
1735 : constructors::id::HTMLBodyElement,
1736 : HTMLElementBinding::sNativePropertyHooks,
1737 : &DefaultXrayExpandoObjectClass
1738 : } };
1739 :
1740 : void
1741 1 : CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, bool aDefineOnGlobal)
1742 : {
1743 1 : JS::Handle<JSObject*> parentProto(HTMLElementBinding::GetProtoObjectHandle(aCx));
1744 1 : if (!parentProto) {
1745 0 : return;
1746 : }
1747 :
1748 1 : JS::Handle<JSObject*> constructorProto(HTMLElementBinding::GetConstructorObjectHandle(aCx));
1749 1 : if (!constructorProto) {
1750 0 : return;
1751 : }
1752 :
1753 : static bool sIdsInited = false;
1754 1 : if (!sIdsInited && NS_IsMainThread()) {
1755 1 : if (!InitIds(aCx, sNativeProperties.Upcast())) {
1756 0 : return;
1757 : }
1758 1 : sIdsInited = true;
1759 : }
1760 :
1761 1 : JS::Heap<JSObject*>* protoCache = &aProtoAndIfaceCache.EntrySlotOrCreate(prototypes::id::HTMLBodyElement);
1762 1 : JS::Heap<JSObject*>* interfaceCache = &aProtoAndIfaceCache.EntrySlotOrCreate(constructors::id::HTMLBodyElement);
1763 1 : dom::CreateInterfaceObjects(aCx, aGlobal, parentProto,
1764 : &sPrototypeClass.mBase, protoCache,
1765 : constructorProto, &sInterfaceObjectClass.mBase, 0, nullptr,
1766 : interfaceCache,
1767 : sNativeProperties.Upcast(),
1768 : nullptr,
1769 : "HTMLBodyElement", aDefineOnGlobal,
1770 : nullptr,
1771 1 : false);
1772 : }
1773 :
1774 : JS::Handle<JSObject*>
1775 1 : GetProtoObjectHandle(JSContext* aCx)
1776 : {
1777 : /* Get the interface prototype object for this class. This will create the
1778 : object as needed. */
1779 1 : bool aDefineOnGlobal = true;
1780 :
1781 : /* Make sure our global is sane. Hopefully we can remove this sometime */
1782 1 : JSObject* global = JS::CurrentGlobalOrNull(aCx);
1783 1 : if (!(js::GetObjectClass(global)->flags & JSCLASS_DOM_GLOBAL)) {
1784 0 : return nullptr;
1785 : }
1786 :
1787 : /* Check to see whether the interface objects are already installed */
1788 1 : ProtoAndIfaceCache& protoAndIfaceCache = *GetProtoAndIfaceCache(global);
1789 1 : if (!protoAndIfaceCache.HasEntryInSlot(prototypes::id::HTMLBodyElement)) {
1790 2 : JS::Rooted<JSObject*> rootedGlobal(aCx, global);
1791 1 : CreateInterfaceObjects(aCx, rootedGlobal, protoAndIfaceCache, aDefineOnGlobal);
1792 : }
1793 :
1794 : /*
1795 : * The object might _still_ be null, but that's OK.
1796 : *
1797 : * Calling fromMarkedLocation() is safe because protoAndIfaceCache is
1798 : * traced by TraceProtoAndIfaceCache() and its contents are never
1799 : * changed after they have been set.
1800 : *
1801 : * Calling address() avoids the read read barrier that does gray
1802 : * unmarking, but it's not possible for the object to be gray here.
1803 : */
1804 :
1805 1 : const JS::Heap<JSObject*>& entrySlot = protoAndIfaceCache.EntrySlotMustExist(prototypes::id::HTMLBodyElement);
1806 1 : MOZ_ASSERT(JS::ObjectIsNotGray(entrySlot));
1807 1 : return JS::Handle<JSObject*>::fromMarkedLocation(entrySlot.address());
1808 : }
1809 :
1810 : JS::Handle<JSObject*>
1811 0 : GetConstructorObjectHandle(JSContext* aCx, bool aDefineOnGlobal)
1812 : {
1813 : /* Get the interface object for this class. This will create the object as
1814 : needed. */
1815 :
1816 : /* Make sure our global is sane. Hopefully we can remove this sometime */
1817 0 : JSObject* global = JS::CurrentGlobalOrNull(aCx);
1818 0 : if (!(js::GetObjectClass(global)->flags & JSCLASS_DOM_GLOBAL)) {
1819 0 : return nullptr;
1820 : }
1821 :
1822 : /* Check to see whether the interface objects are already installed */
1823 0 : ProtoAndIfaceCache& protoAndIfaceCache = *GetProtoAndIfaceCache(global);
1824 0 : if (!protoAndIfaceCache.HasEntryInSlot(constructors::id::HTMLBodyElement)) {
1825 0 : JS::Rooted<JSObject*> rootedGlobal(aCx, global);
1826 0 : CreateInterfaceObjects(aCx, rootedGlobal, protoAndIfaceCache, aDefineOnGlobal);
1827 : }
1828 :
1829 : /*
1830 : * The object might _still_ be null, but that's OK.
1831 : *
1832 : * Calling fromMarkedLocation() is safe because protoAndIfaceCache is
1833 : * traced by TraceProtoAndIfaceCache() and its contents are never
1834 : * changed after they have been set.
1835 : *
1836 : * Calling address() avoids the read read barrier that does gray
1837 : * unmarking, but it's not possible for the object to be gray here.
1838 : */
1839 :
1840 0 : const JS::Heap<JSObject*>& entrySlot = protoAndIfaceCache.EntrySlotMustExist(constructors::id::HTMLBodyElement);
1841 0 : MOZ_ASSERT(JS::ObjectIsNotGray(entrySlot));
1842 0 : return JS::Handle<JSObject*>::fromMarkedLocation(entrySlot.address());
1843 : }
1844 :
1845 : JSObject*
1846 0 : GetConstructorObject(JSContext* aCx)
1847 : {
1848 0 : return GetConstructorObjectHandle(aCx);
1849 : }
1850 :
1851 : } // namespace HTMLBodyElementBinding
1852 :
1853 :
1854 :
1855 : } // namespace dom
1856 : } // namespace mozilla
|