Coverage Report

Created: 2018-09-25 14:53

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