Line data Source code
1 : /* THIS FILE IS AUTOGENERATED FROM HTMLObjectElement.webidl BY Codegen.py - DO NOT EDIT */
2 :
3 : #include "AtomList.h"
4 : #include "HTMLElementBinding.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/HTMLFormElement.h"
14 : #include "mozilla/dom/HTMLIFrameElement.h"
15 : #include "mozilla/dom/HTMLObjectElement.h"
16 : #include "mozilla/dom/NonRefcountedDOMObject.h"
17 : #include "mozilla/dom/Nullable.h"
18 : #include "mozilla/dom/PrimitiveConversions.h"
19 : #include "mozilla/dom/ScriptSettings.h"
20 : #include "mozilla/dom/SimpleGlobalObject.h"
21 : #include "mozilla/dom/ValidityState.h"
22 : #include "mozilla/dom/XrayExpandoClass.h"
23 : #include "nsContentUtils.h"
24 : #include "nsIDocument.h"
25 : #include "nsIFrameLoader.h"
26 : #include "nsIURI.h"
27 : #include "nsPIDOMWindow.h"
28 : #include "nsXULElement.h"
29 :
30 : namespace mozilla {
31 : namespace dom {
32 :
33 :
34 0 : MozPluginParameter::MozPluginParameter()
35 : {
36 : // Safe to pass a null context if we pass a null value
37 0 : Init(nullptr, JS::NullHandleValue);
38 0 : }
39 :
40 :
41 :
42 : bool
43 0 : MozPluginParameter::InitIds(JSContext* cx, MozPluginParameterAtoms* atomsCache)
44 : {
45 0 : MOZ_ASSERT(!*reinterpret_cast<jsid**>(atomsCache));
46 :
47 : // Initialize these in reverse order so that any failure leaves the first one
48 : // uninitialized.
49 0 : if (!atomsCache->value_id.init(cx, "value") ||
50 0 : !atomsCache->name_id.init(cx, "name")) {
51 0 : return false;
52 : }
53 0 : return true;
54 : }
55 :
56 : bool
57 0 : MozPluginParameter::Init(JSContext* cx, JS::Handle<JS::Value> val, const char* sourceDescription, bool passedToJSImpl)
58 : {
59 : // Passing a null JSContext is OK only if we're initing from null,
60 : // Since in that case we will not have to do any property gets
61 : // Also evaluate isNullOrUndefined in order to avoid false-positive
62 : // checkers by static analysis tools
63 0 : MOZ_ASSERT_IF(!cx, val.isNull() && val.isNullOrUndefined());
64 0 : MozPluginParameterAtoms* atomsCache = nullptr;
65 0 : if (cx) {
66 0 : atomsCache = GetAtomCache<MozPluginParameterAtoms>(cx);
67 0 : if (!*reinterpret_cast<jsid**>(atomsCache) && !InitIds(cx, atomsCache)) {
68 0 : return false;
69 : }
70 : }
71 :
72 0 : if (!IsConvertibleToDictionary(val)) {
73 0 : return ThrowErrorMessage(cx, MSG_NOT_DICTIONARY, sourceDescription);
74 : }
75 :
76 0 : bool isNull = val.isNullOrUndefined();
77 : // We only need these if !isNull, in which case we have |cx|.
78 0 : Maybe<JS::Rooted<JSObject *> > object;
79 0 : Maybe<JS::Rooted<JS::Value> > temp;
80 0 : if (!isNull) {
81 0 : MOZ_ASSERT(cx);
82 0 : object.emplace(cx, &val.toObject());
83 0 : temp.emplace(cx);
84 : }
85 0 : if (!isNull) {
86 0 : if (!JS_GetPropertyById(cx, *object, atomsCache->name_id, temp.ptr())) {
87 0 : return false;
88 : }
89 : }
90 0 : if (!isNull && !temp->isUndefined()) {
91 0 : if (!ConvertJSValueToString(cx, temp.ref(), eStringify, eStringify, mName)) {
92 0 : return false;
93 : }
94 : } else {
95 : static const char16_t data[] = { 0 };
96 0 : mName.Rebind(data, ArrayLength(data) - 1);
97 : }
98 0 : mIsAnyMemberPresent = true;
99 :
100 0 : if (!isNull) {
101 0 : if (!JS_GetPropertyById(cx, *object, atomsCache->value_id, temp.ptr())) {
102 0 : return false;
103 : }
104 : }
105 0 : if (!isNull && !temp->isUndefined()) {
106 0 : if (!ConvertJSValueToString(cx, temp.ref(), eStringify, eStringify, mValue)) {
107 0 : return false;
108 : }
109 : } else {
110 : static const char16_t data[] = { 0 };
111 0 : mValue.Rebind(data, ArrayLength(data) - 1);
112 : }
113 0 : mIsAnyMemberPresent = true;
114 0 : return true;
115 : }
116 :
117 : bool
118 0 : MozPluginParameter::Init(const nsAString& aJSON)
119 : {
120 0 : AutoJSAPI jsapi;
121 0 : JSObject* cleanGlobal = SimpleGlobalObject::Create(SimpleGlobalObject::GlobalType::BindingDetail);
122 0 : if (!cleanGlobal) {
123 0 : return false;
124 : }
125 0 : if (!jsapi.Init(cleanGlobal)) {
126 0 : return false;
127 : }
128 0 : JSContext* cx = jsapi.cx();
129 0 : JS::Rooted<JS::Value> json(cx);
130 0 : bool ok = ParseJSON(cx, aJSON, &json);
131 0 : NS_ENSURE_TRUE(ok, false);
132 0 : return Init(cx, json);
133 : }
134 :
135 : bool
136 0 : MozPluginParameter::ToObjectInternal(JSContext* cx, JS::MutableHandle<JS::Value> rval) const
137 : {
138 0 : MozPluginParameterAtoms* atomsCache = GetAtomCache<MozPluginParameterAtoms>(cx);
139 0 : if (!*reinterpret_cast<jsid**>(atomsCache) && !InitIds(cx, atomsCache)) {
140 0 : return false;
141 : }
142 :
143 0 : JS::Rooted<JSObject*> obj(cx, JS_NewPlainObject(cx));
144 0 : if (!obj) {
145 0 : return false;
146 : }
147 0 : rval.set(JS::ObjectValue(*obj));
148 :
149 : do {
150 : // block for our 'break' successCode and scope for 'temp' and 'currentValue'
151 0 : JS::Rooted<JS::Value> temp(cx);
152 0 : nsString const & currentValue = mName;
153 0 : if (!xpc::NonVoidStringToJsval(cx, currentValue, &temp)) {
154 0 : return false;
155 : }
156 0 : if (!JS_DefinePropertyById(cx, obj, atomsCache->name_id, temp, JSPROP_ENUMERATE)) {
157 0 : return false;
158 : }
159 0 : break;
160 : } while(0);
161 :
162 : do {
163 : // block for our 'break' successCode and scope for 'temp' and 'currentValue'
164 0 : JS::Rooted<JS::Value> temp(cx);
165 0 : nsString const & currentValue = mValue;
166 0 : if (!xpc::NonVoidStringToJsval(cx, currentValue, &temp)) {
167 0 : return false;
168 : }
169 0 : if (!JS_DefinePropertyById(cx, obj, atomsCache->value_id, temp, JSPROP_ENUMERATE)) {
170 0 : return false;
171 : }
172 0 : break;
173 : } while(0);
174 :
175 0 : return true;
176 : }
177 :
178 : bool
179 0 : MozPluginParameter::ToJSON(nsAString& aJSON) const
180 : {
181 0 : AutoJSAPI jsapi;
182 0 : jsapi.Init();
183 0 : JSContext *cx = jsapi.cx();
184 : // It's safe to use UnprivilegedJunkScopeOrWorkerGlobal here
185 : // because we'll only be creating objects, in ways that have no
186 : // side-effects, followed by a call to JS::ToJSONMaybeSafely,
187 : // which likewise guarantees no side-effects for the sorts of
188 : // things we will pass it.
189 0 : JSAutoCompartment ac(cx, binding_detail::UnprivilegedJunkScopeOrWorkerGlobal());
190 0 : JS::Rooted<JS::Value> val(cx);
191 0 : if (!ToObjectInternal(cx, &val)) {
192 0 : return false;
193 : }
194 0 : JS::Rooted<JSObject*> obj(cx, &val.toObject());
195 0 : return StringifyToJSON(cx, obj, aJSON);
196 : }
197 :
198 : void
199 0 : MozPluginParameter::TraceDictionary(JSTracer* trc)
200 : {
201 0 : }
202 :
203 : MozPluginParameter&
204 0 : MozPluginParameter::operator=(const MozPluginParameter& aOther)
205 : {
206 0 : mName = aOther.mName;
207 0 : mValue = aOther.mValue;
208 0 : return *this;
209 : }
210 :
211 : namespace binding_detail {
212 : } // namespace binding_detail
213 :
214 :
215 : namespace HTMLObjectElementBinding {
216 :
217 : static_assert(IsRefcounted<NativeType>::value == IsRefcounted<HTMLElementBinding::NativeType>::value,
218 : "Can't inherit from an interface with a different ownership model.");
219 :
220 : static bool
221 0 : get_data(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLObjectElement* self, JSJitGetterCallArgs args)
222 : {
223 0 : if (!mozilla::dom::EnforceNotInPrerendering(cx, obj)) {
224 : // Return false from the JSNative in order to trigger
225 : // an uncatchable exception.
226 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
227 0 : return false;
228 : }
229 0 : DOMString result;
230 0 : self->GetData(result);
231 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
232 0 : if (!xpc::NonVoidStringToJsval(cx, result, args.rval())) {
233 0 : return false;
234 : }
235 0 : return true;
236 : }
237 :
238 : static bool
239 0 : set_data(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLObjectElement* self, JSJitSetterCallArgs args)
240 : {
241 0 : if (!mozilla::dom::EnforceNotInPrerendering(cx, obj)) {
242 : // Return false from the JSNative in order to trigger
243 : // an uncatchable exception.
244 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
245 0 : return false;
246 : }
247 0 : binding_detail::FakeString arg0;
248 0 : if (!ConvertJSValueToString(cx, args[0], eStringify, eStringify, arg0)) {
249 0 : return false;
250 : }
251 0 : CustomElementReactionsStack* reactionsStack = GetCustomElementReactionsStack(obj);
252 0 : Maybe<AutoCEReaction> ceReaction;
253 0 : if (reactionsStack) {
254 0 : ceReaction.emplace(reactionsStack);
255 : }
256 0 : binding_detail::FastErrorResult rv;
257 0 : self->SetData(NonNullHelper(Constify(arg0)), rv);
258 0 : if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
259 0 : return false;
260 : }
261 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
262 :
263 0 : return true;
264 : }
265 :
266 : static const JSJitInfo data_getterinfo = {
267 : { (JSJitGetterOp)get_data },
268 : { prototypes::id::HTMLObjectElement },
269 : { PrototypeTraits<prototypes::id::HTMLObjectElement>::Depth },
270 : JSJitInfo::Getter,
271 : JSJitInfo::AliasDOMSets, /* aliasSet. Not relevant for setters. */
272 : JSVAL_TYPE_STRING, /* returnType. Not relevant for setters. */
273 : false, /* isInfallible. False in setters. */
274 : true, /* isMovable. Not relevant for setters. */
275 : true, /* isEliminatable. Not relevant for setters. */
276 : false, /* isAlwaysInSlot. Only relevant for getters. */
277 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
278 : false, /* isTypedMethod. Only relevant for methods. */
279 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
280 : };
281 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
282 : static_assert(0 < 1, "There is no slot for us");
283 : static const JSJitInfo data_setterinfo = {
284 : { (JSJitGetterOp)set_data },
285 : { prototypes::id::HTMLObjectElement },
286 : { PrototypeTraits<prototypes::id::HTMLObjectElement>::Depth },
287 : JSJitInfo::Setter,
288 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
289 : JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */
290 : false, /* isInfallible. False in setters. */
291 : false, /* isMovable. Not relevant for setters. */
292 : false, /* isEliminatable. Not relevant for setters. */
293 : false, /* isAlwaysInSlot. Only relevant for getters. */
294 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
295 : false, /* isTypedMethod. Only relevant for methods. */
296 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
297 : };
298 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
299 : static_assert(0 < 1, "There is no slot for us");
300 :
301 : static bool
302 0 : get_type(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLObjectElement* self, JSJitGetterCallArgs args)
303 : {
304 0 : if (!mozilla::dom::EnforceNotInPrerendering(cx, obj)) {
305 : // Return false from the JSNative in order to trigger
306 : // an uncatchable exception.
307 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
308 0 : return false;
309 : }
310 0 : DOMString result;
311 0 : self->GetType(result);
312 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
313 0 : if (!xpc::NonVoidStringToJsval(cx, result, args.rval())) {
314 0 : return false;
315 : }
316 0 : return true;
317 : }
318 :
319 : static bool
320 0 : set_type(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLObjectElement* self, JSJitSetterCallArgs args)
321 : {
322 0 : if (!mozilla::dom::EnforceNotInPrerendering(cx, obj)) {
323 : // Return false from the JSNative in order to trigger
324 : // an uncatchable exception.
325 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
326 0 : return false;
327 : }
328 0 : binding_detail::FakeString arg0;
329 0 : if (!ConvertJSValueToString(cx, args[0], eStringify, eStringify, arg0)) {
330 0 : return false;
331 : }
332 0 : CustomElementReactionsStack* reactionsStack = GetCustomElementReactionsStack(obj);
333 0 : Maybe<AutoCEReaction> ceReaction;
334 0 : if (reactionsStack) {
335 0 : ceReaction.emplace(reactionsStack);
336 : }
337 0 : binding_detail::FastErrorResult rv;
338 0 : self->SetType(NonNullHelper(Constify(arg0)), rv);
339 0 : if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
340 0 : return false;
341 : }
342 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
343 :
344 0 : return true;
345 : }
346 :
347 : static const JSJitInfo type_getterinfo = {
348 : { (JSJitGetterOp)get_type },
349 : { prototypes::id::HTMLObjectElement },
350 : { PrototypeTraits<prototypes::id::HTMLObjectElement>::Depth },
351 : JSJitInfo::Getter,
352 : JSJitInfo::AliasDOMSets, /* aliasSet. Not relevant for setters. */
353 : JSVAL_TYPE_STRING, /* returnType. Not relevant for setters. */
354 : false, /* isInfallible. False in setters. */
355 : true, /* isMovable. Not relevant for setters. */
356 : true, /* isEliminatable. Not relevant for setters. */
357 : false, /* isAlwaysInSlot. Only relevant for getters. */
358 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
359 : false, /* isTypedMethod. Only relevant for methods. */
360 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
361 : };
362 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
363 : static_assert(0 < 1, "There is no slot for us");
364 : static const JSJitInfo type_setterinfo = {
365 : { (JSJitGetterOp)set_type },
366 : { prototypes::id::HTMLObjectElement },
367 : { PrototypeTraits<prototypes::id::HTMLObjectElement>::Depth },
368 : JSJitInfo::Setter,
369 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
370 : JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */
371 : false, /* isInfallible. False in setters. */
372 : false, /* isMovable. Not relevant for setters. */
373 : false, /* isEliminatable. Not relevant for setters. */
374 : false, /* isAlwaysInSlot. Only relevant for getters. */
375 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
376 : false, /* isTypedMethod. Only relevant for methods. */
377 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
378 : };
379 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
380 : static_assert(0 < 1, "There is no slot for us");
381 :
382 : static bool
383 0 : get_typeMustMatch(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLObjectElement* self, JSJitGetterCallArgs args)
384 : {
385 0 : if (!mozilla::dom::EnforceNotInPrerendering(cx, obj)) {
386 : // Return false from the JSNative in order to trigger
387 : // an uncatchable exception.
388 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
389 0 : return false;
390 : }
391 0 : bool result(self->TypeMustMatch());
392 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
393 0 : args.rval().setBoolean(result);
394 0 : return true;
395 : }
396 :
397 : static bool
398 0 : set_typeMustMatch(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLObjectElement* self, JSJitSetterCallArgs args)
399 : {
400 0 : if (!mozilla::dom::EnforceNotInPrerendering(cx, obj)) {
401 : // Return false from the JSNative in order to trigger
402 : // an uncatchable exception.
403 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
404 0 : return false;
405 : }
406 : bool arg0;
407 0 : if (!ValueToPrimitive<bool, eDefault>(cx, args[0], &arg0)) {
408 0 : return false;
409 : }
410 0 : CustomElementReactionsStack* reactionsStack = GetCustomElementReactionsStack(obj);
411 0 : Maybe<AutoCEReaction> ceReaction;
412 0 : if (reactionsStack) {
413 0 : ceReaction.emplace(reactionsStack);
414 : }
415 0 : binding_detail::FastErrorResult rv;
416 0 : self->SetTypeMustMatch(arg0, rv);
417 0 : if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
418 0 : return false;
419 : }
420 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
421 :
422 0 : return true;
423 : }
424 :
425 : static const JSJitInfo typeMustMatch_getterinfo = {
426 : { (JSJitGetterOp)get_typeMustMatch },
427 : { prototypes::id::HTMLObjectElement },
428 : { PrototypeTraits<prototypes::id::HTMLObjectElement>::Depth },
429 : JSJitInfo::Getter,
430 : JSJitInfo::AliasDOMSets, /* aliasSet. Not relevant for setters. */
431 : JSVAL_TYPE_BOOLEAN, /* returnType. Not relevant for setters. */
432 : true, /* isInfallible. False in setters. */
433 : true, /* isMovable. Not relevant for setters. */
434 : true, /* isEliminatable. Not relevant for setters. */
435 : false, /* isAlwaysInSlot. Only relevant for getters. */
436 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
437 : false, /* isTypedMethod. Only relevant for methods. */
438 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
439 : };
440 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
441 : static_assert(0 < 1, "There is no slot for us");
442 : static const JSJitInfo typeMustMatch_setterinfo = {
443 : { (JSJitGetterOp)set_typeMustMatch },
444 : { prototypes::id::HTMLObjectElement },
445 : { PrototypeTraits<prototypes::id::HTMLObjectElement>::Depth },
446 : JSJitInfo::Setter,
447 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
448 : JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */
449 : false, /* isInfallible. False in setters. */
450 : false, /* isMovable. Not relevant for setters. */
451 : false, /* isEliminatable. Not relevant for setters. */
452 : false, /* isAlwaysInSlot. Only relevant for getters. */
453 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
454 : false, /* isTypedMethod. Only relevant for methods. */
455 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
456 : };
457 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
458 : static_assert(0 < 1, "There is no slot for us");
459 :
460 : static bool
461 0 : get_name(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLObjectElement* self, JSJitGetterCallArgs args)
462 : {
463 0 : if (!mozilla::dom::EnforceNotInPrerendering(cx, obj)) {
464 : // Return false from the JSNative in order to trigger
465 : // an uncatchable exception.
466 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
467 0 : return false;
468 : }
469 0 : DOMString result;
470 0 : self->GetName(result);
471 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
472 0 : if (!xpc::NonVoidStringToJsval(cx, result, args.rval())) {
473 0 : return false;
474 : }
475 0 : return true;
476 : }
477 :
478 : static bool
479 0 : set_name(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLObjectElement* self, JSJitSetterCallArgs args)
480 : {
481 0 : if (!mozilla::dom::EnforceNotInPrerendering(cx, obj)) {
482 : // Return false from the JSNative in order to trigger
483 : // an uncatchable exception.
484 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
485 0 : return false;
486 : }
487 0 : binding_detail::FakeString arg0;
488 0 : if (!ConvertJSValueToString(cx, args[0], eStringify, eStringify, arg0)) {
489 0 : return false;
490 : }
491 0 : CustomElementReactionsStack* reactionsStack = GetCustomElementReactionsStack(obj);
492 0 : Maybe<AutoCEReaction> ceReaction;
493 0 : if (reactionsStack) {
494 0 : ceReaction.emplace(reactionsStack);
495 : }
496 0 : binding_detail::FastErrorResult rv;
497 0 : self->SetName(NonNullHelper(Constify(arg0)), rv);
498 0 : if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
499 0 : return false;
500 : }
501 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
502 :
503 0 : return true;
504 : }
505 :
506 : static const JSJitInfo name_getterinfo = {
507 : { (JSJitGetterOp)get_name },
508 : { prototypes::id::HTMLObjectElement },
509 : { PrototypeTraits<prototypes::id::HTMLObjectElement>::Depth },
510 : JSJitInfo::Getter,
511 : JSJitInfo::AliasDOMSets, /* aliasSet. Not relevant for setters. */
512 : JSVAL_TYPE_STRING, /* returnType. Not relevant for setters. */
513 : false, /* isInfallible. False in setters. */
514 : true, /* isMovable. Not relevant for setters. */
515 : true, /* isEliminatable. Not relevant for setters. */
516 : false, /* isAlwaysInSlot. Only relevant for getters. */
517 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
518 : false, /* isTypedMethod. Only relevant for methods. */
519 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
520 : };
521 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
522 : static_assert(0 < 1, "There is no slot for us");
523 : static const JSJitInfo name_setterinfo = {
524 : { (JSJitGetterOp)set_name },
525 : { prototypes::id::HTMLObjectElement },
526 : { PrototypeTraits<prototypes::id::HTMLObjectElement>::Depth },
527 : JSJitInfo::Setter,
528 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
529 : JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */
530 : false, /* isInfallible. False in setters. */
531 : false, /* isMovable. Not relevant for setters. */
532 : false, /* isEliminatable. Not relevant for setters. */
533 : false, /* isAlwaysInSlot. Only relevant for getters. */
534 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
535 : false, /* isTypedMethod. Only relevant for methods. */
536 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
537 : };
538 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
539 : static_assert(0 < 1, "There is no slot for us");
540 :
541 : static bool
542 0 : get_useMap(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLObjectElement* self, JSJitGetterCallArgs args)
543 : {
544 0 : if (!mozilla::dom::EnforceNotInPrerendering(cx, obj)) {
545 : // Return false from the JSNative in order to trigger
546 : // an uncatchable exception.
547 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
548 0 : return false;
549 : }
550 0 : DOMString result;
551 0 : self->GetUseMap(result);
552 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
553 0 : if (!xpc::NonVoidStringToJsval(cx, result, args.rval())) {
554 0 : return false;
555 : }
556 0 : return true;
557 : }
558 :
559 : static bool
560 0 : set_useMap(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLObjectElement* self, JSJitSetterCallArgs args)
561 : {
562 0 : if (!mozilla::dom::EnforceNotInPrerendering(cx, obj)) {
563 : // Return false from the JSNative in order to trigger
564 : // an uncatchable exception.
565 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
566 0 : return false;
567 : }
568 0 : binding_detail::FakeString arg0;
569 0 : if (!ConvertJSValueToString(cx, args[0], eStringify, eStringify, arg0)) {
570 0 : return false;
571 : }
572 0 : CustomElementReactionsStack* reactionsStack = GetCustomElementReactionsStack(obj);
573 0 : Maybe<AutoCEReaction> ceReaction;
574 0 : if (reactionsStack) {
575 0 : ceReaction.emplace(reactionsStack);
576 : }
577 0 : binding_detail::FastErrorResult rv;
578 0 : self->SetUseMap(NonNullHelper(Constify(arg0)), rv);
579 0 : if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
580 0 : return false;
581 : }
582 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
583 :
584 0 : return true;
585 : }
586 :
587 : static const JSJitInfo useMap_getterinfo = {
588 : { (JSJitGetterOp)get_useMap },
589 : { prototypes::id::HTMLObjectElement },
590 : { PrototypeTraits<prototypes::id::HTMLObjectElement>::Depth },
591 : JSJitInfo::Getter,
592 : JSJitInfo::AliasDOMSets, /* aliasSet. Not relevant for setters. */
593 : JSVAL_TYPE_STRING, /* returnType. Not relevant for setters. */
594 : false, /* isInfallible. False in setters. */
595 : true, /* isMovable. Not relevant for setters. */
596 : true, /* isEliminatable. Not relevant for setters. */
597 : false, /* isAlwaysInSlot. Only relevant for getters. */
598 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
599 : false, /* isTypedMethod. Only relevant for methods. */
600 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
601 : };
602 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
603 : static_assert(0 < 1, "There is no slot for us");
604 : static const JSJitInfo useMap_setterinfo = {
605 : { (JSJitGetterOp)set_useMap },
606 : { prototypes::id::HTMLObjectElement },
607 : { PrototypeTraits<prototypes::id::HTMLObjectElement>::Depth },
608 : JSJitInfo::Setter,
609 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
610 : JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */
611 : false, /* isInfallible. False in setters. */
612 : false, /* isMovable. Not relevant for setters. */
613 : false, /* isEliminatable. Not relevant for setters. */
614 : false, /* isAlwaysInSlot. Only relevant for getters. */
615 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
616 : false, /* isTypedMethod. Only relevant for methods. */
617 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
618 : };
619 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
620 : static_assert(0 < 1, "There is no slot for us");
621 :
622 : static bool
623 0 : get_form(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLObjectElement* self, JSJitGetterCallArgs args)
624 : {
625 0 : if (!mozilla::dom::EnforceNotInPrerendering(cx, obj)) {
626 : // Return false from the JSNative in order to trigger
627 : // an uncatchable exception.
628 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
629 0 : return false;
630 : }
631 0 : auto result(StrongOrRawPtr<mozilla::dom::HTMLFormElement>(self->GetForm()));
632 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
633 0 : if (!result) {
634 0 : args.rval().setNull();
635 0 : return true;
636 : }
637 0 : if (!GetOrCreateDOMReflector(cx, result, args.rval())) {
638 0 : MOZ_ASSERT(true || JS_IsExceptionPending(cx));
639 0 : return false;
640 : }
641 0 : return true;
642 : }
643 :
644 : static const JSJitInfo form_getterinfo = {
645 : { (JSJitGetterOp)get_form },
646 : { prototypes::id::HTMLObjectElement },
647 : { PrototypeTraits<prototypes::id::HTMLObjectElement>::Depth },
648 : JSJitInfo::Getter,
649 : JSJitInfo::AliasDOMSets, /* aliasSet. Not relevant for setters. */
650 : JSVAL_TYPE_UNKNOWN, /* returnType. Not relevant for setters. */
651 : false, /* isInfallible. False in setters. */
652 : true, /* isMovable. Not relevant for setters. */
653 : true, /* isEliminatable. Not relevant for setters. */
654 : false, /* isAlwaysInSlot. Only relevant for getters. */
655 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
656 : false, /* isTypedMethod. Only relevant for methods. */
657 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
658 : };
659 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
660 : static_assert(0 < 1, "There is no slot for us");
661 :
662 : static bool
663 0 : get_width(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLObjectElement* self, JSJitGetterCallArgs args)
664 : {
665 0 : if (!mozilla::dom::EnforceNotInPrerendering(cx, obj)) {
666 : // Return false from the JSNative in order to trigger
667 : // an uncatchable exception.
668 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
669 0 : return false;
670 : }
671 0 : DOMString result;
672 0 : self->GetWidth(result);
673 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
674 0 : if (!xpc::NonVoidStringToJsval(cx, result, args.rval())) {
675 0 : return false;
676 : }
677 0 : return true;
678 : }
679 :
680 : static bool
681 0 : set_width(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLObjectElement* self, JSJitSetterCallArgs args)
682 : {
683 0 : if (!mozilla::dom::EnforceNotInPrerendering(cx, obj)) {
684 : // Return false from the JSNative in order to trigger
685 : // an uncatchable exception.
686 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
687 0 : return false;
688 : }
689 0 : binding_detail::FakeString arg0;
690 0 : if (!ConvertJSValueToString(cx, args[0], eStringify, eStringify, arg0)) {
691 0 : return false;
692 : }
693 0 : CustomElementReactionsStack* reactionsStack = GetCustomElementReactionsStack(obj);
694 0 : Maybe<AutoCEReaction> ceReaction;
695 0 : if (reactionsStack) {
696 0 : ceReaction.emplace(reactionsStack);
697 : }
698 0 : binding_detail::FastErrorResult rv;
699 0 : self->SetWidth(NonNullHelper(Constify(arg0)), rv);
700 0 : if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
701 0 : return false;
702 : }
703 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
704 :
705 0 : return true;
706 : }
707 :
708 : static const JSJitInfo width_getterinfo = {
709 : { (JSJitGetterOp)get_width },
710 : { prototypes::id::HTMLObjectElement },
711 : { PrototypeTraits<prototypes::id::HTMLObjectElement>::Depth },
712 : JSJitInfo::Getter,
713 : JSJitInfo::AliasDOMSets, /* aliasSet. Not relevant for setters. */
714 : JSVAL_TYPE_STRING, /* returnType. Not relevant for setters. */
715 : false, /* isInfallible. False in setters. */
716 : true, /* isMovable. Not relevant for setters. */
717 : true, /* isEliminatable. Not relevant for setters. */
718 : false, /* isAlwaysInSlot. Only relevant for getters. */
719 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
720 : false, /* isTypedMethod. Only relevant for methods. */
721 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
722 : };
723 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
724 : static_assert(0 < 1, "There is no slot for us");
725 : static const JSJitInfo width_setterinfo = {
726 : { (JSJitGetterOp)set_width },
727 : { prototypes::id::HTMLObjectElement },
728 : { PrototypeTraits<prototypes::id::HTMLObjectElement>::Depth },
729 : JSJitInfo::Setter,
730 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
731 : JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */
732 : false, /* isInfallible. False in setters. */
733 : false, /* isMovable. Not relevant for setters. */
734 : false, /* isEliminatable. Not relevant for setters. */
735 : false, /* isAlwaysInSlot. Only relevant for getters. */
736 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
737 : false, /* isTypedMethod. Only relevant for methods. */
738 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
739 : };
740 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
741 : static_assert(0 < 1, "There is no slot for us");
742 :
743 : static bool
744 0 : get_height(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLObjectElement* self, JSJitGetterCallArgs args)
745 : {
746 0 : if (!mozilla::dom::EnforceNotInPrerendering(cx, obj)) {
747 : // Return false from the JSNative in order to trigger
748 : // an uncatchable exception.
749 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
750 0 : return false;
751 : }
752 0 : DOMString result;
753 0 : self->GetHeight(result);
754 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
755 0 : if (!xpc::NonVoidStringToJsval(cx, result, args.rval())) {
756 0 : return false;
757 : }
758 0 : return true;
759 : }
760 :
761 : static bool
762 0 : set_height(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLObjectElement* self, JSJitSetterCallArgs args)
763 : {
764 0 : if (!mozilla::dom::EnforceNotInPrerendering(cx, obj)) {
765 : // Return false from the JSNative in order to trigger
766 : // an uncatchable exception.
767 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
768 0 : return false;
769 : }
770 0 : binding_detail::FakeString arg0;
771 0 : if (!ConvertJSValueToString(cx, args[0], eStringify, eStringify, arg0)) {
772 0 : return false;
773 : }
774 0 : CustomElementReactionsStack* reactionsStack = GetCustomElementReactionsStack(obj);
775 0 : Maybe<AutoCEReaction> ceReaction;
776 0 : if (reactionsStack) {
777 0 : ceReaction.emplace(reactionsStack);
778 : }
779 0 : binding_detail::FastErrorResult rv;
780 0 : self->SetHeight(NonNullHelper(Constify(arg0)), rv);
781 0 : if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
782 0 : return false;
783 : }
784 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
785 :
786 0 : return true;
787 : }
788 :
789 : static const JSJitInfo height_getterinfo = {
790 : { (JSJitGetterOp)get_height },
791 : { prototypes::id::HTMLObjectElement },
792 : { PrototypeTraits<prototypes::id::HTMLObjectElement>::Depth },
793 : JSJitInfo::Getter,
794 : JSJitInfo::AliasDOMSets, /* aliasSet. Not relevant for setters. */
795 : JSVAL_TYPE_STRING, /* returnType. Not relevant for setters. */
796 : false, /* isInfallible. False in setters. */
797 : true, /* isMovable. Not relevant for setters. */
798 : true, /* isEliminatable. Not relevant for setters. */
799 : false, /* isAlwaysInSlot. Only relevant for getters. */
800 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
801 : false, /* isTypedMethod. Only relevant for methods. */
802 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
803 : };
804 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
805 : static_assert(0 < 1, "There is no slot for us");
806 : static const JSJitInfo height_setterinfo = {
807 : { (JSJitGetterOp)set_height },
808 : { prototypes::id::HTMLObjectElement },
809 : { PrototypeTraits<prototypes::id::HTMLObjectElement>::Depth },
810 : JSJitInfo::Setter,
811 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
812 : JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */
813 : false, /* isInfallible. False in setters. */
814 : false, /* isMovable. Not relevant for setters. */
815 : false, /* isEliminatable. Not relevant for setters. */
816 : false, /* isAlwaysInSlot. Only relevant for getters. */
817 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
818 : false, /* isTypedMethod. Only relevant for methods. */
819 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
820 : };
821 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
822 : static_assert(0 < 1, "There is no slot for us");
823 :
824 : static bool
825 0 : get_contentDocument(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLObjectElement* self, JSJitGetterCallArgs args)
826 : {
827 0 : if (!mozilla::dom::EnforceNotInPrerendering(cx, obj)) {
828 : // Return false from the JSNative in order to trigger
829 : // an uncatchable exception.
830 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
831 0 : return false;
832 : }
833 0 : JSCompartment* compartment = js::GetContextCompartment(cx);
834 0 : MOZ_ASSERT(compartment);
835 0 : JSPrincipals* principals = JS_GetCompartmentPrincipals(compartment);
836 : // Initializing a nonnull is pretty darn annoying...
837 0 : NonNull<nsIPrincipal> subjectPrincipal;
838 0 : subjectPrincipal = static_cast<nsIPrincipal*>(nsJSPrincipals::get(principals));
839 0 : auto result(StrongOrRawPtr<nsIDocument>(self->GetContentDocument(subjectPrincipal)));
840 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
841 0 : if (!result) {
842 0 : args.rval().setNull();
843 0 : return true;
844 : }
845 0 : if (!GetOrCreateDOMReflector(cx, result, args.rval())) {
846 0 : MOZ_ASSERT(true || JS_IsExceptionPending(cx));
847 0 : return false;
848 : }
849 0 : return true;
850 : }
851 :
852 : static const JSJitInfo contentDocument_getterinfo = {
853 : { (JSJitGetterOp)get_contentDocument },
854 : { prototypes::id::HTMLObjectElement },
855 : { PrototypeTraits<prototypes::id::HTMLObjectElement>::Depth },
856 : JSJitInfo::Getter,
857 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
858 : JSVAL_TYPE_UNKNOWN, /* returnType. Not relevant for setters. */
859 : false, /* isInfallible. False in setters. */
860 : false, /* isMovable. Not relevant for setters. */
861 : false, /* isEliminatable. Not relevant for setters. */
862 : false, /* isAlwaysInSlot. Only relevant for getters. */
863 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
864 : false, /* isTypedMethod. Only relevant for methods. */
865 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
866 : };
867 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
868 : static_assert(0 < 1, "There is no slot for us");
869 :
870 : static bool
871 0 : get_contentWindow(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLObjectElement* self, JSJitGetterCallArgs args)
872 : {
873 0 : if (!mozilla::dom::EnforceNotInPrerendering(cx, obj)) {
874 : // Return false from the JSNative in order to trigger
875 : // an uncatchable exception.
876 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
877 0 : return false;
878 : }
879 0 : JSCompartment* compartment = js::GetContextCompartment(cx);
880 0 : MOZ_ASSERT(compartment);
881 0 : JSPrincipals* principals = JS_GetCompartmentPrincipals(compartment);
882 : // Initializing a nonnull is pretty darn annoying...
883 0 : NonNull<nsIPrincipal> subjectPrincipal;
884 0 : subjectPrincipal = static_cast<nsIPrincipal*>(nsJSPrincipals::get(principals));
885 0 : auto result(StrongOrRawPtr<nsPIDOMWindowOuter>(self->GetContentWindow(subjectPrincipal)));
886 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
887 0 : if (!result) {
888 0 : args.rval().setNull();
889 0 : return true;
890 : }
891 0 : if (!WrapObject(cx, result, args.rval())) {
892 0 : return false;
893 : }
894 0 : return true;
895 : }
896 :
897 : static const JSJitInfo contentWindow_getterinfo = {
898 : { (JSJitGetterOp)get_contentWindow },
899 : { prototypes::id::HTMLObjectElement },
900 : { PrototypeTraits<prototypes::id::HTMLObjectElement>::Depth },
901 : JSJitInfo::Getter,
902 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
903 : JSVAL_TYPE_UNKNOWN, /* returnType. Not relevant for setters. */
904 : false, /* isInfallible. False in setters. */
905 : false, /* isMovable. Not relevant for setters. */
906 : false, /* isEliminatable. Not relevant for setters. */
907 : false, /* isAlwaysInSlot. Only relevant for getters. */
908 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
909 : false, /* isTypedMethod. Only relevant for methods. */
910 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
911 : };
912 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
913 : static_assert(0 < 1, "There is no slot for us");
914 :
915 : static bool
916 0 : get_willValidate(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLObjectElement* self, JSJitGetterCallArgs args)
917 : {
918 0 : if (!mozilla::dom::EnforceNotInPrerendering(cx, obj)) {
919 : // Return false from the JSNative in order to trigger
920 : // an uncatchable exception.
921 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
922 0 : return false;
923 : }
924 0 : bool result(self->WillValidate());
925 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
926 0 : args.rval().setBoolean(result);
927 0 : return true;
928 : }
929 :
930 : static const JSJitInfo willValidate_getterinfo = {
931 : { (JSJitGetterOp)get_willValidate },
932 : { prototypes::id::HTMLObjectElement },
933 : { PrototypeTraits<prototypes::id::HTMLObjectElement>::Depth },
934 : JSJitInfo::Getter,
935 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
936 : JSVAL_TYPE_BOOLEAN, /* returnType. Not relevant for setters. */
937 : true, /* isInfallible. False in setters. */
938 : false, /* isMovable. Not relevant for setters. */
939 : false, /* isEliminatable. Not relevant for setters. */
940 : false, /* isAlwaysInSlot. Only relevant for getters. */
941 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
942 : false, /* isTypedMethod. Only relevant for methods. */
943 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
944 : };
945 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
946 : static_assert(0 < 1, "There is no slot for us");
947 :
948 : static bool
949 0 : get_validity(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLObjectElement* self, JSJitGetterCallArgs args)
950 : {
951 0 : if (!mozilla::dom::EnforceNotInPrerendering(cx, obj)) {
952 : // Return false from the JSNative in order to trigger
953 : // an uncatchable exception.
954 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
955 0 : return false;
956 : }
957 0 : auto result(StrongOrRawPtr<mozilla::dom::ValidityState>(self->Validity()));
958 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
959 0 : if (!GetOrCreateDOMReflector(cx, result, args.rval())) {
960 0 : MOZ_ASSERT(true || JS_IsExceptionPending(cx));
961 0 : return false;
962 : }
963 0 : return true;
964 : }
965 :
966 : static const JSJitInfo validity_getterinfo = {
967 : { (JSJitGetterOp)get_validity },
968 : { prototypes::id::HTMLObjectElement },
969 : { PrototypeTraits<prototypes::id::HTMLObjectElement>::Depth },
970 : JSJitInfo::Getter,
971 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
972 : JSVAL_TYPE_OBJECT, /* returnType. Not relevant for setters. */
973 : false, /* isInfallible. False in setters. */
974 : false, /* isMovable. Not relevant for setters. */
975 : false, /* isEliminatable. Not relevant for setters. */
976 : false, /* isAlwaysInSlot. Only relevant for getters. */
977 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
978 : false, /* isTypedMethod. Only relevant for methods. */
979 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
980 : };
981 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
982 : static_assert(0 < 1, "There is no slot for us");
983 :
984 : static bool
985 0 : get_validationMessage(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLObjectElement* self, JSJitGetterCallArgs args)
986 : {
987 0 : if (!mozilla::dom::EnforceNotInPrerendering(cx, obj)) {
988 : // Return false from the JSNative in order to trigger
989 : // an uncatchable exception.
990 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
991 0 : return false;
992 : }
993 0 : DOMString result;
994 0 : self->GetValidationMessage(result);
995 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
996 0 : if (!xpc::NonVoidStringToJsval(cx, result, args.rval())) {
997 0 : return false;
998 : }
999 0 : return true;
1000 : }
1001 :
1002 : static const JSJitInfo validationMessage_getterinfo = {
1003 : { (JSJitGetterOp)get_validationMessage },
1004 : { prototypes::id::HTMLObjectElement },
1005 : { PrototypeTraits<prototypes::id::HTMLObjectElement>::Depth },
1006 : JSJitInfo::Getter,
1007 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
1008 : JSVAL_TYPE_STRING, /* returnType. Not relevant for setters. */
1009 : false, /* isInfallible. False in setters. */
1010 : false, /* isMovable. Not relevant for setters. */
1011 : false, /* isEliminatable. Not relevant for setters. */
1012 : false, /* isAlwaysInSlot. Only relevant for getters. */
1013 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
1014 : false, /* isTypedMethod. Only relevant for methods. */
1015 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
1016 : };
1017 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
1018 : static_assert(0 < 1, "There is no slot for us");
1019 :
1020 : static bool
1021 0 : checkValidity(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLObjectElement* self, const JSJitMethodCallArgs& args)
1022 : {
1023 0 : if (!mozilla::dom::EnforceNotInPrerendering(cx, obj)) {
1024 : // Return false from the JSNative in order to trigger
1025 : // an uncatchable exception.
1026 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
1027 0 : return false;
1028 : }
1029 0 : bool result(self->CheckValidity());
1030 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
1031 0 : args.rval().setBoolean(result);
1032 0 : return true;
1033 : }
1034 :
1035 : static const JSJitInfo checkValidity_methodinfo = {
1036 : { (JSJitGetterOp)checkValidity },
1037 : { prototypes::id::HTMLObjectElement },
1038 : { PrototypeTraits<prototypes::id::HTMLObjectElement>::Depth },
1039 : JSJitInfo::Method,
1040 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
1041 : JSVAL_TYPE_BOOLEAN, /* returnType. Not relevant for setters. */
1042 : true, /* isInfallible. False in setters. */
1043 : false, /* isMovable. Not relevant for setters. */
1044 : false, /* isEliminatable. Not relevant for setters. */
1045 : false, /* isAlwaysInSlot. Only relevant for getters. */
1046 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
1047 : false, /* isTypedMethod. Only relevant for methods. */
1048 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
1049 : };
1050 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
1051 : static_assert(0 < 1, "There is no slot for us");
1052 :
1053 : static bool
1054 0 : reportValidity(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLObjectElement* self, const JSJitMethodCallArgs& args)
1055 : {
1056 0 : if (!mozilla::dom::EnforceNotInPrerendering(cx, obj)) {
1057 : // Return false from the JSNative in order to trigger
1058 : // an uncatchable exception.
1059 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
1060 0 : return false;
1061 : }
1062 0 : bool result(self->ReportValidity());
1063 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
1064 0 : args.rval().setBoolean(result);
1065 0 : return true;
1066 : }
1067 :
1068 : static const JSJitInfo reportValidity_methodinfo = {
1069 : { (JSJitGetterOp)reportValidity },
1070 : { prototypes::id::HTMLObjectElement },
1071 : { PrototypeTraits<prototypes::id::HTMLObjectElement>::Depth },
1072 : JSJitInfo::Method,
1073 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
1074 : JSVAL_TYPE_BOOLEAN, /* returnType. Not relevant for setters. */
1075 : true, /* isInfallible. False in setters. */
1076 : false, /* isMovable. Not relevant for setters. */
1077 : false, /* isEliminatable. Not relevant for setters. */
1078 : false, /* isAlwaysInSlot. Only relevant for getters. */
1079 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
1080 : false, /* isTypedMethod. Only relevant for methods. */
1081 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
1082 : };
1083 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
1084 : static_assert(0 < 1, "There is no slot for us");
1085 :
1086 : static bool
1087 0 : setCustomValidity(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLObjectElement* self, const JSJitMethodCallArgs& args)
1088 : {
1089 0 : if (MOZ_UNLIKELY(args.length() < 1)) {
1090 0 : return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "HTMLObjectElement.setCustomValidity");
1091 : }
1092 0 : if (!mozilla::dom::EnforceNotInPrerendering(cx, obj)) {
1093 : // Return false from the JSNative in order to trigger
1094 : // an uncatchable exception.
1095 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
1096 0 : return false;
1097 : }
1098 0 : binding_detail::FakeString arg0;
1099 0 : if (!ConvertJSValueToString(cx, args[0], eStringify, eStringify, arg0)) {
1100 0 : return false;
1101 : }
1102 0 : self->SetCustomValidity(NonNullHelper(Constify(arg0)));
1103 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
1104 0 : args.rval().setUndefined();
1105 0 : return true;
1106 : }
1107 :
1108 : static const JSJitInfo setCustomValidity_methodinfo = {
1109 : { (JSJitGetterOp)setCustomValidity },
1110 : { prototypes::id::HTMLObjectElement },
1111 : { PrototypeTraits<prototypes::id::HTMLObjectElement>::Depth },
1112 : JSJitInfo::Method,
1113 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
1114 : JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */
1115 : false, /* isInfallible. False in setters. */
1116 : false, /* isMovable. Not relevant for setters. */
1117 : false, /* isEliminatable. Not relevant for setters. */
1118 : false, /* isAlwaysInSlot. Only relevant for getters. */
1119 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
1120 : false, /* isTypedMethod. Only relevant for methods. */
1121 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
1122 : };
1123 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
1124 : static_assert(0 < 1, "There is no slot for us");
1125 :
1126 : static bool
1127 0 : get_align(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLObjectElement* self, JSJitGetterCallArgs args)
1128 : {
1129 0 : if (!mozilla::dom::EnforceNotInPrerendering(cx, obj)) {
1130 : // Return false from the JSNative in order to trigger
1131 : // an uncatchable exception.
1132 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
1133 0 : return false;
1134 : }
1135 0 : DOMString result;
1136 0 : self->GetAlign(result);
1137 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
1138 0 : if (!xpc::NonVoidStringToJsval(cx, result, args.rval())) {
1139 0 : return false;
1140 : }
1141 0 : return true;
1142 : }
1143 :
1144 : static bool
1145 0 : set_align(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLObjectElement* self, JSJitSetterCallArgs args)
1146 : {
1147 0 : if (!mozilla::dom::EnforceNotInPrerendering(cx, obj)) {
1148 : // Return false from the JSNative in order to trigger
1149 : // an uncatchable exception.
1150 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
1151 0 : return false;
1152 : }
1153 0 : binding_detail::FakeString arg0;
1154 0 : if (!ConvertJSValueToString(cx, args[0], eStringify, eStringify, arg0)) {
1155 0 : return false;
1156 : }
1157 0 : CustomElementReactionsStack* reactionsStack = GetCustomElementReactionsStack(obj);
1158 0 : Maybe<AutoCEReaction> ceReaction;
1159 0 : if (reactionsStack) {
1160 0 : ceReaction.emplace(reactionsStack);
1161 : }
1162 0 : binding_detail::FastErrorResult rv;
1163 0 : self->SetAlign(NonNullHelper(Constify(arg0)), rv);
1164 0 : if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
1165 0 : return false;
1166 : }
1167 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
1168 :
1169 0 : return true;
1170 : }
1171 :
1172 : static const JSJitInfo align_getterinfo = {
1173 : { (JSJitGetterOp)get_align },
1174 : { prototypes::id::HTMLObjectElement },
1175 : { PrototypeTraits<prototypes::id::HTMLObjectElement>::Depth },
1176 : JSJitInfo::Getter,
1177 : JSJitInfo::AliasDOMSets, /* aliasSet. Not relevant for setters. */
1178 : JSVAL_TYPE_STRING, /* returnType. Not relevant for setters. */
1179 : false, /* isInfallible. False in setters. */
1180 : true, /* isMovable. Not relevant for setters. */
1181 : true, /* 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 : static const JSJitInfo align_setterinfo = {
1190 : { (JSJitGetterOp)set_align },
1191 : { prototypes::id::HTMLObjectElement },
1192 : { PrototypeTraits<prototypes::id::HTMLObjectElement>::Depth },
1193 : JSJitInfo::Setter,
1194 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
1195 : JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */
1196 : false, /* isInfallible. False in setters. */
1197 : false, /* isMovable. Not relevant for setters. */
1198 : false, /* isEliminatable. Not relevant for setters. */
1199 : false, /* isAlwaysInSlot. Only relevant for getters. */
1200 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
1201 : false, /* isTypedMethod. Only relevant for methods. */
1202 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
1203 : };
1204 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
1205 : static_assert(0 < 1, "There is no slot for us");
1206 :
1207 : static bool
1208 0 : get_archive(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLObjectElement* self, JSJitGetterCallArgs args)
1209 : {
1210 0 : if (!mozilla::dom::EnforceNotInPrerendering(cx, obj)) {
1211 : // Return false from the JSNative in order to trigger
1212 : // an uncatchable exception.
1213 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
1214 0 : return false;
1215 : }
1216 0 : DOMString result;
1217 0 : self->GetArchive(result);
1218 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
1219 0 : if (!xpc::NonVoidStringToJsval(cx, result, args.rval())) {
1220 0 : return false;
1221 : }
1222 0 : return true;
1223 : }
1224 :
1225 : static bool
1226 0 : set_archive(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLObjectElement* self, JSJitSetterCallArgs args)
1227 : {
1228 0 : if (!mozilla::dom::EnforceNotInPrerendering(cx, obj)) {
1229 : // Return false from the JSNative in order to trigger
1230 : // an uncatchable exception.
1231 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
1232 0 : return false;
1233 : }
1234 0 : binding_detail::FakeString arg0;
1235 0 : if (!ConvertJSValueToString(cx, args[0], eStringify, eStringify, arg0)) {
1236 0 : return false;
1237 : }
1238 0 : CustomElementReactionsStack* reactionsStack = GetCustomElementReactionsStack(obj);
1239 0 : Maybe<AutoCEReaction> ceReaction;
1240 0 : if (reactionsStack) {
1241 0 : ceReaction.emplace(reactionsStack);
1242 : }
1243 0 : binding_detail::FastErrorResult rv;
1244 0 : self->SetArchive(NonNullHelper(Constify(arg0)), rv);
1245 0 : if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
1246 0 : return false;
1247 : }
1248 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
1249 :
1250 0 : return true;
1251 : }
1252 :
1253 : static const JSJitInfo archive_getterinfo = {
1254 : { (JSJitGetterOp)get_archive },
1255 : { prototypes::id::HTMLObjectElement },
1256 : { PrototypeTraits<prototypes::id::HTMLObjectElement>::Depth },
1257 : JSJitInfo::Getter,
1258 : JSJitInfo::AliasDOMSets, /* aliasSet. Not relevant for setters. */
1259 : JSVAL_TYPE_STRING, /* returnType. Not relevant for setters. */
1260 : false, /* isInfallible. False in setters. */
1261 : true, /* isMovable. Not relevant for setters. */
1262 : true, /* isEliminatable. Not relevant for setters. */
1263 : false, /* isAlwaysInSlot. Only relevant for getters. */
1264 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
1265 : false, /* isTypedMethod. Only relevant for methods. */
1266 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
1267 : };
1268 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
1269 : static_assert(0 < 1, "There is no slot for us");
1270 : static const JSJitInfo archive_setterinfo = {
1271 : { (JSJitGetterOp)set_archive },
1272 : { prototypes::id::HTMLObjectElement },
1273 : { PrototypeTraits<prototypes::id::HTMLObjectElement>::Depth },
1274 : JSJitInfo::Setter,
1275 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
1276 : JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */
1277 : false, /* isInfallible. False in setters. */
1278 : false, /* isMovable. Not relevant for setters. */
1279 : false, /* isEliminatable. Not relevant for setters. */
1280 : false, /* isAlwaysInSlot. Only relevant for getters. */
1281 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
1282 : false, /* isTypedMethod. Only relevant for methods. */
1283 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
1284 : };
1285 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
1286 : static_assert(0 < 1, "There is no slot for us");
1287 :
1288 : static bool
1289 0 : get_code(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLObjectElement* self, JSJitGetterCallArgs args)
1290 : {
1291 0 : if (!mozilla::dom::EnforceNotInPrerendering(cx, obj)) {
1292 : // Return false from the JSNative in order to trigger
1293 : // an uncatchable exception.
1294 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
1295 0 : return false;
1296 : }
1297 0 : DOMString result;
1298 0 : self->GetCode(result);
1299 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
1300 0 : if (!xpc::NonVoidStringToJsval(cx, result, args.rval())) {
1301 0 : return false;
1302 : }
1303 0 : return true;
1304 : }
1305 :
1306 : static bool
1307 0 : set_code(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLObjectElement* self, JSJitSetterCallArgs args)
1308 : {
1309 0 : if (!mozilla::dom::EnforceNotInPrerendering(cx, obj)) {
1310 : // Return false from the JSNative in order to trigger
1311 : // an uncatchable exception.
1312 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
1313 0 : return false;
1314 : }
1315 0 : binding_detail::FakeString arg0;
1316 0 : if (!ConvertJSValueToString(cx, args[0], eStringify, eStringify, arg0)) {
1317 0 : return false;
1318 : }
1319 0 : CustomElementReactionsStack* reactionsStack = GetCustomElementReactionsStack(obj);
1320 0 : Maybe<AutoCEReaction> ceReaction;
1321 0 : if (reactionsStack) {
1322 0 : ceReaction.emplace(reactionsStack);
1323 : }
1324 0 : binding_detail::FastErrorResult rv;
1325 0 : self->SetCode(NonNullHelper(Constify(arg0)), rv);
1326 0 : if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
1327 0 : return false;
1328 : }
1329 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
1330 :
1331 0 : return true;
1332 : }
1333 :
1334 : static const JSJitInfo code_getterinfo = {
1335 : { (JSJitGetterOp)get_code },
1336 : { prototypes::id::HTMLObjectElement },
1337 : { PrototypeTraits<prototypes::id::HTMLObjectElement>::Depth },
1338 : JSJitInfo::Getter,
1339 : JSJitInfo::AliasDOMSets, /* aliasSet. Not relevant for setters. */
1340 : JSVAL_TYPE_STRING, /* returnType. Not relevant for setters. */
1341 : false, /* isInfallible. False in setters. */
1342 : true, /* isMovable. Not relevant for setters. */
1343 : true, /* isEliminatable. Not relevant for setters. */
1344 : false, /* isAlwaysInSlot. Only relevant for getters. */
1345 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
1346 : false, /* isTypedMethod. Only relevant for methods. */
1347 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
1348 : };
1349 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
1350 : static_assert(0 < 1, "There is no slot for us");
1351 : static const JSJitInfo code_setterinfo = {
1352 : { (JSJitGetterOp)set_code },
1353 : { prototypes::id::HTMLObjectElement },
1354 : { PrototypeTraits<prototypes::id::HTMLObjectElement>::Depth },
1355 : JSJitInfo::Setter,
1356 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
1357 : JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */
1358 : false, /* isInfallible. False in setters. */
1359 : false, /* isMovable. Not relevant for setters. */
1360 : false, /* isEliminatable. Not relevant for setters. */
1361 : false, /* isAlwaysInSlot. Only relevant for getters. */
1362 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
1363 : false, /* isTypedMethod. Only relevant for methods. */
1364 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
1365 : };
1366 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
1367 : static_assert(0 < 1, "There is no slot for us");
1368 :
1369 : static bool
1370 0 : get_declare(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLObjectElement* self, JSJitGetterCallArgs args)
1371 : {
1372 0 : if (!mozilla::dom::EnforceNotInPrerendering(cx, obj)) {
1373 : // Return false from the JSNative in order to trigger
1374 : // an uncatchable exception.
1375 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
1376 0 : return false;
1377 : }
1378 0 : bool result(self->Declare());
1379 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
1380 0 : args.rval().setBoolean(result);
1381 0 : return true;
1382 : }
1383 :
1384 : static bool
1385 0 : set_declare(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLObjectElement* self, JSJitSetterCallArgs args)
1386 : {
1387 0 : if (!mozilla::dom::EnforceNotInPrerendering(cx, obj)) {
1388 : // Return false from the JSNative in order to trigger
1389 : // an uncatchable exception.
1390 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
1391 0 : return false;
1392 : }
1393 : bool arg0;
1394 0 : if (!ValueToPrimitive<bool, eDefault>(cx, args[0], &arg0)) {
1395 0 : return false;
1396 : }
1397 0 : CustomElementReactionsStack* reactionsStack = GetCustomElementReactionsStack(obj);
1398 0 : Maybe<AutoCEReaction> ceReaction;
1399 0 : if (reactionsStack) {
1400 0 : ceReaction.emplace(reactionsStack);
1401 : }
1402 0 : binding_detail::FastErrorResult rv;
1403 0 : self->SetDeclare(arg0, rv);
1404 0 : if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
1405 0 : return false;
1406 : }
1407 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
1408 :
1409 0 : return true;
1410 : }
1411 :
1412 : static const JSJitInfo declare_getterinfo = {
1413 : { (JSJitGetterOp)get_declare },
1414 : { prototypes::id::HTMLObjectElement },
1415 : { PrototypeTraits<prototypes::id::HTMLObjectElement>::Depth },
1416 : JSJitInfo::Getter,
1417 : JSJitInfo::AliasDOMSets, /* aliasSet. Not relevant for setters. */
1418 : JSVAL_TYPE_BOOLEAN, /* returnType. Not relevant for setters. */
1419 : true, /* isInfallible. False in setters. */
1420 : true, /* isMovable. Not relevant for setters. */
1421 : true, /* isEliminatable. Not relevant for setters. */
1422 : false, /* isAlwaysInSlot. Only relevant for getters. */
1423 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
1424 : false, /* isTypedMethod. Only relevant for methods. */
1425 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
1426 : };
1427 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
1428 : static_assert(0 < 1, "There is no slot for us");
1429 : static const JSJitInfo declare_setterinfo = {
1430 : { (JSJitGetterOp)set_declare },
1431 : { prototypes::id::HTMLObjectElement },
1432 : { PrototypeTraits<prototypes::id::HTMLObjectElement>::Depth },
1433 : JSJitInfo::Setter,
1434 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
1435 : JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */
1436 : false, /* isInfallible. False in setters. */
1437 : false, /* isMovable. Not relevant for setters. */
1438 : false, /* isEliminatable. Not relevant for setters. */
1439 : false, /* isAlwaysInSlot. Only relevant for getters. */
1440 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
1441 : false, /* isTypedMethod. Only relevant for methods. */
1442 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
1443 : };
1444 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
1445 : static_assert(0 < 1, "There is no slot for us");
1446 :
1447 : static bool
1448 0 : get_hspace(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLObjectElement* self, JSJitGetterCallArgs args)
1449 : {
1450 0 : if (!mozilla::dom::EnforceNotInPrerendering(cx, obj)) {
1451 : // Return false from the JSNative in order to trigger
1452 : // an uncatchable exception.
1453 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
1454 0 : return false;
1455 : }
1456 0 : uint32_t result(self->Hspace());
1457 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
1458 0 : args.rval().setNumber(result);
1459 0 : return true;
1460 : }
1461 :
1462 : static bool
1463 0 : set_hspace(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLObjectElement* self, JSJitSetterCallArgs args)
1464 : {
1465 0 : if (!mozilla::dom::EnforceNotInPrerendering(cx, obj)) {
1466 : // Return false from the JSNative in order to trigger
1467 : // an uncatchable exception.
1468 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
1469 0 : return false;
1470 : }
1471 : uint32_t arg0;
1472 0 : if (!ValueToPrimitive<uint32_t, eDefault>(cx, args[0], &arg0)) {
1473 0 : return false;
1474 : }
1475 0 : CustomElementReactionsStack* reactionsStack = GetCustomElementReactionsStack(obj);
1476 0 : Maybe<AutoCEReaction> ceReaction;
1477 0 : if (reactionsStack) {
1478 0 : ceReaction.emplace(reactionsStack);
1479 : }
1480 0 : binding_detail::FastErrorResult rv;
1481 0 : self->SetHspace(arg0, rv);
1482 0 : if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
1483 0 : return false;
1484 : }
1485 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
1486 :
1487 0 : return true;
1488 : }
1489 :
1490 : static const JSJitInfo hspace_getterinfo = {
1491 : { (JSJitGetterOp)get_hspace },
1492 : { prototypes::id::HTMLObjectElement },
1493 : { PrototypeTraits<prototypes::id::HTMLObjectElement>::Depth },
1494 : JSJitInfo::Getter,
1495 : JSJitInfo::AliasDOMSets, /* aliasSet. Not relevant for setters. */
1496 : JSVAL_TYPE_DOUBLE, /* returnType. Not relevant for setters. */
1497 : true, /* isInfallible. False in setters. */
1498 : true, /* isMovable. Not relevant for setters. */
1499 : true, /* isEliminatable. Not relevant for setters. */
1500 : false, /* isAlwaysInSlot. Only relevant for getters. */
1501 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
1502 : false, /* isTypedMethod. Only relevant for methods. */
1503 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
1504 : };
1505 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
1506 : static_assert(0 < 1, "There is no slot for us");
1507 : static const JSJitInfo hspace_setterinfo = {
1508 : { (JSJitGetterOp)set_hspace },
1509 : { prototypes::id::HTMLObjectElement },
1510 : { PrototypeTraits<prototypes::id::HTMLObjectElement>::Depth },
1511 : JSJitInfo::Setter,
1512 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
1513 : JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */
1514 : false, /* isInfallible. False in setters. */
1515 : false, /* isMovable. Not relevant for setters. */
1516 : false, /* isEliminatable. Not relevant for setters. */
1517 : false, /* isAlwaysInSlot. Only relevant for getters. */
1518 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
1519 : false, /* isTypedMethod. Only relevant for methods. */
1520 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
1521 : };
1522 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
1523 : static_assert(0 < 1, "There is no slot for us");
1524 :
1525 : static bool
1526 0 : get_standby(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLObjectElement* self, JSJitGetterCallArgs args)
1527 : {
1528 0 : if (!mozilla::dom::EnforceNotInPrerendering(cx, obj)) {
1529 : // Return false from the JSNative in order to trigger
1530 : // an uncatchable exception.
1531 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
1532 0 : return false;
1533 : }
1534 0 : DOMString result;
1535 0 : self->GetStandby(result);
1536 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
1537 0 : if (!xpc::NonVoidStringToJsval(cx, result, args.rval())) {
1538 0 : return false;
1539 : }
1540 0 : return true;
1541 : }
1542 :
1543 : static bool
1544 0 : set_standby(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLObjectElement* self, JSJitSetterCallArgs args)
1545 : {
1546 0 : if (!mozilla::dom::EnforceNotInPrerendering(cx, obj)) {
1547 : // Return false from the JSNative in order to trigger
1548 : // an uncatchable exception.
1549 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
1550 0 : return false;
1551 : }
1552 0 : binding_detail::FakeString arg0;
1553 0 : if (!ConvertJSValueToString(cx, args[0], eStringify, eStringify, arg0)) {
1554 0 : return false;
1555 : }
1556 0 : CustomElementReactionsStack* reactionsStack = GetCustomElementReactionsStack(obj);
1557 0 : Maybe<AutoCEReaction> ceReaction;
1558 0 : if (reactionsStack) {
1559 0 : ceReaction.emplace(reactionsStack);
1560 : }
1561 0 : binding_detail::FastErrorResult rv;
1562 0 : self->SetStandby(NonNullHelper(Constify(arg0)), rv);
1563 0 : if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
1564 0 : return false;
1565 : }
1566 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
1567 :
1568 0 : return true;
1569 : }
1570 :
1571 : static const JSJitInfo standby_getterinfo = {
1572 : { (JSJitGetterOp)get_standby },
1573 : { prototypes::id::HTMLObjectElement },
1574 : { PrototypeTraits<prototypes::id::HTMLObjectElement>::Depth },
1575 : JSJitInfo::Getter,
1576 : JSJitInfo::AliasDOMSets, /* aliasSet. Not relevant for setters. */
1577 : JSVAL_TYPE_STRING, /* returnType. Not relevant for setters. */
1578 : false, /* isInfallible. False in setters. */
1579 : true, /* isMovable. Not relevant for setters. */
1580 : true, /* isEliminatable. Not relevant for setters. */
1581 : false, /* isAlwaysInSlot. Only relevant for getters. */
1582 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
1583 : false, /* isTypedMethod. Only relevant for methods. */
1584 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
1585 : };
1586 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
1587 : static_assert(0 < 1, "There is no slot for us");
1588 : static const JSJitInfo standby_setterinfo = {
1589 : { (JSJitGetterOp)set_standby },
1590 : { prototypes::id::HTMLObjectElement },
1591 : { PrototypeTraits<prototypes::id::HTMLObjectElement>::Depth },
1592 : JSJitInfo::Setter,
1593 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
1594 : JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */
1595 : false, /* isInfallible. False in setters. */
1596 : false, /* isMovable. Not relevant for setters. */
1597 : false, /* isEliminatable. Not relevant for setters. */
1598 : false, /* isAlwaysInSlot. Only relevant for getters. */
1599 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
1600 : false, /* isTypedMethod. Only relevant for methods. */
1601 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
1602 : };
1603 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
1604 : static_assert(0 < 1, "There is no slot for us");
1605 :
1606 : static bool
1607 0 : get_vspace(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLObjectElement* self, JSJitGetterCallArgs args)
1608 : {
1609 0 : if (!mozilla::dom::EnforceNotInPrerendering(cx, obj)) {
1610 : // Return false from the JSNative in order to trigger
1611 : // an uncatchable exception.
1612 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
1613 0 : return false;
1614 : }
1615 0 : uint32_t result(self->Vspace());
1616 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
1617 0 : args.rval().setNumber(result);
1618 0 : return true;
1619 : }
1620 :
1621 : static bool
1622 0 : set_vspace(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLObjectElement* self, JSJitSetterCallArgs args)
1623 : {
1624 0 : if (!mozilla::dom::EnforceNotInPrerendering(cx, obj)) {
1625 : // Return false from the JSNative in order to trigger
1626 : // an uncatchable exception.
1627 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
1628 0 : return false;
1629 : }
1630 : uint32_t arg0;
1631 0 : if (!ValueToPrimitive<uint32_t, eDefault>(cx, args[0], &arg0)) {
1632 0 : return false;
1633 : }
1634 0 : CustomElementReactionsStack* reactionsStack = GetCustomElementReactionsStack(obj);
1635 0 : Maybe<AutoCEReaction> ceReaction;
1636 0 : if (reactionsStack) {
1637 0 : ceReaction.emplace(reactionsStack);
1638 : }
1639 0 : binding_detail::FastErrorResult rv;
1640 0 : self->SetVspace(arg0, rv);
1641 0 : if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
1642 0 : return false;
1643 : }
1644 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
1645 :
1646 0 : return true;
1647 : }
1648 :
1649 : static const JSJitInfo vspace_getterinfo = {
1650 : { (JSJitGetterOp)get_vspace },
1651 : { prototypes::id::HTMLObjectElement },
1652 : { PrototypeTraits<prototypes::id::HTMLObjectElement>::Depth },
1653 : JSJitInfo::Getter,
1654 : JSJitInfo::AliasDOMSets, /* aliasSet. Not relevant for setters. */
1655 : JSVAL_TYPE_DOUBLE, /* returnType. Not relevant for setters. */
1656 : true, /* isInfallible. False in setters. */
1657 : true, /* isMovable. Not relevant for setters. */
1658 : true, /* isEliminatable. Not relevant for setters. */
1659 : false, /* isAlwaysInSlot. Only relevant for getters. */
1660 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
1661 : false, /* isTypedMethod. Only relevant for methods. */
1662 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
1663 : };
1664 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
1665 : static_assert(0 < 1, "There is no slot for us");
1666 : static const JSJitInfo vspace_setterinfo = {
1667 : { (JSJitGetterOp)set_vspace },
1668 : { prototypes::id::HTMLObjectElement },
1669 : { PrototypeTraits<prototypes::id::HTMLObjectElement>::Depth },
1670 : JSJitInfo::Setter,
1671 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
1672 : JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */
1673 : false, /* isInfallible. False in setters. */
1674 : false, /* isMovable. Not relevant for setters. */
1675 : false, /* isEliminatable. Not relevant for setters. */
1676 : false, /* isAlwaysInSlot. Only relevant for getters. */
1677 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
1678 : false, /* isTypedMethod. Only relevant for methods. */
1679 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
1680 : };
1681 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
1682 : static_assert(0 < 1, "There is no slot for us");
1683 :
1684 : static bool
1685 0 : get_codeBase(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLObjectElement* self, JSJitGetterCallArgs args)
1686 : {
1687 0 : if (!mozilla::dom::EnforceNotInPrerendering(cx, obj)) {
1688 : // Return false from the JSNative in order to trigger
1689 : // an uncatchable exception.
1690 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
1691 0 : return false;
1692 : }
1693 0 : DOMString result;
1694 0 : self->GetCodeBase(result);
1695 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
1696 0 : if (!xpc::NonVoidStringToJsval(cx, result, args.rval())) {
1697 0 : return false;
1698 : }
1699 0 : return true;
1700 : }
1701 :
1702 : static bool
1703 0 : set_codeBase(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLObjectElement* self, JSJitSetterCallArgs args)
1704 : {
1705 0 : if (!mozilla::dom::EnforceNotInPrerendering(cx, obj)) {
1706 : // Return false from the JSNative in order to trigger
1707 : // an uncatchable exception.
1708 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
1709 0 : return false;
1710 : }
1711 0 : binding_detail::FakeString arg0;
1712 0 : if (!ConvertJSValueToString(cx, args[0], eStringify, eStringify, arg0)) {
1713 0 : return false;
1714 : }
1715 0 : CustomElementReactionsStack* reactionsStack = GetCustomElementReactionsStack(obj);
1716 0 : Maybe<AutoCEReaction> ceReaction;
1717 0 : if (reactionsStack) {
1718 0 : ceReaction.emplace(reactionsStack);
1719 : }
1720 0 : binding_detail::FastErrorResult rv;
1721 0 : self->SetCodeBase(NonNullHelper(Constify(arg0)), rv);
1722 0 : if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
1723 0 : return false;
1724 : }
1725 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
1726 :
1727 0 : return true;
1728 : }
1729 :
1730 : static const JSJitInfo codeBase_getterinfo = {
1731 : { (JSJitGetterOp)get_codeBase },
1732 : { prototypes::id::HTMLObjectElement },
1733 : { PrototypeTraits<prototypes::id::HTMLObjectElement>::Depth },
1734 : JSJitInfo::Getter,
1735 : JSJitInfo::AliasDOMSets, /* aliasSet. Not relevant for setters. */
1736 : JSVAL_TYPE_STRING, /* returnType. Not relevant for setters. */
1737 : false, /* isInfallible. False in setters. */
1738 : true, /* isMovable. Not relevant for setters. */
1739 : true, /* isEliminatable. Not relevant for setters. */
1740 : false, /* isAlwaysInSlot. Only relevant for getters. */
1741 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
1742 : false, /* isTypedMethod. Only relevant for methods. */
1743 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
1744 : };
1745 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
1746 : static_assert(0 < 1, "There is no slot for us");
1747 : static const JSJitInfo codeBase_setterinfo = {
1748 : { (JSJitGetterOp)set_codeBase },
1749 : { prototypes::id::HTMLObjectElement },
1750 : { PrototypeTraits<prototypes::id::HTMLObjectElement>::Depth },
1751 : JSJitInfo::Setter,
1752 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
1753 : JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */
1754 : false, /* isInfallible. False in setters. */
1755 : false, /* isMovable. Not relevant for setters. */
1756 : false, /* isEliminatable. Not relevant for setters. */
1757 : false, /* isAlwaysInSlot. Only relevant for getters. */
1758 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
1759 : false, /* isTypedMethod. Only relevant for methods. */
1760 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
1761 : };
1762 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
1763 : static_assert(0 < 1, "There is no slot for us");
1764 :
1765 : static bool
1766 0 : get_codeType(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLObjectElement* self, JSJitGetterCallArgs args)
1767 : {
1768 0 : if (!mozilla::dom::EnforceNotInPrerendering(cx, obj)) {
1769 : // Return false from the JSNative in order to trigger
1770 : // an uncatchable exception.
1771 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
1772 0 : return false;
1773 : }
1774 0 : DOMString result;
1775 0 : self->GetCodeType(result);
1776 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
1777 0 : if (!xpc::NonVoidStringToJsval(cx, result, args.rval())) {
1778 0 : return false;
1779 : }
1780 0 : return true;
1781 : }
1782 :
1783 : static bool
1784 0 : set_codeType(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLObjectElement* self, JSJitSetterCallArgs args)
1785 : {
1786 0 : if (!mozilla::dom::EnforceNotInPrerendering(cx, obj)) {
1787 : // Return false from the JSNative in order to trigger
1788 : // an uncatchable exception.
1789 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
1790 0 : return false;
1791 : }
1792 0 : binding_detail::FakeString arg0;
1793 0 : if (!ConvertJSValueToString(cx, args[0], eStringify, eStringify, arg0)) {
1794 0 : return false;
1795 : }
1796 0 : CustomElementReactionsStack* reactionsStack = GetCustomElementReactionsStack(obj);
1797 0 : Maybe<AutoCEReaction> ceReaction;
1798 0 : if (reactionsStack) {
1799 0 : ceReaction.emplace(reactionsStack);
1800 : }
1801 0 : binding_detail::FastErrorResult rv;
1802 0 : self->SetCodeType(NonNullHelper(Constify(arg0)), rv);
1803 0 : if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
1804 0 : return false;
1805 : }
1806 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
1807 :
1808 0 : return true;
1809 : }
1810 :
1811 : static const JSJitInfo codeType_getterinfo = {
1812 : { (JSJitGetterOp)get_codeType },
1813 : { prototypes::id::HTMLObjectElement },
1814 : { PrototypeTraits<prototypes::id::HTMLObjectElement>::Depth },
1815 : JSJitInfo::Getter,
1816 : JSJitInfo::AliasDOMSets, /* aliasSet. Not relevant for setters. */
1817 : JSVAL_TYPE_STRING, /* returnType. Not relevant for setters. */
1818 : false, /* isInfallible. False in setters. */
1819 : true, /* isMovable. Not relevant for setters. */
1820 : true, /* isEliminatable. Not relevant for setters. */
1821 : false, /* isAlwaysInSlot. Only relevant for getters. */
1822 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
1823 : false, /* isTypedMethod. Only relevant for methods. */
1824 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
1825 : };
1826 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
1827 : static_assert(0 < 1, "There is no slot for us");
1828 : static const JSJitInfo codeType_setterinfo = {
1829 : { (JSJitGetterOp)set_codeType },
1830 : { prototypes::id::HTMLObjectElement },
1831 : { PrototypeTraits<prototypes::id::HTMLObjectElement>::Depth },
1832 : JSJitInfo::Setter,
1833 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
1834 : JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */
1835 : false, /* isInfallible. False in setters. */
1836 : false, /* isMovable. Not relevant for setters. */
1837 : false, /* isEliminatable. Not relevant for setters. */
1838 : false, /* isAlwaysInSlot. Only relevant for getters. */
1839 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
1840 : false, /* isTypedMethod. Only relevant for methods. */
1841 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
1842 : };
1843 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
1844 : static_assert(0 < 1, "There is no slot for us");
1845 :
1846 : static bool
1847 0 : get_border(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLObjectElement* self, JSJitGetterCallArgs args)
1848 : {
1849 0 : if (!mozilla::dom::EnforceNotInPrerendering(cx, obj)) {
1850 : // Return false from the JSNative in order to trigger
1851 : // an uncatchable exception.
1852 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
1853 0 : return false;
1854 : }
1855 0 : DOMString result;
1856 0 : self->GetBorder(result);
1857 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
1858 0 : if (!xpc::NonVoidStringToJsval(cx, result, args.rval())) {
1859 0 : return false;
1860 : }
1861 0 : return true;
1862 : }
1863 :
1864 : static bool
1865 0 : set_border(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLObjectElement* self, JSJitSetterCallArgs args)
1866 : {
1867 0 : if (!mozilla::dom::EnforceNotInPrerendering(cx, obj)) {
1868 : // Return false from the JSNative in order to trigger
1869 : // an uncatchable exception.
1870 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
1871 0 : return false;
1872 : }
1873 0 : binding_detail::FakeString arg0;
1874 0 : if (!ConvertJSValueToString(cx, args[0], eEmpty, eStringify, arg0)) {
1875 0 : return false;
1876 : }
1877 0 : CustomElementReactionsStack* reactionsStack = GetCustomElementReactionsStack(obj);
1878 0 : Maybe<AutoCEReaction> ceReaction;
1879 0 : if (reactionsStack) {
1880 0 : ceReaction.emplace(reactionsStack);
1881 : }
1882 0 : binding_detail::FastErrorResult rv;
1883 0 : self->SetBorder(NonNullHelper(Constify(arg0)), rv);
1884 0 : if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
1885 0 : return false;
1886 : }
1887 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
1888 :
1889 0 : return true;
1890 : }
1891 :
1892 : static const JSJitInfo border_getterinfo = {
1893 : { (JSJitGetterOp)get_border },
1894 : { prototypes::id::HTMLObjectElement },
1895 : { PrototypeTraits<prototypes::id::HTMLObjectElement>::Depth },
1896 : JSJitInfo::Getter,
1897 : JSJitInfo::AliasDOMSets, /* aliasSet. Not relevant for setters. */
1898 : JSVAL_TYPE_STRING, /* returnType. Not relevant for setters. */
1899 : false, /* isInfallible. False in setters. */
1900 : true, /* isMovable. Not relevant for setters. */
1901 : true, /* isEliminatable. Not relevant for setters. */
1902 : false, /* isAlwaysInSlot. Only relevant for getters. */
1903 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
1904 : false, /* isTypedMethod. Only relevant for methods. */
1905 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
1906 : };
1907 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
1908 : static_assert(0 < 1, "There is no slot for us");
1909 : static const JSJitInfo border_setterinfo = {
1910 : { (JSJitGetterOp)set_border },
1911 : { prototypes::id::HTMLObjectElement },
1912 : { PrototypeTraits<prototypes::id::HTMLObjectElement>::Depth },
1913 : JSJitInfo::Setter,
1914 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
1915 : JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */
1916 : false, /* isInfallible. False in setters. */
1917 : false, /* isMovable. Not relevant for setters. */
1918 : false, /* isEliminatable. Not relevant for setters. */
1919 : false, /* isAlwaysInSlot. Only relevant for getters. */
1920 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
1921 : false, /* isTypedMethod. Only relevant for methods. */
1922 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
1923 : };
1924 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
1925 : static_assert(0 < 1, "There is no slot for us");
1926 :
1927 : static bool
1928 0 : getSVGDocument(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLObjectElement* self, const JSJitMethodCallArgs& args)
1929 : {
1930 0 : if (!mozilla::dom::EnforceNotInPrerendering(cx, obj)) {
1931 : // Return false from the JSNative in order to trigger
1932 : // an uncatchable exception.
1933 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
1934 0 : return false;
1935 : }
1936 0 : JSCompartment* compartment = js::GetContextCompartment(cx);
1937 0 : MOZ_ASSERT(compartment);
1938 0 : JSPrincipals* principals = JS_GetCompartmentPrincipals(compartment);
1939 : // Initializing a nonnull is pretty darn annoying...
1940 0 : NonNull<nsIPrincipal> subjectPrincipal;
1941 0 : subjectPrincipal = static_cast<nsIPrincipal*>(nsJSPrincipals::get(principals));
1942 0 : auto result(StrongOrRawPtr<nsIDocument>(self->GetSVGDocument(subjectPrincipal)));
1943 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
1944 0 : if (!result) {
1945 0 : args.rval().setNull();
1946 0 : return true;
1947 : }
1948 0 : if (!GetOrCreateDOMReflector(cx, result, args.rval())) {
1949 0 : MOZ_ASSERT(true || JS_IsExceptionPending(cx));
1950 0 : return false;
1951 : }
1952 0 : return true;
1953 : }
1954 :
1955 : static const JSJitInfo getSVGDocument_methodinfo = {
1956 : { (JSJitGetterOp)getSVGDocument },
1957 : { prototypes::id::HTMLObjectElement },
1958 : { PrototypeTraits<prototypes::id::HTMLObjectElement>::Depth },
1959 : JSJitInfo::Method,
1960 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
1961 : JSVAL_TYPE_UNKNOWN, /* returnType. Not relevant for setters. */
1962 : false, /* isInfallible. False in setters. */
1963 : false, /* isMovable. Not relevant for setters. */
1964 : false, /* isEliminatable. Not relevant for setters. */
1965 : false, /* isAlwaysInSlot. Only relevant for getters. */
1966 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
1967 : false, /* isTypedMethod. Only relevant for methods. */
1968 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
1969 : };
1970 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
1971 : static_assert(0 < 1, "There is no slot for us");
1972 :
1973 : static bool
1974 0 : get_frameLoader(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLObjectElement* self, JSJitGetterCallArgs args)
1975 : {
1976 0 : if (!mozilla::dom::EnforceNotInPrerendering(cx, obj)) {
1977 : // Return false from the JSNative in order to trigger
1978 : // an uncatchable exception.
1979 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
1980 0 : return false;
1981 : }
1982 0 : auto result(StrongOrRawPtr<nsIFrameLoader>(self->GetFrameLoader()));
1983 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
1984 0 : if (!result) {
1985 0 : args.rval().setNull();
1986 0 : return true;
1987 : }
1988 0 : if (!WrapObject(cx, result, &NS_GET_IID(nsIFrameLoader), args.rval())) {
1989 0 : return false;
1990 : }
1991 0 : return true;
1992 : }
1993 :
1994 : static const JSJitInfo frameLoader_getterinfo = {
1995 : { (JSJitGetterOp)get_frameLoader },
1996 : { prototypes::id::HTMLObjectElement },
1997 : { PrototypeTraits<prototypes::id::HTMLObjectElement>::Depth },
1998 : JSJitInfo::Getter,
1999 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
2000 : JSVAL_TYPE_UNKNOWN, /* returnType. Not relevant for setters. */
2001 : false, /* isInfallible. False in setters. */
2002 : false, /* isMovable. Not relevant for setters. */
2003 : false, /* isEliminatable. Not relevant for setters. */
2004 : false, /* isAlwaysInSlot. Only relevant for getters. */
2005 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
2006 : false, /* isTypedMethod. Only relevant for methods. */
2007 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
2008 : };
2009 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
2010 : static_assert(0 < 1, "There is no slot for us");
2011 :
2012 : static bool
2013 0 : setIsPrerendered(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLObjectElement* self, const JSJitMethodCallArgs& args)
2014 : {
2015 0 : if (!mozilla::dom::EnforceNotInPrerendering(cx, obj)) {
2016 : // Return false from the JSNative in order to trigger
2017 : // an uncatchable exception.
2018 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
2019 0 : return false;
2020 : }
2021 0 : self->SetIsPrerendered();
2022 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
2023 0 : args.rval().setUndefined();
2024 0 : return true;
2025 : }
2026 :
2027 : static const JSJitInfo setIsPrerendered_methodinfo = {
2028 : { (JSJitGetterOp)setIsPrerendered },
2029 : { prototypes::id::HTMLObjectElement },
2030 : { PrototypeTraits<prototypes::id::HTMLObjectElement>::Depth },
2031 : JSJitInfo::Method,
2032 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
2033 : JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */
2034 : true, /* isInfallible. False in setters. */
2035 : false, /* isMovable. Not relevant for setters. */
2036 : false, /* isEliminatable. Not relevant for setters. */
2037 : false, /* isAlwaysInSlot. Only relevant for getters. */
2038 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
2039 : false, /* isTypedMethod. Only relevant for methods. */
2040 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
2041 : };
2042 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
2043 : static_assert(0 < 1, "There is no slot for us");
2044 :
2045 : static bool
2046 0 : presetOpenerWindow(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLObjectElement* self, const JSJitMethodCallArgs& args)
2047 : {
2048 0 : if (MOZ_UNLIKELY(args.length() < 1)) {
2049 0 : return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "HTMLObjectElement.presetOpenerWindow");
2050 : }
2051 0 : if (!mozilla::dom::EnforceNotInPrerendering(cx, obj)) {
2052 : // Return false from the JSNative in order to trigger
2053 : // an uncatchable exception.
2054 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
2055 0 : return false;
2056 : }
2057 : nsPIDOMWindowOuter* arg0;
2058 0 : RefPtr<nsPIDOMWindowOuter> arg0_holder;
2059 0 : if (args[0].isObject()) {
2060 0 : JS::Rooted<JSObject*> source(cx, &args[0].toObject());
2061 0 : if (NS_FAILED(UnwrapArg<nsPIDOMWindowOuter>(cx, source, getter_AddRefs(arg0_holder)))) {
2062 0 : ThrowErrorMessage(cx, MSG_DOES_NOT_IMPLEMENT_INTERFACE, "Argument 1 of HTMLObjectElement.presetOpenerWindow", "WindowProxy");
2063 0 : return false;
2064 : }
2065 0 : MOZ_ASSERT(arg0_holder);
2066 0 : arg0 = arg0_holder;
2067 0 : } else if (args[0].isNullOrUndefined()) {
2068 0 : arg0 = nullptr;
2069 : } else {
2070 0 : ThrowErrorMessage(cx, MSG_NOT_OBJECT, "Argument 1 of HTMLObjectElement.presetOpenerWindow");
2071 0 : return false;
2072 : }
2073 0 : binding_detail::FastErrorResult rv;
2074 0 : self->PresetOpenerWindow(Constify(arg0), rv);
2075 0 : if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
2076 0 : return false;
2077 : }
2078 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
2079 0 : args.rval().setUndefined();
2080 0 : return true;
2081 : }
2082 :
2083 : static const JSJitInfo presetOpenerWindow_methodinfo = {
2084 : { (JSJitGetterOp)presetOpenerWindow },
2085 : { prototypes::id::HTMLObjectElement },
2086 : { PrototypeTraits<prototypes::id::HTMLObjectElement>::Depth },
2087 : JSJitInfo::Method,
2088 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
2089 : JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */
2090 : false, /* isInfallible. False in setters. */
2091 : false, /* isMovable. Not relevant for setters. */
2092 : false, /* isEliminatable. Not relevant for setters. */
2093 : false, /* isAlwaysInSlot. Only relevant for getters. */
2094 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
2095 : false, /* isTypedMethod. Only relevant for methods. */
2096 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
2097 : };
2098 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
2099 : static_assert(0 < 1, "There is no slot for us");
2100 :
2101 : static bool
2102 0 : swapFrameLoaders(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLObjectElement* self, const JSJitMethodCallArgs& args)
2103 : {
2104 0 : unsigned argcount = std::min(args.length(), 1u);
2105 0 : switch (argcount) {
2106 : case 1: {
2107 0 : if (args[0].isObject()) {
2108 : do {
2109 0 : NonNull<nsXULElement> arg0;
2110 : {
2111 0 : nsresult rv = UnwrapObject<prototypes::id::XULElement, nsXULElement>(args[0], arg0);
2112 0 : if (NS_FAILED(rv)) {
2113 0 : break;
2114 : }
2115 : }
2116 0 : if (!mozilla::dom::EnforceNotInPrerendering(cx, obj)) {
2117 : // Return false from the JSNative in order to trigger
2118 : // an uncatchable exception.
2119 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
2120 0 : return false;
2121 : }
2122 0 : binding_detail::FastErrorResult rv;
2123 0 : self->SwapFrameLoaders(NonNullHelper(arg0), rv);
2124 0 : if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
2125 0 : return false;
2126 : }
2127 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
2128 0 : args.rval().setUndefined();
2129 0 : return true;
2130 : } while (0);
2131 : do {
2132 0 : NonNull<mozilla::dom::HTMLIFrameElement> arg0;
2133 : {
2134 0 : nsresult rv = UnwrapObject<prototypes::id::HTMLIFrameElement, mozilla::dom::HTMLIFrameElement>(args[0], arg0);
2135 0 : if (NS_FAILED(rv)) {
2136 0 : break;
2137 : }
2138 : }
2139 0 : if (!mozilla::dom::EnforceNotInPrerendering(cx, obj)) {
2140 : // Return false from the JSNative in order to trigger
2141 : // an uncatchable exception.
2142 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
2143 0 : return false;
2144 : }
2145 0 : binding_detail::FastErrorResult rv;
2146 0 : self->SwapFrameLoaders(NonNullHelper(arg0), rv);
2147 0 : if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
2148 0 : return false;
2149 : }
2150 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
2151 0 : args.rval().setUndefined();
2152 0 : return true;
2153 : } while (0);
2154 : }
2155 0 : return ThrowErrorMessage(cx, MSG_OVERLOAD_RESOLUTION_FAILED, "1", "1", "HTMLObjectElement.swapFrameLoaders");
2156 : break;
2157 : }
2158 : default: {
2159 0 : return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "HTMLObjectElement.swapFrameLoaders");
2160 : break;
2161 : }
2162 : }
2163 : MOZ_CRASH("We have an always-returning default case");
2164 : return false;
2165 : }
2166 :
2167 : static const JSJitInfo swapFrameLoaders_methodinfo = {
2168 : { (JSJitGetterOp)swapFrameLoaders },
2169 : { prototypes::id::HTMLObjectElement },
2170 : { PrototypeTraits<prototypes::id::HTMLObjectElement>::Depth },
2171 : JSJitInfo::Method,
2172 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
2173 : JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */
2174 : false, /* isInfallible. False in setters. */
2175 : false, /* isMovable. Not relevant for setters. */
2176 : false, /* isEliminatable. Not relevant for setters. */
2177 : false, /* isAlwaysInSlot. Only relevant for getters. */
2178 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
2179 : false, /* isTypedMethod. Only relevant for methods. */
2180 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
2181 : };
2182 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
2183 : static_assert(0 < 1, "There is no slot for us");
2184 :
2185 : static bool
2186 0 : get_loadingEnabled(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLObjectElement* self, JSJitGetterCallArgs args)
2187 : {
2188 0 : if (!mozilla::dom::EnforceNotInPrerendering(cx, obj)) {
2189 : // Return false from the JSNative in order to trigger
2190 : // an uncatchable exception.
2191 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
2192 0 : return false;
2193 : }
2194 0 : bool result(self->LoadingEnabled());
2195 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
2196 0 : args.rval().setBoolean(result);
2197 0 : return true;
2198 : }
2199 :
2200 : static bool
2201 0 : set_loadingEnabled(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLObjectElement* self, JSJitSetterCallArgs args)
2202 : {
2203 0 : if (!mozilla::dom::EnforceNotInPrerendering(cx, obj)) {
2204 : // Return false from the JSNative in order to trigger
2205 : // an uncatchable exception.
2206 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
2207 0 : return false;
2208 : }
2209 : bool arg0;
2210 0 : if (!ValueToPrimitive<bool, eDefault>(cx, args[0], &arg0)) {
2211 0 : return false;
2212 : }
2213 0 : self->SetLoadingEnabled(arg0);
2214 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
2215 :
2216 0 : return true;
2217 : }
2218 :
2219 : static const JSJitInfo loadingEnabled_getterinfo = {
2220 : { (JSJitGetterOp)get_loadingEnabled },
2221 : { prototypes::id::HTMLObjectElement },
2222 : { PrototypeTraits<prototypes::id::HTMLObjectElement>::Depth },
2223 : JSJitInfo::Getter,
2224 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
2225 : JSVAL_TYPE_BOOLEAN, /* returnType. Not relevant for setters. */
2226 : true, /* isInfallible. False in setters. */
2227 : false, /* isMovable. Not relevant for setters. */
2228 : false, /* isEliminatable. Not relevant for setters. */
2229 : false, /* isAlwaysInSlot. Only relevant for getters. */
2230 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
2231 : false, /* isTypedMethod. Only relevant for methods. */
2232 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
2233 : };
2234 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
2235 : static_assert(0 < 1, "There is no slot for us");
2236 : static const JSJitInfo loadingEnabled_setterinfo = {
2237 : { (JSJitGetterOp)set_loadingEnabled },
2238 : { prototypes::id::HTMLObjectElement },
2239 : { PrototypeTraits<prototypes::id::HTMLObjectElement>::Depth },
2240 : JSJitInfo::Setter,
2241 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
2242 : JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */
2243 : false, /* isInfallible. False in setters. */
2244 : false, /* isMovable. Not relevant for setters. */
2245 : false, /* isEliminatable. Not relevant for setters. */
2246 : false, /* isAlwaysInSlot. Only relevant for getters. */
2247 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
2248 : false, /* isTypedMethod. Only relevant for methods. */
2249 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
2250 : };
2251 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
2252 : static_assert(0 < 1, "There is no slot for us");
2253 :
2254 : static bool
2255 0 : get_imageBlockingStatus(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLObjectElement* self, JSJitGetterCallArgs args)
2256 : {
2257 0 : if (!mozilla::dom::EnforceNotInPrerendering(cx, obj)) {
2258 : // Return false from the JSNative in order to trigger
2259 : // an uncatchable exception.
2260 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
2261 0 : return false;
2262 : }
2263 0 : int16_t result(self->ImageBlockingStatus());
2264 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
2265 0 : args.rval().setInt32(int32_t(result));
2266 0 : return true;
2267 : }
2268 :
2269 : static const JSJitInfo imageBlockingStatus_getterinfo = {
2270 : { (JSJitGetterOp)get_imageBlockingStatus },
2271 : { prototypes::id::HTMLObjectElement },
2272 : { PrototypeTraits<prototypes::id::HTMLObjectElement>::Depth },
2273 : JSJitInfo::Getter,
2274 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
2275 : JSVAL_TYPE_INT32, /* returnType. Not relevant for setters. */
2276 : true, /* isInfallible. False in setters. */
2277 : false, /* isMovable. Not relevant for setters. */
2278 : false, /* isEliminatable. Not relevant for setters. */
2279 : false, /* isAlwaysInSlot. Only relevant for getters. */
2280 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
2281 : false, /* isTypedMethod. Only relevant for methods. */
2282 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
2283 : };
2284 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
2285 : static_assert(0 < 1, "There is no slot for us");
2286 :
2287 : static bool
2288 0 : addObserver(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLObjectElement* self, const JSJitMethodCallArgs& args)
2289 : {
2290 0 : if (MOZ_UNLIKELY(args.length() < 1)) {
2291 0 : return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "HTMLObjectElement.addObserver");
2292 : }
2293 0 : if (!mozilla::dom::EnforceNotInPrerendering(cx, obj)) {
2294 : // Return false from the JSNative in order to trigger
2295 : // an uncatchable exception.
2296 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
2297 0 : return false;
2298 : }
2299 : imgINotificationObserver* arg0;
2300 0 : RefPtr<imgINotificationObserver> arg0_holder;
2301 0 : if (args[0].isObject()) {
2302 0 : JS::Rooted<JSObject*> source(cx, &args[0].toObject());
2303 0 : if (NS_FAILED(UnwrapArg<imgINotificationObserver>(cx, source, getter_AddRefs(arg0_holder)))) {
2304 0 : ThrowErrorMessage(cx, MSG_DOES_NOT_IMPLEMENT_INTERFACE, "Argument 1 of HTMLObjectElement.addObserver", "imgINotificationObserver");
2305 0 : return false;
2306 : }
2307 0 : MOZ_ASSERT(arg0_holder);
2308 0 : arg0 = arg0_holder;
2309 : } else {
2310 0 : ThrowErrorMessage(cx, MSG_NOT_OBJECT, "Argument 1 of HTMLObjectElement.addObserver");
2311 0 : return false;
2312 : }
2313 0 : self->AddObserver(NonNullHelper(arg0));
2314 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
2315 0 : args.rval().setUndefined();
2316 0 : return true;
2317 : }
2318 :
2319 : static const JSJitInfo addObserver_methodinfo = {
2320 : { (JSJitGetterOp)addObserver },
2321 : { prototypes::id::HTMLObjectElement },
2322 : { PrototypeTraits<prototypes::id::HTMLObjectElement>::Depth },
2323 : JSJitInfo::Method,
2324 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
2325 : JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */
2326 : false, /* isInfallible. False in setters. */
2327 : false, /* isMovable. Not relevant for setters. */
2328 : false, /* isEliminatable. Not relevant for setters. */
2329 : false, /* isAlwaysInSlot. Only relevant for getters. */
2330 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
2331 : false, /* isTypedMethod. Only relevant for methods. */
2332 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
2333 : };
2334 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
2335 : static_assert(0 < 1, "There is no slot for us");
2336 :
2337 : static bool
2338 0 : removeObserver(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLObjectElement* self, const JSJitMethodCallArgs& args)
2339 : {
2340 0 : if (MOZ_UNLIKELY(args.length() < 1)) {
2341 0 : return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "HTMLObjectElement.removeObserver");
2342 : }
2343 0 : if (!mozilla::dom::EnforceNotInPrerendering(cx, obj)) {
2344 : // Return false from the JSNative in order to trigger
2345 : // an uncatchable exception.
2346 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
2347 0 : return false;
2348 : }
2349 : imgINotificationObserver* arg0;
2350 0 : RefPtr<imgINotificationObserver> arg0_holder;
2351 0 : if (args[0].isObject()) {
2352 0 : JS::Rooted<JSObject*> source(cx, &args[0].toObject());
2353 0 : if (NS_FAILED(UnwrapArg<imgINotificationObserver>(cx, source, getter_AddRefs(arg0_holder)))) {
2354 0 : ThrowErrorMessage(cx, MSG_DOES_NOT_IMPLEMENT_INTERFACE, "Argument 1 of HTMLObjectElement.removeObserver", "imgINotificationObserver");
2355 0 : return false;
2356 : }
2357 0 : MOZ_ASSERT(arg0_holder);
2358 0 : arg0 = arg0_holder;
2359 : } else {
2360 0 : ThrowErrorMessage(cx, MSG_NOT_OBJECT, "Argument 1 of HTMLObjectElement.removeObserver");
2361 0 : return false;
2362 : }
2363 0 : self->RemoveObserver(NonNullHelper(arg0));
2364 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
2365 0 : args.rval().setUndefined();
2366 0 : return true;
2367 : }
2368 :
2369 : static const JSJitInfo removeObserver_methodinfo = {
2370 : { (JSJitGetterOp)removeObserver },
2371 : { prototypes::id::HTMLObjectElement },
2372 : { PrototypeTraits<prototypes::id::HTMLObjectElement>::Depth },
2373 : JSJitInfo::Method,
2374 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
2375 : JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */
2376 : false, /* isInfallible. False in setters. */
2377 : false, /* isMovable. Not relevant for setters. */
2378 : false, /* isEliminatable. Not relevant for setters. */
2379 : false, /* isAlwaysInSlot. Only relevant for getters. */
2380 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
2381 : false, /* isTypedMethod. Only relevant for methods. */
2382 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
2383 : };
2384 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
2385 : static_assert(0 < 1, "There is no slot for us");
2386 :
2387 : static bool
2388 0 : getRequest(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLObjectElement* self, const JSJitMethodCallArgs& args)
2389 : {
2390 0 : if (MOZ_UNLIKELY(args.length() < 1)) {
2391 0 : return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "HTMLObjectElement.getRequest");
2392 : }
2393 0 : if (!mozilla::dom::EnforceNotInPrerendering(cx, obj)) {
2394 : // Return false from the JSNative in order to trigger
2395 : // an uncatchable exception.
2396 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
2397 0 : return false;
2398 : }
2399 : int32_t arg0;
2400 0 : if (!ValueToPrimitive<int32_t, eDefault>(cx, args[0], &arg0)) {
2401 0 : return false;
2402 : }
2403 0 : binding_detail::FastErrorResult rv;
2404 0 : auto result(StrongOrRawPtr<imgIRequest>(self->GetRequest(arg0, rv)));
2405 0 : if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
2406 0 : return false;
2407 : }
2408 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
2409 0 : if (!result) {
2410 0 : args.rval().setNull();
2411 0 : return true;
2412 : }
2413 0 : if (!WrapObject(cx, result, &NS_GET_IID(imgIRequest), args.rval())) {
2414 0 : return false;
2415 : }
2416 0 : return true;
2417 : }
2418 :
2419 : static const JSJitInfo getRequest_methodinfo = {
2420 : { (JSJitGetterOp)getRequest },
2421 : { prototypes::id::HTMLObjectElement },
2422 : { PrototypeTraits<prototypes::id::HTMLObjectElement>::Depth },
2423 : JSJitInfo::Method,
2424 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
2425 : JSVAL_TYPE_UNKNOWN, /* returnType. Not relevant for setters. */
2426 : false, /* isInfallible. False in setters. */
2427 : false, /* isMovable. Not relevant for setters. */
2428 : false, /* isEliminatable. Not relevant for setters. */
2429 : false, /* isAlwaysInSlot. Only relevant for getters. */
2430 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
2431 : false, /* isTypedMethod. Only relevant for methods. */
2432 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
2433 : };
2434 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
2435 : static_assert(0 < 1, "There is no slot for us");
2436 :
2437 : static bool
2438 0 : getRequestType(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLObjectElement* self, const JSJitMethodCallArgs& args)
2439 : {
2440 0 : if (MOZ_UNLIKELY(args.length() < 1)) {
2441 0 : return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "HTMLObjectElement.getRequestType");
2442 : }
2443 0 : if (!mozilla::dom::EnforceNotInPrerendering(cx, obj)) {
2444 : // Return false from the JSNative in order to trigger
2445 : // an uncatchable exception.
2446 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
2447 0 : return false;
2448 : }
2449 : imgIRequest* arg0;
2450 0 : RefPtr<imgIRequest> arg0_holder;
2451 0 : if (args[0].isObject()) {
2452 0 : JS::Rooted<JSObject*> source(cx, &args[0].toObject());
2453 0 : if (NS_FAILED(UnwrapArg<imgIRequest>(cx, source, getter_AddRefs(arg0_holder)))) {
2454 0 : ThrowErrorMessage(cx, MSG_DOES_NOT_IMPLEMENT_INTERFACE, "Argument 1 of HTMLObjectElement.getRequestType", "imgIRequest");
2455 0 : return false;
2456 : }
2457 0 : MOZ_ASSERT(arg0_holder);
2458 0 : arg0 = arg0_holder;
2459 : } else {
2460 0 : ThrowErrorMessage(cx, MSG_NOT_OBJECT, "Argument 1 of HTMLObjectElement.getRequestType");
2461 0 : return false;
2462 : }
2463 0 : binding_detail::FastErrorResult rv;
2464 0 : int32_t result(self->GetRequestType(NonNullHelper(arg0), rv));
2465 0 : if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
2466 0 : return false;
2467 : }
2468 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
2469 0 : args.rval().setInt32(int32_t(result));
2470 0 : return true;
2471 : }
2472 :
2473 : static const JSJitInfo getRequestType_methodinfo = {
2474 : { (JSJitGetterOp)getRequestType },
2475 : { prototypes::id::HTMLObjectElement },
2476 : { PrototypeTraits<prototypes::id::HTMLObjectElement>::Depth },
2477 : JSJitInfo::Method,
2478 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
2479 : JSVAL_TYPE_INT32, /* returnType. Not relevant for setters. */
2480 : false, /* isInfallible. False in setters. */
2481 : false, /* isMovable. Not relevant for setters. */
2482 : false, /* isEliminatable. Not relevant for setters. */
2483 : false, /* isAlwaysInSlot. Only relevant for getters. */
2484 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
2485 : false, /* isTypedMethod. Only relevant for methods. */
2486 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
2487 : };
2488 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
2489 : static_assert(0 < 1, "There is no slot for us");
2490 :
2491 : static bool
2492 0 : get_currentURI(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLObjectElement* self, JSJitGetterCallArgs args)
2493 : {
2494 0 : if (!mozilla::dom::EnforceNotInPrerendering(cx, obj)) {
2495 : // Return false from the JSNative in order to trigger
2496 : // an uncatchable exception.
2497 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
2498 0 : return false;
2499 : }
2500 0 : binding_detail::FastErrorResult rv;
2501 0 : auto result(StrongOrRawPtr<nsIURI>(self->GetCurrentURI(rv)));
2502 0 : if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
2503 0 : return false;
2504 : }
2505 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
2506 0 : if (!result) {
2507 0 : args.rval().setNull();
2508 0 : return true;
2509 : }
2510 0 : if (!WrapObject(cx, result, &NS_GET_IID(nsIURI), args.rval())) {
2511 0 : return false;
2512 : }
2513 0 : return true;
2514 : }
2515 :
2516 : static const JSJitInfo currentURI_getterinfo = {
2517 : { (JSJitGetterOp)get_currentURI },
2518 : { prototypes::id::HTMLObjectElement },
2519 : { PrototypeTraits<prototypes::id::HTMLObjectElement>::Depth },
2520 : JSJitInfo::Getter,
2521 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
2522 : JSVAL_TYPE_UNKNOWN, /* returnType. Not relevant for setters. */
2523 : false, /* isInfallible. False in setters. */
2524 : false, /* isMovable. Not relevant for setters. */
2525 : false, /* isEliminatable. Not relevant for setters. */
2526 : false, /* isAlwaysInSlot. Only relevant for getters. */
2527 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
2528 : false, /* isTypedMethod. Only relevant for methods. */
2529 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
2530 : };
2531 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
2532 : static_assert(0 < 1, "There is no slot for us");
2533 :
2534 : static bool
2535 0 : forceReload(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLObjectElement* self, const JSJitMethodCallArgs& args)
2536 : {
2537 0 : if (!mozilla::dom::EnforceNotInPrerendering(cx, obj)) {
2538 : // Return false from the JSNative in order to trigger
2539 : // an uncatchable exception.
2540 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
2541 0 : return false;
2542 : }
2543 0 : Optional<bool> arg0;
2544 0 : if (args.hasDefined(0)) {
2545 0 : arg0.Construct();
2546 0 : if (!ValueToPrimitive<bool, eDefault>(cx, args[0], &arg0.Value())) {
2547 0 : return false;
2548 : }
2549 : }
2550 0 : binding_detail::FastErrorResult rv;
2551 0 : self->ForceReload(Constify(arg0), rv);
2552 0 : if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
2553 0 : return false;
2554 : }
2555 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
2556 0 : args.rval().setUndefined();
2557 0 : return true;
2558 : }
2559 :
2560 : static const JSJitInfo forceReload_methodinfo = {
2561 : { (JSJitGetterOp)forceReload },
2562 : { prototypes::id::HTMLObjectElement },
2563 : { PrototypeTraits<prototypes::id::HTMLObjectElement>::Depth },
2564 : JSJitInfo::Method,
2565 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
2566 : JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */
2567 : false, /* isInfallible. False in setters. */
2568 : false, /* isMovable. Not relevant for setters. */
2569 : false, /* isEliminatable. Not relevant for setters. */
2570 : false, /* isAlwaysInSlot. Only relevant for getters. */
2571 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
2572 : false, /* isTypedMethod. Only relevant for methods. */
2573 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
2574 : };
2575 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
2576 : static_assert(0 < 1, "There is no slot for us");
2577 :
2578 : static bool
2579 0 : forceImageState(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLObjectElement* self, const JSJitMethodCallArgs& args)
2580 : {
2581 0 : if (MOZ_UNLIKELY(args.length() < 2)) {
2582 0 : return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "HTMLObjectElement.forceImageState");
2583 : }
2584 0 : if (!mozilla::dom::EnforceNotInPrerendering(cx, obj)) {
2585 : // Return false from the JSNative in order to trigger
2586 : // an uncatchable exception.
2587 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
2588 0 : return false;
2589 : }
2590 : bool arg0;
2591 0 : if (!ValueToPrimitive<bool, eDefault>(cx, args[0], &arg0)) {
2592 0 : return false;
2593 : }
2594 : uint64_t arg1;
2595 0 : if (!ValueToPrimitive<uint64_t, eDefault>(cx, args[1], &arg1)) {
2596 0 : return false;
2597 : }
2598 0 : self->ForceImageState(arg0, arg1);
2599 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
2600 0 : args.rval().setUndefined();
2601 0 : return true;
2602 : }
2603 :
2604 : static const JSJitInfo forceImageState_methodinfo = {
2605 : { (JSJitGetterOp)forceImageState },
2606 : { prototypes::id::HTMLObjectElement },
2607 : { PrototypeTraits<prototypes::id::HTMLObjectElement>::Depth },
2608 : JSJitInfo::Method,
2609 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
2610 : JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */
2611 : false, /* isInfallible. False in setters. */
2612 : false, /* isMovable. Not relevant for setters. */
2613 : false, /* isEliminatable. Not relevant for setters. */
2614 : false, /* isAlwaysInSlot. Only relevant for getters. */
2615 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
2616 : false, /* isTypedMethod. Only relevant for methods. */
2617 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
2618 : };
2619 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
2620 : static_assert(0 < 1, "There is no slot for us");
2621 :
2622 : static bool
2623 0 : get_actualType(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLObjectElement* self, JSJitGetterCallArgs args)
2624 : {
2625 0 : if (!mozilla::dom::EnforceNotInPrerendering(cx, obj)) {
2626 : // Return false from the JSNative in order to trigger
2627 : // an uncatchable exception.
2628 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
2629 0 : return false;
2630 : }
2631 0 : DOMString result;
2632 0 : self->GetActualType(result);
2633 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
2634 0 : if (!xpc::NonVoidStringToJsval(cx, result, args.rval())) {
2635 0 : return false;
2636 : }
2637 0 : return true;
2638 : }
2639 :
2640 : static const JSJitInfo actualType_getterinfo = {
2641 : { (JSJitGetterOp)get_actualType },
2642 : { prototypes::id::HTMLObjectElement },
2643 : { PrototypeTraits<prototypes::id::HTMLObjectElement>::Depth },
2644 : JSJitInfo::Getter,
2645 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
2646 : JSVAL_TYPE_STRING, /* returnType. Not relevant for setters. */
2647 : false, /* isInfallible. False in setters. */
2648 : false, /* isMovable. Not relevant for setters. */
2649 : false, /* isEliminatable. Not relevant for setters. */
2650 : false, /* isAlwaysInSlot. Only relevant for getters. */
2651 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
2652 : false, /* isTypedMethod. Only relevant for methods. */
2653 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
2654 : };
2655 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
2656 : static_assert(0 < 1, "There is no slot for us");
2657 :
2658 : static bool
2659 0 : get_displayedType(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLObjectElement* self, JSJitGetterCallArgs args)
2660 : {
2661 0 : if (!mozilla::dom::EnforceNotInPrerendering(cx, obj)) {
2662 : // Return false from the JSNative in order to trigger
2663 : // an uncatchable exception.
2664 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
2665 0 : return false;
2666 : }
2667 0 : uint32_t result(self->DisplayedType());
2668 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
2669 0 : args.rval().setNumber(result);
2670 0 : return true;
2671 : }
2672 :
2673 : static const JSJitInfo displayedType_getterinfo = {
2674 : { (JSJitGetterOp)get_displayedType },
2675 : { prototypes::id::HTMLObjectElement },
2676 : { PrototypeTraits<prototypes::id::HTMLObjectElement>::Depth },
2677 : JSJitInfo::Getter,
2678 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
2679 : JSVAL_TYPE_DOUBLE, /* returnType. Not relevant for setters. */
2680 : true, /* isInfallible. False in setters. */
2681 : false, /* isMovable. Not relevant for setters. */
2682 : false, /* isEliminatable. Not relevant for setters. */
2683 : false, /* isAlwaysInSlot. Only relevant for getters. */
2684 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
2685 : false, /* isTypedMethod. Only relevant for methods. */
2686 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
2687 : };
2688 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
2689 : static_assert(0 < 1, "There is no slot for us");
2690 :
2691 : static bool
2692 0 : getContentTypeForMIMEType(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLObjectElement* self, const JSJitMethodCallArgs& args)
2693 : {
2694 0 : if (MOZ_UNLIKELY(args.length() < 1)) {
2695 0 : return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "HTMLObjectElement.getContentTypeForMIMEType");
2696 : }
2697 0 : if (!mozilla::dom::EnforceNotInPrerendering(cx, obj)) {
2698 : // Return false from the JSNative in order to trigger
2699 : // an uncatchable exception.
2700 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
2701 0 : return false;
2702 : }
2703 0 : binding_detail::FakeString arg0;
2704 0 : if (!ConvertJSValueToString(cx, args[0], eStringify, eStringify, arg0)) {
2705 0 : return false;
2706 : }
2707 0 : uint32_t result(self->GetContentTypeForMIMEType(NonNullHelper(Constify(arg0))));
2708 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
2709 0 : args.rval().setNumber(result);
2710 0 : return true;
2711 : }
2712 :
2713 : static const JSJitInfo getContentTypeForMIMEType_methodinfo = {
2714 : { (JSJitGetterOp)getContentTypeForMIMEType },
2715 : { prototypes::id::HTMLObjectElement },
2716 : { PrototypeTraits<prototypes::id::HTMLObjectElement>::Depth },
2717 : JSJitInfo::Method,
2718 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
2719 : JSVAL_TYPE_DOUBLE, /* returnType. Not relevant for setters. */
2720 : false, /* isInfallible. False in setters. */
2721 : false, /* isMovable. Not relevant for setters. */
2722 : false, /* isEliminatable. Not relevant for setters. */
2723 : false, /* isAlwaysInSlot. Only relevant for getters. */
2724 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
2725 : false, /* isTypedMethod. Only relevant for methods. */
2726 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
2727 : };
2728 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
2729 : static_assert(0 < 1, "There is no slot for us");
2730 :
2731 : static bool
2732 0 : getPluginAttributes(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLObjectElement* self, const JSJitMethodCallArgs& args)
2733 : {
2734 0 : if (!mozilla::dom::EnforceNotInPrerendering(cx, obj)) {
2735 : // Return false from the JSNative in order to trigger
2736 : // an uncatchable exception.
2737 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
2738 0 : return false;
2739 : }
2740 0 : nsTArray<MozPluginParameter> result;
2741 0 : self->GetPluginAttributes(result);
2742 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
2743 :
2744 0 : uint32_t length = result.Length();
2745 0 : JS::Rooted<JSObject*> returnArray(cx, JS_NewArrayObject(cx, length));
2746 0 : if (!returnArray) {
2747 0 : return false;
2748 : }
2749 : // Scope for 'tmp'
2750 : {
2751 0 : JS::Rooted<JS::Value> tmp(cx);
2752 0 : for (uint32_t sequenceIdx0 = 0; sequenceIdx0 < length; ++sequenceIdx0) {
2753 : // Control block to let us common up the JS_DefineElement calls when there
2754 : // are different ways to succeed at wrapping the object.
2755 : do {
2756 0 : if (!result[sequenceIdx0].ToObjectInternal(cx, &tmp)) {
2757 0 : return false;
2758 : }
2759 0 : break;
2760 : } while (0);
2761 0 : if (!JS_DefineElement(cx, returnArray, sequenceIdx0, tmp,
2762 : JSPROP_ENUMERATE)) {
2763 0 : return false;
2764 : }
2765 : }
2766 : }
2767 0 : args.rval().setObject(*returnArray);
2768 0 : return true;
2769 : }
2770 :
2771 : static const JSJitInfo getPluginAttributes_methodinfo = {
2772 : { (JSJitGetterOp)getPluginAttributes },
2773 : { prototypes::id::HTMLObjectElement },
2774 : { PrototypeTraits<prototypes::id::HTMLObjectElement>::Depth },
2775 : JSJitInfo::Method,
2776 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
2777 : JSVAL_TYPE_OBJECT, /* returnType. Not relevant for setters. */
2778 : false, /* isInfallible. False in setters. */
2779 : false, /* isMovable. Not relevant for setters. */
2780 : false, /* isEliminatable. Not relevant for setters. */
2781 : false, /* isAlwaysInSlot. Only relevant for getters. */
2782 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
2783 : false, /* isTypedMethod. Only relevant for methods. */
2784 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
2785 : };
2786 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
2787 : static_assert(0 < 1, "There is no slot for us");
2788 :
2789 : static bool
2790 0 : getPluginParameters(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLObjectElement* self, const JSJitMethodCallArgs& args)
2791 : {
2792 0 : if (!mozilla::dom::EnforceNotInPrerendering(cx, obj)) {
2793 : // Return false from the JSNative in order to trigger
2794 : // an uncatchable exception.
2795 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
2796 0 : return false;
2797 : }
2798 0 : nsTArray<MozPluginParameter> result;
2799 0 : self->GetPluginParameters(result);
2800 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
2801 :
2802 0 : uint32_t length = result.Length();
2803 0 : JS::Rooted<JSObject*> returnArray(cx, JS_NewArrayObject(cx, length));
2804 0 : if (!returnArray) {
2805 0 : return false;
2806 : }
2807 : // Scope for 'tmp'
2808 : {
2809 0 : JS::Rooted<JS::Value> tmp(cx);
2810 0 : for (uint32_t sequenceIdx0 = 0; sequenceIdx0 < length; ++sequenceIdx0) {
2811 : // Control block to let us common up the JS_DefineElement calls when there
2812 : // are different ways to succeed at wrapping the object.
2813 : do {
2814 0 : if (!result[sequenceIdx0].ToObjectInternal(cx, &tmp)) {
2815 0 : return false;
2816 : }
2817 0 : break;
2818 : } while (0);
2819 0 : if (!JS_DefineElement(cx, returnArray, sequenceIdx0, tmp,
2820 : JSPROP_ENUMERATE)) {
2821 0 : return false;
2822 : }
2823 : }
2824 : }
2825 0 : args.rval().setObject(*returnArray);
2826 0 : return true;
2827 : }
2828 :
2829 : static const JSJitInfo getPluginParameters_methodinfo = {
2830 : { (JSJitGetterOp)getPluginParameters },
2831 : { prototypes::id::HTMLObjectElement },
2832 : { PrototypeTraits<prototypes::id::HTMLObjectElement>::Depth },
2833 : JSJitInfo::Method,
2834 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
2835 : JSVAL_TYPE_OBJECT, /* returnType. Not relevant for setters. */
2836 : false, /* isInfallible. False in setters. */
2837 : false, /* isMovable. Not relevant for setters. */
2838 : false, /* isEliminatable. Not relevant for setters. */
2839 : false, /* isAlwaysInSlot. Only relevant for getters. */
2840 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
2841 : false, /* isTypedMethod. Only relevant for methods. */
2842 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
2843 : };
2844 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
2845 : static_assert(0 < 1, "There is no slot for us");
2846 :
2847 : static bool
2848 0 : playPlugin(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLObjectElement* self, const JSJitMethodCallArgs& args)
2849 : {
2850 0 : if (!mozilla::dom::EnforceNotInPrerendering(cx, obj)) {
2851 : // Return false from the JSNative in order to trigger
2852 : // an uncatchable exception.
2853 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
2854 0 : return false;
2855 : }
2856 0 : binding_detail::FastErrorResult rv;
2857 0 : self->PlayPlugin(SystemCallerGuarantee(), rv);
2858 0 : if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
2859 0 : return false;
2860 : }
2861 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
2862 0 : args.rval().setUndefined();
2863 0 : return true;
2864 : }
2865 :
2866 : static const JSJitInfo playPlugin_methodinfo = {
2867 : { (JSJitGetterOp)playPlugin },
2868 : { prototypes::id::HTMLObjectElement },
2869 : { PrototypeTraits<prototypes::id::HTMLObjectElement>::Depth },
2870 : JSJitInfo::Method,
2871 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
2872 : JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */
2873 : false, /* isInfallible. False in setters. */
2874 : false, /* isMovable. Not relevant for setters. */
2875 : false, /* isEliminatable. Not relevant for setters. */
2876 : false, /* isAlwaysInSlot. Only relevant for getters. */
2877 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
2878 : false, /* isTypedMethod. Only relevant for methods. */
2879 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
2880 : };
2881 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
2882 : static_assert(0 < 1, "There is no slot for us");
2883 :
2884 : static bool
2885 0 : reload(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLObjectElement* self, const JSJitMethodCallArgs& args)
2886 : {
2887 0 : if (MOZ_UNLIKELY(args.length() < 1)) {
2888 0 : return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "HTMLObjectElement.reload");
2889 : }
2890 0 : if (!mozilla::dom::EnforceNotInPrerendering(cx, obj)) {
2891 : // Return false from the JSNative in order to trigger
2892 : // an uncatchable exception.
2893 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
2894 0 : return false;
2895 : }
2896 : bool arg0;
2897 0 : if (!ValueToPrimitive<bool, eDefault>(cx, args[0], &arg0)) {
2898 0 : return false;
2899 : }
2900 0 : binding_detail::FastErrorResult rv;
2901 0 : self->Reload(arg0, rv);
2902 0 : if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
2903 0 : return false;
2904 : }
2905 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
2906 0 : args.rval().setUndefined();
2907 0 : return true;
2908 : }
2909 :
2910 : static const JSJitInfo reload_methodinfo = {
2911 : { (JSJitGetterOp)reload },
2912 : { prototypes::id::HTMLObjectElement },
2913 : { PrototypeTraits<prototypes::id::HTMLObjectElement>::Depth },
2914 : JSJitInfo::Method,
2915 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
2916 : JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */
2917 : false, /* isInfallible. False in setters. */
2918 : false, /* isMovable. Not relevant for setters. */
2919 : false, /* isEliminatable. Not relevant for setters. */
2920 : false, /* isAlwaysInSlot. Only relevant for getters. */
2921 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
2922 : false, /* isTypedMethod. Only relevant for methods. */
2923 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
2924 : };
2925 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
2926 : static_assert(0 < 1, "There is no slot for us");
2927 :
2928 : static bool
2929 0 : get_activated(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLObjectElement* self, JSJitGetterCallArgs args)
2930 : {
2931 0 : if (!mozilla::dom::EnforceNotInPrerendering(cx, obj)) {
2932 : // Return false from the JSNative in order to trigger
2933 : // an uncatchable exception.
2934 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
2935 0 : return false;
2936 : }
2937 0 : bool result(self->Activated());
2938 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
2939 0 : args.rval().setBoolean(result);
2940 0 : return true;
2941 : }
2942 :
2943 : static const JSJitInfo activated_getterinfo = {
2944 : { (JSJitGetterOp)get_activated },
2945 : { prototypes::id::HTMLObjectElement },
2946 : { PrototypeTraits<prototypes::id::HTMLObjectElement>::Depth },
2947 : JSJitInfo::Getter,
2948 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
2949 : JSVAL_TYPE_BOOLEAN, /* returnType. Not relevant for setters. */
2950 : true, /* isInfallible. False in setters. */
2951 : false, /* isMovable. Not relevant for setters. */
2952 : false, /* isEliminatable. Not relevant for setters. */
2953 : false, /* isAlwaysInSlot. Only relevant for getters. */
2954 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
2955 : false, /* isTypedMethod. Only relevant for methods. */
2956 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
2957 : };
2958 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
2959 : static_assert(0 < 1, "There is no slot for us");
2960 :
2961 : static bool
2962 0 : get_srcURI(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLObjectElement* self, JSJitGetterCallArgs args)
2963 : {
2964 0 : if (!mozilla::dom::EnforceNotInPrerendering(cx, obj)) {
2965 : // Return false from the JSNative in order to trigger
2966 : // an uncatchable exception.
2967 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
2968 0 : return false;
2969 : }
2970 0 : auto result(StrongOrRawPtr<nsIURI>(self->GetSrcURI()));
2971 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
2972 0 : if (!result) {
2973 0 : args.rval().setNull();
2974 0 : return true;
2975 : }
2976 0 : if (!WrapObject(cx, result, &NS_GET_IID(nsIURI), args.rval())) {
2977 0 : return false;
2978 : }
2979 0 : return true;
2980 : }
2981 :
2982 : static const JSJitInfo srcURI_getterinfo = {
2983 : { (JSJitGetterOp)get_srcURI },
2984 : { prototypes::id::HTMLObjectElement },
2985 : { PrototypeTraits<prototypes::id::HTMLObjectElement>::Depth },
2986 : JSJitInfo::Getter,
2987 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
2988 : JSVAL_TYPE_UNKNOWN, /* returnType. Not relevant for setters. */
2989 : false, /* isInfallible. False in setters. */
2990 : false, /* isMovable. Not relevant for setters. */
2991 : false, /* isEliminatable. Not relevant for setters. */
2992 : false, /* isAlwaysInSlot. Only relevant for getters. */
2993 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
2994 : false, /* isTypedMethod. Only relevant for methods. */
2995 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
2996 : };
2997 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
2998 : static_assert(0 < 1, "There is no slot for us");
2999 :
3000 : static bool
3001 0 : get_defaultFallbackType(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLObjectElement* self, JSJitGetterCallArgs args)
3002 : {
3003 0 : if (!mozilla::dom::EnforceNotInPrerendering(cx, obj)) {
3004 : // Return false from the JSNative in order to trigger
3005 : // an uncatchable exception.
3006 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
3007 0 : return false;
3008 : }
3009 0 : uint32_t result(self->DefaultFallbackType());
3010 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
3011 0 : args.rval().setNumber(result);
3012 0 : return true;
3013 : }
3014 :
3015 : static const JSJitInfo defaultFallbackType_getterinfo = {
3016 : { (JSJitGetterOp)get_defaultFallbackType },
3017 : { prototypes::id::HTMLObjectElement },
3018 : { PrototypeTraits<prototypes::id::HTMLObjectElement>::Depth },
3019 : JSJitInfo::Getter,
3020 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
3021 : JSVAL_TYPE_DOUBLE, /* returnType. Not relevant for setters. */
3022 : true, /* isInfallible. False in setters. */
3023 : false, /* isMovable. Not relevant for setters. */
3024 : false, /* isEliminatable. Not relevant for setters. */
3025 : false, /* isAlwaysInSlot. Only relevant for getters. */
3026 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
3027 : false, /* isTypedMethod. Only relevant for methods. */
3028 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
3029 : };
3030 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
3031 : static_assert(0 < 1, "There is no slot for us");
3032 :
3033 : static bool
3034 0 : get_pluginFallbackType(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLObjectElement* self, JSJitGetterCallArgs args)
3035 : {
3036 0 : if (!mozilla::dom::EnforceNotInPrerendering(cx, obj)) {
3037 : // Return false from the JSNative in order to trigger
3038 : // an uncatchable exception.
3039 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
3040 0 : return false;
3041 : }
3042 0 : uint32_t result(self->PluginFallbackType());
3043 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
3044 0 : args.rval().setNumber(result);
3045 0 : return true;
3046 : }
3047 :
3048 : static const JSJitInfo pluginFallbackType_getterinfo = {
3049 : { (JSJitGetterOp)get_pluginFallbackType },
3050 : { prototypes::id::HTMLObjectElement },
3051 : { PrototypeTraits<prototypes::id::HTMLObjectElement>::Depth },
3052 : JSJitInfo::Getter,
3053 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
3054 : JSVAL_TYPE_DOUBLE, /* returnType. Not relevant for setters. */
3055 : true, /* isInfallible. False in setters. */
3056 : false, /* isMovable. Not relevant for setters. */
3057 : false, /* isEliminatable. Not relevant for setters. */
3058 : false, /* isAlwaysInSlot. Only relevant for getters. */
3059 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
3060 : false, /* isTypedMethod. Only relevant for methods. */
3061 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
3062 : };
3063 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
3064 : static_assert(0 < 1, "There is no slot for us");
3065 :
3066 : static bool
3067 0 : get_hasRunningPlugin(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLObjectElement* self, JSJitGetterCallArgs args)
3068 : {
3069 0 : if (!mozilla::dom::EnforceNotInPrerendering(cx, obj)) {
3070 : // Return false from the JSNative in order to trigger
3071 : // an uncatchable exception.
3072 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
3073 0 : return false;
3074 : }
3075 0 : bool result(self->HasRunningPlugin());
3076 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
3077 0 : args.rval().setBoolean(result);
3078 0 : return true;
3079 : }
3080 :
3081 : static const JSJitInfo hasRunningPlugin_getterinfo = {
3082 : { (JSJitGetterOp)get_hasRunningPlugin },
3083 : { prototypes::id::HTMLObjectElement },
3084 : { PrototypeTraits<prototypes::id::HTMLObjectElement>::Depth },
3085 : JSJitInfo::Getter,
3086 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
3087 : JSVAL_TYPE_BOOLEAN, /* returnType. Not relevant for setters. */
3088 : true, /* isInfallible. False in setters. */
3089 : false, /* isMovable. Not relevant for setters. */
3090 : false, /* isEliminatable. Not relevant for setters. */
3091 : false, /* isAlwaysInSlot. Only relevant for getters. */
3092 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
3093 : false, /* isTypedMethod. Only relevant for methods. */
3094 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
3095 : };
3096 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
3097 : static_assert(0 < 1, "There is no slot for us");
3098 :
3099 : static bool
3100 0 : skipFakePlugins(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLObjectElement* self, const JSJitMethodCallArgs& args)
3101 : {
3102 0 : if (!mozilla::dom::EnforceNotInPrerendering(cx, obj)) {
3103 : // Return false from the JSNative in order to trigger
3104 : // an uncatchable exception.
3105 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
3106 0 : return false;
3107 : }
3108 0 : binding_detail::FastErrorResult rv;
3109 0 : self->SkipFakePlugins(rv);
3110 0 : if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
3111 0 : return false;
3112 : }
3113 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
3114 0 : args.rval().setUndefined();
3115 0 : return true;
3116 : }
3117 :
3118 : static const JSJitInfo skipFakePlugins_methodinfo = {
3119 : { (JSJitGetterOp)skipFakePlugins },
3120 : { prototypes::id::HTMLObjectElement },
3121 : { PrototypeTraits<prototypes::id::HTMLObjectElement>::Depth },
3122 : JSJitInfo::Method,
3123 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
3124 : JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */
3125 : false, /* isInfallible. False in setters. */
3126 : false, /* isMovable. Not relevant for setters. */
3127 : false, /* isEliminatable. Not relevant for setters. */
3128 : false, /* isAlwaysInSlot. Only relevant for getters. */
3129 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
3130 : false, /* isTypedMethod. Only relevant for methods. */
3131 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
3132 : };
3133 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
3134 : static_assert(0 < 1, "There is no slot for us");
3135 :
3136 : static bool
3137 0 : get_runID(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLObjectElement* self, JSJitGetterCallArgs args)
3138 : {
3139 0 : if (!mozilla::dom::EnforceNotInPrerendering(cx, obj)) {
3140 : // Return false from the JSNative in order to trigger
3141 : // an uncatchable exception.
3142 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
3143 0 : return false;
3144 : }
3145 0 : binding_detail::FastErrorResult rv;
3146 0 : uint32_t result(self->GetRunID(SystemCallerGuarantee(), rv));
3147 0 : if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
3148 0 : return false;
3149 : }
3150 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
3151 0 : args.rval().setNumber(result);
3152 0 : return true;
3153 : }
3154 :
3155 : static const JSJitInfo runID_getterinfo = {
3156 : { (JSJitGetterOp)get_runID },
3157 : { prototypes::id::HTMLObjectElement },
3158 : { PrototypeTraits<prototypes::id::HTMLObjectElement>::Depth },
3159 : JSJitInfo::Getter,
3160 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
3161 : JSVAL_TYPE_DOUBLE, /* returnType. Not relevant for setters. */
3162 : false, /* isInfallible. False in setters. */
3163 : false, /* isMovable. Not relevant for setters. */
3164 : false, /* isEliminatable. Not relevant for setters. */
3165 : false, /* isAlwaysInSlot. Only relevant for getters. */
3166 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
3167 : false, /* isTypedMethod. Only relevant for methods. */
3168 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
3169 : };
3170 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
3171 : static_assert(0 < 1, "There is no slot for us");
3172 :
3173 : static bool
3174 0 : _addProperty(JSContext* cx, JS::Handle<JSObject*> obj, JS::Handle<jsid> id, JS::Handle<JS::Value> val)
3175 : {
3176 0 : mozilla::dom::HTMLObjectElement* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::dom::HTMLObjectElement>(obj);
3177 : // We don't want to preserve if we don't have a wrapper, and we
3178 : // obviously can't preserve if we're not initialized.
3179 0 : if (self && self->GetWrapperPreserveColor()) {
3180 0 : PreserveWrapper(self);
3181 : }
3182 0 : return true;
3183 : }
3184 :
3185 : static void
3186 0 : _finalize(js::FreeOp* fop, JSObject* obj)
3187 : {
3188 0 : mozilla::dom::HTMLObjectElement* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::dom::HTMLObjectElement>(obj);
3189 0 : if (self) {
3190 0 : ClearWrapper(self, self, obj);
3191 0 : AddForDeferredFinalization<mozilla::dom::HTMLObjectElement>(self);
3192 : }
3193 0 : }
3194 :
3195 : static void
3196 0 : _objectMoved(JSObject* obj, const JSObject* old)
3197 : {
3198 0 : mozilla::dom::HTMLObjectElement* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::dom::HTMLObjectElement>(obj);
3199 0 : if (self) {
3200 0 : UpdateWrapper(self, self, obj, old);
3201 : }
3202 0 : }
3203 :
3204 : // We deliberately use brace-elision to make Visual Studio produce better initalization code.
3205 : #if defined(__clang__)
3206 : #pragma clang diagnostic push
3207 : #pragma clang diagnostic ignored "-Wmissing-braces"
3208 : #endif
3209 : static const JSFunctionSpec sMethods_specs[] = {
3210 : JS_FNSPEC("checkValidity", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&checkValidity_methodinfo), 0, JSPROP_ENUMERATE, nullptr),
3211 : JS_FNSPEC("reportValidity", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&reportValidity_methodinfo), 0, JSPROP_ENUMERATE, nullptr),
3212 : JS_FNSPEC("setCustomValidity", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&setCustomValidity_methodinfo), 1, JSPROP_ENUMERATE, nullptr),
3213 : JS_FNSPEC("getSVGDocument", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&getSVGDocument_methodinfo), 0, JSPROP_ENUMERATE, nullptr),
3214 : JS_FS_END
3215 : };
3216 : #if defined(__clang__)
3217 : #pragma clang diagnostic pop
3218 : #endif
3219 :
3220 :
3221 : // Can't be const because the pref-enabled boolean needs to be writable
3222 : static Prefable<const JSFunctionSpec> sMethods[] = {
3223 : { nullptr, &sMethods_specs[0] },
3224 : { nullptr, nullptr }
3225 : };
3226 :
3227 : static_assert(1 <= 1ull << NUM_BITS_PROPERTY_INFO_PREF_INDEX,
3228 : "We have a prefable index that is >= (1 << NUM_BITS_PROPERTY_INFO_PREF_INDEX)");
3229 : static_assert(4 <= 1ull << NUM_BITS_PROPERTY_INFO_SPEC_INDEX,
3230 : "We have a spec index that is >= (1 << NUM_BITS_PROPERTY_INFO_SPEC_INDEX)");
3231 :
3232 : // We deliberately use brace-elision to make Visual Studio produce better initalization code.
3233 : #if defined(__clang__)
3234 : #pragma clang diagnostic push
3235 : #pragma clang diagnostic ignored "-Wmissing-braces"
3236 : #endif
3237 : static const JSFunctionSpec sChromeMethods_specs[] = {
3238 : JS_FNSPEC("setIsPrerendered", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&setIsPrerendered_methodinfo), 0, JSPROP_ENUMERATE, nullptr),
3239 : JS_FNSPEC("presetOpenerWindow", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&presetOpenerWindow_methodinfo), 1, JSPROP_ENUMERATE, nullptr),
3240 : JS_FNSPEC("swapFrameLoaders", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&swapFrameLoaders_methodinfo), 1, JSPROP_ENUMERATE, nullptr),
3241 : JS_FNSPEC("addObserver", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&addObserver_methodinfo), 1, JSPROP_ENUMERATE, nullptr),
3242 : JS_FNSPEC("removeObserver", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&removeObserver_methodinfo), 1, JSPROP_ENUMERATE, nullptr),
3243 : JS_FNSPEC("getRequest", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&getRequest_methodinfo), 1, JSPROP_ENUMERATE, nullptr),
3244 : JS_FNSPEC("getRequestType", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&getRequestType_methodinfo), 1, JSPROP_ENUMERATE, nullptr),
3245 : JS_FNSPEC("forceReload", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&forceReload_methodinfo), 0, JSPROP_ENUMERATE, nullptr),
3246 : JS_FNSPEC("forceImageState", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&forceImageState_methodinfo), 2, JSPROP_ENUMERATE, nullptr),
3247 : JS_FNSPEC("getContentTypeForMIMEType", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&getContentTypeForMIMEType_methodinfo), 1, JSPROP_ENUMERATE, nullptr),
3248 : JS_FNSPEC("getPluginAttributes", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&getPluginAttributes_methodinfo), 0, JSPROP_ENUMERATE, nullptr),
3249 : JS_FNSPEC("getPluginParameters", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&getPluginParameters_methodinfo), 0, JSPROP_ENUMERATE, nullptr),
3250 : JS_FNSPEC("playPlugin", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&playPlugin_methodinfo), 0, JSPROP_ENUMERATE, nullptr),
3251 : JS_FNSPEC("reload", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&reload_methodinfo), 1, JSPROP_ENUMERATE, nullptr),
3252 : JS_FNSPEC("skipFakePlugins", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&skipFakePlugins_methodinfo), 0, JSPROP_ENUMERATE, nullptr),
3253 : JS_FS_END
3254 : };
3255 : #if defined(__clang__)
3256 : #pragma clang diagnostic pop
3257 : #endif
3258 :
3259 :
3260 : // Can't be const because the pref-enabled boolean needs to be writable
3261 : static Prefable<const JSFunctionSpec> sChromeMethods[] = {
3262 : { nullptr, &sChromeMethods_specs[0] },
3263 : { nullptr, nullptr }
3264 : };
3265 :
3266 : static_assert(1 <= 1ull << NUM_BITS_PROPERTY_INFO_PREF_INDEX,
3267 : "We have a prefable index that is >= (1 << NUM_BITS_PROPERTY_INFO_PREF_INDEX)");
3268 : static_assert(15 <= 1ull << NUM_BITS_PROPERTY_INFO_SPEC_INDEX,
3269 : "We have a spec index that is >= (1 << NUM_BITS_PROPERTY_INFO_SPEC_INDEX)");
3270 :
3271 : // We deliberately use brace-elision to make Visual Studio produce better initalization code.
3272 : #if defined(__clang__)
3273 : #pragma clang diagnostic push
3274 : #pragma clang diagnostic ignored "-Wmissing-braces"
3275 : #endif
3276 : static const JSPropertySpec sAttributes_specs[] = {
3277 : { "data", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &data_getterinfo, GenericBindingSetter, &data_setterinfo },
3278 : { "type", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &type_getterinfo, GenericBindingSetter, &type_setterinfo },
3279 : { "typeMustMatch", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &typeMustMatch_getterinfo, GenericBindingSetter, &typeMustMatch_setterinfo },
3280 : { "name", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &name_getterinfo, GenericBindingSetter, &name_setterinfo },
3281 : { "useMap", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &useMap_getterinfo, GenericBindingSetter, &useMap_setterinfo },
3282 : { "form", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &form_getterinfo, nullptr, nullptr },
3283 : { "width", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &width_getterinfo, GenericBindingSetter, &width_setterinfo },
3284 : { "height", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &height_getterinfo, GenericBindingSetter, &height_setterinfo },
3285 : { "contentDocument", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &contentDocument_getterinfo, nullptr, nullptr },
3286 : { "contentWindow", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &contentWindow_getterinfo, nullptr, nullptr },
3287 : { "willValidate", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &willValidate_getterinfo, nullptr, nullptr },
3288 : { "validity", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &validity_getterinfo, nullptr, nullptr },
3289 : { "validationMessage", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &validationMessage_getterinfo, nullptr, nullptr },
3290 : { "align", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &align_getterinfo, GenericBindingSetter, &align_setterinfo },
3291 : { "archive", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &archive_getterinfo, GenericBindingSetter, &archive_setterinfo },
3292 : { "code", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &code_getterinfo, GenericBindingSetter, &code_setterinfo },
3293 : { "declare", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &declare_getterinfo, GenericBindingSetter, &declare_setterinfo },
3294 : { "hspace", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &hspace_getterinfo, GenericBindingSetter, &hspace_setterinfo },
3295 : { "standby", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &standby_getterinfo, GenericBindingSetter, &standby_setterinfo },
3296 : { "vspace", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &vspace_getterinfo, GenericBindingSetter, &vspace_setterinfo },
3297 : { "codeBase", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &codeBase_getterinfo, GenericBindingSetter, &codeBase_setterinfo },
3298 : { "codeType", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &codeType_getterinfo, GenericBindingSetter, &codeType_setterinfo },
3299 : { "border", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &border_getterinfo, GenericBindingSetter, &border_setterinfo },
3300 : { nullptr, 0, nullptr, nullptr, nullptr, nullptr }
3301 : };
3302 : #if defined(__clang__)
3303 : #pragma clang diagnostic pop
3304 : #endif
3305 :
3306 :
3307 : // Can't be const because the pref-enabled boolean needs to be writable
3308 : static Prefable<const JSPropertySpec> sAttributes[] = {
3309 : { nullptr, &sAttributes_specs[0] },
3310 : { nullptr, nullptr }
3311 : };
3312 :
3313 : static_assert(1 <= 1ull << NUM_BITS_PROPERTY_INFO_PREF_INDEX,
3314 : "We have a prefable index that is >= (1 << NUM_BITS_PROPERTY_INFO_PREF_INDEX)");
3315 : static_assert(23 <= 1ull << NUM_BITS_PROPERTY_INFO_SPEC_INDEX,
3316 : "We have a spec index that is >= (1 << NUM_BITS_PROPERTY_INFO_SPEC_INDEX)");
3317 :
3318 : // We deliberately use brace-elision to make Visual Studio produce better initalization code.
3319 : #if defined(__clang__)
3320 : #pragma clang diagnostic push
3321 : #pragma clang diagnostic ignored "-Wmissing-braces"
3322 : #endif
3323 : static const JSPropertySpec sChromeAttributes_specs[] = {
3324 : { "frameLoader", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &frameLoader_getterinfo, nullptr, nullptr },
3325 : { "loadingEnabled", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &loadingEnabled_getterinfo, GenericBindingSetter, &loadingEnabled_setterinfo },
3326 : { "imageBlockingStatus", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &imageBlockingStatus_getterinfo, nullptr, nullptr },
3327 : { "currentURI", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, ¤tURI_getterinfo, nullptr, nullptr },
3328 : { "actualType", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &actualType_getterinfo, nullptr, nullptr },
3329 : { "displayedType", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &displayedType_getterinfo, nullptr, nullptr },
3330 : { "activated", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &activated_getterinfo, nullptr, nullptr },
3331 : { "srcURI", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &srcURI_getterinfo, nullptr, nullptr },
3332 : { "defaultFallbackType", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &defaultFallbackType_getterinfo, nullptr, nullptr },
3333 : { "pluginFallbackType", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &pluginFallbackType_getterinfo, nullptr, nullptr },
3334 : { "hasRunningPlugin", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &hasRunningPlugin_getterinfo, nullptr, nullptr },
3335 : { "runID", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &runID_getterinfo, nullptr, nullptr },
3336 : { nullptr, 0, nullptr, nullptr, nullptr, nullptr }
3337 : };
3338 : #if defined(__clang__)
3339 : #pragma clang diagnostic pop
3340 : #endif
3341 :
3342 :
3343 : // Can't be const because the pref-enabled boolean needs to be writable
3344 : static Prefable<const JSPropertySpec> sChromeAttributes[] = {
3345 : { nullptr, &sChromeAttributes_specs[0] },
3346 : { nullptr, nullptr }
3347 : };
3348 :
3349 : static_assert(1 <= 1ull << NUM_BITS_PROPERTY_INFO_PREF_INDEX,
3350 : "We have a prefable index that is >= (1 << NUM_BITS_PROPERTY_INFO_PREF_INDEX)");
3351 : static_assert(12 <= 1ull << NUM_BITS_PROPERTY_INFO_SPEC_INDEX,
3352 : "We have a spec index that is >= (1 << NUM_BITS_PROPERTY_INFO_SPEC_INDEX)");
3353 :
3354 : // We deliberately use brace-elision to make Visual Studio produce better initalization code.
3355 : #if defined(__clang__)
3356 : #pragma clang diagnostic push
3357 : #pragma clang diagnostic ignored "-Wmissing-braces"
3358 : #endif
3359 : static const ConstantSpec sChromeConstants_specs[] = {
3360 : { "UNKNOWN_REQUEST", JS::Int32Value(-1) },
3361 : { "CURRENT_REQUEST", JS::Int32Value(0) },
3362 : { "PENDING_REQUEST", JS::Int32Value(1) },
3363 : { "TYPE_LOADING", JS::NumberValue(0U) },
3364 : { "TYPE_IMAGE", JS::NumberValue(1U) },
3365 : { "TYPE_PLUGIN", JS::NumberValue(2U) },
3366 : { "TYPE_FAKE_PLUGIN", JS::NumberValue(3U) },
3367 : { "TYPE_DOCUMENT", JS::NumberValue(4U) },
3368 : { "TYPE_NULL", JS::NumberValue(5U) },
3369 : { "PLUGIN_UNSUPPORTED", JS::NumberValue(0U) },
3370 : { "PLUGIN_ALTERNATE", JS::NumberValue(1U) },
3371 : { "PLUGIN_DISABLED", JS::NumberValue(2U) },
3372 : { "PLUGIN_BLOCKLISTED", JS::NumberValue(3U) },
3373 : { "PLUGIN_OUTDATED", JS::NumberValue(4U) },
3374 : { "PLUGIN_CRASHED", JS::NumberValue(5U) },
3375 : { "PLUGIN_SUPPRESSED", JS::NumberValue(6U) },
3376 : { "PLUGIN_USER_DISABLED", JS::NumberValue(7U) },
3377 : { "PLUGIN_CLICK_TO_PLAY", JS::NumberValue(8U) },
3378 : { "PLUGIN_VULNERABLE_UPDATABLE", JS::NumberValue(9U) },
3379 : { "PLUGIN_VULNERABLE_NO_UPDATE", JS::NumberValue(10U) },
3380 : { 0, JS::UndefinedValue() }
3381 : };
3382 : #if defined(__clang__)
3383 : #pragma clang diagnostic pop
3384 : #endif
3385 :
3386 :
3387 : // Can't be const because the pref-enabled boolean needs to be writable
3388 : static Prefable<const ConstantSpec> sChromeConstants[] = {
3389 : { nullptr, &sChromeConstants_specs[0] },
3390 : { nullptr, nullptr }
3391 : };
3392 :
3393 : static_assert(1 <= 1ull << NUM_BITS_PROPERTY_INFO_PREF_INDEX,
3394 : "We have a prefable index that is >= (1 << NUM_BITS_PROPERTY_INFO_PREF_INDEX)");
3395 : static_assert(20 <= 1ull << NUM_BITS_PROPERTY_INFO_SPEC_INDEX,
3396 : "We have a spec index that is >= (1 << NUM_BITS_PROPERTY_INFO_SPEC_INDEX)");
3397 :
3398 :
3399 : static uint16_t sNativeProperties_sortedPropertyIndices[27];
3400 : static PropertyInfo sNativeProperties_propertyInfos[27];
3401 :
3402 : static const NativePropertiesN<2> sNativeProperties = {
3403 : false, 0,
3404 : false, 0,
3405 : true, 0 /* sMethods */,
3406 : true, 1 /* sAttributes */,
3407 : false, 0,
3408 : false, 0,
3409 : false, 0,
3410 : -1,
3411 : 27,
3412 : sNativeProperties_sortedPropertyIndices,
3413 : {
3414 : { sMethods, &sNativeProperties_propertyInfos[0] },
3415 : { sAttributes, &sNativeProperties_propertyInfos[4] }
3416 : }
3417 : };
3418 : static_assert(27 < 1ull << CHAR_BIT * sizeof(sNativeProperties.propertyInfoCount),
3419 : "We have a property info count that is oversized");
3420 :
3421 : static uint16_t sChromeOnlyNativeProperties_sortedPropertyIndices[47];
3422 : static PropertyInfo sChromeOnlyNativeProperties_propertyInfos[47];
3423 :
3424 : static const NativePropertiesN<3> sChromeOnlyNativeProperties = {
3425 : false, 0,
3426 : false, 0,
3427 : true, 0 /* sChromeMethods */,
3428 : true, 1 /* sChromeAttributes */,
3429 : false, 0,
3430 : false, 0,
3431 : true, 2 /* sChromeConstants */,
3432 : -1,
3433 : 47,
3434 : sChromeOnlyNativeProperties_sortedPropertyIndices,
3435 : {
3436 : { sChromeMethods, &sChromeOnlyNativeProperties_propertyInfos[0] },
3437 : { sChromeAttributes, &sChromeOnlyNativeProperties_propertyInfos[15] },
3438 : { sChromeConstants, &sChromeOnlyNativeProperties_propertyInfos[27] }
3439 : }
3440 : };
3441 : static_assert(47 < 1ull << CHAR_BIT * sizeof(sChromeOnlyNativeProperties.propertyInfoCount),
3442 : "We have a property info count that is oversized");
3443 :
3444 : static bool
3445 0 : _constructor(JSContext* cx, unsigned argc, JS::Value* vp)
3446 : {
3447 0 : JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
3448 0 : JS::Rooted<JSObject*> obj(cx, &args.callee());
3449 0 : if (!args.isConstructing()) {
3450 : // XXXbz wish I could get the name from the callee instead of
3451 : // Adding more relocations
3452 0 : return ThrowConstructorWithoutNew(cx, "HTMLObjectElement");
3453 : }
3454 :
3455 0 : GlobalObject global(cx, obj);
3456 0 : if (global.Failed()) {
3457 0 : return false;
3458 : }
3459 :
3460 : // The newTarget might be a cross-compartment wrapper. Get the underlying object
3461 : // so we can do the spec's object-identity checks.
3462 0 : JS::Rooted<JSObject*> newTarget(cx, js::CheckedUnwrap(&args.newTarget().toObject()));
3463 0 : if (!newTarget) {
3464 0 : return ThrowErrorMessage(cx, MSG_ILLEGAL_CONSTRUCTOR);
3465 : }
3466 :
3467 : // Step 2 of https://html.spec.whatwg.org/multipage/dom.html#htmlconstructor.
3468 : // Enter the compartment of our underlying newTarget object, so we end
3469 : // up comparing to the constructor object for our interface from that global.
3470 : {
3471 0 : JSAutoCompartment ac(cx, newTarget);
3472 0 : JS::Handle<JSObject*> constructor(GetConstructorObjectHandle(cx));
3473 0 : if (!constructor) {
3474 0 : return false;
3475 : }
3476 0 : if (newTarget == constructor) {
3477 0 : return ThrowErrorMessage(cx, MSG_ILLEGAL_CONSTRUCTOR);
3478 : }
3479 : }
3480 :
3481 0 : JS::Rooted<JSObject*> desiredProto(cx);
3482 0 : if (!GetDesiredProto(cx, args, &desiredProto)) {
3483 0 : return false;
3484 : }
3485 0 : if (!desiredProto) {
3486 : // Step 7 of https://html.spec.whatwg.org/multipage/dom.html#htmlconstructor.
3487 : // This fallback behavior is designed to match analogous behavior for the
3488 : // JavaScript built-ins. So we enter the compartment of our underlying
3489 : // newTarget object and fall back to the prototype object from that global.
3490 : // XXX The spec says to use GetFunctionRealm(), which is not actually
3491 : // the same thing as what we have here (e.g. in the case of scripted callable proxies
3492 : // whose target is not same-compartment with the proxy, or bound functions, etc).
3493 : // https://bugzilla.mozilla.org/show_bug.cgi?id=1317658
3494 : {
3495 0 : JSAutoCompartment ac(cx, newTarget);
3496 0 : desiredProto = GetProtoObjectHandle(cx);
3497 0 : if (!desiredProto) {
3498 0 : return false;
3499 : }
3500 : }
3501 :
3502 : // desiredProto is in the compartment of the underlying newTarget object.
3503 : // Wrap it into the context compartment.
3504 0 : if (!JS_WrapObject(cx, &desiredProto)) {
3505 0 : return false;
3506 : }
3507 : }
3508 :
3509 0 : if (!mozilla::dom::EnforceNotInPrerendering(cx, obj)) {
3510 : // Return false from the JSNative in order to trigger
3511 : // an uncatchable exception.
3512 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
3513 0 : return false;
3514 : }
3515 0 : bool objIsXray = xpc::WrapperFactory::IsXrayWrapper(obj);
3516 0 : Maybe<JSAutoCompartment> ac;
3517 0 : if (objIsXray) {
3518 0 : obj = js::CheckedUnwrap(obj);
3519 0 : if (!obj) {
3520 0 : return false;
3521 : }
3522 0 : ac.emplace(cx, obj);
3523 0 : if (!JS_WrapObject(cx, &desiredProto)) {
3524 0 : return false;
3525 : }
3526 : }
3527 0 : binding_detail::FastErrorResult rv;
3528 0 : auto result(StrongOrRawPtr<mozilla::dom::HTMLObjectElement>(CreateHTMLElement(global, args, rv)));
3529 0 : if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
3530 0 : return false;
3531 : }
3532 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
3533 : static_assert(!IsPointer<decltype(result)>::value,
3534 : "NewObject implies that we need to keep the object alive with a strong reference.");
3535 0 : if (!GetOrCreateDOMReflector(cx, result, args.rval(), desiredProto)) {
3536 0 : MOZ_ASSERT(true || JS_IsExceptionPending(cx));
3537 0 : return false;
3538 : }
3539 0 : return true;
3540 : }
3541 :
3542 : static const js::ClassOps sInterfaceObjectClassOps = {
3543 : nullptr, /* addProperty */
3544 : nullptr, /* delProperty */
3545 : nullptr, /* getProperty */
3546 : nullptr, /* setProperty */
3547 : nullptr, /* enumerate */
3548 : nullptr, /* newEnumerate */
3549 : nullptr, /* resolve */
3550 : nullptr, /* mayResolve */
3551 : nullptr, /* finalize */
3552 : _constructor, /* call */
3553 : nullptr, /* hasInstance */
3554 : _constructor, /* construct */
3555 : nullptr, /* trace */
3556 : };
3557 :
3558 : static const DOMIfaceAndProtoJSClass sInterfaceObjectClass = {
3559 : {
3560 : "Function",
3561 : JSCLASS_IS_DOMIFACEANDPROTOJSCLASS | JSCLASS_HAS_RESERVED_SLOTS(DOM_INTERFACE_SLOTS_BASE),
3562 : &sInterfaceObjectClassOps,
3563 : JS_NULL_CLASS_SPEC,
3564 : JS_NULL_CLASS_EXT,
3565 : &sInterfaceObjectClassObjectOps
3566 : },
3567 : eInterface,
3568 : true,
3569 : prototypes::id::HTMLObjectElement,
3570 : PrototypeTraits<prototypes::id::HTMLObjectElement>::Depth,
3571 : sNativePropertyHooks,
3572 : "function HTMLObjectElement() {\n [native code]\n}",
3573 : HTMLElementBinding::GetConstructorObject
3574 : };
3575 :
3576 : static bool
3577 0 : _resolve(JSContext* cx, JS::Handle<JSObject*> obj, JS::Handle<jsid> id, bool* resolvedp)
3578 : {
3579 0 : mozilla::dom::HTMLObjectElement* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::dom::HTMLObjectElement>(obj);
3580 0 : JS::Rooted<JS::PropertyDescriptor> desc(cx);
3581 0 : if (!self->DoResolve(cx, obj, id, &desc)) {
3582 0 : return false;
3583 : }
3584 0 : if (!desc.object()) {
3585 0 : return true;
3586 : }
3587 : // If desc.value() is undefined, then the DoResolve call
3588 : // has already defined it on the object. Don't try to also
3589 : // define it.
3590 0 : if (!desc.value().isUndefined()) {
3591 0 : desc.attributesRef() |= JSPROP_RESOLVING;
3592 0 : if (!JS_DefinePropertyById(cx, obj, id, desc)) {
3593 0 : return false;
3594 : }
3595 : }
3596 0 : *resolvedp = true;
3597 0 : return true;
3598 : }
3599 :
3600 : static bool
3601 0 : _mayResolve(const JSAtomState& names, jsid id, JSObject* maybeObj)
3602 : {
3603 0 : return mozilla::dom::HTMLObjectElement::MayResolve(id);
3604 : }
3605 :
3606 : static bool
3607 0 : _newEnumerate(JSContext* cx, JS::Handle<JSObject*> obj, JS::AutoIdVector& properties, bool enumerableOnly)
3608 : {
3609 : mozilla::dom::HTMLObjectElement* self;
3610 0 : JS::Rooted<JS::Value> rootSelf(cx, JS::ObjectValue(*obj));
3611 : {
3612 0 : nsresult rv = UnwrapObject<prototypes::id::HTMLObjectElement, mozilla::dom::HTMLObjectElement>(&rootSelf, self);
3613 0 : if (NS_FAILED(rv)) {
3614 0 : return ThrowErrorMessage(cx, MSG_THIS_DOES_NOT_IMPLEMENT_INTERFACE, "Value", "HTMLObjectElement");
3615 : }
3616 : }
3617 0 : binding_detail::FastErrorResult rv;
3618 0 : self->GetOwnPropertyNames(cx, properties, enumerableOnly, rv);
3619 0 : if (rv.MaybeSetPendingException(cx)) {
3620 0 : return false;
3621 : }
3622 0 : return true;
3623 : }
3624 :
3625 : static const DOMIfaceAndProtoJSClass sPrototypeClass = {
3626 : {
3627 : "HTMLObjectElementPrototype",
3628 : JSCLASS_IS_DOMIFACEANDPROTOJSCLASS | JSCLASS_HAS_RESERVED_SLOTS(DOM_INTERFACE_PROTO_SLOTS_BASE),
3629 : JS_NULL_CLASS_OPS,
3630 : JS_NULL_CLASS_SPEC,
3631 : JS_NULL_CLASS_EXT,
3632 : JS_NULL_OBJECT_OPS
3633 : },
3634 : eInterfacePrototype,
3635 : false,
3636 : prototypes::id::HTMLObjectElement,
3637 : PrototypeTraits<prototypes::id::HTMLObjectElement>::Depth,
3638 : sNativePropertyHooks,
3639 : "[object HTMLObjectElementPrototype]",
3640 : HTMLElementBinding::GetProtoObject
3641 : };
3642 :
3643 : JSObject*
3644 0 : DefineDOMInterface(JSContext* aCx, JS::Handle<JSObject*> aGlobal, JS::Handle<jsid> id, bool aDefineOnGlobal)
3645 : {
3646 0 : return GetConstructorObjectHandle(aCx, aDefineOnGlobal);
3647 : }
3648 :
3649 : static const js::ClassOps sClassOps = {
3650 : _addProperty, /* addProperty */
3651 : nullptr, /* delProperty */
3652 : nullptr, /* getProperty */
3653 : nullptr, /* setProperty */
3654 : nullptr, /* enumerate */
3655 : _newEnumerate, /* newEnumerate */
3656 : _resolve, /* resolve */
3657 : _mayResolve, /* mayResolve */
3658 : _finalize, /* finalize */
3659 : nullptr, /* call */
3660 : nullptr, /* hasInstance */
3661 : nullptr, /* construct */
3662 : nullptr, /* trace */
3663 : };
3664 :
3665 : static const js::ClassExtension sClassExtension = {
3666 : nullptr, /* weakmapKeyDelegateOp */
3667 : _objectMoved /* objectMovedOp */
3668 : };
3669 :
3670 : static const DOMJSClass sClass = {
3671 : { "HTMLObjectElement",
3672 : JSCLASS_IS_DOMJSCLASS | JSCLASS_FOREGROUND_FINALIZE | JSCLASS_HAS_RESERVED_SLOTS(1),
3673 : &sClassOps,
3674 : JS_NULL_CLASS_SPEC,
3675 : &sClassExtension,
3676 : JS_NULL_OBJECT_OPS
3677 : },
3678 : { prototypes::id::EventTarget, prototypes::id::Node, prototypes::id::Element, prototypes::id::HTMLElement, prototypes::id::HTMLObjectElement, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count },
3679 : IsBaseOf<nsISupports, mozilla::dom::HTMLObjectElement >::value,
3680 : sNativePropertyHooks,
3681 : FindAssociatedGlobalForNative<mozilla::dom::HTMLObjectElement>::Get,
3682 : GetProtoObjectHandle,
3683 : GetCCParticipant<mozilla::dom::HTMLObjectElement>::Get()
3684 : };
3685 : static_assert(1 == DOM_INSTANCE_RESERVED_SLOTS,
3686 : "Must have the right minimal number of reserved slots.");
3687 : static_assert(1 >= 1,
3688 : "Must have enough reserved slots.");
3689 :
3690 : const JSClass*
3691 0 : GetJSClass()
3692 : {
3693 0 : return sClass.ToJSClass();
3694 : }
3695 :
3696 : bool
3697 0 : Wrap(JSContext* aCx, mozilla::dom::HTMLObjectElement* aObject, nsWrapperCache* aCache, JS::Handle<JSObject*> aGivenProto, JS::MutableHandle<JSObject*> aReflector)
3698 : {
3699 : MOZ_ASSERT(static_cast<mozilla::dom::HTMLObjectElement*>(aObject) ==
3700 : reinterpret_cast<mozilla::dom::HTMLObjectElement*>(aObject),
3701 : "Multiple inheritance for mozilla::dom::HTMLObjectElement is broken.");
3702 : MOZ_ASSERT(static_cast<nsGenericHTMLElement*>(aObject) ==
3703 : reinterpret_cast<nsGenericHTMLElement*>(aObject),
3704 : "Multiple inheritance for nsGenericHTMLElement is broken.");
3705 : MOZ_ASSERT(static_cast<mozilla::dom::Element*>(aObject) ==
3706 : reinterpret_cast<mozilla::dom::Element*>(aObject),
3707 : "Multiple inheritance for mozilla::dom::Element is broken.");
3708 : MOZ_ASSERT(static_cast<nsINode*>(aObject) ==
3709 : reinterpret_cast<nsINode*>(aObject),
3710 : "Multiple inheritance for nsINode is broken.");
3711 : MOZ_ASSERT(static_cast<mozilla::dom::EventTarget*>(aObject) ==
3712 : reinterpret_cast<mozilla::dom::EventTarget*>(aObject),
3713 : "Multiple inheritance for mozilla::dom::EventTarget is broken.");
3714 0 : MOZ_ASSERT(ToSupportsIsCorrect(aObject));
3715 0 : MOZ_ASSERT_IF(aGivenProto, js::IsObjectInContextCompartment(aGivenProto, aCx));
3716 0 : MOZ_ASSERT(!aCache->GetWrapper(),
3717 : "You should probably not be using Wrap() directly; use "
3718 : "GetOrCreateDOMReflector instead");
3719 :
3720 0 : MOZ_ASSERT(ToSupportsIsOnPrimaryInheritanceChain(aObject, aCache),
3721 : "nsISupports must be on our primary inheritance chain");
3722 :
3723 0 : JS::Rooted<JSObject*> global(aCx, FindAssociatedGlobal(aCx, aObject->GetParentObject()));
3724 0 : if (!global) {
3725 0 : return false;
3726 : }
3727 0 : MOZ_ASSERT(JS_IsGlobalObject(global));
3728 0 : MOZ_ASSERT(JS::ObjectIsNotGray(global));
3729 :
3730 : // That might have ended up wrapping us already, due to the wonders
3731 : // of XBL. Check for that, and bail out as needed.
3732 0 : aReflector.set(aCache->GetWrapper());
3733 0 : if (aReflector) {
3734 : #ifdef DEBUG
3735 0 : binding_detail::AssertReflectorHasGivenProto(aCx, aReflector, aGivenProto);
3736 : #endif // DEBUG
3737 0 : return true;
3738 : }
3739 :
3740 0 : JSAutoCompartment ac(aCx, global);
3741 0 : JS::Handle<JSObject*> canonicalProto = GetProtoObjectHandle(aCx);
3742 0 : if (!canonicalProto) {
3743 0 : return false;
3744 : }
3745 0 : JS::Rooted<JSObject*> proto(aCx);
3746 0 : if (aGivenProto) {
3747 0 : proto = aGivenProto;
3748 : // Unfortunately, while aGivenProto was in the compartment of aCx
3749 : // coming in, we changed compartments to that of "parent" so may need
3750 : // to wrap the proto here.
3751 0 : if (js::GetContextCompartment(aCx) != js::GetObjectCompartment(proto)) {
3752 0 : if (!JS_WrapObject(aCx, &proto)) {
3753 0 : return false;
3754 : }
3755 : }
3756 : } else {
3757 0 : proto = canonicalProto;
3758 : }
3759 :
3760 0 : BindingJSObjectCreator<mozilla::dom::HTMLObjectElement> creator(aCx);
3761 0 : creator.CreateObject(aCx, sClass.ToJSClass(), proto, aObject, aReflector);
3762 0 : if (!aReflector) {
3763 0 : return false;
3764 : }
3765 :
3766 0 : aCache->SetWrapper(aReflector);
3767 0 : creator.InitializationSucceeded();
3768 :
3769 0 : MOZ_ASSERT(aCache->GetWrapperPreserveColor() &&
3770 : aCache->GetWrapperPreserveColor() == aReflector);
3771 : // If proto != canonicalProto, we have to preserve our wrapper;
3772 : // otherwise we won't be able to properly recreate it later, since
3773 : // we won't know what proto to use. Note that we don't check
3774 : // aGivenProto here, since it's entirely possible (and even
3775 : // somewhat common) to have a non-null aGivenProto which is the
3776 : // same as canonicalProto.
3777 0 : if (proto != canonicalProto) {
3778 0 : PreserveWrapper(aObject);
3779 : }
3780 :
3781 0 : return true;
3782 : }
3783 :
3784 : const NativePropertyHooks sNativePropertyHooks[] = { {
3785 : nullptr,
3786 : nullptr,
3787 : nullptr,
3788 : { sNativeProperties.Upcast(), sChromeOnlyNativeProperties.Upcast() },
3789 : prototypes::id::HTMLObjectElement,
3790 : constructors::id::HTMLObjectElement,
3791 : HTMLElementBinding::sNativePropertyHooks,
3792 : &DefaultXrayExpandoObjectClass
3793 : } };
3794 :
3795 : void
3796 0 : CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, bool aDefineOnGlobal)
3797 : {
3798 0 : JS::Handle<JSObject*> parentProto(HTMLElementBinding::GetProtoObjectHandle(aCx));
3799 0 : if (!parentProto) {
3800 0 : return;
3801 : }
3802 :
3803 0 : JS::Handle<JSObject*> constructorProto(HTMLElementBinding::GetConstructorObjectHandle(aCx));
3804 0 : if (!constructorProto) {
3805 0 : return;
3806 : }
3807 :
3808 : static bool sIdsInited = false;
3809 0 : if (!sIdsInited && NS_IsMainThread()) {
3810 0 : if (!InitIds(aCx, sNativeProperties.Upcast())) {
3811 0 : return;
3812 : }
3813 0 : if (!InitIds(aCx, sChromeOnlyNativeProperties.Upcast())) {
3814 0 : return;
3815 : }
3816 0 : sIdsInited = true;
3817 : }
3818 :
3819 0 : JS::Heap<JSObject*>* protoCache = &aProtoAndIfaceCache.EntrySlotOrCreate(prototypes::id::HTMLObjectElement);
3820 0 : JS::Heap<JSObject*>* interfaceCache = &aProtoAndIfaceCache.EntrySlotOrCreate(constructors::id::HTMLObjectElement);
3821 0 : dom::CreateInterfaceObjects(aCx, aGlobal, parentProto,
3822 : &sPrototypeClass.mBase, protoCache,
3823 : constructorProto, &sInterfaceObjectClass.mBase, 0, nullptr,
3824 : interfaceCache,
3825 : sNativeProperties.Upcast(),
3826 0 : nsContentUtils::ThreadsafeIsSystemCaller(aCx) ? sChromeOnlyNativeProperties.Upcast() : nullptr,
3827 : "HTMLObjectElement", aDefineOnGlobal,
3828 : nullptr,
3829 0 : false);
3830 : }
3831 :
3832 : JS::Handle<JSObject*>
3833 0 : GetProtoObjectHandle(JSContext* aCx)
3834 : {
3835 : /* Get the interface prototype object for this class. This will create the
3836 : object as needed. */
3837 0 : bool aDefineOnGlobal = true;
3838 :
3839 : /* Make sure our global is sane. Hopefully we can remove this sometime */
3840 0 : JSObject* global = JS::CurrentGlobalOrNull(aCx);
3841 0 : if (!(js::GetObjectClass(global)->flags & JSCLASS_DOM_GLOBAL)) {
3842 0 : return nullptr;
3843 : }
3844 :
3845 : /* Check to see whether the interface objects are already installed */
3846 0 : ProtoAndIfaceCache& protoAndIfaceCache = *GetProtoAndIfaceCache(global);
3847 0 : if (!protoAndIfaceCache.HasEntryInSlot(prototypes::id::HTMLObjectElement)) {
3848 0 : JS::Rooted<JSObject*> rootedGlobal(aCx, global);
3849 0 : CreateInterfaceObjects(aCx, rootedGlobal, protoAndIfaceCache, aDefineOnGlobal);
3850 : }
3851 :
3852 : /*
3853 : * The object might _still_ be null, but that's OK.
3854 : *
3855 : * Calling fromMarkedLocation() is safe because protoAndIfaceCache is
3856 : * traced by TraceProtoAndIfaceCache() and its contents are never
3857 : * changed after they have been set.
3858 : *
3859 : * Calling address() avoids the read read barrier that does gray
3860 : * unmarking, but it's not possible for the object to be gray here.
3861 : */
3862 :
3863 0 : const JS::Heap<JSObject*>& entrySlot = protoAndIfaceCache.EntrySlotMustExist(prototypes::id::HTMLObjectElement);
3864 0 : MOZ_ASSERT(JS::ObjectIsNotGray(entrySlot));
3865 0 : return JS::Handle<JSObject*>::fromMarkedLocation(entrySlot.address());
3866 : }
3867 :
3868 : JS::Handle<JSObject*>
3869 0 : GetConstructorObjectHandle(JSContext* aCx, bool aDefineOnGlobal)
3870 : {
3871 : /* Get the interface object for this class. This will create the object as
3872 : needed. */
3873 :
3874 : /* Make sure our global is sane. Hopefully we can remove this sometime */
3875 0 : JSObject* global = JS::CurrentGlobalOrNull(aCx);
3876 0 : if (!(js::GetObjectClass(global)->flags & JSCLASS_DOM_GLOBAL)) {
3877 0 : return nullptr;
3878 : }
3879 :
3880 : /* Check to see whether the interface objects are already installed */
3881 0 : ProtoAndIfaceCache& protoAndIfaceCache = *GetProtoAndIfaceCache(global);
3882 0 : if (!protoAndIfaceCache.HasEntryInSlot(constructors::id::HTMLObjectElement)) {
3883 0 : JS::Rooted<JSObject*> rootedGlobal(aCx, global);
3884 0 : CreateInterfaceObjects(aCx, rootedGlobal, protoAndIfaceCache, aDefineOnGlobal);
3885 : }
3886 :
3887 : /*
3888 : * The object might _still_ be null, but that's OK.
3889 : *
3890 : * Calling fromMarkedLocation() is safe because protoAndIfaceCache is
3891 : * traced by TraceProtoAndIfaceCache() and its contents are never
3892 : * changed after they have been set.
3893 : *
3894 : * Calling address() avoids the read read barrier that does gray
3895 : * unmarking, but it's not possible for the object to be gray here.
3896 : */
3897 :
3898 0 : const JS::Heap<JSObject*>& entrySlot = protoAndIfaceCache.EntrySlotMustExist(constructors::id::HTMLObjectElement);
3899 0 : MOZ_ASSERT(JS::ObjectIsNotGray(entrySlot));
3900 0 : return JS::Handle<JSObject*>::fromMarkedLocation(entrySlot.address());
3901 : }
3902 :
3903 : JSObject*
3904 0 : GetConstructorObject(JSContext* aCx)
3905 : {
3906 0 : return GetConstructorObjectHandle(aCx);
3907 : }
3908 :
3909 : } // namespace HTMLObjectElementBinding
3910 :
3911 :
3912 :
3913 : } // namespace dom
3914 : } // namespace mozilla
|