Line data Source code
1 : /* THIS FILE IS AUTOGENERATED FROM HTMLFrameElement.webidl BY Codegen.py - DO NOT EDIT */
2 :
3 : #include "HTMLElementBinding.h"
4 : #include "HTMLFrameElementBinding.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/HTMLFrameElement.h"
11 : #include "mozilla/dom/HTMLIFrameElement.h"
12 : #include "mozilla/dom/NonRefcountedDOMObject.h"
13 : #include "mozilla/dom/Nullable.h"
14 : #include "mozilla/dom/PrimitiveConversions.h"
15 : #include "mozilla/dom/XrayExpandoClass.h"
16 : #include "nsContentUtils.h"
17 : #include "nsIDocument.h"
18 : #include "nsIFrameLoader.h"
19 : #include "nsPIDOMWindow.h"
20 : #include "nsXULElement.h"
21 :
22 : namespace mozilla {
23 : namespace dom {
24 :
25 : namespace HTMLFrameElementBinding {
26 :
27 : static_assert(IsRefcounted<NativeType>::value == IsRefcounted<HTMLElementBinding::NativeType>::value,
28 : "Can't inherit from an interface with a different ownership model.");
29 :
30 : static bool
31 0 : get_name(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLFrameElement* self, JSJitGetterCallArgs args)
32 : {
33 0 : DOMString result;
34 0 : self->GetName(result);
35 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
36 0 : if (!xpc::NonVoidStringToJsval(cx, result, args.rval())) {
37 0 : return false;
38 : }
39 0 : return true;
40 : }
41 :
42 : static bool
43 0 : set_name(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLFrameElement* self, JSJitSetterCallArgs args)
44 : {
45 0 : binding_detail::FakeString arg0;
46 0 : if (!ConvertJSValueToString(cx, args[0], eStringify, eStringify, arg0)) {
47 0 : return false;
48 : }
49 0 : CustomElementReactionsStack* reactionsStack = GetCustomElementReactionsStack(obj);
50 0 : Maybe<AutoCEReaction> ceReaction;
51 0 : if (reactionsStack) {
52 0 : ceReaction.emplace(reactionsStack);
53 : }
54 0 : binding_detail::FastErrorResult rv;
55 0 : self->SetName(NonNullHelper(Constify(arg0)), rv);
56 0 : if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
57 0 : return false;
58 : }
59 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
60 :
61 0 : return true;
62 : }
63 :
64 : static const JSJitInfo name_getterinfo = {
65 : { (JSJitGetterOp)get_name },
66 : { prototypes::id::HTMLFrameElement },
67 : { PrototypeTraits<prototypes::id::HTMLFrameElement>::Depth },
68 : JSJitInfo::Getter,
69 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
70 : JSVAL_TYPE_STRING, /* returnType. Not relevant for setters. */
71 : false, /* isInfallible. False in setters. */
72 : false, /* isMovable. Not relevant for setters. */
73 : false, /* isEliminatable. Not relevant for setters. */
74 : false, /* isAlwaysInSlot. Only relevant for getters. */
75 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
76 : false, /* isTypedMethod. Only relevant for methods. */
77 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
78 : };
79 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
80 : static_assert(0 < 1, "There is no slot for us");
81 : static const JSJitInfo name_setterinfo = {
82 : { (JSJitGetterOp)set_name },
83 : { prototypes::id::HTMLFrameElement },
84 : { PrototypeTraits<prototypes::id::HTMLFrameElement>::Depth },
85 : JSJitInfo::Setter,
86 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
87 : JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */
88 : false, /* isInfallible. False in setters. */
89 : false, /* isMovable. Not relevant for setters. */
90 : false, /* isEliminatable. Not relevant for setters. */
91 : false, /* isAlwaysInSlot. Only relevant for getters. */
92 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
93 : false, /* isTypedMethod. Only relevant for methods. */
94 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
95 : };
96 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
97 : static_assert(0 < 1, "There is no slot for us");
98 :
99 : static bool
100 0 : get_scrolling(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLFrameElement* self, JSJitGetterCallArgs args)
101 : {
102 0 : DOMString result;
103 0 : self->GetScrolling(result);
104 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
105 0 : if (!xpc::NonVoidStringToJsval(cx, result, args.rval())) {
106 0 : return false;
107 : }
108 0 : return true;
109 : }
110 :
111 : static bool
112 0 : set_scrolling(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLFrameElement* self, JSJitSetterCallArgs args)
113 : {
114 0 : binding_detail::FakeString arg0;
115 0 : if (!ConvertJSValueToString(cx, args[0], eStringify, eStringify, arg0)) {
116 0 : return false;
117 : }
118 0 : CustomElementReactionsStack* reactionsStack = GetCustomElementReactionsStack(obj);
119 0 : Maybe<AutoCEReaction> ceReaction;
120 0 : if (reactionsStack) {
121 0 : ceReaction.emplace(reactionsStack);
122 : }
123 0 : binding_detail::FastErrorResult rv;
124 0 : self->SetScrolling(NonNullHelper(Constify(arg0)), rv);
125 0 : if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
126 0 : return false;
127 : }
128 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
129 :
130 0 : return true;
131 : }
132 :
133 : static const JSJitInfo scrolling_getterinfo = {
134 : { (JSJitGetterOp)get_scrolling },
135 : { prototypes::id::HTMLFrameElement },
136 : { PrototypeTraits<prototypes::id::HTMLFrameElement>::Depth },
137 : JSJitInfo::Getter,
138 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
139 : JSVAL_TYPE_STRING, /* 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 : static const JSJitInfo scrolling_setterinfo = {
151 : { (JSJitGetterOp)set_scrolling },
152 : { prototypes::id::HTMLFrameElement },
153 : { PrototypeTraits<prototypes::id::HTMLFrameElement>::Depth },
154 : JSJitInfo::Setter,
155 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
156 : JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */
157 : false, /* isInfallible. False in setters. */
158 : false, /* isMovable. Not relevant for setters. */
159 : false, /* isEliminatable. Not relevant for setters. */
160 : false, /* isAlwaysInSlot. Only relevant for getters. */
161 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
162 : false, /* isTypedMethod. Only relevant for methods. */
163 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
164 : };
165 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
166 : static_assert(0 < 1, "There is no slot for us");
167 :
168 : static bool
169 0 : get_src(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLFrameElement* self, JSJitGetterCallArgs args)
170 : {
171 0 : DOMString result;
172 0 : self->GetSrc(result);
173 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
174 0 : if (!xpc::NonVoidStringToJsval(cx, result, args.rval())) {
175 0 : return false;
176 : }
177 0 : return true;
178 : }
179 :
180 : static bool
181 0 : set_src(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLFrameElement* self, JSJitSetterCallArgs args)
182 : {
183 0 : binding_detail::FakeString arg0;
184 0 : if (!ConvertJSValueToString(cx, args[0], eStringify, eStringify, arg0)) {
185 0 : return false;
186 : }
187 0 : CustomElementReactionsStack* reactionsStack = GetCustomElementReactionsStack(obj);
188 0 : Maybe<AutoCEReaction> ceReaction;
189 0 : if (reactionsStack) {
190 0 : ceReaction.emplace(reactionsStack);
191 : }
192 0 : binding_detail::FastErrorResult rv;
193 0 : self->SetSrc(NonNullHelper(Constify(arg0)), rv);
194 0 : if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
195 0 : return false;
196 : }
197 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
198 :
199 0 : return true;
200 : }
201 :
202 : static const JSJitInfo src_getterinfo = {
203 : { (JSJitGetterOp)get_src },
204 : { prototypes::id::HTMLFrameElement },
205 : { PrototypeTraits<prototypes::id::HTMLFrameElement>::Depth },
206 : JSJitInfo::Getter,
207 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
208 : JSVAL_TYPE_STRING, /* returnType. Not relevant for setters. */
209 : false, /* isInfallible. False in setters. */
210 : false, /* isMovable. Not relevant for setters. */
211 : false, /* isEliminatable. Not relevant for setters. */
212 : false, /* isAlwaysInSlot. Only relevant for getters. */
213 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
214 : false, /* isTypedMethod. Only relevant for methods. */
215 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
216 : };
217 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
218 : static_assert(0 < 1, "There is no slot for us");
219 : static const JSJitInfo src_setterinfo = {
220 : { (JSJitGetterOp)set_src },
221 : { prototypes::id::HTMLFrameElement },
222 : { PrototypeTraits<prototypes::id::HTMLFrameElement>::Depth },
223 : JSJitInfo::Setter,
224 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
225 : JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */
226 : false, /* isInfallible. False in setters. */
227 : false, /* isMovable. Not relevant for setters. */
228 : false, /* isEliminatable. Not relevant for setters. */
229 : false, /* isAlwaysInSlot. Only relevant for getters. */
230 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
231 : false, /* isTypedMethod. Only relevant for methods. */
232 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
233 : };
234 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
235 : static_assert(0 < 1, "There is no slot for us");
236 :
237 : static bool
238 0 : get_frameBorder(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLFrameElement* self, JSJitGetterCallArgs args)
239 : {
240 0 : DOMString result;
241 0 : self->GetFrameBorder(result);
242 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
243 0 : if (!xpc::NonVoidStringToJsval(cx, result, args.rval())) {
244 0 : return false;
245 : }
246 0 : return true;
247 : }
248 :
249 : static bool
250 0 : set_frameBorder(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLFrameElement* self, JSJitSetterCallArgs args)
251 : {
252 0 : binding_detail::FakeString arg0;
253 0 : if (!ConvertJSValueToString(cx, args[0], eStringify, eStringify, arg0)) {
254 0 : return false;
255 : }
256 0 : CustomElementReactionsStack* reactionsStack = GetCustomElementReactionsStack(obj);
257 0 : Maybe<AutoCEReaction> ceReaction;
258 0 : if (reactionsStack) {
259 0 : ceReaction.emplace(reactionsStack);
260 : }
261 0 : binding_detail::FastErrorResult rv;
262 0 : self->SetFrameBorder(NonNullHelper(Constify(arg0)), rv);
263 0 : if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
264 0 : return false;
265 : }
266 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
267 :
268 0 : return true;
269 : }
270 :
271 : static const JSJitInfo frameBorder_getterinfo = {
272 : { (JSJitGetterOp)get_frameBorder },
273 : { prototypes::id::HTMLFrameElement },
274 : { PrototypeTraits<prototypes::id::HTMLFrameElement>::Depth },
275 : JSJitInfo::Getter,
276 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
277 : JSVAL_TYPE_STRING, /* returnType. Not relevant for setters. */
278 : false, /* isInfallible. False in setters. */
279 : false, /* isMovable. Not relevant for setters. */
280 : false, /* isEliminatable. Not relevant for setters. */
281 : false, /* isAlwaysInSlot. Only relevant for getters. */
282 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
283 : false, /* isTypedMethod. Only relevant for methods. */
284 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
285 : };
286 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
287 : static_assert(0 < 1, "There is no slot for us");
288 : static const JSJitInfo frameBorder_setterinfo = {
289 : { (JSJitGetterOp)set_frameBorder },
290 : { prototypes::id::HTMLFrameElement },
291 : { PrototypeTraits<prototypes::id::HTMLFrameElement>::Depth },
292 : JSJitInfo::Setter,
293 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
294 : JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */
295 : false, /* isInfallible. False in setters. */
296 : false, /* isMovable. Not relevant for setters. */
297 : false, /* isEliminatable. Not relevant for setters. */
298 : false, /* isAlwaysInSlot. Only relevant for getters. */
299 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
300 : false, /* isTypedMethod. Only relevant for methods. */
301 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
302 : };
303 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
304 : static_assert(0 < 1, "There is no slot for us");
305 :
306 : static bool
307 0 : get_longDesc(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLFrameElement* self, JSJitGetterCallArgs args)
308 : {
309 0 : DOMString result;
310 0 : self->GetLongDesc(result);
311 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
312 0 : if (!xpc::NonVoidStringToJsval(cx, result, args.rval())) {
313 0 : return false;
314 : }
315 0 : return true;
316 : }
317 :
318 : static bool
319 0 : set_longDesc(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLFrameElement* self, JSJitSetterCallArgs args)
320 : {
321 0 : binding_detail::FakeString arg0;
322 0 : if (!ConvertJSValueToString(cx, args[0], eStringify, eStringify, arg0)) {
323 0 : return false;
324 : }
325 0 : CustomElementReactionsStack* reactionsStack = GetCustomElementReactionsStack(obj);
326 0 : Maybe<AutoCEReaction> ceReaction;
327 0 : if (reactionsStack) {
328 0 : ceReaction.emplace(reactionsStack);
329 : }
330 0 : binding_detail::FastErrorResult rv;
331 0 : self->SetLongDesc(NonNullHelper(Constify(arg0)), rv);
332 0 : if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
333 0 : return false;
334 : }
335 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
336 :
337 0 : return true;
338 : }
339 :
340 : static const JSJitInfo longDesc_getterinfo = {
341 : { (JSJitGetterOp)get_longDesc },
342 : { prototypes::id::HTMLFrameElement },
343 : { PrototypeTraits<prototypes::id::HTMLFrameElement>::Depth },
344 : JSJitInfo::Getter,
345 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
346 : JSVAL_TYPE_STRING, /* returnType. Not relevant for setters. */
347 : false, /* isInfallible. False in setters. */
348 : false, /* isMovable. Not relevant for setters. */
349 : false, /* isEliminatable. Not relevant for setters. */
350 : false, /* isAlwaysInSlot. Only relevant for getters. */
351 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
352 : false, /* isTypedMethod. Only relevant for methods. */
353 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
354 : };
355 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
356 : static_assert(0 < 1, "There is no slot for us");
357 : static const JSJitInfo longDesc_setterinfo = {
358 : { (JSJitGetterOp)set_longDesc },
359 : { prototypes::id::HTMLFrameElement },
360 : { PrototypeTraits<prototypes::id::HTMLFrameElement>::Depth },
361 : JSJitInfo::Setter,
362 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
363 : JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */
364 : false, /* isInfallible. False in setters. */
365 : false, /* isMovable. Not relevant for setters. */
366 : false, /* isEliminatable. Not relevant for setters. */
367 : false, /* isAlwaysInSlot. Only relevant for getters. */
368 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
369 : false, /* isTypedMethod. Only relevant for methods. */
370 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
371 : };
372 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
373 : static_assert(0 < 1, "There is no slot for us");
374 :
375 : static bool
376 0 : get_noResize(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLFrameElement* self, JSJitGetterCallArgs args)
377 : {
378 0 : bool result(self->NoResize());
379 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
380 0 : args.rval().setBoolean(result);
381 0 : return true;
382 : }
383 :
384 : static bool
385 0 : set_noResize(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLFrameElement* self, JSJitSetterCallArgs args)
386 : {
387 : bool arg0;
388 0 : if (!ValueToPrimitive<bool, eDefault>(cx, args[0], &arg0)) {
389 0 : return false;
390 : }
391 0 : CustomElementReactionsStack* reactionsStack = GetCustomElementReactionsStack(obj);
392 0 : Maybe<AutoCEReaction> ceReaction;
393 0 : if (reactionsStack) {
394 0 : ceReaction.emplace(reactionsStack);
395 : }
396 0 : binding_detail::FastErrorResult rv;
397 0 : self->SetNoResize(arg0, rv);
398 0 : if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
399 0 : return false;
400 : }
401 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
402 :
403 0 : return true;
404 : }
405 :
406 : static const JSJitInfo noResize_getterinfo = {
407 : { (JSJitGetterOp)get_noResize },
408 : { prototypes::id::HTMLFrameElement },
409 : { PrototypeTraits<prototypes::id::HTMLFrameElement>::Depth },
410 : JSJitInfo::Getter,
411 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
412 : JSVAL_TYPE_BOOLEAN, /* returnType. Not relevant for setters. */
413 : true, /* isInfallible. False in setters. */
414 : false, /* isMovable. Not relevant for setters. */
415 : false, /* isEliminatable. Not relevant for setters. */
416 : false, /* isAlwaysInSlot. Only relevant for getters. */
417 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
418 : false, /* isTypedMethod. Only relevant for methods. */
419 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
420 : };
421 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
422 : static_assert(0 < 1, "There is no slot for us");
423 : static const JSJitInfo noResize_setterinfo = {
424 : { (JSJitGetterOp)set_noResize },
425 : { prototypes::id::HTMLFrameElement },
426 : { PrototypeTraits<prototypes::id::HTMLFrameElement>::Depth },
427 : JSJitInfo::Setter,
428 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
429 : JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */
430 : false, /* isInfallible. False in setters. */
431 : false, /* isMovable. Not relevant for setters. */
432 : false, /* isEliminatable. Not relevant for setters. */
433 : false, /* isAlwaysInSlot. Only relevant for getters. */
434 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
435 : false, /* isTypedMethod. Only relevant for methods. */
436 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
437 : };
438 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
439 : static_assert(0 < 1, "There is no slot for us");
440 :
441 : static bool
442 0 : get_contentDocument(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLFrameElement* self, JSJitGetterCallArgs args)
443 : {
444 0 : JSCompartment* compartment = js::GetContextCompartment(cx);
445 0 : MOZ_ASSERT(compartment);
446 0 : JSPrincipals* principals = JS_GetCompartmentPrincipals(compartment);
447 : // Initializing a nonnull is pretty darn annoying...
448 0 : NonNull<nsIPrincipal> subjectPrincipal;
449 0 : subjectPrincipal = static_cast<nsIPrincipal*>(nsJSPrincipals::get(principals));
450 0 : auto result(StrongOrRawPtr<nsIDocument>(self->GetContentDocument(subjectPrincipal)));
451 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
452 0 : if (!result) {
453 0 : args.rval().setNull();
454 0 : return true;
455 : }
456 0 : if (!GetOrCreateDOMReflector(cx, result, args.rval())) {
457 0 : MOZ_ASSERT(true || JS_IsExceptionPending(cx));
458 0 : return false;
459 : }
460 0 : return true;
461 : }
462 :
463 : static const JSJitInfo contentDocument_getterinfo = {
464 : { (JSJitGetterOp)get_contentDocument },
465 : { prototypes::id::HTMLFrameElement },
466 : { PrototypeTraits<prototypes::id::HTMLFrameElement>::Depth },
467 : JSJitInfo::Getter,
468 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
469 : JSVAL_TYPE_UNKNOWN, /* returnType. Not relevant for setters. */
470 : false, /* isInfallible. False in setters. */
471 : false, /* isMovable. Not relevant for setters. */
472 : false, /* isEliminatable. Not relevant for setters. */
473 : false, /* isAlwaysInSlot. Only relevant for getters. */
474 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
475 : false, /* isTypedMethod. Only relevant for methods. */
476 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
477 : };
478 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
479 : static_assert(0 < 1, "There is no slot for us");
480 :
481 : static bool
482 0 : get_contentWindow(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLFrameElement* self, JSJitGetterCallArgs args)
483 : {
484 0 : auto result(StrongOrRawPtr<nsPIDOMWindowOuter>(self->GetContentWindow()));
485 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
486 0 : if (!result) {
487 0 : args.rval().setNull();
488 0 : return true;
489 : }
490 0 : if (!WrapObject(cx, result, args.rval())) {
491 0 : return false;
492 : }
493 0 : return true;
494 : }
495 :
496 : static const JSJitInfo contentWindow_getterinfo = {
497 : { (JSJitGetterOp)get_contentWindow },
498 : { prototypes::id::HTMLFrameElement },
499 : { PrototypeTraits<prototypes::id::HTMLFrameElement>::Depth },
500 : JSJitInfo::Getter,
501 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
502 : JSVAL_TYPE_UNKNOWN, /* returnType. Not relevant for setters. */
503 : false, /* isInfallible. False in setters. */
504 : false, /* isMovable. Not relevant for setters. */
505 : false, /* isEliminatable. Not relevant for setters. */
506 : false, /* isAlwaysInSlot. Only relevant for getters. */
507 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
508 : false, /* isTypedMethod. Only relevant for methods. */
509 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
510 : };
511 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
512 : static_assert(0 < 1, "There is no slot for us");
513 :
514 : static bool
515 0 : get_marginHeight(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLFrameElement* self, JSJitGetterCallArgs args)
516 : {
517 0 : DOMString result;
518 0 : self->GetMarginHeight(result);
519 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
520 0 : if (!xpc::NonVoidStringToJsval(cx, result, args.rval())) {
521 0 : return false;
522 : }
523 0 : return true;
524 : }
525 :
526 : static bool
527 0 : set_marginHeight(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLFrameElement* self, JSJitSetterCallArgs args)
528 : {
529 0 : binding_detail::FakeString arg0;
530 0 : if (!ConvertJSValueToString(cx, args[0], eEmpty, eStringify, arg0)) {
531 0 : return false;
532 : }
533 0 : CustomElementReactionsStack* reactionsStack = GetCustomElementReactionsStack(obj);
534 0 : Maybe<AutoCEReaction> ceReaction;
535 0 : if (reactionsStack) {
536 0 : ceReaction.emplace(reactionsStack);
537 : }
538 0 : binding_detail::FastErrorResult rv;
539 0 : self->SetMarginHeight(NonNullHelper(Constify(arg0)), rv);
540 0 : if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
541 0 : return false;
542 : }
543 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
544 :
545 0 : return true;
546 : }
547 :
548 : static const JSJitInfo marginHeight_getterinfo = {
549 : { (JSJitGetterOp)get_marginHeight },
550 : { prototypes::id::HTMLFrameElement },
551 : { PrototypeTraits<prototypes::id::HTMLFrameElement>::Depth },
552 : JSJitInfo::Getter,
553 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
554 : JSVAL_TYPE_STRING, /* returnType. Not relevant for setters. */
555 : false, /* isInfallible. False in setters. */
556 : false, /* isMovable. Not relevant for setters. */
557 : false, /* isEliminatable. Not relevant for setters. */
558 : false, /* isAlwaysInSlot. Only relevant for getters. */
559 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
560 : false, /* isTypedMethod. Only relevant for methods. */
561 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
562 : };
563 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
564 : static_assert(0 < 1, "There is no slot for us");
565 : static const JSJitInfo marginHeight_setterinfo = {
566 : { (JSJitGetterOp)set_marginHeight },
567 : { prototypes::id::HTMLFrameElement },
568 : { PrototypeTraits<prototypes::id::HTMLFrameElement>::Depth },
569 : JSJitInfo::Setter,
570 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
571 : JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */
572 : false, /* isInfallible. False in setters. */
573 : false, /* isMovable. Not relevant for setters. */
574 : false, /* isEliminatable. Not relevant for setters. */
575 : false, /* isAlwaysInSlot. Only relevant for getters. */
576 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
577 : false, /* isTypedMethod. Only relevant for methods. */
578 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
579 : };
580 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
581 : static_assert(0 < 1, "There is no slot for us");
582 :
583 : static bool
584 0 : get_marginWidth(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLFrameElement* self, JSJitGetterCallArgs args)
585 : {
586 0 : DOMString result;
587 0 : self->GetMarginWidth(result);
588 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
589 0 : if (!xpc::NonVoidStringToJsval(cx, result, args.rval())) {
590 0 : return false;
591 : }
592 0 : return true;
593 : }
594 :
595 : static bool
596 0 : set_marginWidth(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLFrameElement* self, JSJitSetterCallArgs args)
597 : {
598 0 : binding_detail::FakeString arg0;
599 0 : if (!ConvertJSValueToString(cx, args[0], eEmpty, eStringify, arg0)) {
600 0 : return false;
601 : }
602 0 : CustomElementReactionsStack* reactionsStack = GetCustomElementReactionsStack(obj);
603 0 : Maybe<AutoCEReaction> ceReaction;
604 0 : if (reactionsStack) {
605 0 : ceReaction.emplace(reactionsStack);
606 : }
607 0 : binding_detail::FastErrorResult rv;
608 0 : self->SetMarginWidth(NonNullHelper(Constify(arg0)), rv);
609 0 : if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
610 0 : return false;
611 : }
612 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
613 :
614 0 : return true;
615 : }
616 :
617 : static const JSJitInfo marginWidth_getterinfo = {
618 : { (JSJitGetterOp)get_marginWidth },
619 : { prototypes::id::HTMLFrameElement },
620 : { PrototypeTraits<prototypes::id::HTMLFrameElement>::Depth },
621 : JSJitInfo::Getter,
622 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
623 : JSVAL_TYPE_STRING, /* returnType. Not relevant for setters. */
624 : false, /* isInfallible. False in setters. */
625 : false, /* isMovable. Not relevant for setters. */
626 : false, /* isEliminatable. Not relevant for setters. */
627 : false, /* isAlwaysInSlot. Only relevant for getters. */
628 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
629 : false, /* isTypedMethod. Only relevant for methods. */
630 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
631 : };
632 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
633 : static_assert(0 < 1, "There is no slot for us");
634 : static const JSJitInfo marginWidth_setterinfo = {
635 : { (JSJitGetterOp)set_marginWidth },
636 : { prototypes::id::HTMLFrameElement },
637 : { PrototypeTraits<prototypes::id::HTMLFrameElement>::Depth },
638 : JSJitInfo::Setter,
639 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
640 : JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */
641 : false, /* isInfallible. False in setters. */
642 : false, /* isMovable. Not relevant for setters. */
643 : false, /* isEliminatable. Not relevant for setters. */
644 : false, /* isAlwaysInSlot. Only relevant for getters. */
645 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
646 : false, /* isTypedMethod. Only relevant for methods. */
647 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
648 : };
649 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
650 : static_assert(0 < 1, "There is no slot for us");
651 :
652 : static bool
653 0 : get_frameLoader(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLFrameElement* self, JSJitGetterCallArgs args)
654 : {
655 0 : auto result(StrongOrRawPtr<nsIFrameLoader>(self->GetFrameLoader()));
656 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
657 0 : if (!result) {
658 0 : args.rval().setNull();
659 0 : return true;
660 : }
661 0 : if (!WrapObject(cx, result, &NS_GET_IID(nsIFrameLoader), args.rval())) {
662 0 : return false;
663 : }
664 0 : return true;
665 : }
666 :
667 : static const JSJitInfo frameLoader_getterinfo = {
668 : { (JSJitGetterOp)get_frameLoader },
669 : { prototypes::id::HTMLFrameElement },
670 : { PrototypeTraits<prototypes::id::HTMLFrameElement>::Depth },
671 : JSJitInfo::Getter,
672 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
673 : JSVAL_TYPE_UNKNOWN, /* returnType. Not relevant for setters. */
674 : false, /* isInfallible. False in setters. */
675 : false, /* isMovable. Not relevant for setters. */
676 : false, /* isEliminatable. Not relevant for setters. */
677 : false, /* isAlwaysInSlot. Only relevant for getters. */
678 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
679 : false, /* isTypedMethod. Only relevant for methods. */
680 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
681 : };
682 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
683 : static_assert(0 < 1, "There is no slot for us");
684 :
685 : static bool
686 0 : setIsPrerendered(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLFrameElement* self, const JSJitMethodCallArgs& args)
687 : {
688 0 : self->SetIsPrerendered();
689 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
690 0 : args.rval().setUndefined();
691 0 : return true;
692 : }
693 :
694 : static const JSJitInfo setIsPrerendered_methodinfo = {
695 : { (JSJitGetterOp)setIsPrerendered },
696 : { prototypes::id::HTMLFrameElement },
697 : { PrototypeTraits<prototypes::id::HTMLFrameElement>::Depth },
698 : JSJitInfo::Method,
699 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
700 : JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */
701 : true, /* isInfallible. False in setters. */
702 : false, /* isMovable. Not relevant for setters. */
703 : false, /* isEliminatable. Not relevant for setters. */
704 : false, /* isAlwaysInSlot. Only relevant for getters. */
705 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
706 : false, /* isTypedMethod. Only relevant for methods. */
707 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
708 : };
709 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
710 : static_assert(0 < 1, "There is no slot for us");
711 :
712 : static bool
713 0 : presetOpenerWindow(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLFrameElement* self, const JSJitMethodCallArgs& args)
714 : {
715 0 : if (MOZ_UNLIKELY(args.length() < 1)) {
716 0 : return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "HTMLFrameElement.presetOpenerWindow");
717 : }
718 : nsPIDOMWindowOuter* arg0;
719 0 : RefPtr<nsPIDOMWindowOuter> arg0_holder;
720 0 : if (args[0].isObject()) {
721 0 : JS::Rooted<JSObject*> source(cx, &args[0].toObject());
722 0 : if (NS_FAILED(UnwrapArg<nsPIDOMWindowOuter>(cx, source, getter_AddRefs(arg0_holder)))) {
723 0 : ThrowErrorMessage(cx, MSG_DOES_NOT_IMPLEMENT_INTERFACE, "Argument 1 of HTMLFrameElement.presetOpenerWindow", "WindowProxy");
724 0 : return false;
725 : }
726 0 : MOZ_ASSERT(arg0_holder);
727 0 : arg0 = arg0_holder;
728 0 : } else if (args[0].isNullOrUndefined()) {
729 0 : arg0 = nullptr;
730 : } else {
731 0 : ThrowErrorMessage(cx, MSG_NOT_OBJECT, "Argument 1 of HTMLFrameElement.presetOpenerWindow");
732 0 : return false;
733 : }
734 0 : binding_detail::FastErrorResult rv;
735 0 : self->PresetOpenerWindow(Constify(arg0), rv);
736 0 : if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
737 0 : return false;
738 : }
739 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
740 0 : args.rval().setUndefined();
741 0 : return true;
742 : }
743 :
744 : static const JSJitInfo presetOpenerWindow_methodinfo = {
745 : { (JSJitGetterOp)presetOpenerWindow },
746 : { prototypes::id::HTMLFrameElement },
747 : { PrototypeTraits<prototypes::id::HTMLFrameElement>::Depth },
748 : JSJitInfo::Method,
749 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
750 : JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */
751 : false, /* isInfallible. False in setters. */
752 : false, /* isMovable. Not relevant for setters. */
753 : false, /* isEliminatable. Not relevant for setters. */
754 : false, /* isAlwaysInSlot. Only relevant for getters. */
755 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
756 : false, /* isTypedMethod. Only relevant for methods. */
757 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
758 : };
759 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
760 : static_assert(0 < 1, "There is no slot for us");
761 :
762 : static bool
763 0 : swapFrameLoaders(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLFrameElement* self, const JSJitMethodCallArgs& args)
764 : {
765 0 : unsigned argcount = std::min(args.length(), 1u);
766 0 : switch (argcount) {
767 : case 1: {
768 0 : if (args[0].isObject()) {
769 : do {
770 0 : NonNull<nsXULElement> arg0;
771 : {
772 0 : nsresult rv = UnwrapObject<prototypes::id::XULElement, nsXULElement>(args[0], arg0);
773 0 : if (NS_FAILED(rv)) {
774 0 : break;
775 : }
776 : }
777 0 : binding_detail::FastErrorResult rv;
778 0 : self->SwapFrameLoaders(NonNullHelper(arg0), rv);
779 0 : if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
780 0 : return false;
781 : }
782 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
783 0 : args.rval().setUndefined();
784 0 : return true;
785 : } while (0);
786 : do {
787 0 : NonNull<mozilla::dom::HTMLIFrameElement> arg0;
788 : {
789 0 : nsresult rv = UnwrapObject<prototypes::id::HTMLIFrameElement, mozilla::dom::HTMLIFrameElement>(args[0], arg0);
790 0 : if (NS_FAILED(rv)) {
791 0 : break;
792 : }
793 : }
794 0 : binding_detail::FastErrorResult rv;
795 0 : self->SwapFrameLoaders(NonNullHelper(arg0), rv);
796 0 : if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
797 0 : return false;
798 : }
799 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
800 0 : args.rval().setUndefined();
801 0 : return true;
802 : } while (0);
803 : }
804 0 : return ThrowErrorMessage(cx, MSG_OVERLOAD_RESOLUTION_FAILED, "1", "1", "HTMLFrameElement.swapFrameLoaders");
805 : break;
806 : }
807 : default: {
808 0 : return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "HTMLFrameElement.swapFrameLoaders");
809 : break;
810 : }
811 : }
812 : MOZ_CRASH("We have an always-returning default case");
813 : return false;
814 : }
815 :
816 : static const JSJitInfo swapFrameLoaders_methodinfo = {
817 : { (JSJitGetterOp)swapFrameLoaders },
818 : { prototypes::id::HTMLFrameElement },
819 : { PrototypeTraits<prototypes::id::HTMLFrameElement>::Depth },
820 : JSJitInfo::Method,
821 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
822 : JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */
823 : false, /* isInfallible. False in setters. */
824 : false, /* isMovable. Not relevant for setters. */
825 : false, /* isEliminatable. Not relevant for setters. */
826 : false, /* isAlwaysInSlot. Only relevant for getters. */
827 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
828 : false, /* isTypedMethod. Only relevant for methods. */
829 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
830 : };
831 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
832 : static_assert(0 < 1, "There is no slot for us");
833 :
834 : static bool
835 0 : _addProperty(JSContext* cx, JS::Handle<JSObject*> obj, JS::Handle<jsid> id, JS::Handle<JS::Value> val)
836 : {
837 0 : mozilla::dom::HTMLFrameElement* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::dom::HTMLFrameElement>(obj);
838 : // We don't want to preserve if we don't have a wrapper, and we
839 : // obviously can't preserve if we're not initialized.
840 0 : if (self && self->GetWrapperPreserveColor()) {
841 0 : PreserveWrapper(self);
842 : }
843 0 : return true;
844 : }
845 :
846 : static void
847 0 : _finalize(js::FreeOp* fop, JSObject* obj)
848 : {
849 0 : mozilla::dom::HTMLFrameElement* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::dom::HTMLFrameElement>(obj);
850 0 : if (self) {
851 0 : ClearWrapper(self, self, obj);
852 0 : AddForDeferredFinalization<mozilla::dom::HTMLFrameElement>(self);
853 : }
854 0 : }
855 :
856 : static void
857 0 : _objectMoved(JSObject* obj, const JSObject* old)
858 : {
859 0 : mozilla::dom::HTMLFrameElement* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::dom::HTMLFrameElement>(obj);
860 0 : if (self) {
861 0 : UpdateWrapper(self, self, obj, old);
862 : }
863 0 : }
864 :
865 : // We deliberately use brace-elision to make Visual Studio produce better initalization code.
866 : #if defined(__clang__)
867 : #pragma clang diagnostic push
868 : #pragma clang diagnostic ignored "-Wmissing-braces"
869 : #endif
870 : static const JSFunctionSpec sChromeMethods_specs[] = {
871 : JS_FNSPEC("setIsPrerendered", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&setIsPrerendered_methodinfo), 0, JSPROP_ENUMERATE, nullptr),
872 : JS_FNSPEC("presetOpenerWindow", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&presetOpenerWindow_methodinfo), 1, JSPROP_ENUMERATE, nullptr),
873 : JS_FNSPEC("swapFrameLoaders", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&swapFrameLoaders_methodinfo), 1, JSPROP_ENUMERATE, nullptr),
874 : JS_FS_END
875 : };
876 : #if defined(__clang__)
877 : #pragma clang diagnostic pop
878 : #endif
879 :
880 :
881 : // Can't be const because the pref-enabled boolean needs to be writable
882 : static Prefable<const JSFunctionSpec> sChromeMethods[] = {
883 : { nullptr, &sChromeMethods_specs[0] },
884 : { nullptr, nullptr }
885 : };
886 :
887 : static_assert(1 <= 1ull << NUM_BITS_PROPERTY_INFO_PREF_INDEX,
888 : "We have a prefable index that is >= (1 << NUM_BITS_PROPERTY_INFO_PREF_INDEX)");
889 : static_assert(3 <= 1ull << NUM_BITS_PROPERTY_INFO_SPEC_INDEX,
890 : "We have a spec index that is >= (1 << NUM_BITS_PROPERTY_INFO_SPEC_INDEX)");
891 :
892 : // We deliberately use brace-elision to make Visual Studio produce better initalization code.
893 : #if defined(__clang__)
894 : #pragma clang diagnostic push
895 : #pragma clang diagnostic ignored "-Wmissing-braces"
896 : #endif
897 : static const JSPropertySpec sAttributes_specs[] = {
898 : { "name", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &name_getterinfo, GenericBindingSetter, &name_setterinfo },
899 : { "scrolling", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &scrolling_getterinfo, GenericBindingSetter, &scrolling_setterinfo },
900 : { "src", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &src_getterinfo, GenericBindingSetter, &src_setterinfo },
901 : { "frameBorder", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &frameBorder_getterinfo, GenericBindingSetter, &frameBorder_setterinfo },
902 : { "longDesc", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &longDesc_getterinfo, GenericBindingSetter, &longDesc_setterinfo },
903 : { "noResize", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &noResize_getterinfo, GenericBindingSetter, &noResize_setterinfo },
904 : { "contentDocument", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &contentDocument_getterinfo, nullptr, nullptr },
905 : { "contentWindow", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &contentWindow_getterinfo, nullptr, nullptr },
906 : { "marginHeight", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &marginHeight_getterinfo, GenericBindingSetter, &marginHeight_setterinfo },
907 : { "marginWidth", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &marginWidth_getterinfo, GenericBindingSetter, &marginWidth_setterinfo },
908 : { nullptr, 0, nullptr, nullptr, nullptr, nullptr }
909 : };
910 : #if defined(__clang__)
911 : #pragma clang diagnostic pop
912 : #endif
913 :
914 :
915 : // Can't be const because the pref-enabled boolean needs to be writable
916 : static Prefable<const JSPropertySpec> sAttributes[] = {
917 : { nullptr, &sAttributes_specs[0] },
918 : { nullptr, nullptr }
919 : };
920 :
921 : static_assert(1 <= 1ull << NUM_BITS_PROPERTY_INFO_PREF_INDEX,
922 : "We have a prefable index that is >= (1 << NUM_BITS_PROPERTY_INFO_PREF_INDEX)");
923 : static_assert(10 <= 1ull << NUM_BITS_PROPERTY_INFO_SPEC_INDEX,
924 : "We have a spec index that is >= (1 << NUM_BITS_PROPERTY_INFO_SPEC_INDEX)");
925 :
926 : // We deliberately use brace-elision to make Visual Studio produce better initalization code.
927 : #if defined(__clang__)
928 : #pragma clang diagnostic push
929 : #pragma clang diagnostic ignored "-Wmissing-braces"
930 : #endif
931 : static const JSPropertySpec sChromeAttributes_specs[] = {
932 : { "frameLoader", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &frameLoader_getterinfo, nullptr, nullptr },
933 : { nullptr, 0, nullptr, nullptr, nullptr, nullptr }
934 : };
935 : #if defined(__clang__)
936 : #pragma clang diagnostic pop
937 : #endif
938 :
939 :
940 : // Can't be const because the pref-enabled boolean needs to be writable
941 : static Prefable<const JSPropertySpec> sChromeAttributes[] = {
942 : { nullptr, &sChromeAttributes_specs[0] },
943 : { nullptr, nullptr }
944 : };
945 :
946 : static_assert(1 <= 1ull << NUM_BITS_PROPERTY_INFO_PREF_INDEX,
947 : "We have a prefable index that is >= (1 << NUM_BITS_PROPERTY_INFO_PREF_INDEX)");
948 : static_assert(1 <= 1ull << NUM_BITS_PROPERTY_INFO_SPEC_INDEX,
949 : "We have a spec index that is >= (1 << NUM_BITS_PROPERTY_INFO_SPEC_INDEX)");
950 :
951 :
952 : static uint16_t sNativeProperties_sortedPropertyIndices[10];
953 : static PropertyInfo sNativeProperties_propertyInfos[10];
954 :
955 : static const NativePropertiesN<1> sNativeProperties = {
956 : false, 0,
957 : false, 0,
958 : false, 0,
959 : true, 0 /* sAttributes */,
960 : false, 0,
961 : false, 0,
962 : false, 0,
963 : -1,
964 : 10,
965 : sNativeProperties_sortedPropertyIndices,
966 : {
967 : { sAttributes, &sNativeProperties_propertyInfos[0] }
968 : }
969 : };
970 : static_assert(10 < 1ull << CHAR_BIT * sizeof(sNativeProperties.propertyInfoCount),
971 : "We have a property info count that is oversized");
972 :
973 : static uint16_t sChromeOnlyNativeProperties_sortedPropertyIndices[4];
974 : static PropertyInfo sChromeOnlyNativeProperties_propertyInfos[4];
975 :
976 : static const NativePropertiesN<2> sChromeOnlyNativeProperties = {
977 : false, 0,
978 : false, 0,
979 : true, 0 /* sChromeMethods */,
980 : true, 1 /* sChromeAttributes */,
981 : false, 0,
982 : false, 0,
983 : false, 0,
984 : -1,
985 : 4,
986 : sChromeOnlyNativeProperties_sortedPropertyIndices,
987 : {
988 : { sChromeMethods, &sChromeOnlyNativeProperties_propertyInfos[0] },
989 : { sChromeAttributes, &sChromeOnlyNativeProperties_propertyInfos[3] }
990 : }
991 : };
992 : static_assert(4 < 1ull << CHAR_BIT * sizeof(sChromeOnlyNativeProperties.propertyInfoCount),
993 : "We have a property info count that is oversized");
994 :
995 : static bool
996 0 : _constructor(JSContext* cx, unsigned argc, JS::Value* vp)
997 : {
998 0 : JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
999 0 : JS::Rooted<JSObject*> obj(cx, &args.callee());
1000 0 : if (!args.isConstructing()) {
1001 : // XXXbz wish I could get the name from the callee instead of
1002 : // Adding more relocations
1003 0 : return ThrowConstructorWithoutNew(cx, "HTMLFrameElement");
1004 : }
1005 :
1006 0 : GlobalObject global(cx, obj);
1007 0 : if (global.Failed()) {
1008 0 : return false;
1009 : }
1010 :
1011 : // The newTarget might be a cross-compartment wrapper. Get the underlying object
1012 : // so we can do the spec's object-identity checks.
1013 0 : JS::Rooted<JSObject*> newTarget(cx, js::CheckedUnwrap(&args.newTarget().toObject()));
1014 0 : if (!newTarget) {
1015 0 : return ThrowErrorMessage(cx, MSG_ILLEGAL_CONSTRUCTOR);
1016 : }
1017 :
1018 : // Step 2 of https://html.spec.whatwg.org/multipage/dom.html#htmlconstructor.
1019 : // Enter the compartment of our underlying newTarget object, so we end
1020 : // up comparing to the constructor object for our interface from that global.
1021 : {
1022 0 : JSAutoCompartment ac(cx, newTarget);
1023 0 : JS::Handle<JSObject*> constructor(GetConstructorObjectHandle(cx));
1024 0 : if (!constructor) {
1025 0 : return false;
1026 : }
1027 0 : if (newTarget == constructor) {
1028 0 : return ThrowErrorMessage(cx, MSG_ILLEGAL_CONSTRUCTOR);
1029 : }
1030 : }
1031 :
1032 0 : JS::Rooted<JSObject*> desiredProto(cx);
1033 0 : if (!GetDesiredProto(cx, args, &desiredProto)) {
1034 0 : return false;
1035 : }
1036 0 : if (!desiredProto) {
1037 : // Step 7 of https://html.spec.whatwg.org/multipage/dom.html#htmlconstructor.
1038 : // This fallback behavior is designed to match analogous behavior for the
1039 : // JavaScript built-ins. So we enter the compartment of our underlying
1040 : // newTarget object and fall back to the prototype object from that global.
1041 : // XXX The spec says to use GetFunctionRealm(), which is not actually
1042 : // the same thing as what we have here (e.g. in the case of scripted callable proxies
1043 : // whose target is not same-compartment with the proxy, or bound functions, etc).
1044 : // https://bugzilla.mozilla.org/show_bug.cgi?id=1317658
1045 : {
1046 0 : JSAutoCompartment ac(cx, newTarget);
1047 0 : desiredProto = GetProtoObjectHandle(cx);
1048 0 : if (!desiredProto) {
1049 0 : return false;
1050 : }
1051 : }
1052 :
1053 : // desiredProto is in the compartment of the underlying newTarget object.
1054 : // Wrap it into the context compartment.
1055 0 : if (!JS_WrapObject(cx, &desiredProto)) {
1056 0 : return false;
1057 : }
1058 : }
1059 :
1060 0 : bool objIsXray = xpc::WrapperFactory::IsXrayWrapper(obj);
1061 0 : Maybe<JSAutoCompartment> ac;
1062 0 : if (objIsXray) {
1063 0 : obj = js::CheckedUnwrap(obj);
1064 0 : if (!obj) {
1065 0 : return false;
1066 : }
1067 0 : ac.emplace(cx, obj);
1068 0 : if (!JS_WrapObject(cx, &desiredProto)) {
1069 0 : return false;
1070 : }
1071 : }
1072 0 : binding_detail::FastErrorResult rv;
1073 0 : auto result(StrongOrRawPtr<mozilla::dom::HTMLFrameElement>(CreateHTMLElement(global, args, rv)));
1074 0 : if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
1075 0 : return false;
1076 : }
1077 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
1078 : static_assert(!IsPointer<decltype(result)>::value,
1079 : "NewObject implies that we need to keep the object alive with a strong reference.");
1080 0 : if (!GetOrCreateDOMReflector(cx, result, args.rval(), desiredProto)) {
1081 0 : MOZ_ASSERT(true || JS_IsExceptionPending(cx));
1082 0 : return false;
1083 : }
1084 0 : return true;
1085 : }
1086 :
1087 : static const js::ClassOps sInterfaceObjectClassOps = {
1088 : nullptr, /* addProperty */
1089 : nullptr, /* delProperty */
1090 : nullptr, /* getProperty */
1091 : nullptr, /* setProperty */
1092 : nullptr, /* enumerate */
1093 : nullptr, /* newEnumerate */
1094 : nullptr, /* resolve */
1095 : nullptr, /* mayResolve */
1096 : nullptr, /* finalize */
1097 : _constructor, /* call */
1098 : nullptr, /* hasInstance */
1099 : _constructor, /* construct */
1100 : nullptr, /* trace */
1101 : };
1102 :
1103 : static const DOMIfaceAndProtoJSClass sInterfaceObjectClass = {
1104 : {
1105 : "Function",
1106 : JSCLASS_IS_DOMIFACEANDPROTOJSCLASS | JSCLASS_HAS_RESERVED_SLOTS(DOM_INTERFACE_SLOTS_BASE),
1107 : &sInterfaceObjectClassOps,
1108 : JS_NULL_CLASS_SPEC,
1109 : JS_NULL_CLASS_EXT,
1110 : &sInterfaceObjectClassObjectOps
1111 : },
1112 : eInterface,
1113 : true,
1114 : prototypes::id::HTMLFrameElement,
1115 : PrototypeTraits<prototypes::id::HTMLFrameElement>::Depth,
1116 : sNativePropertyHooks,
1117 : "function HTMLFrameElement() {\n [native code]\n}",
1118 : HTMLElementBinding::GetConstructorObject
1119 : };
1120 :
1121 : static const DOMIfaceAndProtoJSClass sPrototypeClass = {
1122 : {
1123 : "HTMLFrameElementPrototype",
1124 : JSCLASS_IS_DOMIFACEANDPROTOJSCLASS | JSCLASS_HAS_RESERVED_SLOTS(DOM_INTERFACE_PROTO_SLOTS_BASE),
1125 : JS_NULL_CLASS_OPS,
1126 : JS_NULL_CLASS_SPEC,
1127 : JS_NULL_CLASS_EXT,
1128 : JS_NULL_OBJECT_OPS
1129 : },
1130 : eInterfacePrototype,
1131 : false,
1132 : prototypes::id::HTMLFrameElement,
1133 : PrototypeTraits<prototypes::id::HTMLFrameElement>::Depth,
1134 : sNativePropertyHooks,
1135 : "[object HTMLFrameElementPrototype]",
1136 : HTMLElementBinding::GetProtoObject
1137 : };
1138 :
1139 : JSObject*
1140 0 : DefineDOMInterface(JSContext* aCx, JS::Handle<JSObject*> aGlobal, JS::Handle<jsid> id, bool aDefineOnGlobal)
1141 : {
1142 0 : return GetConstructorObjectHandle(aCx, aDefineOnGlobal);
1143 : }
1144 :
1145 : static const js::ClassOps sClassOps = {
1146 : _addProperty, /* addProperty */
1147 : nullptr, /* delProperty */
1148 : nullptr, /* getProperty */
1149 : nullptr, /* setProperty */
1150 : nullptr, /* enumerate */
1151 : nullptr, /* newEnumerate */
1152 : nullptr, /* resolve */
1153 : nullptr, /* mayResolve */
1154 : _finalize, /* finalize */
1155 : nullptr, /* call */
1156 : nullptr, /* hasInstance */
1157 : nullptr, /* construct */
1158 : nullptr, /* trace */
1159 : };
1160 :
1161 : static const js::ClassExtension sClassExtension = {
1162 : nullptr, /* weakmapKeyDelegateOp */
1163 : _objectMoved /* objectMovedOp */
1164 : };
1165 :
1166 : static const DOMJSClass sClass = {
1167 : { "HTMLFrameElement",
1168 : JSCLASS_IS_DOMJSCLASS | JSCLASS_FOREGROUND_FINALIZE | JSCLASS_HAS_RESERVED_SLOTS(1),
1169 : &sClassOps,
1170 : JS_NULL_CLASS_SPEC,
1171 : &sClassExtension,
1172 : JS_NULL_OBJECT_OPS
1173 : },
1174 : { prototypes::id::EventTarget, prototypes::id::Node, prototypes::id::Element, prototypes::id::HTMLElement, prototypes::id::HTMLFrameElement, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count },
1175 : IsBaseOf<nsISupports, mozilla::dom::HTMLFrameElement >::value,
1176 : sNativePropertyHooks,
1177 : FindAssociatedGlobalForNative<mozilla::dom::HTMLFrameElement>::Get,
1178 : GetProtoObjectHandle,
1179 : GetCCParticipant<mozilla::dom::HTMLFrameElement>::Get()
1180 : };
1181 : static_assert(1 == DOM_INSTANCE_RESERVED_SLOTS,
1182 : "Must have the right minimal number of reserved slots.");
1183 : static_assert(1 >= 1,
1184 : "Must have enough reserved slots.");
1185 :
1186 : const JSClass*
1187 0 : GetJSClass()
1188 : {
1189 0 : return sClass.ToJSClass();
1190 : }
1191 :
1192 : bool
1193 0 : Wrap(JSContext* aCx, mozilla::dom::HTMLFrameElement* aObject, nsWrapperCache* aCache, JS::Handle<JSObject*> aGivenProto, JS::MutableHandle<JSObject*> aReflector)
1194 : {
1195 : MOZ_ASSERT(static_cast<mozilla::dom::HTMLFrameElement*>(aObject) ==
1196 : reinterpret_cast<mozilla::dom::HTMLFrameElement*>(aObject),
1197 : "Multiple inheritance for mozilla::dom::HTMLFrameElement is broken.");
1198 : MOZ_ASSERT(static_cast<nsGenericHTMLElement*>(aObject) ==
1199 : reinterpret_cast<nsGenericHTMLElement*>(aObject),
1200 : "Multiple inheritance for nsGenericHTMLElement is broken.");
1201 : MOZ_ASSERT(static_cast<mozilla::dom::Element*>(aObject) ==
1202 : reinterpret_cast<mozilla::dom::Element*>(aObject),
1203 : "Multiple inheritance for mozilla::dom::Element is broken.");
1204 : MOZ_ASSERT(static_cast<nsINode*>(aObject) ==
1205 : reinterpret_cast<nsINode*>(aObject),
1206 : "Multiple inheritance for nsINode is broken.");
1207 : MOZ_ASSERT(static_cast<mozilla::dom::EventTarget*>(aObject) ==
1208 : reinterpret_cast<mozilla::dom::EventTarget*>(aObject),
1209 : "Multiple inheritance for mozilla::dom::EventTarget is broken.");
1210 0 : MOZ_ASSERT(ToSupportsIsCorrect(aObject));
1211 0 : MOZ_ASSERT_IF(aGivenProto, js::IsObjectInContextCompartment(aGivenProto, aCx));
1212 0 : MOZ_ASSERT(!aCache->GetWrapper(),
1213 : "You should probably not be using Wrap() directly; use "
1214 : "GetOrCreateDOMReflector instead");
1215 :
1216 0 : MOZ_ASSERT(ToSupportsIsOnPrimaryInheritanceChain(aObject, aCache),
1217 : "nsISupports must be on our primary inheritance chain");
1218 :
1219 0 : JS::Rooted<JSObject*> global(aCx, FindAssociatedGlobal(aCx, aObject->GetParentObject()));
1220 0 : if (!global) {
1221 0 : return false;
1222 : }
1223 0 : MOZ_ASSERT(JS_IsGlobalObject(global));
1224 0 : MOZ_ASSERT(JS::ObjectIsNotGray(global));
1225 :
1226 : // That might have ended up wrapping us already, due to the wonders
1227 : // of XBL. Check for that, and bail out as needed.
1228 0 : aReflector.set(aCache->GetWrapper());
1229 0 : if (aReflector) {
1230 : #ifdef DEBUG
1231 0 : binding_detail::AssertReflectorHasGivenProto(aCx, aReflector, aGivenProto);
1232 : #endif // DEBUG
1233 0 : return true;
1234 : }
1235 :
1236 0 : JSAutoCompartment ac(aCx, global);
1237 0 : JS::Handle<JSObject*> canonicalProto = GetProtoObjectHandle(aCx);
1238 0 : if (!canonicalProto) {
1239 0 : return false;
1240 : }
1241 0 : JS::Rooted<JSObject*> proto(aCx);
1242 0 : if (aGivenProto) {
1243 0 : proto = aGivenProto;
1244 : // Unfortunately, while aGivenProto was in the compartment of aCx
1245 : // coming in, we changed compartments to that of "parent" so may need
1246 : // to wrap the proto here.
1247 0 : if (js::GetContextCompartment(aCx) != js::GetObjectCompartment(proto)) {
1248 0 : if (!JS_WrapObject(aCx, &proto)) {
1249 0 : return false;
1250 : }
1251 : }
1252 : } else {
1253 0 : proto = canonicalProto;
1254 : }
1255 :
1256 0 : BindingJSObjectCreator<mozilla::dom::HTMLFrameElement> creator(aCx);
1257 0 : creator.CreateObject(aCx, sClass.ToJSClass(), proto, aObject, aReflector);
1258 0 : if (!aReflector) {
1259 0 : return false;
1260 : }
1261 :
1262 0 : aCache->SetWrapper(aReflector);
1263 0 : creator.InitializationSucceeded();
1264 :
1265 0 : MOZ_ASSERT(aCache->GetWrapperPreserveColor() &&
1266 : aCache->GetWrapperPreserveColor() == aReflector);
1267 : // If proto != canonicalProto, we have to preserve our wrapper;
1268 : // otherwise we won't be able to properly recreate it later, since
1269 : // we won't know what proto to use. Note that we don't check
1270 : // aGivenProto here, since it's entirely possible (and even
1271 : // somewhat common) to have a non-null aGivenProto which is the
1272 : // same as canonicalProto.
1273 0 : if (proto != canonicalProto) {
1274 0 : PreserveWrapper(aObject);
1275 : }
1276 :
1277 0 : return true;
1278 : }
1279 :
1280 : const NativePropertyHooks sNativePropertyHooks[] = { {
1281 : nullptr,
1282 : nullptr,
1283 : nullptr,
1284 : { sNativeProperties.Upcast(), sChromeOnlyNativeProperties.Upcast() },
1285 : prototypes::id::HTMLFrameElement,
1286 : constructors::id::HTMLFrameElement,
1287 : HTMLElementBinding::sNativePropertyHooks,
1288 : &DefaultXrayExpandoObjectClass
1289 : } };
1290 :
1291 : void
1292 0 : CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, bool aDefineOnGlobal)
1293 : {
1294 0 : JS::Handle<JSObject*> parentProto(HTMLElementBinding::GetProtoObjectHandle(aCx));
1295 0 : if (!parentProto) {
1296 0 : return;
1297 : }
1298 :
1299 0 : JS::Handle<JSObject*> constructorProto(HTMLElementBinding::GetConstructorObjectHandle(aCx));
1300 0 : if (!constructorProto) {
1301 0 : return;
1302 : }
1303 :
1304 : static bool sIdsInited = false;
1305 0 : if (!sIdsInited && NS_IsMainThread()) {
1306 0 : if (!InitIds(aCx, sNativeProperties.Upcast())) {
1307 0 : return;
1308 : }
1309 0 : if (!InitIds(aCx, sChromeOnlyNativeProperties.Upcast())) {
1310 0 : return;
1311 : }
1312 0 : sIdsInited = true;
1313 : }
1314 :
1315 0 : JS::Heap<JSObject*>* protoCache = &aProtoAndIfaceCache.EntrySlotOrCreate(prototypes::id::HTMLFrameElement);
1316 0 : JS::Heap<JSObject*>* interfaceCache = &aProtoAndIfaceCache.EntrySlotOrCreate(constructors::id::HTMLFrameElement);
1317 0 : dom::CreateInterfaceObjects(aCx, aGlobal, parentProto,
1318 : &sPrototypeClass.mBase, protoCache,
1319 : constructorProto, &sInterfaceObjectClass.mBase, 0, nullptr,
1320 : interfaceCache,
1321 : sNativeProperties.Upcast(),
1322 0 : nsContentUtils::ThreadsafeIsSystemCaller(aCx) ? sChromeOnlyNativeProperties.Upcast() : nullptr,
1323 : "HTMLFrameElement", aDefineOnGlobal,
1324 : nullptr,
1325 0 : false);
1326 : }
1327 :
1328 : JS::Handle<JSObject*>
1329 0 : GetProtoObjectHandle(JSContext* aCx)
1330 : {
1331 : /* Get the interface prototype object for this class. This will create the
1332 : object as needed. */
1333 0 : bool aDefineOnGlobal = true;
1334 :
1335 : /* Make sure our global is sane. Hopefully we can remove this sometime */
1336 0 : JSObject* global = JS::CurrentGlobalOrNull(aCx);
1337 0 : if (!(js::GetObjectClass(global)->flags & JSCLASS_DOM_GLOBAL)) {
1338 0 : return nullptr;
1339 : }
1340 :
1341 : /* Check to see whether the interface objects are already installed */
1342 0 : ProtoAndIfaceCache& protoAndIfaceCache = *GetProtoAndIfaceCache(global);
1343 0 : if (!protoAndIfaceCache.HasEntryInSlot(prototypes::id::HTMLFrameElement)) {
1344 0 : JS::Rooted<JSObject*> rootedGlobal(aCx, global);
1345 0 : CreateInterfaceObjects(aCx, rootedGlobal, protoAndIfaceCache, aDefineOnGlobal);
1346 : }
1347 :
1348 : /*
1349 : * The object might _still_ be null, but that's OK.
1350 : *
1351 : * Calling fromMarkedLocation() is safe because protoAndIfaceCache is
1352 : * traced by TraceProtoAndIfaceCache() and its contents are never
1353 : * changed after they have been set.
1354 : *
1355 : * Calling address() avoids the read read barrier that does gray
1356 : * unmarking, but it's not possible for the object to be gray here.
1357 : */
1358 :
1359 0 : const JS::Heap<JSObject*>& entrySlot = protoAndIfaceCache.EntrySlotMustExist(prototypes::id::HTMLFrameElement);
1360 0 : MOZ_ASSERT(JS::ObjectIsNotGray(entrySlot));
1361 0 : return JS::Handle<JSObject*>::fromMarkedLocation(entrySlot.address());
1362 : }
1363 :
1364 : JS::Handle<JSObject*>
1365 0 : GetConstructorObjectHandle(JSContext* aCx, bool aDefineOnGlobal)
1366 : {
1367 : /* Get the interface object for this class. This will create the object as
1368 : needed. */
1369 :
1370 : /* Make sure our global is sane. Hopefully we can remove this sometime */
1371 0 : JSObject* global = JS::CurrentGlobalOrNull(aCx);
1372 0 : if (!(js::GetObjectClass(global)->flags & JSCLASS_DOM_GLOBAL)) {
1373 0 : return nullptr;
1374 : }
1375 :
1376 : /* Check to see whether the interface objects are already installed */
1377 0 : ProtoAndIfaceCache& protoAndIfaceCache = *GetProtoAndIfaceCache(global);
1378 0 : if (!protoAndIfaceCache.HasEntryInSlot(constructors::id::HTMLFrameElement)) {
1379 0 : JS::Rooted<JSObject*> rootedGlobal(aCx, global);
1380 0 : CreateInterfaceObjects(aCx, rootedGlobal, protoAndIfaceCache, aDefineOnGlobal);
1381 : }
1382 :
1383 : /*
1384 : * The object might _still_ be null, but that's OK.
1385 : *
1386 : * Calling fromMarkedLocation() is safe because protoAndIfaceCache is
1387 : * traced by TraceProtoAndIfaceCache() and its contents are never
1388 : * changed after they have been set.
1389 : *
1390 : * Calling address() avoids the read read barrier that does gray
1391 : * unmarking, but it's not possible for the object to be gray here.
1392 : */
1393 :
1394 0 : const JS::Heap<JSObject*>& entrySlot = protoAndIfaceCache.EntrySlotMustExist(constructors::id::HTMLFrameElement);
1395 0 : MOZ_ASSERT(JS::ObjectIsNotGray(entrySlot));
1396 0 : return JS::Handle<JSObject*>::fromMarkedLocation(entrySlot.address());
1397 : }
1398 :
1399 : JSObject*
1400 0 : GetConstructorObject(JSContext* aCx)
1401 : {
1402 0 : return GetConstructorObjectHandle(aCx);
1403 : }
1404 :
1405 : } // namespace HTMLFrameElementBinding
1406 :
1407 :
1408 :
1409 : } // namespace dom
1410 : } // namespace mozilla
|