Line data Source code
1 : /* THIS FILE IS AUTOGENERATED FROM HTMLEmbedElement.webidl BY Codegen.py - DO NOT EDIT */
2 :
3 : #include "HTMLElementBinding.h"
4 : #include "HTMLEmbedElementBinding.h"
5 : #include "HTMLObjectElementBinding.h"
6 : #include "WrapperFactory.h"
7 : #include "imgINotificationObserver.h"
8 : #include "imgIRequest.h"
9 : #include "mozilla/OwningNonNull.h"
10 : #include "mozilla/dom/BindingUtils.h"
11 : #include "mozilla/dom/CustomElementRegistry.h"
12 : #include "mozilla/dom/DOMJSClass.h"
13 : #include "mozilla/dom/HTMLIFrameElement.h"
14 : #include "mozilla/dom/HTMLSharedObjectElement.h"
15 : #include "mozilla/dom/NonRefcountedDOMObject.h"
16 : #include "mozilla/dom/Nullable.h"
17 : #include "mozilla/dom/PrimitiveConversions.h"
18 : #include "mozilla/dom/XrayExpandoClass.h"
19 : #include "nsContentUtils.h"
20 : #include "nsIDocument.h"
21 : #include "nsIFrameLoader.h"
22 : #include "nsIURI.h"
23 : #include "nsPIDOMWindow.h"
24 : #include "nsXULElement.h"
25 :
26 : namespace mozilla {
27 : namespace dom {
28 :
29 : namespace HTMLEmbedElementBinding {
30 :
31 : static_assert(IsRefcounted<NativeType>::value == IsRefcounted<HTMLElementBinding::NativeType>::value,
32 : "Can't inherit from an interface with a different ownership model.");
33 :
34 : static bool
35 0 : get_src(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLSharedObjectElement* self, JSJitGetterCallArgs args)
36 : {
37 0 : DOMString result;
38 0 : self->GetSrc(result);
39 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
40 0 : if (!xpc::NonVoidStringToJsval(cx, result, args.rval())) {
41 0 : return false;
42 : }
43 0 : return true;
44 : }
45 :
46 : static bool
47 0 : set_src(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLSharedObjectElement* self, JSJitSetterCallArgs args)
48 : {
49 0 : binding_detail::FakeString arg0;
50 0 : if (!ConvertJSValueToString(cx, args[0], eStringify, eStringify, arg0)) {
51 0 : return false;
52 : }
53 0 : CustomElementReactionsStack* reactionsStack = GetCustomElementReactionsStack(obj);
54 0 : Maybe<AutoCEReaction> ceReaction;
55 0 : if (reactionsStack) {
56 0 : ceReaction.emplace(reactionsStack);
57 : }
58 0 : binding_detail::FastErrorResult rv;
59 0 : self->SetSrc(NonNullHelper(Constify(arg0)), rv);
60 0 : if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
61 0 : return false;
62 : }
63 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
64 :
65 0 : return true;
66 : }
67 :
68 : static const JSJitInfo src_getterinfo = {
69 : { (JSJitGetterOp)get_src },
70 : { prototypes::id::HTMLEmbedElement },
71 : { PrototypeTraits<prototypes::id::HTMLEmbedElement>::Depth },
72 : JSJitInfo::Getter,
73 : JSJitInfo::AliasDOMSets, /* aliasSet. Not relevant for setters. */
74 : JSVAL_TYPE_STRING, /* returnType. Not relevant for setters. */
75 : false, /* isInfallible. False in setters. */
76 : true, /* isMovable. Not relevant for setters. */
77 : true, /* isEliminatable. Not relevant for setters. */
78 : false, /* isAlwaysInSlot. Only relevant for getters. */
79 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
80 : false, /* isTypedMethod. Only relevant for methods. */
81 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
82 : };
83 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
84 : static_assert(0 < 1, "There is no slot for us");
85 : static const JSJitInfo src_setterinfo = {
86 : { (JSJitGetterOp)set_src },
87 : { prototypes::id::HTMLEmbedElement },
88 : { PrototypeTraits<prototypes::id::HTMLEmbedElement>::Depth },
89 : JSJitInfo::Setter,
90 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
91 : JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */
92 : false, /* isInfallible. False in setters. */
93 : false, /* isMovable. Not relevant for setters. */
94 : false, /* isEliminatable. Not relevant for setters. */
95 : false, /* isAlwaysInSlot. Only relevant for getters. */
96 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
97 : false, /* isTypedMethod. Only relevant for methods. */
98 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
99 : };
100 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
101 : static_assert(0 < 1, "There is no slot for us");
102 :
103 : static bool
104 0 : get_type(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLSharedObjectElement* self, JSJitGetterCallArgs args)
105 : {
106 0 : DOMString result;
107 0 : self->GetType(result);
108 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
109 0 : if (!xpc::NonVoidStringToJsval(cx, result, args.rval())) {
110 0 : return false;
111 : }
112 0 : return true;
113 : }
114 :
115 : static bool
116 0 : set_type(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLSharedObjectElement* self, JSJitSetterCallArgs args)
117 : {
118 0 : binding_detail::FakeString arg0;
119 0 : if (!ConvertJSValueToString(cx, args[0], eStringify, eStringify, arg0)) {
120 0 : return false;
121 : }
122 0 : CustomElementReactionsStack* reactionsStack = GetCustomElementReactionsStack(obj);
123 0 : Maybe<AutoCEReaction> ceReaction;
124 0 : if (reactionsStack) {
125 0 : ceReaction.emplace(reactionsStack);
126 : }
127 0 : binding_detail::FastErrorResult rv;
128 0 : self->SetType(NonNullHelper(Constify(arg0)), rv);
129 0 : if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
130 0 : return false;
131 : }
132 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
133 :
134 0 : return true;
135 : }
136 :
137 : static const JSJitInfo type_getterinfo = {
138 : { (JSJitGetterOp)get_type },
139 : { prototypes::id::HTMLEmbedElement },
140 : { PrototypeTraits<prototypes::id::HTMLEmbedElement>::Depth },
141 : JSJitInfo::Getter,
142 : JSJitInfo::AliasDOMSets, /* aliasSet. Not relevant for setters. */
143 : JSVAL_TYPE_STRING, /* returnType. Not relevant for setters. */
144 : false, /* isInfallible. False in setters. */
145 : true, /* isMovable. Not relevant for setters. */
146 : true, /* isEliminatable. Not relevant for setters. */
147 : false, /* isAlwaysInSlot. Only relevant for getters. */
148 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
149 : false, /* isTypedMethod. Only relevant for methods. */
150 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
151 : };
152 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
153 : static_assert(0 < 1, "There is no slot for us");
154 : static const JSJitInfo type_setterinfo = {
155 : { (JSJitGetterOp)set_type },
156 : { prototypes::id::HTMLEmbedElement },
157 : { PrototypeTraits<prototypes::id::HTMLEmbedElement>::Depth },
158 : JSJitInfo::Setter,
159 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
160 : JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */
161 : false, /* isInfallible. False in setters. */
162 : false, /* isMovable. Not relevant for setters. */
163 : false, /* isEliminatable. Not relevant for setters. */
164 : false, /* isAlwaysInSlot. Only relevant for getters. */
165 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
166 : false, /* isTypedMethod. Only relevant for methods. */
167 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
168 : };
169 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
170 : static_assert(0 < 1, "There is no slot for us");
171 :
172 : static bool
173 0 : get_width(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLSharedObjectElement* self, JSJitGetterCallArgs args)
174 : {
175 0 : DOMString result;
176 0 : self->GetWidth(result);
177 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
178 0 : if (!xpc::NonVoidStringToJsval(cx, result, args.rval())) {
179 0 : return false;
180 : }
181 0 : return true;
182 : }
183 :
184 : static bool
185 0 : set_width(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLSharedObjectElement* self, JSJitSetterCallArgs args)
186 : {
187 0 : binding_detail::FakeString arg0;
188 0 : if (!ConvertJSValueToString(cx, args[0], eStringify, eStringify, arg0)) {
189 0 : return false;
190 : }
191 0 : CustomElementReactionsStack* reactionsStack = GetCustomElementReactionsStack(obj);
192 0 : Maybe<AutoCEReaction> ceReaction;
193 0 : if (reactionsStack) {
194 0 : ceReaction.emplace(reactionsStack);
195 : }
196 0 : binding_detail::FastErrorResult rv;
197 0 : self->SetWidth(NonNullHelper(Constify(arg0)), rv);
198 0 : if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
199 0 : return false;
200 : }
201 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
202 :
203 0 : return true;
204 : }
205 :
206 : static const JSJitInfo width_getterinfo = {
207 : { (JSJitGetterOp)get_width },
208 : { prototypes::id::HTMLEmbedElement },
209 : { PrototypeTraits<prototypes::id::HTMLEmbedElement>::Depth },
210 : JSJitInfo::Getter,
211 : JSJitInfo::AliasDOMSets, /* aliasSet. Not relevant for setters. */
212 : JSVAL_TYPE_STRING, /* returnType. Not relevant for setters. */
213 : false, /* isInfallible. False in setters. */
214 : true, /* isMovable. Not relevant for setters. */
215 : true, /* isEliminatable. Not relevant for setters. */
216 : false, /* isAlwaysInSlot. Only relevant for getters. */
217 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
218 : false, /* isTypedMethod. Only relevant for methods. */
219 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
220 : };
221 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
222 : static_assert(0 < 1, "There is no slot for us");
223 : static const JSJitInfo width_setterinfo = {
224 : { (JSJitGetterOp)set_width },
225 : { prototypes::id::HTMLEmbedElement },
226 : { PrototypeTraits<prototypes::id::HTMLEmbedElement>::Depth },
227 : JSJitInfo::Setter,
228 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
229 : JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */
230 : false, /* isInfallible. False in setters. */
231 : false, /* isMovable. Not relevant for setters. */
232 : false, /* isEliminatable. Not relevant for setters. */
233 : false, /* isAlwaysInSlot. Only relevant for getters. */
234 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
235 : false, /* isTypedMethod. Only relevant for methods. */
236 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
237 : };
238 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
239 : static_assert(0 < 1, "There is no slot for us");
240 :
241 : static bool
242 0 : get_height(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLSharedObjectElement* self, JSJitGetterCallArgs args)
243 : {
244 0 : DOMString result;
245 0 : self->GetHeight(result);
246 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
247 0 : if (!xpc::NonVoidStringToJsval(cx, result, args.rval())) {
248 0 : return false;
249 : }
250 0 : return true;
251 : }
252 :
253 : static bool
254 0 : set_height(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLSharedObjectElement* self, JSJitSetterCallArgs args)
255 : {
256 0 : binding_detail::FakeString arg0;
257 0 : if (!ConvertJSValueToString(cx, args[0], eStringify, eStringify, arg0)) {
258 0 : return false;
259 : }
260 0 : CustomElementReactionsStack* reactionsStack = GetCustomElementReactionsStack(obj);
261 0 : Maybe<AutoCEReaction> ceReaction;
262 0 : if (reactionsStack) {
263 0 : ceReaction.emplace(reactionsStack);
264 : }
265 0 : binding_detail::FastErrorResult rv;
266 0 : self->SetHeight(NonNullHelper(Constify(arg0)), rv);
267 0 : if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
268 0 : return false;
269 : }
270 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
271 :
272 0 : return true;
273 : }
274 :
275 : static const JSJitInfo height_getterinfo = {
276 : { (JSJitGetterOp)get_height },
277 : { prototypes::id::HTMLEmbedElement },
278 : { PrototypeTraits<prototypes::id::HTMLEmbedElement>::Depth },
279 : JSJitInfo::Getter,
280 : JSJitInfo::AliasDOMSets, /* aliasSet. Not relevant for setters. */
281 : JSVAL_TYPE_STRING, /* returnType. Not relevant for setters. */
282 : false, /* isInfallible. False in setters. */
283 : true, /* isMovable. Not relevant for setters. */
284 : true, /* isEliminatable. Not relevant for setters. */
285 : false, /* isAlwaysInSlot. Only relevant for getters. */
286 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
287 : false, /* isTypedMethod. Only relevant for methods. */
288 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
289 : };
290 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
291 : static_assert(0 < 1, "There is no slot for us");
292 : static const JSJitInfo height_setterinfo = {
293 : { (JSJitGetterOp)set_height },
294 : { prototypes::id::HTMLEmbedElement },
295 : { PrototypeTraits<prototypes::id::HTMLEmbedElement>::Depth },
296 : JSJitInfo::Setter,
297 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
298 : JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */
299 : false, /* isInfallible. False in setters. */
300 : false, /* isMovable. Not relevant for setters. */
301 : false, /* isEliminatable. Not relevant for setters. */
302 : false, /* isAlwaysInSlot. Only relevant for getters. */
303 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
304 : false, /* isTypedMethod. Only relevant for methods. */
305 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
306 : };
307 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
308 : static_assert(0 < 1, "There is no slot for us");
309 :
310 : static bool
311 0 : get_align(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLSharedObjectElement* self, JSJitGetterCallArgs args)
312 : {
313 0 : DOMString result;
314 0 : self->GetAlign(result);
315 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
316 0 : if (!xpc::NonVoidStringToJsval(cx, result, args.rval())) {
317 0 : return false;
318 : }
319 0 : return true;
320 : }
321 :
322 : static bool
323 0 : set_align(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLSharedObjectElement* self, JSJitSetterCallArgs args)
324 : {
325 0 : binding_detail::FakeString arg0;
326 0 : if (!ConvertJSValueToString(cx, args[0], eStringify, eStringify, arg0)) {
327 0 : return false;
328 : }
329 0 : CustomElementReactionsStack* reactionsStack = GetCustomElementReactionsStack(obj);
330 0 : Maybe<AutoCEReaction> ceReaction;
331 0 : if (reactionsStack) {
332 0 : ceReaction.emplace(reactionsStack);
333 : }
334 0 : binding_detail::FastErrorResult rv;
335 0 : self->SetAlign(NonNullHelper(Constify(arg0)), rv);
336 0 : if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
337 0 : return false;
338 : }
339 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
340 :
341 0 : return true;
342 : }
343 :
344 : static const JSJitInfo align_getterinfo = {
345 : { (JSJitGetterOp)get_align },
346 : { prototypes::id::HTMLEmbedElement },
347 : { PrototypeTraits<prototypes::id::HTMLEmbedElement>::Depth },
348 : JSJitInfo::Getter,
349 : JSJitInfo::AliasDOMSets, /* aliasSet. Not relevant for setters. */
350 : JSVAL_TYPE_STRING, /* returnType. Not relevant for setters. */
351 : false, /* isInfallible. False in setters. */
352 : true, /* isMovable. Not relevant for setters. */
353 : true, /* isEliminatable. Not relevant for setters. */
354 : false, /* isAlwaysInSlot. Only relevant for getters. */
355 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
356 : false, /* isTypedMethod. Only relevant for methods. */
357 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
358 : };
359 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
360 : static_assert(0 < 1, "There is no slot for us");
361 : static const JSJitInfo align_setterinfo = {
362 : { (JSJitGetterOp)set_align },
363 : { prototypes::id::HTMLEmbedElement },
364 : { PrototypeTraits<prototypes::id::HTMLEmbedElement>::Depth },
365 : JSJitInfo::Setter,
366 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
367 : JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */
368 : false, /* isInfallible. False in setters. */
369 : false, /* isMovable. Not relevant for setters. */
370 : false, /* isEliminatable. Not relevant for setters. */
371 : false, /* isAlwaysInSlot. Only relevant for getters. */
372 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
373 : false, /* isTypedMethod. Only relevant for methods. */
374 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
375 : };
376 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
377 : static_assert(0 < 1, "There is no slot for us");
378 :
379 : static bool
380 0 : get_name(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLSharedObjectElement* self, JSJitGetterCallArgs args)
381 : {
382 0 : DOMString result;
383 0 : self->GetName(result);
384 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
385 0 : if (!xpc::NonVoidStringToJsval(cx, result, args.rval())) {
386 0 : return false;
387 : }
388 0 : return true;
389 : }
390 :
391 : static bool
392 0 : set_name(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLSharedObjectElement* self, JSJitSetterCallArgs args)
393 : {
394 0 : binding_detail::FakeString arg0;
395 0 : if (!ConvertJSValueToString(cx, args[0], eStringify, eStringify, arg0)) {
396 0 : return false;
397 : }
398 0 : CustomElementReactionsStack* reactionsStack = GetCustomElementReactionsStack(obj);
399 0 : Maybe<AutoCEReaction> ceReaction;
400 0 : if (reactionsStack) {
401 0 : ceReaction.emplace(reactionsStack);
402 : }
403 0 : binding_detail::FastErrorResult rv;
404 0 : self->SetName(NonNullHelper(Constify(arg0)), rv);
405 0 : if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
406 0 : return false;
407 : }
408 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
409 :
410 0 : return true;
411 : }
412 :
413 : static const JSJitInfo name_getterinfo = {
414 : { (JSJitGetterOp)get_name },
415 : { prototypes::id::HTMLEmbedElement },
416 : { PrototypeTraits<prototypes::id::HTMLEmbedElement>::Depth },
417 : JSJitInfo::Getter,
418 : JSJitInfo::AliasDOMSets, /* aliasSet. Not relevant for setters. */
419 : JSVAL_TYPE_STRING, /* returnType. Not relevant for setters. */
420 : false, /* isInfallible. False in setters. */
421 : true, /* isMovable. Not relevant for setters. */
422 : true, /* isEliminatable. Not relevant for setters. */
423 : false, /* isAlwaysInSlot. Only relevant for getters. */
424 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
425 : false, /* isTypedMethod. Only relevant for methods. */
426 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
427 : };
428 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
429 : static_assert(0 < 1, "There is no slot for us");
430 : static const JSJitInfo name_setterinfo = {
431 : { (JSJitGetterOp)set_name },
432 : { prototypes::id::HTMLEmbedElement },
433 : { PrototypeTraits<prototypes::id::HTMLEmbedElement>::Depth },
434 : JSJitInfo::Setter,
435 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
436 : JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */
437 : false, /* isInfallible. False in setters. */
438 : false, /* isMovable. Not relevant for setters. */
439 : false, /* isEliminatable. Not relevant for setters. */
440 : false, /* isAlwaysInSlot. Only relevant for getters. */
441 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
442 : false, /* isTypedMethod. Only relevant for methods. */
443 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
444 : };
445 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
446 : static_assert(0 < 1, "There is no slot for us");
447 :
448 : static bool
449 0 : getSVGDocument(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLSharedObjectElement* self, const JSJitMethodCallArgs& args)
450 : {
451 0 : JSCompartment* compartment = js::GetContextCompartment(cx);
452 0 : MOZ_ASSERT(compartment);
453 0 : JSPrincipals* principals = JS_GetCompartmentPrincipals(compartment);
454 : // Initializing a nonnull is pretty darn annoying...
455 0 : NonNull<nsIPrincipal> subjectPrincipal;
456 0 : subjectPrincipal = static_cast<nsIPrincipal*>(nsJSPrincipals::get(principals));
457 0 : auto result(StrongOrRawPtr<nsIDocument>(self->GetSVGDocument(subjectPrincipal)));
458 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
459 0 : if (!result) {
460 0 : args.rval().setNull();
461 0 : return true;
462 : }
463 0 : if (!GetOrCreateDOMReflector(cx, result, args.rval())) {
464 0 : MOZ_ASSERT(true || JS_IsExceptionPending(cx));
465 0 : return false;
466 : }
467 0 : return true;
468 : }
469 :
470 : static const JSJitInfo getSVGDocument_methodinfo = {
471 : { (JSJitGetterOp)getSVGDocument },
472 : { prototypes::id::HTMLEmbedElement },
473 : { PrototypeTraits<prototypes::id::HTMLEmbedElement>::Depth },
474 : JSJitInfo::Method,
475 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
476 : JSVAL_TYPE_UNKNOWN, /* returnType. Not relevant for setters. */
477 : false, /* isInfallible. False in setters. */
478 : false, /* isMovable. Not relevant for setters. */
479 : false, /* isEliminatable. Not relevant for setters. */
480 : false, /* isAlwaysInSlot. Only relevant for getters. */
481 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
482 : false, /* isTypedMethod. Only relevant for methods. */
483 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
484 : };
485 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
486 : static_assert(0 < 1, "There is no slot for us");
487 :
488 : static bool
489 0 : get_frameLoader(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLSharedObjectElement* self, JSJitGetterCallArgs args)
490 : {
491 0 : auto result(StrongOrRawPtr<nsIFrameLoader>(self->GetFrameLoader()));
492 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
493 0 : if (!result) {
494 0 : args.rval().setNull();
495 0 : return true;
496 : }
497 0 : if (!WrapObject(cx, result, &NS_GET_IID(nsIFrameLoader), args.rval())) {
498 0 : return false;
499 : }
500 0 : return true;
501 : }
502 :
503 : static const JSJitInfo frameLoader_getterinfo = {
504 : { (JSJitGetterOp)get_frameLoader },
505 : { prototypes::id::HTMLEmbedElement },
506 : { PrototypeTraits<prototypes::id::HTMLEmbedElement>::Depth },
507 : JSJitInfo::Getter,
508 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
509 : JSVAL_TYPE_UNKNOWN, /* returnType. Not relevant for setters. */
510 : false, /* isInfallible. False in setters. */
511 : false, /* isMovable. Not relevant for setters. */
512 : false, /* isEliminatable. Not relevant for setters. */
513 : false, /* isAlwaysInSlot. Only relevant for getters. */
514 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
515 : false, /* isTypedMethod. Only relevant for methods. */
516 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
517 : };
518 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
519 : static_assert(0 < 1, "There is no slot for us");
520 :
521 : static bool
522 0 : setIsPrerendered(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLSharedObjectElement* self, const JSJitMethodCallArgs& args)
523 : {
524 0 : self->SetIsPrerendered();
525 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
526 0 : args.rval().setUndefined();
527 0 : return true;
528 : }
529 :
530 : static const JSJitInfo setIsPrerendered_methodinfo = {
531 : { (JSJitGetterOp)setIsPrerendered },
532 : { prototypes::id::HTMLEmbedElement },
533 : { PrototypeTraits<prototypes::id::HTMLEmbedElement>::Depth },
534 : JSJitInfo::Method,
535 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
536 : JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */
537 : true, /* isInfallible. False in setters. */
538 : false, /* isMovable. Not relevant for setters. */
539 : false, /* isEliminatable. Not relevant for setters. */
540 : false, /* isAlwaysInSlot. Only relevant for getters. */
541 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
542 : false, /* isTypedMethod. Only relevant for methods. */
543 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
544 : };
545 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
546 : static_assert(0 < 1, "There is no slot for us");
547 :
548 : static bool
549 0 : presetOpenerWindow(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLSharedObjectElement* self, const JSJitMethodCallArgs& args)
550 : {
551 0 : if (MOZ_UNLIKELY(args.length() < 1)) {
552 0 : return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "HTMLEmbedElement.presetOpenerWindow");
553 : }
554 : nsPIDOMWindowOuter* arg0;
555 0 : RefPtr<nsPIDOMWindowOuter> arg0_holder;
556 0 : if (args[0].isObject()) {
557 0 : JS::Rooted<JSObject*> source(cx, &args[0].toObject());
558 0 : if (NS_FAILED(UnwrapArg<nsPIDOMWindowOuter>(cx, source, getter_AddRefs(arg0_holder)))) {
559 0 : ThrowErrorMessage(cx, MSG_DOES_NOT_IMPLEMENT_INTERFACE, "Argument 1 of HTMLEmbedElement.presetOpenerWindow", "WindowProxy");
560 0 : return false;
561 : }
562 0 : MOZ_ASSERT(arg0_holder);
563 0 : arg0 = arg0_holder;
564 0 : } else if (args[0].isNullOrUndefined()) {
565 0 : arg0 = nullptr;
566 : } else {
567 0 : ThrowErrorMessage(cx, MSG_NOT_OBJECT, "Argument 1 of HTMLEmbedElement.presetOpenerWindow");
568 0 : return false;
569 : }
570 0 : binding_detail::FastErrorResult rv;
571 0 : self->PresetOpenerWindow(Constify(arg0), rv);
572 0 : if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
573 0 : return false;
574 : }
575 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
576 0 : args.rval().setUndefined();
577 0 : return true;
578 : }
579 :
580 : static const JSJitInfo presetOpenerWindow_methodinfo = {
581 : { (JSJitGetterOp)presetOpenerWindow },
582 : { prototypes::id::HTMLEmbedElement },
583 : { PrototypeTraits<prototypes::id::HTMLEmbedElement>::Depth },
584 : JSJitInfo::Method,
585 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
586 : JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */
587 : false, /* isInfallible. False in setters. */
588 : false, /* isMovable. Not relevant for setters. */
589 : false, /* isEliminatable. Not relevant for setters. */
590 : false, /* isAlwaysInSlot. Only relevant for getters. */
591 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
592 : false, /* isTypedMethod. Only relevant for methods. */
593 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
594 : };
595 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
596 : static_assert(0 < 1, "There is no slot for us");
597 :
598 : static bool
599 0 : swapFrameLoaders(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLSharedObjectElement* self, const JSJitMethodCallArgs& args)
600 : {
601 0 : unsigned argcount = std::min(args.length(), 1u);
602 0 : switch (argcount) {
603 : case 1: {
604 0 : if (args[0].isObject()) {
605 : do {
606 0 : NonNull<nsXULElement> arg0;
607 : {
608 0 : nsresult rv = UnwrapObject<prototypes::id::XULElement, nsXULElement>(args[0], arg0);
609 0 : if (NS_FAILED(rv)) {
610 0 : break;
611 : }
612 : }
613 0 : binding_detail::FastErrorResult rv;
614 0 : self->SwapFrameLoaders(NonNullHelper(arg0), rv);
615 0 : if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
616 0 : return false;
617 : }
618 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
619 0 : args.rval().setUndefined();
620 0 : return true;
621 : } while (0);
622 : do {
623 0 : NonNull<mozilla::dom::HTMLIFrameElement> arg0;
624 : {
625 0 : nsresult rv = UnwrapObject<prototypes::id::HTMLIFrameElement, mozilla::dom::HTMLIFrameElement>(args[0], arg0);
626 0 : if (NS_FAILED(rv)) {
627 0 : break;
628 : }
629 : }
630 0 : binding_detail::FastErrorResult rv;
631 0 : self->SwapFrameLoaders(NonNullHelper(arg0), rv);
632 0 : if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
633 0 : return false;
634 : }
635 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
636 0 : args.rval().setUndefined();
637 0 : return true;
638 : } while (0);
639 : }
640 0 : return ThrowErrorMessage(cx, MSG_OVERLOAD_RESOLUTION_FAILED, "1", "1", "HTMLEmbedElement.swapFrameLoaders");
641 : break;
642 : }
643 : default: {
644 0 : return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "HTMLEmbedElement.swapFrameLoaders");
645 : break;
646 : }
647 : }
648 : MOZ_CRASH("We have an always-returning default case");
649 : return false;
650 : }
651 :
652 : static const JSJitInfo swapFrameLoaders_methodinfo = {
653 : { (JSJitGetterOp)swapFrameLoaders },
654 : { prototypes::id::HTMLEmbedElement },
655 : { PrototypeTraits<prototypes::id::HTMLEmbedElement>::Depth },
656 : JSJitInfo::Method,
657 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
658 : JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */
659 : false, /* isInfallible. False in setters. */
660 : false, /* isMovable. Not relevant for setters. */
661 : false, /* isEliminatable. Not relevant for setters. */
662 : false, /* isAlwaysInSlot. Only relevant for getters. */
663 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
664 : false, /* isTypedMethod. Only relevant for methods. */
665 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
666 : };
667 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
668 : static_assert(0 < 1, "There is no slot for us");
669 :
670 : static bool
671 0 : get_loadingEnabled(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLSharedObjectElement* self, JSJitGetterCallArgs args)
672 : {
673 0 : bool result(self->LoadingEnabled());
674 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
675 0 : args.rval().setBoolean(result);
676 0 : return true;
677 : }
678 :
679 : static bool
680 0 : set_loadingEnabled(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLSharedObjectElement* self, JSJitSetterCallArgs args)
681 : {
682 : bool arg0;
683 0 : if (!ValueToPrimitive<bool, eDefault>(cx, args[0], &arg0)) {
684 0 : return false;
685 : }
686 0 : self->SetLoadingEnabled(arg0);
687 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
688 :
689 0 : return true;
690 : }
691 :
692 : static const JSJitInfo loadingEnabled_getterinfo = {
693 : { (JSJitGetterOp)get_loadingEnabled },
694 : { prototypes::id::HTMLEmbedElement },
695 : { PrototypeTraits<prototypes::id::HTMLEmbedElement>::Depth },
696 : JSJitInfo::Getter,
697 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
698 : JSVAL_TYPE_BOOLEAN, /* returnType. Not relevant for setters. */
699 : true, /* isInfallible. False in setters. */
700 : false, /* isMovable. Not relevant for setters. */
701 : false, /* isEliminatable. Not relevant for setters. */
702 : false, /* isAlwaysInSlot. Only relevant for getters. */
703 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
704 : false, /* isTypedMethod. Only relevant for methods. */
705 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
706 : };
707 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
708 : static_assert(0 < 1, "There is no slot for us");
709 : static const JSJitInfo loadingEnabled_setterinfo = {
710 : { (JSJitGetterOp)set_loadingEnabled },
711 : { prototypes::id::HTMLEmbedElement },
712 : { PrototypeTraits<prototypes::id::HTMLEmbedElement>::Depth },
713 : JSJitInfo::Setter,
714 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
715 : JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */
716 : false, /* isInfallible. False in setters. */
717 : false, /* isMovable. Not relevant for setters. */
718 : false, /* isEliminatable. Not relevant for setters. */
719 : false, /* isAlwaysInSlot. Only relevant for getters. */
720 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
721 : false, /* isTypedMethod. Only relevant for methods. */
722 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
723 : };
724 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
725 : static_assert(0 < 1, "There is no slot for us");
726 :
727 : static bool
728 0 : get_imageBlockingStatus(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLSharedObjectElement* self, JSJitGetterCallArgs args)
729 : {
730 0 : int16_t result(self->ImageBlockingStatus());
731 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
732 0 : args.rval().setInt32(int32_t(result));
733 0 : return true;
734 : }
735 :
736 : static const JSJitInfo imageBlockingStatus_getterinfo = {
737 : { (JSJitGetterOp)get_imageBlockingStatus },
738 : { prototypes::id::HTMLEmbedElement },
739 : { PrototypeTraits<prototypes::id::HTMLEmbedElement>::Depth },
740 : JSJitInfo::Getter,
741 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
742 : JSVAL_TYPE_INT32, /* returnType. Not relevant for setters. */
743 : true, /* isInfallible. False in setters. */
744 : false, /* isMovable. Not relevant for setters. */
745 : false, /* isEliminatable. Not relevant for setters. */
746 : false, /* isAlwaysInSlot. Only relevant for getters. */
747 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
748 : false, /* isTypedMethod. Only relevant for methods. */
749 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
750 : };
751 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
752 : static_assert(0 < 1, "There is no slot for us");
753 :
754 : static bool
755 0 : addObserver(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLSharedObjectElement* self, const JSJitMethodCallArgs& args)
756 : {
757 0 : if (MOZ_UNLIKELY(args.length() < 1)) {
758 0 : return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "HTMLEmbedElement.addObserver");
759 : }
760 : imgINotificationObserver* arg0;
761 0 : RefPtr<imgINotificationObserver> arg0_holder;
762 0 : if (args[0].isObject()) {
763 0 : JS::Rooted<JSObject*> source(cx, &args[0].toObject());
764 0 : if (NS_FAILED(UnwrapArg<imgINotificationObserver>(cx, source, getter_AddRefs(arg0_holder)))) {
765 0 : ThrowErrorMessage(cx, MSG_DOES_NOT_IMPLEMENT_INTERFACE, "Argument 1 of HTMLEmbedElement.addObserver", "imgINotificationObserver");
766 0 : return false;
767 : }
768 0 : MOZ_ASSERT(arg0_holder);
769 0 : arg0 = arg0_holder;
770 : } else {
771 0 : ThrowErrorMessage(cx, MSG_NOT_OBJECT, "Argument 1 of HTMLEmbedElement.addObserver");
772 0 : return false;
773 : }
774 0 : self->AddObserver(NonNullHelper(arg0));
775 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
776 0 : args.rval().setUndefined();
777 0 : return true;
778 : }
779 :
780 : static const JSJitInfo addObserver_methodinfo = {
781 : { (JSJitGetterOp)addObserver },
782 : { prototypes::id::HTMLEmbedElement },
783 : { PrototypeTraits<prototypes::id::HTMLEmbedElement>::Depth },
784 : JSJitInfo::Method,
785 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
786 : JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */
787 : false, /* isInfallible. False in setters. */
788 : false, /* isMovable. Not relevant for setters. */
789 : false, /* isEliminatable. Not relevant for setters. */
790 : false, /* isAlwaysInSlot. Only relevant for getters. */
791 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
792 : false, /* isTypedMethod. Only relevant for methods. */
793 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
794 : };
795 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
796 : static_assert(0 < 1, "There is no slot for us");
797 :
798 : static bool
799 0 : removeObserver(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLSharedObjectElement* self, const JSJitMethodCallArgs& args)
800 : {
801 0 : if (MOZ_UNLIKELY(args.length() < 1)) {
802 0 : return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "HTMLEmbedElement.removeObserver");
803 : }
804 : imgINotificationObserver* arg0;
805 0 : RefPtr<imgINotificationObserver> arg0_holder;
806 0 : if (args[0].isObject()) {
807 0 : JS::Rooted<JSObject*> source(cx, &args[0].toObject());
808 0 : if (NS_FAILED(UnwrapArg<imgINotificationObserver>(cx, source, getter_AddRefs(arg0_holder)))) {
809 0 : ThrowErrorMessage(cx, MSG_DOES_NOT_IMPLEMENT_INTERFACE, "Argument 1 of HTMLEmbedElement.removeObserver", "imgINotificationObserver");
810 0 : return false;
811 : }
812 0 : MOZ_ASSERT(arg0_holder);
813 0 : arg0 = arg0_holder;
814 : } else {
815 0 : ThrowErrorMessage(cx, MSG_NOT_OBJECT, "Argument 1 of HTMLEmbedElement.removeObserver");
816 0 : return false;
817 : }
818 0 : self->RemoveObserver(NonNullHelper(arg0));
819 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
820 0 : args.rval().setUndefined();
821 0 : return true;
822 : }
823 :
824 : static const JSJitInfo removeObserver_methodinfo = {
825 : { (JSJitGetterOp)removeObserver },
826 : { prototypes::id::HTMLEmbedElement },
827 : { PrototypeTraits<prototypes::id::HTMLEmbedElement>::Depth },
828 : JSJitInfo::Method,
829 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
830 : JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */
831 : false, /* isInfallible. False in setters. */
832 : false, /* isMovable. Not relevant for setters. */
833 : false, /* isEliminatable. Not relevant for setters. */
834 : false, /* isAlwaysInSlot. Only relevant for getters. */
835 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
836 : false, /* isTypedMethod. Only relevant for methods. */
837 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
838 : };
839 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
840 : static_assert(0 < 1, "There is no slot for us");
841 :
842 : static bool
843 0 : getRequest(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLSharedObjectElement* self, const JSJitMethodCallArgs& args)
844 : {
845 0 : if (MOZ_UNLIKELY(args.length() < 1)) {
846 0 : return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "HTMLEmbedElement.getRequest");
847 : }
848 : int32_t arg0;
849 0 : if (!ValueToPrimitive<int32_t, eDefault>(cx, args[0], &arg0)) {
850 0 : return false;
851 : }
852 0 : binding_detail::FastErrorResult rv;
853 0 : auto result(StrongOrRawPtr<imgIRequest>(self->GetRequest(arg0, rv)));
854 0 : if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
855 0 : return false;
856 : }
857 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
858 0 : if (!result) {
859 0 : args.rval().setNull();
860 0 : return true;
861 : }
862 0 : if (!WrapObject(cx, result, &NS_GET_IID(imgIRequest), args.rval())) {
863 0 : return false;
864 : }
865 0 : return true;
866 : }
867 :
868 : static const JSJitInfo getRequest_methodinfo = {
869 : { (JSJitGetterOp)getRequest },
870 : { prototypes::id::HTMLEmbedElement },
871 : { PrototypeTraits<prototypes::id::HTMLEmbedElement>::Depth },
872 : JSJitInfo::Method,
873 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
874 : JSVAL_TYPE_UNKNOWN, /* returnType. Not relevant for setters. */
875 : false, /* isInfallible. False in setters. */
876 : false, /* isMovable. Not relevant for setters. */
877 : false, /* isEliminatable. Not relevant for setters. */
878 : false, /* isAlwaysInSlot. Only relevant for getters. */
879 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
880 : false, /* isTypedMethod. Only relevant for methods. */
881 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
882 : };
883 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
884 : static_assert(0 < 1, "There is no slot for us");
885 :
886 : static bool
887 0 : getRequestType(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLSharedObjectElement* self, const JSJitMethodCallArgs& args)
888 : {
889 0 : if (MOZ_UNLIKELY(args.length() < 1)) {
890 0 : return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "HTMLEmbedElement.getRequestType");
891 : }
892 : imgIRequest* arg0;
893 0 : RefPtr<imgIRequest> arg0_holder;
894 0 : if (args[0].isObject()) {
895 0 : JS::Rooted<JSObject*> source(cx, &args[0].toObject());
896 0 : if (NS_FAILED(UnwrapArg<imgIRequest>(cx, source, getter_AddRefs(arg0_holder)))) {
897 0 : ThrowErrorMessage(cx, MSG_DOES_NOT_IMPLEMENT_INTERFACE, "Argument 1 of HTMLEmbedElement.getRequestType", "imgIRequest");
898 0 : return false;
899 : }
900 0 : MOZ_ASSERT(arg0_holder);
901 0 : arg0 = arg0_holder;
902 : } else {
903 0 : ThrowErrorMessage(cx, MSG_NOT_OBJECT, "Argument 1 of HTMLEmbedElement.getRequestType");
904 0 : return false;
905 : }
906 0 : binding_detail::FastErrorResult rv;
907 0 : int32_t result(self->GetRequestType(NonNullHelper(arg0), rv));
908 0 : if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
909 0 : return false;
910 : }
911 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
912 0 : args.rval().setInt32(int32_t(result));
913 0 : return true;
914 : }
915 :
916 : static const JSJitInfo getRequestType_methodinfo = {
917 : { (JSJitGetterOp)getRequestType },
918 : { prototypes::id::HTMLEmbedElement },
919 : { PrototypeTraits<prototypes::id::HTMLEmbedElement>::Depth },
920 : JSJitInfo::Method,
921 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
922 : JSVAL_TYPE_INT32, /* returnType. Not relevant for setters. */
923 : false, /* isInfallible. False in setters. */
924 : false, /* isMovable. Not relevant for setters. */
925 : false, /* isEliminatable. Not relevant for setters. */
926 : false, /* isAlwaysInSlot. Only relevant for getters. */
927 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
928 : false, /* isTypedMethod. Only relevant for methods. */
929 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
930 : };
931 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
932 : static_assert(0 < 1, "There is no slot for us");
933 :
934 : static bool
935 0 : get_currentURI(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLSharedObjectElement* self, JSJitGetterCallArgs args)
936 : {
937 0 : binding_detail::FastErrorResult rv;
938 0 : auto result(StrongOrRawPtr<nsIURI>(self->GetCurrentURI(rv)));
939 0 : if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
940 0 : return false;
941 : }
942 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
943 0 : if (!result) {
944 0 : args.rval().setNull();
945 0 : return true;
946 : }
947 0 : if (!WrapObject(cx, result, &NS_GET_IID(nsIURI), args.rval())) {
948 0 : return false;
949 : }
950 0 : return true;
951 : }
952 :
953 : static const JSJitInfo currentURI_getterinfo = {
954 : { (JSJitGetterOp)get_currentURI },
955 : { prototypes::id::HTMLEmbedElement },
956 : { PrototypeTraits<prototypes::id::HTMLEmbedElement>::Depth },
957 : JSJitInfo::Getter,
958 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
959 : JSVAL_TYPE_UNKNOWN, /* returnType. Not relevant for setters. */
960 : false, /* isInfallible. False in setters. */
961 : false, /* isMovable. Not relevant for setters. */
962 : false, /* isEliminatable. Not relevant for setters. */
963 : false, /* isAlwaysInSlot. Only relevant for getters. */
964 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
965 : false, /* isTypedMethod. Only relevant for methods. */
966 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
967 : };
968 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
969 : static_assert(0 < 1, "There is no slot for us");
970 :
971 : static bool
972 0 : forceReload(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLSharedObjectElement* self, const JSJitMethodCallArgs& args)
973 : {
974 0 : Optional<bool> arg0;
975 0 : if (args.hasDefined(0)) {
976 0 : arg0.Construct();
977 0 : if (!ValueToPrimitive<bool, eDefault>(cx, args[0], &arg0.Value())) {
978 0 : return false;
979 : }
980 : }
981 0 : binding_detail::FastErrorResult rv;
982 0 : self->ForceReload(Constify(arg0), rv);
983 0 : if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
984 0 : return false;
985 : }
986 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
987 0 : args.rval().setUndefined();
988 0 : return true;
989 : }
990 :
991 : static const JSJitInfo forceReload_methodinfo = {
992 : { (JSJitGetterOp)forceReload },
993 : { prototypes::id::HTMLEmbedElement },
994 : { PrototypeTraits<prototypes::id::HTMLEmbedElement>::Depth },
995 : JSJitInfo::Method,
996 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
997 : JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */
998 : false, /* isInfallible. False in setters. */
999 : false, /* isMovable. Not relevant for setters. */
1000 : false, /* isEliminatable. Not relevant for setters. */
1001 : false, /* isAlwaysInSlot. Only relevant for getters. */
1002 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
1003 : false, /* isTypedMethod. Only relevant for methods. */
1004 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
1005 : };
1006 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
1007 : static_assert(0 < 1, "There is no slot for us");
1008 :
1009 : static bool
1010 0 : forceImageState(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLSharedObjectElement* self, const JSJitMethodCallArgs& args)
1011 : {
1012 0 : if (MOZ_UNLIKELY(args.length() < 2)) {
1013 0 : return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "HTMLEmbedElement.forceImageState");
1014 : }
1015 : bool arg0;
1016 0 : if (!ValueToPrimitive<bool, eDefault>(cx, args[0], &arg0)) {
1017 0 : return false;
1018 : }
1019 : uint64_t arg1;
1020 0 : if (!ValueToPrimitive<uint64_t, eDefault>(cx, args[1], &arg1)) {
1021 0 : return false;
1022 : }
1023 0 : self->ForceImageState(arg0, arg1);
1024 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
1025 0 : args.rval().setUndefined();
1026 0 : return true;
1027 : }
1028 :
1029 : static const JSJitInfo forceImageState_methodinfo = {
1030 : { (JSJitGetterOp)forceImageState },
1031 : { prototypes::id::HTMLEmbedElement },
1032 : { PrototypeTraits<prototypes::id::HTMLEmbedElement>::Depth },
1033 : JSJitInfo::Method,
1034 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
1035 : JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */
1036 : false, /* isInfallible. False in setters. */
1037 : false, /* isMovable. Not relevant for setters. */
1038 : false, /* isEliminatable. Not relevant for setters. */
1039 : false, /* isAlwaysInSlot. Only relevant for getters. */
1040 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
1041 : false, /* isTypedMethod. Only relevant for methods. */
1042 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
1043 : };
1044 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
1045 : static_assert(0 < 1, "There is no slot for us");
1046 :
1047 : static bool
1048 0 : get_actualType(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLSharedObjectElement* self, JSJitGetterCallArgs args)
1049 : {
1050 0 : DOMString result;
1051 0 : self->GetActualType(result);
1052 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
1053 0 : if (!xpc::NonVoidStringToJsval(cx, result, args.rval())) {
1054 0 : return false;
1055 : }
1056 0 : return true;
1057 : }
1058 :
1059 : static const JSJitInfo actualType_getterinfo = {
1060 : { (JSJitGetterOp)get_actualType },
1061 : { prototypes::id::HTMLEmbedElement },
1062 : { PrototypeTraits<prototypes::id::HTMLEmbedElement>::Depth },
1063 : JSJitInfo::Getter,
1064 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
1065 : JSVAL_TYPE_STRING, /* returnType. Not relevant for setters. */
1066 : false, /* isInfallible. False in setters. */
1067 : false, /* isMovable. Not relevant for setters. */
1068 : false, /* isEliminatable. Not relevant for setters. */
1069 : false, /* isAlwaysInSlot. Only relevant for getters. */
1070 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
1071 : false, /* isTypedMethod. Only relevant for methods. */
1072 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
1073 : };
1074 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
1075 : static_assert(0 < 1, "There is no slot for us");
1076 :
1077 : static bool
1078 0 : get_displayedType(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLSharedObjectElement* self, JSJitGetterCallArgs args)
1079 : {
1080 0 : uint32_t result(self->DisplayedType());
1081 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
1082 0 : args.rval().setNumber(result);
1083 0 : return true;
1084 : }
1085 :
1086 : static const JSJitInfo displayedType_getterinfo = {
1087 : { (JSJitGetterOp)get_displayedType },
1088 : { prototypes::id::HTMLEmbedElement },
1089 : { PrototypeTraits<prototypes::id::HTMLEmbedElement>::Depth },
1090 : JSJitInfo::Getter,
1091 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
1092 : JSVAL_TYPE_DOUBLE, /* returnType. Not relevant for setters. */
1093 : true, /* isInfallible. False in setters. */
1094 : false, /* isMovable. Not relevant for setters. */
1095 : false, /* isEliminatable. Not relevant for setters. */
1096 : false, /* isAlwaysInSlot. Only relevant for getters. */
1097 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
1098 : false, /* isTypedMethod. Only relevant for methods. */
1099 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
1100 : };
1101 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
1102 : static_assert(0 < 1, "There is no slot for us");
1103 :
1104 : static bool
1105 0 : getContentTypeForMIMEType(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLSharedObjectElement* self, const JSJitMethodCallArgs& args)
1106 : {
1107 0 : if (MOZ_UNLIKELY(args.length() < 1)) {
1108 0 : return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "HTMLEmbedElement.getContentTypeForMIMEType");
1109 : }
1110 0 : binding_detail::FakeString arg0;
1111 0 : if (!ConvertJSValueToString(cx, args[0], eStringify, eStringify, arg0)) {
1112 0 : return false;
1113 : }
1114 0 : uint32_t result(self->GetContentTypeForMIMEType(NonNullHelper(Constify(arg0))));
1115 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
1116 0 : args.rval().setNumber(result);
1117 0 : return true;
1118 : }
1119 :
1120 : static const JSJitInfo getContentTypeForMIMEType_methodinfo = {
1121 : { (JSJitGetterOp)getContentTypeForMIMEType },
1122 : { prototypes::id::HTMLEmbedElement },
1123 : { PrototypeTraits<prototypes::id::HTMLEmbedElement>::Depth },
1124 : JSJitInfo::Method,
1125 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
1126 : JSVAL_TYPE_DOUBLE, /* 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 : getPluginAttributes(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLSharedObjectElement* self, const JSJitMethodCallArgs& args)
1140 : {
1141 0 : nsTArray<MozPluginParameter> result;
1142 0 : self->GetPluginAttributes(result);
1143 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
1144 :
1145 0 : uint32_t length = result.Length();
1146 0 : JS::Rooted<JSObject*> returnArray(cx, JS_NewArrayObject(cx, length));
1147 0 : if (!returnArray) {
1148 0 : return false;
1149 : }
1150 : // Scope for 'tmp'
1151 : {
1152 0 : JS::Rooted<JS::Value> tmp(cx);
1153 0 : for (uint32_t sequenceIdx0 = 0; sequenceIdx0 < length; ++sequenceIdx0) {
1154 : // Control block to let us common up the JS_DefineElement calls when there
1155 : // are different ways to succeed at wrapping the object.
1156 : do {
1157 0 : if (!result[sequenceIdx0].ToObjectInternal(cx, &tmp)) {
1158 0 : return false;
1159 : }
1160 0 : break;
1161 : } while (0);
1162 0 : if (!JS_DefineElement(cx, returnArray, sequenceIdx0, tmp,
1163 : JSPROP_ENUMERATE)) {
1164 0 : return false;
1165 : }
1166 : }
1167 : }
1168 0 : args.rval().setObject(*returnArray);
1169 0 : return true;
1170 : }
1171 :
1172 : static const JSJitInfo getPluginAttributes_methodinfo = {
1173 : { (JSJitGetterOp)getPluginAttributes },
1174 : { prototypes::id::HTMLEmbedElement },
1175 : { PrototypeTraits<prototypes::id::HTMLEmbedElement>::Depth },
1176 : JSJitInfo::Method,
1177 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
1178 : JSVAL_TYPE_OBJECT, /* returnType. Not relevant for setters. */
1179 : false, /* isInfallible. False in setters. */
1180 : false, /* isMovable. Not relevant for setters. */
1181 : false, /* isEliminatable. Not relevant for setters. */
1182 : false, /* isAlwaysInSlot. Only relevant for getters. */
1183 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
1184 : false, /* isTypedMethod. Only relevant for methods. */
1185 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
1186 : };
1187 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
1188 : static_assert(0 < 1, "There is no slot for us");
1189 :
1190 : static bool
1191 0 : getPluginParameters(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLSharedObjectElement* self, const JSJitMethodCallArgs& args)
1192 : {
1193 0 : nsTArray<MozPluginParameter> result;
1194 0 : self->GetPluginParameters(result);
1195 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
1196 :
1197 0 : uint32_t length = result.Length();
1198 0 : JS::Rooted<JSObject*> returnArray(cx, JS_NewArrayObject(cx, length));
1199 0 : if (!returnArray) {
1200 0 : return false;
1201 : }
1202 : // Scope for 'tmp'
1203 : {
1204 0 : JS::Rooted<JS::Value> tmp(cx);
1205 0 : for (uint32_t sequenceIdx0 = 0; sequenceIdx0 < length; ++sequenceIdx0) {
1206 : // Control block to let us common up the JS_DefineElement calls when there
1207 : // are different ways to succeed at wrapping the object.
1208 : do {
1209 0 : if (!result[sequenceIdx0].ToObjectInternal(cx, &tmp)) {
1210 0 : return false;
1211 : }
1212 0 : break;
1213 : } while (0);
1214 0 : if (!JS_DefineElement(cx, returnArray, sequenceIdx0, tmp,
1215 : JSPROP_ENUMERATE)) {
1216 0 : return false;
1217 : }
1218 : }
1219 : }
1220 0 : args.rval().setObject(*returnArray);
1221 0 : return true;
1222 : }
1223 :
1224 : static const JSJitInfo getPluginParameters_methodinfo = {
1225 : { (JSJitGetterOp)getPluginParameters },
1226 : { prototypes::id::HTMLEmbedElement },
1227 : { PrototypeTraits<prototypes::id::HTMLEmbedElement>::Depth },
1228 : JSJitInfo::Method,
1229 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
1230 : JSVAL_TYPE_OBJECT, /* returnType. Not relevant for setters. */
1231 : false, /* isInfallible. False in setters. */
1232 : false, /* isMovable. Not relevant for setters. */
1233 : false, /* isEliminatable. Not relevant for setters. */
1234 : false, /* isAlwaysInSlot. Only relevant for getters. */
1235 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
1236 : false, /* isTypedMethod. Only relevant for methods. */
1237 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
1238 : };
1239 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
1240 : static_assert(0 < 1, "There is no slot for us");
1241 :
1242 : static bool
1243 0 : playPlugin(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLSharedObjectElement* self, const JSJitMethodCallArgs& args)
1244 : {
1245 0 : binding_detail::FastErrorResult rv;
1246 0 : self->PlayPlugin(SystemCallerGuarantee(), rv);
1247 0 : if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
1248 0 : return false;
1249 : }
1250 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
1251 0 : args.rval().setUndefined();
1252 0 : return true;
1253 : }
1254 :
1255 : static const JSJitInfo playPlugin_methodinfo = {
1256 : { (JSJitGetterOp)playPlugin },
1257 : { prototypes::id::HTMLEmbedElement },
1258 : { PrototypeTraits<prototypes::id::HTMLEmbedElement>::Depth },
1259 : JSJitInfo::Method,
1260 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
1261 : JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */
1262 : false, /* isInfallible. False in setters. */
1263 : false, /* isMovable. Not relevant for setters. */
1264 : false, /* isEliminatable. Not relevant for setters. */
1265 : false, /* isAlwaysInSlot. Only relevant for getters. */
1266 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
1267 : false, /* isTypedMethod. Only relevant for methods. */
1268 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
1269 : };
1270 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
1271 : static_assert(0 < 1, "There is no slot for us");
1272 :
1273 : static bool
1274 0 : reload(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLSharedObjectElement* self, const JSJitMethodCallArgs& args)
1275 : {
1276 0 : if (MOZ_UNLIKELY(args.length() < 1)) {
1277 0 : return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "HTMLEmbedElement.reload");
1278 : }
1279 : bool arg0;
1280 0 : if (!ValueToPrimitive<bool, eDefault>(cx, args[0], &arg0)) {
1281 0 : return false;
1282 : }
1283 0 : binding_detail::FastErrorResult rv;
1284 0 : self->Reload(arg0, rv);
1285 0 : if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
1286 0 : return false;
1287 : }
1288 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
1289 0 : args.rval().setUndefined();
1290 0 : return true;
1291 : }
1292 :
1293 : static const JSJitInfo reload_methodinfo = {
1294 : { (JSJitGetterOp)reload },
1295 : { prototypes::id::HTMLEmbedElement },
1296 : { PrototypeTraits<prototypes::id::HTMLEmbedElement>::Depth },
1297 : JSJitInfo::Method,
1298 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
1299 : JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */
1300 : false, /* isInfallible. False in setters. */
1301 : false, /* isMovable. Not relevant for setters. */
1302 : false, /* isEliminatable. Not relevant for setters. */
1303 : false, /* isAlwaysInSlot. Only relevant for getters. */
1304 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
1305 : false, /* isTypedMethod. Only relevant for methods. */
1306 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
1307 : };
1308 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
1309 : static_assert(0 < 1, "There is no slot for us");
1310 :
1311 : static bool
1312 0 : get_activated(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLSharedObjectElement* self, JSJitGetterCallArgs args)
1313 : {
1314 0 : bool result(self->Activated());
1315 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
1316 0 : args.rval().setBoolean(result);
1317 0 : return true;
1318 : }
1319 :
1320 : static const JSJitInfo activated_getterinfo = {
1321 : { (JSJitGetterOp)get_activated },
1322 : { prototypes::id::HTMLEmbedElement },
1323 : { PrototypeTraits<prototypes::id::HTMLEmbedElement>::Depth },
1324 : JSJitInfo::Getter,
1325 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
1326 : JSVAL_TYPE_BOOLEAN, /* returnType. Not relevant for setters. */
1327 : true, /* isInfallible. False in setters. */
1328 : false, /* isMovable. Not relevant for setters. */
1329 : false, /* isEliminatable. Not relevant for setters. */
1330 : false, /* isAlwaysInSlot. Only relevant for getters. */
1331 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
1332 : false, /* isTypedMethod. Only relevant for methods. */
1333 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
1334 : };
1335 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
1336 : static_assert(0 < 1, "There is no slot for us");
1337 :
1338 : static bool
1339 0 : get_srcURI(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLSharedObjectElement* self, JSJitGetterCallArgs args)
1340 : {
1341 0 : auto result(StrongOrRawPtr<nsIURI>(self->GetSrcURI()));
1342 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
1343 0 : if (!result) {
1344 0 : args.rval().setNull();
1345 0 : return true;
1346 : }
1347 0 : if (!WrapObject(cx, result, &NS_GET_IID(nsIURI), args.rval())) {
1348 0 : return false;
1349 : }
1350 0 : return true;
1351 : }
1352 :
1353 : static const JSJitInfo srcURI_getterinfo = {
1354 : { (JSJitGetterOp)get_srcURI },
1355 : { prototypes::id::HTMLEmbedElement },
1356 : { PrototypeTraits<prototypes::id::HTMLEmbedElement>::Depth },
1357 : JSJitInfo::Getter,
1358 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
1359 : JSVAL_TYPE_UNKNOWN, /* returnType. Not relevant for setters. */
1360 : false, /* isInfallible. False in setters. */
1361 : false, /* isMovable. Not relevant for setters. */
1362 : false, /* isEliminatable. Not relevant for setters. */
1363 : false, /* isAlwaysInSlot. Only relevant for getters. */
1364 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
1365 : false, /* isTypedMethod. Only relevant for methods. */
1366 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
1367 : };
1368 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
1369 : static_assert(0 < 1, "There is no slot for us");
1370 :
1371 : static bool
1372 0 : get_defaultFallbackType(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLSharedObjectElement* self, JSJitGetterCallArgs args)
1373 : {
1374 0 : uint32_t result(self->DefaultFallbackType());
1375 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
1376 0 : args.rval().setNumber(result);
1377 0 : return true;
1378 : }
1379 :
1380 : static const JSJitInfo defaultFallbackType_getterinfo = {
1381 : { (JSJitGetterOp)get_defaultFallbackType },
1382 : { prototypes::id::HTMLEmbedElement },
1383 : { PrototypeTraits<prototypes::id::HTMLEmbedElement>::Depth },
1384 : JSJitInfo::Getter,
1385 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
1386 : JSVAL_TYPE_DOUBLE, /* returnType. Not relevant for setters. */
1387 : true, /* isInfallible. False in setters. */
1388 : false, /* isMovable. Not relevant for setters. */
1389 : false, /* isEliminatable. Not relevant for setters. */
1390 : false, /* isAlwaysInSlot. Only relevant for getters. */
1391 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
1392 : false, /* isTypedMethod. Only relevant for methods. */
1393 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
1394 : };
1395 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
1396 : static_assert(0 < 1, "There is no slot for us");
1397 :
1398 : static bool
1399 0 : get_pluginFallbackType(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLSharedObjectElement* self, JSJitGetterCallArgs args)
1400 : {
1401 0 : uint32_t result(self->PluginFallbackType());
1402 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
1403 0 : args.rval().setNumber(result);
1404 0 : return true;
1405 : }
1406 :
1407 : static const JSJitInfo pluginFallbackType_getterinfo = {
1408 : { (JSJitGetterOp)get_pluginFallbackType },
1409 : { prototypes::id::HTMLEmbedElement },
1410 : { PrototypeTraits<prototypes::id::HTMLEmbedElement>::Depth },
1411 : JSJitInfo::Getter,
1412 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
1413 : JSVAL_TYPE_DOUBLE, /* returnType. Not relevant for setters. */
1414 : true, /* isInfallible. False in setters. */
1415 : false, /* isMovable. Not relevant for setters. */
1416 : false, /* isEliminatable. Not relevant for setters. */
1417 : false, /* isAlwaysInSlot. Only relevant for getters. */
1418 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
1419 : false, /* isTypedMethod. Only relevant for methods. */
1420 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
1421 : };
1422 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
1423 : static_assert(0 < 1, "There is no slot for us");
1424 :
1425 : static bool
1426 0 : get_hasRunningPlugin(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLSharedObjectElement* self, JSJitGetterCallArgs args)
1427 : {
1428 0 : bool result(self->HasRunningPlugin());
1429 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
1430 0 : args.rval().setBoolean(result);
1431 0 : return true;
1432 : }
1433 :
1434 : static const JSJitInfo hasRunningPlugin_getterinfo = {
1435 : { (JSJitGetterOp)get_hasRunningPlugin },
1436 : { prototypes::id::HTMLEmbedElement },
1437 : { PrototypeTraits<prototypes::id::HTMLEmbedElement>::Depth },
1438 : JSJitInfo::Getter,
1439 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
1440 : JSVAL_TYPE_BOOLEAN, /* returnType. Not relevant for setters. */
1441 : true, /* isInfallible. False in setters. */
1442 : false, /* isMovable. Not relevant for setters. */
1443 : false, /* isEliminatable. Not relevant for setters. */
1444 : false, /* isAlwaysInSlot. Only relevant for getters. */
1445 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
1446 : false, /* isTypedMethod. Only relevant for methods. */
1447 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
1448 : };
1449 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
1450 : static_assert(0 < 1, "There is no slot for us");
1451 :
1452 : static bool
1453 0 : skipFakePlugins(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLSharedObjectElement* self, const JSJitMethodCallArgs& args)
1454 : {
1455 0 : binding_detail::FastErrorResult rv;
1456 0 : self->SkipFakePlugins(rv);
1457 0 : if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
1458 0 : return false;
1459 : }
1460 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
1461 0 : args.rval().setUndefined();
1462 0 : return true;
1463 : }
1464 :
1465 : static const JSJitInfo skipFakePlugins_methodinfo = {
1466 : { (JSJitGetterOp)skipFakePlugins },
1467 : { prototypes::id::HTMLEmbedElement },
1468 : { PrototypeTraits<prototypes::id::HTMLEmbedElement>::Depth },
1469 : JSJitInfo::Method,
1470 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
1471 : JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */
1472 : false, /* isInfallible. False in setters. */
1473 : false, /* isMovable. Not relevant for setters. */
1474 : false, /* isEliminatable. Not relevant for setters. */
1475 : false, /* isAlwaysInSlot. Only relevant for getters. */
1476 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
1477 : false, /* isTypedMethod. Only relevant for methods. */
1478 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
1479 : };
1480 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
1481 : static_assert(0 < 1, "There is no slot for us");
1482 :
1483 : static bool
1484 0 : get_runID(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLSharedObjectElement* self, JSJitGetterCallArgs args)
1485 : {
1486 0 : binding_detail::FastErrorResult rv;
1487 0 : uint32_t result(self->GetRunID(SystemCallerGuarantee(), rv));
1488 0 : if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
1489 0 : return false;
1490 : }
1491 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
1492 0 : args.rval().setNumber(result);
1493 0 : return true;
1494 : }
1495 :
1496 : static const JSJitInfo runID_getterinfo = {
1497 : { (JSJitGetterOp)get_runID },
1498 : { prototypes::id::HTMLEmbedElement },
1499 : { PrototypeTraits<prototypes::id::HTMLEmbedElement>::Depth },
1500 : JSJitInfo::Getter,
1501 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
1502 : JSVAL_TYPE_DOUBLE, /* returnType. Not relevant for setters. */
1503 : false, /* isInfallible. False in setters. */
1504 : false, /* isMovable. Not relevant for setters. */
1505 : false, /* isEliminatable. Not relevant for setters. */
1506 : false, /* isAlwaysInSlot. Only relevant for getters. */
1507 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
1508 : false, /* isTypedMethod. Only relevant for methods. */
1509 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
1510 : };
1511 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
1512 : static_assert(0 < 1, "There is no slot for us");
1513 :
1514 : static bool
1515 0 : _addProperty(JSContext* cx, JS::Handle<JSObject*> obj, JS::Handle<jsid> id, JS::Handle<JS::Value> val)
1516 : {
1517 0 : mozilla::dom::HTMLSharedObjectElement* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::dom::HTMLSharedObjectElement>(obj);
1518 : // We don't want to preserve if we don't have a wrapper, and we
1519 : // obviously can't preserve if we're not initialized.
1520 0 : if (self && self->GetWrapperPreserveColor()) {
1521 0 : PreserveWrapper(self);
1522 : }
1523 0 : return true;
1524 : }
1525 :
1526 : static void
1527 0 : _finalize(js::FreeOp* fop, JSObject* obj)
1528 : {
1529 0 : mozilla::dom::HTMLSharedObjectElement* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::dom::HTMLSharedObjectElement>(obj);
1530 0 : if (self) {
1531 0 : ClearWrapper(self, self, obj);
1532 0 : AddForDeferredFinalization<mozilla::dom::HTMLSharedObjectElement>(self);
1533 : }
1534 0 : }
1535 :
1536 : static void
1537 0 : _objectMoved(JSObject* obj, const JSObject* old)
1538 : {
1539 0 : mozilla::dom::HTMLSharedObjectElement* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::dom::HTMLSharedObjectElement>(obj);
1540 0 : if (self) {
1541 0 : UpdateWrapper(self, self, obj, old);
1542 : }
1543 0 : }
1544 :
1545 : // We deliberately use brace-elision to make Visual Studio produce better initalization code.
1546 : #if defined(__clang__)
1547 : #pragma clang diagnostic push
1548 : #pragma clang diagnostic ignored "-Wmissing-braces"
1549 : #endif
1550 : static const JSFunctionSpec sMethods_specs[] = {
1551 : JS_FNSPEC("getSVGDocument", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&getSVGDocument_methodinfo), 0, JSPROP_ENUMERATE, nullptr),
1552 : JS_FS_END
1553 : };
1554 : #if defined(__clang__)
1555 : #pragma clang diagnostic pop
1556 : #endif
1557 :
1558 :
1559 : // Can't be const because the pref-enabled boolean needs to be writable
1560 : static Prefable<const JSFunctionSpec> sMethods[] = {
1561 : { nullptr, &sMethods_specs[0] },
1562 : { nullptr, nullptr }
1563 : };
1564 :
1565 : static_assert(1 <= 1ull << NUM_BITS_PROPERTY_INFO_PREF_INDEX,
1566 : "We have a prefable index that is >= (1 << NUM_BITS_PROPERTY_INFO_PREF_INDEX)");
1567 : static_assert(1 <= 1ull << NUM_BITS_PROPERTY_INFO_SPEC_INDEX,
1568 : "We have a spec index that is >= (1 << NUM_BITS_PROPERTY_INFO_SPEC_INDEX)");
1569 :
1570 : // We deliberately use brace-elision to make Visual Studio produce better initalization code.
1571 : #if defined(__clang__)
1572 : #pragma clang diagnostic push
1573 : #pragma clang diagnostic ignored "-Wmissing-braces"
1574 : #endif
1575 : static const JSFunctionSpec sChromeMethods_specs[] = {
1576 : JS_FNSPEC("setIsPrerendered", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&setIsPrerendered_methodinfo), 0, JSPROP_ENUMERATE, nullptr),
1577 : JS_FNSPEC("presetOpenerWindow", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&presetOpenerWindow_methodinfo), 1, JSPROP_ENUMERATE, nullptr),
1578 : JS_FNSPEC("swapFrameLoaders", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&swapFrameLoaders_methodinfo), 1, JSPROP_ENUMERATE, nullptr),
1579 : JS_FNSPEC("addObserver", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&addObserver_methodinfo), 1, JSPROP_ENUMERATE, nullptr),
1580 : JS_FNSPEC("removeObserver", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&removeObserver_methodinfo), 1, JSPROP_ENUMERATE, nullptr),
1581 : JS_FNSPEC("getRequest", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&getRequest_methodinfo), 1, JSPROP_ENUMERATE, nullptr),
1582 : JS_FNSPEC("getRequestType", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&getRequestType_methodinfo), 1, JSPROP_ENUMERATE, nullptr),
1583 : JS_FNSPEC("forceReload", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&forceReload_methodinfo), 0, JSPROP_ENUMERATE, nullptr),
1584 : JS_FNSPEC("forceImageState", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&forceImageState_methodinfo), 2, JSPROP_ENUMERATE, nullptr),
1585 : JS_FNSPEC("getContentTypeForMIMEType", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&getContentTypeForMIMEType_methodinfo), 1, JSPROP_ENUMERATE, nullptr),
1586 : JS_FNSPEC("getPluginAttributes", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&getPluginAttributes_methodinfo), 0, JSPROP_ENUMERATE, nullptr),
1587 : JS_FNSPEC("getPluginParameters", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&getPluginParameters_methodinfo), 0, JSPROP_ENUMERATE, nullptr),
1588 : JS_FNSPEC("playPlugin", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&playPlugin_methodinfo), 0, JSPROP_ENUMERATE, nullptr),
1589 : JS_FNSPEC("reload", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&reload_methodinfo), 1, JSPROP_ENUMERATE, nullptr),
1590 : JS_FNSPEC("skipFakePlugins", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&skipFakePlugins_methodinfo), 0, JSPROP_ENUMERATE, nullptr),
1591 : JS_FS_END
1592 : };
1593 : #if defined(__clang__)
1594 : #pragma clang diagnostic pop
1595 : #endif
1596 :
1597 :
1598 : // Can't be const because the pref-enabled boolean needs to be writable
1599 : static Prefable<const JSFunctionSpec> sChromeMethods[] = {
1600 : { nullptr, &sChromeMethods_specs[0] },
1601 : { nullptr, nullptr }
1602 : };
1603 :
1604 : static_assert(1 <= 1ull << NUM_BITS_PROPERTY_INFO_PREF_INDEX,
1605 : "We have a prefable index that is >= (1 << NUM_BITS_PROPERTY_INFO_PREF_INDEX)");
1606 : static_assert(15 <= 1ull << NUM_BITS_PROPERTY_INFO_SPEC_INDEX,
1607 : "We have a spec index that is >= (1 << NUM_BITS_PROPERTY_INFO_SPEC_INDEX)");
1608 :
1609 : // We deliberately use brace-elision to make Visual Studio produce better initalization code.
1610 : #if defined(__clang__)
1611 : #pragma clang diagnostic push
1612 : #pragma clang diagnostic ignored "-Wmissing-braces"
1613 : #endif
1614 : static const JSPropertySpec sAttributes_specs[] = {
1615 : { "src", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &src_getterinfo, GenericBindingSetter, &src_setterinfo },
1616 : { "type", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &type_getterinfo, GenericBindingSetter, &type_setterinfo },
1617 : { "width", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &width_getterinfo, GenericBindingSetter, &width_setterinfo },
1618 : { "height", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &height_getterinfo, GenericBindingSetter, &height_setterinfo },
1619 : { "align", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &align_getterinfo, GenericBindingSetter, &align_setterinfo },
1620 : { "name", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &name_getterinfo, GenericBindingSetter, &name_setterinfo },
1621 : { nullptr, 0, nullptr, nullptr, nullptr, nullptr }
1622 : };
1623 : #if defined(__clang__)
1624 : #pragma clang diagnostic pop
1625 : #endif
1626 :
1627 :
1628 : // Can't be const because the pref-enabled boolean needs to be writable
1629 : static Prefable<const JSPropertySpec> sAttributes[] = {
1630 : { nullptr, &sAttributes_specs[0] },
1631 : { nullptr, nullptr }
1632 : };
1633 :
1634 : static_assert(1 <= 1ull << NUM_BITS_PROPERTY_INFO_PREF_INDEX,
1635 : "We have a prefable index that is >= (1 << NUM_BITS_PROPERTY_INFO_PREF_INDEX)");
1636 : static_assert(6 <= 1ull << NUM_BITS_PROPERTY_INFO_SPEC_INDEX,
1637 : "We have a spec index that is >= (1 << NUM_BITS_PROPERTY_INFO_SPEC_INDEX)");
1638 :
1639 : // We deliberately use brace-elision to make Visual Studio produce better initalization code.
1640 : #if defined(__clang__)
1641 : #pragma clang diagnostic push
1642 : #pragma clang diagnostic ignored "-Wmissing-braces"
1643 : #endif
1644 : static const JSPropertySpec sChromeAttributes_specs[] = {
1645 : { "frameLoader", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &frameLoader_getterinfo, nullptr, nullptr },
1646 : { "loadingEnabled", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &loadingEnabled_getterinfo, GenericBindingSetter, &loadingEnabled_setterinfo },
1647 : { "imageBlockingStatus", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &imageBlockingStatus_getterinfo, nullptr, nullptr },
1648 : { "currentURI", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, ¤tURI_getterinfo, nullptr, nullptr },
1649 : { "actualType", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &actualType_getterinfo, nullptr, nullptr },
1650 : { "displayedType", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &displayedType_getterinfo, nullptr, nullptr },
1651 : { "activated", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &activated_getterinfo, nullptr, nullptr },
1652 : { "srcURI", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &srcURI_getterinfo, nullptr, nullptr },
1653 : { "defaultFallbackType", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &defaultFallbackType_getterinfo, nullptr, nullptr },
1654 : { "pluginFallbackType", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &pluginFallbackType_getterinfo, nullptr, nullptr },
1655 : { "hasRunningPlugin", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &hasRunningPlugin_getterinfo, nullptr, nullptr },
1656 : { "runID", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &runID_getterinfo, nullptr, nullptr },
1657 : { nullptr, 0, nullptr, nullptr, nullptr, nullptr }
1658 : };
1659 : #if defined(__clang__)
1660 : #pragma clang diagnostic pop
1661 : #endif
1662 :
1663 :
1664 : // Can't be const because the pref-enabled boolean needs to be writable
1665 : static Prefable<const JSPropertySpec> sChromeAttributes[] = {
1666 : { nullptr, &sChromeAttributes_specs[0] },
1667 : { nullptr, nullptr }
1668 : };
1669 :
1670 : static_assert(1 <= 1ull << NUM_BITS_PROPERTY_INFO_PREF_INDEX,
1671 : "We have a prefable index that is >= (1 << NUM_BITS_PROPERTY_INFO_PREF_INDEX)");
1672 : static_assert(12 <= 1ull << NUM_BITS_PROPERTY_INFO_SPEC_INDEX,
1673 : "We have a spec index that is >= (1 << NUM_BITS_PROPERTY_INFO_SPEC_INDEX)");
1674 :
1675 : // We deliberately use brace-elision to make Visual Studio produce better initalization code.
1676 : #if defined(__clang__)
1677 : #pragma clang diagnostic push
1678 : #pragma clang diagnostic ignored "-Wmissing-braces"
1679 : #endif
1680 : static const ConstantSpec sChromeConstants_specs[] = {
1681 : { "UNKNOWN_REQUEST", JS::Int32Value(-1) },
1682 : { "CURRENT_REQUEST", JS::Int32Value(0) },
1683 : { "PENDING_REQUEST", JS::Int32Value(1) },
1684 : { "TYPE_LOADING", JS::NumberValue(0U) },
1685 : { "TYPE_IMAGE", JS::NumberValue(1U) },
1686 : { "TYPE_PLUGIN", JS::NumberValue(2U) },
1687 : { "TYPE_FAKE_PLUGIN", JS::NumberValue(3U) },
1688 : { "TYPE_DOCUMENT", JS::NumberValue(4U) },
1689 : { "TYPE_NULL", JS::NumberValue(5U) },
1690 : { "PLUGIN_UNSUPPORTED", JS::NumberValue(0U) },
1691 : { "PLUGIN_ALTERNATE", JS::NumberValue(1U) },
1692 : { "PLUGIN_DISABLED", JS::NumberValue(2U) },
1693 : { "PLUGIN_BLOCKLISTED", JS::NumberValue(3U) },
1694 : { "PLUGIN_OUTDATED", JS::NumberValue(4U) },
1695 : { "PLUGIN_CRASHED", JS::NumberValue(5U) },
1696 : { "PLUGIN_SUPPRESSED", JS::NumberValue(6U) },
1697 : { "PLUGIN_USER_DISABLED", JS::NumberValue(7U) },
1698 : { "PLUGIN_CLICK_TO_PLAY", JS::NumberValue(8U) },
1699 : { "PLUGIN_VULNERABLE_UPDATABLE", JS::NumberValue(9U) },
1700 : { "PLUGIN_VULNERABLE_NO_UPDATE", JS::NumberValue(10U) },
1701 : { 0, JS::UndefinedValue() }
1702 : };
1703 : #if defined(__clang__)
1704 : #pragma clang diagnostic pop
1705 : #endif
1706 :
1707 :
1708 : // Can't be const because the pref-enabled boolean needs to be writable
1709 : static Prefable<const ConstantSpec> sChromeConstants[] = {
1710 : { nullptr, &sChromeConstants_specs[0] },
1711 : { nullptr, nullptr }
1712 : };
1713 :
1714 : static_assert(1 <= 1ull << NUM_BITS_PROPERTY_INFO_PREF_INDEX,
1715 : "We have a prefable index that is >= (1 << NUM_BITS_PROPERTY_INFO_PREF_INDEX)");
1716 : static_assert(20 <= 1ull << NUM_BITS_PROPERTY_INFO_SPEC_INDEX,
1717 : "We have a spec index that is >= (1 << NUM_BITS_PROPERTY_INFO_SPEC_INDEX)");
1718 :
1719 :
1720 : static uint16_t sNativeProperties_sortedPropertyIndices[7];
1721 : static PropertyInfo sNativeProperties_propertyInfos[7];
1722 :
1723 : static const NativePropertiesN<2> sNativeProperties = {
1724 : false, 0,
1725 : false, 0,
1726 : true, 0 /* sMethods */,
1727 : true, 1 /* sAttributes */,
1728 : false, 0,
1729 : false, 0,
1730 : false, 0,
1731 : -1,
1732 : 7,
1733 : sNativeProperties_sortedPropertyIndices,
1734 : {
1735 : { sMethods, &sNativeProperties_propertyInfos[0] },
1736 : { sAttributes, &sNativeProperties_propertyInfos[1] }
1737 : }
1738 : };
1739 : static_assert(7 < 1ull << CHAR_BIT * sizeof(sNativeProperties.propertyInfoCount),
1740 : "We have a property info count that is oversized");
1741 :
1742 : static uint16_t sChromeOnlyNativeProperties_sortedPropertyIndices[47];
1743 : static PropertyInfo sChromeOnlyNativeProperties_propertyInfos[47];
1744 :
1745 : static const NativePropertiesN<3> sChromeOnlyNativeProperties = {
1746 : false, 0,
1747 : false, 0,
1748 : true, 0 /* sChromeMethods */,
1749 : true, 1 /* sChromeAttributes */,
1750 : false, 0,
1751 : false, 0,
1752 : true, 2 /* sChromeConstants */,
1753 : -1,
1754 : 47,
1755 : sChromeOnlyNativeProperties_sortedPropertyIndices,
1756 : {
1757 : { sChromeMethods, &sChromeOnlyNativeProperties_propertyInfos[0] },
1758 : { sChromeAttributes, &sChromeOnlyNativeProperties_propertyInfos[15] },
1759 : { sChromeConstants, &sChromeOnlyNativeProperties_propertyInfos[27] }
1760 : }
1761 : };
1762 : static_assert(47 < 1ull << CHAR_BIT * sizeof(sChromeOnlyNativeProperties.propertyInfoCount),
1763 : "We have a property info count that is oversized");
1764 :
1765 : static bool
1766 0 : _constructor(JSContext* cx, unsigned argc, JS::Value* vp)
1767 : {
1768 0 : JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
1769 0 : JS::Rooted<JSObject*> obj(cx, &args.callee());
1770 0 : if (!args.isConstructing()) {
1771 : // XXXbz wish I could get the name from the callee instead of
1772 : // Adding more relocations
1773 0 : return ThrowConstructorWithoutNew(cx, "HTMLEmbedElement");
1774 : }
1775 :
1776 0 : GlobalObject global(cx, obj);
1777 0 : if (global.Failed()) {
1778 0 : return false;
1779 : }
1780 :
1781 : // The newTarget might be a cross-compartment wrapper. Get the underlying object
1782 : // so we can do the spec's object-identity checks.
1783 0 : JS::Rooted<JSObject*> newTarget(cx, js::CheckedUnwrap(&args.newTarget().toObject()));
1784 0 : if (!newTarget) {
1785 0 : return ThrowErrorMessage(cx, MSG_ILLEGAL_CONSTRUCTOR);
1786 : }
1787 :
1788 : // Step 2 of https://html.spec.whatwg.org/multipage/dom.html#htmlconstructor.
1789 : // Enter the compartment of our underlying newTarget object, so we end
1790 : // up comparing to the constructor object for our interface from that global.
1791 : {
1792 0 : JSAutoCompartment ac(cx, newTarget);
1793 0 : JS::Handle<JSObject*> constructor(GetConstructorObjectHandle(cx));
1794 0 : if (!constructor) {
1795 0 : return false;
1796 : }
1797 0 : if (newTarget == constructor) {
1798 0 : return ThrowErrorMessage(cx, MSG_ILLEGAL_CONSTRUCTOR);
1799 : }
1800 : }
1801 :
1802 0 : JS::Rooted<JSObject*> desiredProto(cx);
1803 0 : if (!GetDesiredProto(cx, args, &desiredProto)) {
1804 0 : return false;
1805 : }
1806 0 : if (!desiredProto) {
1807 : // Step 7 of https://html.spec.whatwg.org/multipage/dom.html#htmlconstructor.
1808 : // This fallback behavior is designed to match analogous behavior for the
1809 : // JavaScript built-ins. So we enter the compartment of our underlying
1810 : // newTarget object and fall back to the prototype object from that global.
1811 : // XXX The spec says to use GetFunctionRealm(), which is not actually
1812 : // the same thing as what we have here (e.g. in the case of scripted callable proxies
1813 : // whose target is not same-compartment with the proxy, or bound functions, etc).
1814 : // https://bugzilla.mozilla.org/show_bug.cgi?id=1317658
1815 : {
1816 0 : JSAutoCompartment ac(cx, newTarget);
1817 0 : desiredProto = GetProtoObjectHandle(cx);
1818 0 : if (!desiredProto) {
1819 0 : return false;
1820 : }
1821 : }
1822 :
1823 : // desiredProto is in the compartment of the underlying newTarget object.
1824 : // Wrap it into the context compartment.
1825 0 : if (!JS_WrapObject(cx, &desiredProto)) {
1826 0 : return false;
1827 : }
1828 : }
1829 :
1830 0 : bool objIsXray = xpc::WrapperFactory::IsXrayWrapper(obj);
1831 0 : Maybe<JSAutoCompartment> ac;
1832 0 : if (objIsXray) {
1833 0 : obj = js::CheckedUnwrap(obj);
1834 0 : if (!obj) {
1835 0 : return false;
1836 : }
1837 0 : ac.emplace(cx, obj);
1838 0 : if (!JS_WrapObject(cx, &desiredProto)) {
1839 0 : return false;
1840 : }
1841 : }
1842 0 : binding_detail::FastErrorResult rv;
1843 0 : auto result(StrongOrRawPtr<mozilla::dom::HTMLSharedObjectElement>(CreateHTMLElement(global, args, rv)));
1844 0 : if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
1845 0 : return false;
1846 : }
1847 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
1848 : static_assert(!IsPointer<decltype(result)>::value,
1849 : "NewObject implies that we need to keep the object alive with a strong reference.");
1850 0 : if (!GetOrCreateDOMReflector(cx, result, args.rval(), desiredProto)) {
1851 0 : MOZ_ASSERT(true || JS_IsExceptionPending(cx));
1852 0 : return false;
1853 : }
1854 0 : return true;
1855 : }
1856 :
1857 : static const js::ClassOps sInterfaceObjectClassOps = {
1858 : nullptr, /* addProperty */
1859 : nullptr, /* delProperty */
1860 : nullptr, /* getProperty */
1861 : nullptr, /* setProperty */
1862 : nullptr, /* enumerate */
1863 : nullptr, /* newEnumerate */
1864 : nullptr, /* resolve */
1865 : nullptr, /* mayResolve */
1866 : nullptr, /* finalize */
1867 : _constructor, /* call */
1868 : nullptr, /* hasInstance */
1869 : _constructor, /* construct */
1870 : nullptr, /* trace */
1871 : };
1872 :
1873 : static const DOMIfaceAndProtoJSClass sInterfaceObjectClass = {
1874 : {
1875 : "Function",
1876 : JSCLASS_IS_DOMIFACEANDPROTOJSCLASS | JSCLASS_HAS_RESERVED_SLOTS(DOM_INTERFACE_SLOTS_BASE),
1877 : &sInterfaceObjectClassOps,
1878 : JS_NULL_CLASS_SPEC,
1879 : JS_NULL_CLASS_EXT,
1880 : &sInterfaceObjectClassObjectOps
1881 : },
1882 : eInterface,
1883 : true,
1884 : prototypes::id::HTMLEmbedElement,
1885 : PrototypeTraits<prototypes::id::HTMLEmbedElement>::Depth,
1886 : sNativePropertyHooks,
1887 : "function HTMLEmbedElement() {\n [native code]\n}",
1888 : HTMLElementBinding::GetConstructorObject
1889 : };
1890 :
1891 : static bool
1892 0 : _resolve(JSContext* cx, JS::Handle<JSObject*> obj, JS::Handle<jsid> id, bool* resolvedp)
1893 : {
1894 0 : mozilla::dom::HTMLSharedObjectElement* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::dom::HTMLSharedObjectElement>(obj);
1895 0 : JS::Rooted<JS::PropertyDescriptor> desc(cx);
1896 0 : if (!self->DoResolve(cx, obj, id, &desc)) {
1897 0 : return false;
1898 : }
1899 0 : if (!desc.object()) {
1900 0 : return true;
1901 : }
1902 : // If desc.value() is undefined, then the DoResolve call
1903 : // has already defined it on the object. Don't try to also
1904 : // define it.
1905 0 : if (!desc.value().isUndefined()) {
1906 0 : desc.attributesRef() |= JSPROP_RESOLVING;
1907 0 : if (!JS_DefinePropertyById(cx, obj, id, desc)) {
1908 0 : return false;
1909 : }
1910 : }
1911 0 : *resolvedp = true;
1912 0 : return true;
1913 : }
1914 :
1915 : static bool
1916 0 : _mayResolve(const JSAtomState& names, jsid id, JSObject* maybeObj)
1917 : {
1918 0 : return mozilla::dom::HTMLSharedObjectElement::MayResolve(id);
1919 : }
1920 :
1921 : static bool
1922 0 : _newEnumerate(JSContext* cx, JS::Handle<JSObject*> obj, JS::AutoIdVector& properties, bool enumerableOnly)
1923 : {
1924 : mozilla::dom::HTMLSharedObjectElement* self;
1925 0 : JS::Rooted<JS::Value> rootSelf(cx, JS::ObjectValue(*obj));
1926 : {
1927 0 : nsresult rv = UnwrapObject<prototypes::id::HTMLEmbedElement, mozilla::dom::HTMLSharedObjectElement>(&rootSelf, self);
1928 0 : if (NS_FAILED(rv)) {
1929 0 : return ThrowErrorMessage(cx, MSG_THIS_DOES_NOT_IMPLEMENT_INTERFACE, "Value", "HTMLEmbedElement");
1930 : }
1931 : }
1932 0 : binding_detail::FastErrorResult rv;
1933 0 : self->GetOwnPropertyNames(cx, properties, enumerableOnly, rv);
1934 0 : if (rv.MaybeSetPendingException(cx)) {
1935 0 : return false;
1936 : }
1937 0 : return true;
1938 : }
1939 :
1940 : static const DOMIfaceAndProtoJSClass sPrototypeClass = {
1941 : {
1942 : "HTMLEmbedElementPrototype",
1943 : JSCLASS_IS_DOMIFACEANDPROTOJSCLASS | JSCLASS_HAS_RESERVED_SLOTS(DOM_INTERFACE_PROTO_SLOTS_BASE),
1944 : JS_NULL_CLASS_OPS,
1945 : JS_NULL_CLASS_SPEC,
1946 : JS_NULL_CLASS_EXT,
1947 : JS_NULL_OBJECT_OPS
1948 : },
1949 : eInterfacePrototype,
1950 : false,
1951 : prototypes::id::HTMLEmbedElement,
1952 : PrototypeTraits<prototypes::id::HTMLEmbedElement>::Depth,
1953 : sNativePropertyHooks,
1954 : "[object HTMLEmbedElementPrototype]",
1955 : HTMLElementBinding::GetProtoObject
1956 : };
1957 :
1958 : JSObject*
1959 0 : DefineDOMInterface(JSContext* aCx, JS::Handle<JSObject*> aGlobal, JS::Handle<jsid> id, bool aDefineOnGlobal)
1960 : {
1961 0 : return GetConstructorObjectHandle(aCx, aDefineOnGlobal);
1962 : }
1963 :
1964 : static const js::ClassOps sClassOps = {
1965 : _addProperty, /* addProperty */
1966 : nullptr, /* delProperty */
1967 : nullptr, /* getProperty */
1968 : nullptr, /* setProperty */
1969 : nullptr, /* enumerate */
1970 : _newEnumerate, /* newEnumerate */
1971 : _resolve, /* resolve */
1972 : _mayResolve, /* mayResolve */
1973 : _finalize, /* finalize */
1974 : nullptr, /* call */
1975 : nullptr, /* hasInstance */
1976 : nullptr, /* construct */
1977 : nullptr, /* trace */
1978 : };
1979 :
1980 : static const js::ClassExtension sClassExtension = {
1981 : nullptr, /* weakmapKeyDelegateOp */
1982 : _objectMoved /* objectMovedOp */
1983 : };
1984 :
1985 : static const DOMJSClass sClass = {
1986 : { "HTMLEmbedElement",
1987 : JSCLASS_IS_DOMJSCLASS | JSCLASS_FOREGROUND_FINALIZE | JSCLASS_HAS_RESERVED_SLOTS(1),
1988 : &sClassOps,
1989 : JS_NULL_CLASS_SPEC,
1990 : &sClassExtension,
1991 : JS_NULL_OBJECT_OPS
1992 : },
1993 : { prototypes::id::EventTarget, prototypes::id::Node, prototypes::id::Element, prototypes::id::HTMLElement, prototypes::id::HTMLEmbedElement, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count },
1994 : IsBaseOf<nsISupports, mozilla::dom::HTMLSharedObjectElement >::value,
1995 : sNativePropertyHooks,
1996 : FindAssociatedGlobalForNative<mozilla::dom::HTMLSharedObjectElement>::Get,
1997 : GetProtoObjectHandle,
1998 : GetCCParticipant<mozilla::dom::HTMLSharedObjectElement>::Get()
1999 : };
2000 : static_assert(1 == DOM_INSTANCE_RESERVED_SLOTS,
2001 : "Must have the right minimal number of reserved slots.");
2002 : static_assert(1 >= 1,
2003 : "Must have enough reserved slots.");
2004 :
2005 : const JSClass*
2006 0 : GetJSClass()
2007 : {
2008 0 : return sClass.ToJSClass();
2009 : }
2010 :
2011 : bool
2012 0 : Wrap(JSContext* aCx, mozilla::dom::HTMLSharedObjectElement* aObject, nsWrapperCache* aCache, JS::Handle<JSObject*> aGivenProto, JS::MutableHandle<JSObject*> aReflector)
2013 : {
2014 : MOZ_ASSERT(static_cast<mozilla::dom::HTMLSharedObjectElement*>(aObject) ==
2015 : reinterpret_cast<mozilla::dom::HTMLSharedObjectElement*>(aObject),
2016 : "Multiple inheritance for mozilla::dom::HTMLSharedObjectElement is broken.");
2017 : MOZ_ASSERT(static_cast<nsGenericHTMLElement*>(aObject) ==
2018 : reinterpret_cast<nsGenericHTMLElement*>(aObject),
2019 : "Multiple inheritance for nsGenericHTMLElement is broken.");
2020 : MOZ_ASSERT(static_cast<mozilla::dom::Element*>(aObject) ==
2021 : reinterpret_cast<mozilla::dom::Element*>(aObject),
2022 : "Multiple inheritance for mozilla::dom::Element is broken.");
2023 : MOZ_ASSERT(static_cast<nsINode*>(aObject) ==
2024 : reinterpret_cast<nsINode*>(aObject),
2025 : "Multiple inheritance for nsINode is broken.");
2026 : MOZ_ASSERT(static_cast<mozilla::dom::EventTarget*>(aObject) ==
2027 : reinterpret_cast<mozilla::dom::EventTarget*>(aObject),
2028 : "Multiple inheritance for mozilla::dom::EventTarget is broken.");
2029 0 : MOZ_ASSERT(ToSupportsIsCorrect(aObject));
2030 0 : MOZ_ASSERT_IF(aGivenProto, js::IsObjectInContextCompartment(aGivenProto, aCx));
2031 0 : MOZ_ASSERT(!aCache->GetWrapper(),
2032 : "You should probably not be using Wrap() directly; use "
2033 : "GetOrCreateDOMReflector instead");
2034 :
2035 0 : MOZ_ASSERT(ToSupportsIsOnPrimaryInheritanceChain(aObject, aCache),
2036 : "nsISupports must be on our primary inheritance chain");
2037 :
2038 0 : JS::Rooted<JSObject*> global(aCx, FindAssociatedGlobal(aCx, aObject->GetParentObject()));
2039 0 : if (!global) {
2040 0 : return false;
2041 : }
2042 0 : MOZ_ASSERT(JS_IsGlobalObject(global));
2043 0 : MOZ_ASSERT(JS::ObjectIsNotGray(global));
2044 :
2045 : // That might have ended up wrapping us already, due to the wonders
2046 : // of XBL. Check for that, and bail out as needed.
2047 0 : aReflector.set(aCache->GetWrapper());
2048 0 : if (aReflector) {
2049 : #ifdef DEBUG
2050 0 : binding_detail::AssertReflectorHasGivenProto(aCx, aReflector, aGivenProto);
2051 : #endif // DEBUG
2052 0 : return true;
2053 : }
2054 :
2055 0 : JSAutoCompartment ac(aCx, global);
2056 0 : JS::Handle<JSObject*> canonicalProto = GetProtoObjectHandle(aCx);
2057 0 : if (!canonicalProto) {
2058 0 : return false;
2059 : }
2060 0 : JS::Rooted<JSObject*> proto(aCx);
2061 0 : if (aGivenProto) {
2062 0 : proto = aGivenProto;
2063 : // Unfortunately, while aGivenProto was in the compartment of aCx
2064 : // coming in, we changed compartments to that of "parent" so may need
2065 : // to wrap the proto here.
2066 0 : if (js::GetContextCompartment(aCx) != js::GetObjectCompartment(proto)) {
2067 0 : if (!JS_WrapObject(aCx, &proto)) {
2068 0 : return false;
2069 : }
2070 : }
2071 : } else {
2072 0 : proto = canonicalProto;
2073 : }
2074 :
2075 0 : BindingJSObjectCreator<mozilla::dom::HTMLSharedObjectElement> creator(aCx);
2076 0 : creator.CreateObject(aCx, sClass.ToJSClass(), proto, aObject, aReflector);
2077 0 : if (!aReflector) {
2078 0 : return false;
2079 : }
2080 :
2081 0 : aCache->SetWrapper(aReflector);
2082 0 : creator.InitializationSucceeded();
2083 :
2084 0 : MOZ_ASSERT(aCache->GetWrapperPreserveColor() &&
2085 : aCache->GetWrapperPreserveColor() == aReflector);
2086 : // If proto != canonicalProto, we have to preserve our wrapper;
2087 : // otherwise we won't be able to properly recreate it later, since
2088 : // we won't know what proto to use. Note that we don't check
2089 : // aGivenProto here, since it's entirely possible (and even
2090 : // somewhat common) to have a non-null aGivenProto which is the
2091 : // same as canonicalProto.
2092 0 : if (proto != canonicalProto) {
2093 0 : PreserveWrapper(aObject);
2094 : }
2095 :
2096 0 : return true;
2097 : }
2098 :
2099 : const NativePropertyHooks sNativePropertyHooks[] = { {
2100 : nullptr,
2101 : nullptr,
2102 : nullptr,
2103 : { sNativeProperties.Upcast(), sChromeOnlyNativeProperties.Upcast() },
2104 : prototypes::id::HTMLEmbedElement,
2105 : constructors::id::HTMLEmbedElement,
2106 : HTMLElementBinding::sNativePropertyHooks,
2107 : &DefaultXrayExpandoObjectClass
2108 : } };
2109 :
2110 : void
2111 0 : CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, bool aDefineOnGlobal)
2112 : {
2113 0 : JS::Handle<JSObject*> parentProto(HTMLElementBinding::GetProtoObjectHandle(aCx));
2114 0 : if (!parentProto) {
2115 0 : return;
2116 : }
2117 :
2118 0 : JS::Handle<JSObject*> constructorProto(HTMLElementBinding::GetConstructorObjectHandle(aCx));
2119 0 : if (!constructorProto) {
2120 0 : return;
2121 : }
2122 :
2123 : static bool sIdsInited = false;
2124 0 : if (!sIdsInited && NS_IsMainThread()) {
2125 0 : if (!InitIds(aCx, sNativeProperties.Upcast())) {
2126 0 : return;
2127 : }
2128 0 : if (!InitIds(aCx, sChromeOnlyNativeProperties.Upcast())) {
2129 0 : return;
2130 : }
2131 0 : sIdsInited = true;
2132 : }
2133 :
2134 0 : JS::Heap<JSObject*>* protoCache = &aProtoAndIfaceCache.EntrySlotOrCreate(prototypes::id::HTMLEmbedElement);
2135 0 : JS::Heap<JSObject*>* interfaceCache = &aProtoAndIfaceCache.EntrySlotOrCreate(constructors::id::HTMLEmbedElement);
2136 0 : dom::CreateInterfaceObjects(aCx, aGlobal, parentProto,
2137 : &sPrototypeClass.mBase, protoCache,
2138 : constructorProto, &sInterfaceObjectClass.mBase, 0, nullptr,
2139 : interfaceCache,
2140 : sNativeProperties.Upcast(),
2141 0 : nsContentUtils::ThreadsafeIsSystemCaller(aCx) ? sChromeOnlyNativeProperties.Upcast() : nullptr,
2142 : "HTMLEmbedElement", aDefineOnGlobal,
2143 : nullptr,
2144 0 : false);
2145 : }
2146 :
2147 : JS::Handle<JSObject*>
2148 0 : GetProtoObjectHandle(JSContext* aCx)
2149 : {
2150 : /* Get the interface prototype object for this class. This will create the
2151 : object as needed. */
2152 0 : bool aDefineOnGlobal = true;
2153 :
2154 : /* Make sure our global is sane. Hopefully we can remove this sometime */
2155 0 : JSObject* global = JS::CurrentGlobalOrNull(aCx);
2156 0 : if (!(js::GetObjectClass(global)->flags & JSCLASS_DOM_GLOBAL)) {
2157 0 : return nullptr;
2158 : }
2159 :
2160 : /* Check to see whether the interface objects are already installed */
2161 0 : ProtoAndIfaceCache& protoAndIfaceCache = *GetProtoAndIfaceCache(global);
2162 0 : if (!protoAndIfaceCache.HasEntryInSlot(prototypes::id::HTMLEmbedElement)) {
2163 0 : JS::Rooted<JSObject*> rootedGlobal(aCx, global);
2164 0 : CreateInterfaceObjects(aCx, rootedGlobal, protoAndIfaceCache, aDefineOnGlobal);
2165 : }
2166 :
2167 : /*
2168 : * The object might _still_ be null, but that's OK.
2169 : *
2170 : * Calling fromMarkedLocation() is safe because protoAndIfaceCache is
2171 : * traced by TraceProtoAndIfaceCache() and its contents are never
2172 : * changed after they have been set.
2173 : *
2174 : * Calling address() avoids the read read barrier that does gray
2175 : * unmarking, but it's not possible for the object to be gray here.
2176 : */
2177 :
2178 0 : const JS::Heap<JSObject*>& entrySlot = protoAndIfaceCache.EntrySlotMustExist(prototypes::id::HTMLEmbedElement);
2179 0 : MOZ_ASSERT(JS::ObjectIsNotGray(entrySlot));
2180 0 : return JS::Handle<JSObject*>::fromMarkedLocation(entrySlot.address());
2181 : }
2182 :
2183 : JS::Handle<JSObject*>
2184 0 : GetConstructorObjectHandle(JSContext* aCx, bool aDefineOnGlobal)
2185 : {
2186 : /* Get the interface object for this class. This will create the object as
2187 : needed. */
2188 :
2189 : /* Make sure our global is sane. Hopefully we can remove this sometime */
2190 0 : JSObject* global = JS::CurrentGlobalOrNull(aCx);
2191 0 : if (!(js::GetObjectClass(global)->flags & JSCLASS_DOM_GLOBAL)) {
2192 0 : return nullptr;
2193 : }
2194 :
2195 : /* Check to see whether the interface objects are already installed */
2196 0 : ProtoAndIfaceCache& protoAndIfaceCache = *GetProtoAndIfaceCache(global);
2197 0 : if (!protoAndIfaceCache.HasEntryInSlot(constructors::id::HTMLEmbedElement)) {
2198 0 : JS::Rooted<JSObject*> rootedGlobal(aCx, global);
2199 0 : CreateInterfaceObjects(aCx, rootedGlobal, protoAndIfaceCache, aDefineOnGlobal);
2200 : }
2201 :
2202 : /*
2203 : * The object might _still_ be null, but that's OK.
2204 : *
2205 : * Calling fromMarkedLocation() is safe because protoAndIfaceCache is
2206 : * traced by TraceProtoAndIfaceCache() and its contents are never
2207 : * changed after they have been set.
2208 : *
2209 : * Calling address() avoids the read read barrier that does gray
2210 : * unmarking, but it's not possible for the object to be gray here.
2211 : */
2212 :
2213 0 : const JS::Heap<JSObject*>& entrySlot = protoAndIfaceCache.EntrySlotMustExist(constructors::id::HTMLEmbedElement);
2214 0 : MOZ_ASSERT(JS::ObjectIsNotGray(entrySlot));
2215 0 : return JS::Handle<JSObject*>::fromMarkedLocation(entrySlot.address());
2216 : }
2217 :
2218 : JSObject*
2219 0 : GetConstructorObject(JSContext* aCx)
2220 : {
2221 0 : return GetConstructorObjectHandle(aCx);
2222 : }
2223 :
2224 : } // namespace HTMLEmbedElementBinding
2225 :
2226 :
2227 :
2228 : } // namespace dom
2229 : } // namespace mozilla
|