Coverage Report

Created: 2018-09-25 14:53

/work/obj-fuzz/dom/bindings/HTMLOutputElementBinding.cpp
Line
Count
Source (jump to first uncovered line)
1
/* THIS FILE IS AUTOGENERATED FROM HTMLOutputElement.webidl BY Codegen.py - DO NOT EDIT */
2
3
#include "HTMLElementBinding.h"
4
#include "HTMLOutputElementBinding.h"
5
#include "WrapperFactory.h"
6
#include "mozilla/OwningNonNull.h"
7
#include "mozilla/dom/BindingUtils.h"
8
#include "mozilla/dom/CustomElementRegistry.h"
9
#include "mozilla/dom/DOMJSClass.h"
10
#include "mozilla/dom/DocGroup.h"
11
#include "mozilla/dom/HTMLFormElement.h"
12
#include "mozilla/dom/HTMLOutputElement.h"
13
#include "mozilla/dom/NonRefcountedDOMObject.h"
14
#include "mozilla/dom/Nullable.h"
15
#include "mozilla/dom/PrimitiveConversions.h"
16
#include "mozilla/dom/ValidityState.h"
17
#include "mozilla/dom/XrayExpandoClass.h"
18
#include "nsDOMTokenList.h"
19
#include "nsINodeList.h"
20
21
namespace mozilla {
22
namespace dom {
23
24
namespace binding_detail {}; // Just to make sure it's known as a namespace
25
using namespace mozilla::dom::binding_detail;
26
27
28
namespace HTMLOutputElement_Binding {
29
30
static_assert(IsRefcounted<NativeType>::value == IsRefcounted<HTMLElement_Binding::NativeType>::value,
31
              "Can't inherit from an interface with a different ownership model.");
32
33
MOZ_CAN_RUN_SCRIPT static bool
34
get_htmlFor(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLOutputElement* self, JSJitGetterCallArgs args)
35
0
{
36
0
  AUTO_PROFILER_LABEL_FAST("get HTMLOutputElement.htmlFor", DOM, cx);
37
0
38
0
  auto result(StrongOrRawPtr<nsDOMTokenList>(self->HtmlFor()));
39
0
  MOZ_ASSERT(!JS_IsExceptionPending(cx));
40
0
  if (!GetOrCreateDOMReflector(cx, result, args.rval())) {
41
0
    MOZ_ASSERT(JS_IsExceptionPending(cx));
42
0
    return false;
43
0
  }
44
0
  return true;
45
0
}
46
47
MOZ_CAN_RUN_SCRIPT static bool
48
set_htmlFor(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLOutputElement* self, JSJitSetterCallArgs args)
49
0
{
50
0
  AUTO_PROFILER_LABEL_FAST("set HTMLOutputElement.htmlFor", DOM, cx);
51
0
52
0
  JS::Rooted<JS::Value> v(cx);
53
0
  if (!JS_GetProperty(cx, obj, "htmlFor", &v)) {
54
0
    return false;
55
0
  }
56
0
57
0
  if (!v.isObject()) {
58
0
    return ThrowErrorMessage(cx, MSG_NOT_OBJECT, "HTMLOutputElement.htmlFor");
59
0
  }
60
0
61
0
  JS::Rooted<JSObject*> targetObj(cx, &v.toObject());
62
0
  return JS_SetProperty(cx, targetObj, "value", args[0]);
63
0
}
64
65
static const JSJitInfo htmlFor_getterinfo = {
66
  { (JSJitGetterOp)get_htmlFor },
67
  { prototypes::id::HTMLOutputElement },
68
  { PrototypeTraits<prototypes::id::HTMLOutputElement>::Depth },
69
  JSJitInfo::Getter,
70
  JSJitInfo::AliasNone, /* aliasSet.  Not relevant for setters. */
71
  JSVAL_TYPE_OBJECT,  /* returnType.  Not relevant for setters. */
72
  false,  /* isInfallible. False in setters. */
73
  true,  /* isMovable.  Not relevant for setters. */
74
  true, /* isEliminatable.  Not relevant for setters. */
75
  false, /* isAlwaysInSlot.  Only relevant for getters. */
76
  false, /* isLazilyCachedInSlot.  Only relevant for getters. */
77
  false,  /* isTypedMethod.  Only relevant for methods. */
78
  0   /* Reserved slot index, if we're stored in a slot, else 0. */
79
};
80
static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
81
static_assert(0 < 1, "There is no slot for us");
82
static const JSJitInfo htmlFor_setterinfo = {
83
  { (JSJitGetterOp)set_htmlFor },
84
  { prototypes::id::HTMLOutputElement },
85
  { PrototypeTraits<prototypes::id::HTMLOutputElement>::Depth },
86
  JSJitInfo::Setter,
87
  JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
88
  JSVAL_TYPE_UNDEFINED,  /* returnType.  Not relevant for setters. */
89
  false,  /* isInfallible. False in setters. */
90
  false,  /* isMovable.  Not relevant for setters. */
91
  false, /* isEliminatable.  Not relevant for setters. */
92
  false, /* isAlwaysInSlot.  Only relevant for getters. */
93
  false, /* isLazilyCachedInSlot.  Only relevant for getters. */
94
  false,  /* isTypedMethod.  Only relevant for methods. */
95
  0   /* Reserved slot index, if we're stored in a slot, else 0. */
96
};
97
static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
98
static_assert(0 < 1, "There is no slot for us");
99
100
MOZ_CAN_RUN_SCRIPT static bool
101
get_form(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLOutputElement* self, JSJitGetterCallArgs args)
102
0
{
103
0
  AUTO_PROFILER_LABEL_FAST("get HTMLOutputElement.form", DOM, cx);
104
0
105
0
  auto result(StrongOrRawPtr<mozilla::dom::HTMLFormElement>(self->GetForm()));
106
0
  MOZ_ASSERT(!JS_IsExceptionPending(cx));
107
0
  if (!result) {
108
0
    args.rval().setNull();
109
0
    return true;
110
0
  }
111
0
  if (!GetOrCreateDOMReflector(cx, result, args.rval())) {
112
0
    MOZ_ASSERT(JS_IsExceptionPending(cx));
113
0
    return false;
114
0
  }
115
0
  return true;
116
0
}
117
118
static const JSJitInfo form_getterinfo = {
119
  { (JSJitGetterOp)get_form },
120
  { prototypes::id::HTMLOutputElement },
121
  { PrototypeTraits<prototypes::id::HTMLOutputElement>::Depth },
122
  JSJitInfo::Getter,
123
  JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
124
  JSVAL_TYPE_UNKNOWN,  /* returnType.  Not relevant for setters. */
125
  false,  /* isInfallible. False in setters. */
126
  false,  /* isMovable.  Not relevant for setters. */
127
  false, /* isEliminatable.  Not relevant for setters. */
128
  false, /* isAlwaysInSlot.  Only relevant for getters. */
129
  false, /* isLazilyCachedInSlot.  Only relevant for getters. */
130
  false,  /* isTypedMethod.  Only relevant for methods. */
131
  0   /* Reserved slot index, if we're stored in a slot, else 0. */
132
};
133
static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
134
static_assert(0 < 1, "There is no slot for us");
135
136
MOZ_CAN_RUN_SCRIPT static bool
137
get_name(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLOutputElement* self, JSJitGetterCallArgs args)
138
0
{
139
0
  AUTO_PROFILER_LABEL_FAST("get HTMLOutputElement.name", DOM, cx);
140
0
141
0
  DOMString result;
142
0
  self->GetName(result);
143
0
  MOZ_ASSERT(!JS_IsExceptionPending(cx));
144
0
  if (!xpc::NonVoidStringToJsval(cx, result, args.rval())) {
145
0
    return false;
146
0
  }
147
0
  return true;
148
0
}
149
150
MOZ_CAN_RUN_SCRIPT static bool
151
set_name(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLOutputElement* self, JSJitSetterCallArgs args)
152
0
{
153
0
  AUTO_PROFILER_LABEL_FAST("set HTMLOutputElement.name", DOM, cx);
154
0
155
0
  binding_detail::FakeString arg0;
156
0
  if (!ConvertJSValueToString(cx, args[0], eStringify, eStringify, arg0)) {
157
0
    return false;
158
0
  }
159
0
  Maybe<AutoCEReaction> ceReaction;
160
0
  if (CustomElementRegistry::IsCustomElementEnabled(cx, obj)) {
161
0
    DocGroup* docGroup = self->GetDocGroup();
162
0
    if (docGroup) {
163
0
      ceReaction.emplace(docGroup->CustomElementReactionsStack(), cx);
164
0
    }
165
0
  }
166
0
  FastErrorResult rv;
167
0
  self->SetName(NonNullHelper(Constify(arg0)), rv);
168
0
  if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
169
0
    return false;
170
0
  }
171
0
  MOZ_ASSERT(!JS_IsExceptionPending(cx));
172
0
173
0
  return true;
174
0
}
175
176
static const JSJitInfo name_getterinfo = {
177
  { (JSJitGetterOp)get_name },
178
  { prototypes::id::HTMLOutputElement },
179
  { PrototypeTraits<prototypes::id::HTMLOutputElement>::Depth },
180
  JSJitInfo::Getter,
181
  JSJitInfo::AliasDOMSets, /* aliasSet.  Not relevant for setters. */
182
  JSVAL_TYPE_STRING,  /* returnType.  Not relevant for setters. */
183
  false,  /* isInfallible. False in setters. */
184
  true,  /* isMovable.  Not relevant for setters. */
185
  true, /* isEliminatable.  Not relevant for setters. */
186
  false, /* isAlwaysInSlot.  Only relevant for getters. */
187
  false, /* isLazilyCachedInSlot.  Only relevant for getters. */
188
  false,  /* isTypedMethod.  Only relevant for methods. */
189
  0   /* Reserved slot index, if we're stored in a slot, else 0. */
190
};
191
static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
192
static_assert(0 < 1, "There is no slot for us");
193
static const JSJitInfo name_setterinfo = {
194
  { (JSJitGetterOp)set_name },
195
  { prototypes::id::HTMLOutputElement },
196
  { PrototypeTraits<prototypes::id::HTMLOutputElement>::Depth },
197
  JSJitInfo::Setter,
198
  JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
199
  JSVAL_TYPE_UNDEFINED,  /* returnType.  Not relevant for setters. */
200
  false,  /* isInfallible. False in setters. */
201
  false,  /* isMovable.  Not relevant for setters. */
202
  false, /* isEliminatable.  Not relevant for setters. */
203
  false, /* isAlwaysInSlot.  Only relevant for getters. */
204
  false, /* isLazilyCachedInSlot.  Only relevant for getters. */
205
  false,  /* isTypedMethod.  Only relevant for methods. */
206
  0   /* Reserved slot index, if we're stored in a slot, else 0. */
207
};
208
static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
209
static_assert(0 < 1, "There is no slot for us");
210
211
MOZ_CAN_RUN_SCRIPT static bool
212
get_type(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLOutputElement* self, JSJitGetterCallArgs args)
213
0
{
214
0
  AUTO_PROFILER_LABEL_FAST("get HTMLOutputElement.type", DOM, cx);
215
0
216
0
  DOMString result;
217
0
  self->GetType(result);
218
0
  MOZ_ASSERT(!JS_IsExceptionPending(cx));
219
0
  if (!xpc::NonVoidStringToJsval(cx, result, args.rval())) {
220
0
    return false;
221
0
  }
222
0
  return true;
223
0
}
224
225
static const JSJitInfo type_getterinfo = {
226
  { (JSJitGetterOp)get_type },
227
  { prototypes::id::HTMLOutputElement },
228
  { PrototypeTraits<prototypes::id::HTMLOutputElement>::Depth },
229
  JSJitInfo::Getter,
230
  JSJitInfo::AliasNone, /* aliasSet.  Not relevant for setters. */
231
  JSVAL_TYPE_STRING,  /* returnType.  Not relevant for setters. */
232
  false,  /* isInfallible. False in setters. */
233
  true,  /* isMovable.  Not relevant for setters. */
234
  true, /* isEliminatable.  Not relevant for setters. */
235
  false, /* isAlwaysInSlot.  Only relevant for getters. */
236
  false, /* isLazilyCachedInSlot.  Only relevant for getters. */
237
  false,  /* isTypedMethod.  Only relevant for methods. */
238
  0   /* Reserved slot index, if we're stored in a slot, else 0. */
239
};
240
static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
241
static_assert(0 < 1, "There is no slot for us");
242
243
MOZ_CAN_RUN_SCRIPT static bool
244
get_defaultValue(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLOutputElement* self, JSJitGetterCallArgs args)
245
0
{
246
0
  AUTO_PROFILER_LABEL_FAST("get HTMLOutputElement.defaultValue", DOM, cx);
247
0
248
0
  DOMString result;
249
0
  self->GetDefaultValue(result);
250
0
  MOZ_ASSERT(!JS_IsExceptionPending(cx));
251
0
  if (!xpc::NonVoidStringToJsval(cx, result, args.rval())) {
252
0
    return false;
253
0
  }
254
0
  return true;
255
0
}
256
257
MOZ_CAN_RUN_SCRIPT static bool
258
set_defaultValue(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLOutputElement* self, JSJitSetterCallArgs args)
259
0
{
260
0
  AUTO_PROFILER_LABEL_FAST("set HTMLOutputElement.defaultValue", DOM, cx);
261
0
262
0
  binding_detail::FakeString arg0;
263
0
  if (!ConvertJSValueToString(cx, args[0], eStringify, eStringify, arg0)) {
264
0
    return false;
265
0
  }
266
0
  Maybe<AutoCEReaction> ceReaction;
267
0
  if (CustomElementRegistry::IsCustomElementEnabled(cx, obj)) {
268
0
    DocGroup* docGroup = self->GetDocGroup();
269
0
    if (docGroup) {
270
0
      ceReaction.emplace(docGroup->CustomElementReactionsStack(), cx);
271
0
    }
272
0
  }
273
0
  FastErrorResult rv;
274
0
  self->SetDefaultValue(NonNullHelper(Constify(arg0)), rv);
275
0
  if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
276
0
    return false;
277
0
  }
278
0
  MOZ_ASSERT(!JS_IsExceptionPending(cx));
279
0
280
0
  return true;
281
0
}
282
283
static const JSJitInfo defaultValue_getterinfo = {
284
  { (JSJitGetterOp)get_defaultValue },
285
  { prototypes::id::HTMLOutputElement },
286
  { PrototypeTraits<prototypes::id::HTMLOutputElement>::Depth },
287
  JSJitInfo::Getter,
288
  JSJitInfo::AliasDOMSets, /* aliasSet.  Not relevant for setters. */
289
  JSVAL_TYPE_STRING,  /* returnType.  Not relevant for setters. */
290
  false,  /* isInfallible. False in setters. */
291
  true,  /* isMovable.  Not relevant for setters. */
292
  true, /* 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
static const JSJitInfo defaultValue_setterinfo = {
301
  { (JSJitGetterOp)set_defaultValue },
302
  { prototypes::id::HTMLOutputElement },
303
  { PrototypeTraits<prototypes::id::HTMLOutputElement>::Depth },
304
  JSJitInfo::Setter,
305
  JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
306
  JSVAL_TYPE_UNDEFINED,  /* returnType.  Not relevant for setters. */
307
  false,  /* isInfallible. False in setters. */
308
  false,  /* isMovable.  Not relevant for setters. */
309
  false, /* isEliminatable.  Not relevant for setters. */
310
  false, /* isAlwaysInSlot.  Only relevant for getters. */
311
  false, /* isLazilyCachedInSlot.  Only relevant for getters. */
312
  false,  /* isTypedMethod.  Only relevant for methods. */
313
  0   /* Reserved slot index, if we're stored in a slot, else 0. */
314
};
315
static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
316
static_assert(0 < 1, "There is no slot for us");
317
318
MOZ_CAN_RUN_SCRIPT static bool
319
get_value(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLOutputElement* self, JSJitGetterCallArgs args)
320
0
{
321
0
  AUTO_PROFILER_LABEL_FAST("get HTMLOutputElement.value", DOM, cx);
322
0
323
0
  DOMString result;
324
0
  self->GetValue(result);
325
0
  MOZ_ASSERT(!JS_IsExceptionPending(cx));
326
0
  if (!xpc::NonVoidStringToJsval(cx, result, args.rval())) {
327
0
    return false;
328
0
  }
329
0
  return true;
330
0
}
331
332
MOZ_CAN_RUN_SCRIPT static bool
333
set_value(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLOutputElement* self, JSJitSetterCallArgs args)
334
0
{
335
0
  AUTO_PROFILER_LABEL_FAST("set HTMLOutputElement.value", DOM, cx);
336
0
337
0
  binding_detail::FakeString arg0;
338
0
  if (!ConvertJSValueToString(cx, args[0], eStringify, eStringify, arg0)) {
339
0
    return false;
340
0
  }
341
0
  Maybe<AutoCEReaction> ceReaction;
342
0
  if (CustomElementRegistry::IsCustomElementEnabled(cx, obj)) {
343
0
    DocGroup* docGroup = self->GetDocGroup();
344
0
    if (docGroup) {
345
0
      ceReaction.emplace(docGroup->CustomElementReactionsStack(), cx);
346
0
    }
347
0
  }
348
0
  FastErrorResult rv;
349
0
  self->SetValue(NonNullHelper(Constify(arg0)), rv);
350
0
  if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
351
0
    return false;
352
0
  }
353
0
  MOZ_ASSERT(!JS_IsExceptionPending(cx));
354
0
355
0
  return true;
356
0
}
357
358
static const JSJitInfo value_getterinfo = {
359
  { (JSJitGetterOp)get_value },
360
  { prototypes::id::HTMLOutputElement },
361
  { PrototypeTraits<prototypes::id::HTMLOutputElement>::Depth },
362
  JSJitInfo::Getter,
363
  JSJitInfo::AliasDOMSets, /* aliasSet.  Not relevant for setters. */
364
  JSVAL_TYPE_STRING,  /* returnType.  Not relevant for setters. */
365
  false,  /* isInfallible. False in setters. */
366
  true,  /* isMovable.  Not relevant for setters. */
367
  true, /* 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
static const JSJitInfo value_setterinfo = {
376
  { (JSJitGetterOp)set_value },
377
  { prototypes::id::HTMLOutputElement },
378
  { PrototypeTraits<prototypes::id::HTMLOutputElement>::Depth },
379
  JSJitInfo::Setter,
380
  JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
381
  JSVAL_TYPE_UNDEFINED,  /* returnType.  Not relevant for setters. */
382
  false,  /* isInfallible. False in setters. */
383
  false,  /* isMovable.  Not relevant for setters. */
384
  false, /* isEliminatable.  Not relevant for setters. */
385
  false, /* isAlwaysInSlot.  Only relevant for getters. */
386
  false, /* isLazilyCachedInSlot.  Only relevant for getters. */
387
  false,  /* isTypedMethod.  Only relevant for methods. */
388
  0   /* Reserved slot index, if we're stored in a slot, else 0. */
389
};
390
static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
391
static_assert(0 < 1, "There is no slot for us");
392
393
MOZ_CAN_RUN_SCRIPT static bool
394
get_willValidate(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLOutputElement* self, JSJitGetterCallArgs args)
395
0
{
396
0
  AUTO_PROFILER_LABEL_FAST("get HTMLOutputElement.willValidate", DOM, cx);
397
0
398
0
  bool result(self->WillValidate());
399
0
  MOZ_ASSERT(!JS_IsExceptionPending(cx));
400
0
  args.rval().setBoolean(result);
401
0
  return true;
402
0
}
403
404
static const JSJitInfo willValidate_getterinfo = {
405
  { (JSJitGetterOp)get_willValidate },
406
  { prototypes::id::HTMLOutputElement },
407
  { PrototypeTraits<prototypes::id::HTMLOutputElement>::Depth },
408
  JSJitInfo::Getter,
409
  JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
410
  JSVAL_TYPE_BOOLEAN,  /* returnType.  Not relevant for setters. */
411
  true,  /* isInfallible. False in setters. */
412
  false,  /* isMovable.  Not relevant for setters. */
413
  false, /* isEliminatable.  Not relevant for setters. */
414
  false, /* isAlwaysInSlot.  Only relevant for getters. */
415
  false, /* isLazilyCachedInSlot.  Only relevant for getters. */
416
  false,  /* isTypedMethod.  Only relevant for methods. */
417
  0   /* Reserved slot index, if we're stored in a slot, else 0. */
418
};
419
static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
420
static_assert(0 < 1, "There is no slot for us");
421
422
MOZ_CAN_RUN_SCRIPT static bool
423
get_validity(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLOutputElement* self, JSJitGetterCallArgs args)
424
0
{
425
0
  AUTO_PROFILER_LABEL_FAST("get HTMLOutputElement.validity", DOM, cx);
426
0
427
0
  auto result(StrongOrRawPtr<mozilla::dom::ValidityState>(self->Validity()));
428
0
  MOZ_ASSERT(!JS_IsExceptionPending(cx));
429
0
  if (!GetOrCreateDOMReflector(cx, result, args.rval())) {
430
0
    MOZ_ASSERT(JS_IsExceptionPending(cx));
431
0
    return false;
432
0
  }
433
0
  return true;
434
0
}
435
436
static const JSJitInfo validity_getterinfo = {
437
  { (JSJitGetterOp)get_validity },
438
  { prototypes::id::HTMLOutputElement },
439
  { PrototypeTraits<prototypes::id::HTMLOutputElement>::Depth },
440
  JSJitInfo::Getter,
441
  JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
442
  JSVAL_TYPE_OBJECT,  /* returnType.  Not relevant for setters. */
443
  false,  /* isInfallible. False in setters. */
444
  false,  /* isMovable.  Not relevant for setters. */
445
  false, /* isEliminatable.  Not relevant for setters. */
446
  false, /* isAlwaysInSlot.  Only relevant for getters. */
447
  false, /* isLazilyCachedInSlot.  Only relevant for getters. */
448
  false,  /* isTypedMethod.  Only relevant for methods. */
449
  0   /* Reserved slot index, if we're stored in a slot, else 0. */
450
};
451
static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
452
static_assert(0 < 1, "There is no slot for us");
453
454
MOZ_CAN_RUN_SCRIPT static bool
455
get_validationMessage(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLOutputElement* self, JSJitGetterCallArgs args)
456
0
{
457
0
  AUTO_PROFILER_LABEL_FAST("get HTMLOutputElement.validationMessage", DOM, cx);
458
0
459
0
  FastErrorResult rv;
460
0
  DOMString result;
461
0
  self->GetValidationMessage(result, rv);
462
0
  if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
463
0
    return false;
464
0
  }
465
0
  MOZ_ASSERT(!JS_IsExceptionPending(cx));
466
0
  if (!xpc::NonVoidStringToJsval(cx, result, args.rval())) {
467
0
    return false;
468
0
  }
469
0
  return true;
470
0
}
471
472
static const JSJitInfo validationMessage_getterinfo = {
473
  { (JSJitGetterOp)get_validationMessage },
474
  { prototypes::id::HTMLOutputElement },
475
  { PrototypeTraits<prototypes::id::HTMLOutputElement>::Depth },
476
  JSJitInfo::Getter,
477
  JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
478
  JSVAL_TYPE_STRING,  /* returnType.  Not relevant for setters. */
479
  false,  /* isInfallible. False in setters. */
480
  false,  /* isMovable.  Not relevant for setters. */
481
  false, /* isEliminatable.  Not relevant for setters. */
482
  false, /* isAlwaysInSlot.  Only relevant for getters. */
483
  false, /* isLazilyCachedInSlot.  Only relevant for getters. */
484
  false,  /* isTypedMethod.  Only relevant for methods. */
485
  0   /* Reserved slot index, if we're stored in a slot, else 0. */
486
};
487
static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
488
static_assert(0 < 1, "There is no slot for us");
489
490
MOZ_CAN_RUN_SCRIPT static bool
491
checkValidity(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLOutputElement* self, const JSJitMethodCallArgs& args)
492
0
{
493
0
  AUTO_PROFILER_LABEL_FAST("HTMLOutputElement.checkValidity", DOM, cx);
494
0
495
0
  bool result(self->CheckValidity());
496
0
  MOZ_ASSERT(!JS_IsExceptionPending(cx));
497
0
  args.rval().setBoolean(result);
498
0
  return true;
499
0
}
500
501
static const JSJitInfo checkValidity_methodinfo = {
502
  { (JSJitGetterOp)checkValidity },
503
  { prototypes::id::HTMLOutputElement },
504
  { PrototypeTraits<prototypes::id::HTMLOutputElement>::Depth },
505
  JSJitInfo::Method,
506
  JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
507
  JSVAL_TYPE_BOOLEAN,  /* returnType.  Not relevant for setters. */
508
  true,  /* isInfallible. False in setters. */
509
  false,  /* isMovable.  Not relevant for setters. */
510
  false, /* isEliminatable.  Not relevant for setters. */
511
  false, /* isAlwaysInSlot.  Only relevant for getters. */
512
  false, /* isLazilyCachedInSlot.  Only relevant for getters. */
513
  false,  /* isTypedMethod.  Only relevant for methods. */
514
  0   /* Reserved slot index, if we're stored in a slot, else 0. */
515
};
516
static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
517
static_assert(0 < 1, "There is no slot for us");
518
519
MOZ_CAN_RUN_SCRIPT static bool
520
reportValidity(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLOutputElement* self, const JSJitMethodCallArgs& args)
521
0
{
522
0
  AUTO_PROFILER_LABEL_FAST("HTMLOutputElement.reportValidity", DOM, cx);
523
0
524
0
  bool result(self->ReportValidity());
525
0
  MOZ_ASSERT(!JS_IsExceptionPending(cx));
526
0
  args.rval().setBoolean(result);
527
0
  return true;
528
0
}
529
530
static const JSJitInfo reportValidity_methodinfo = {
531
  { (JSJitGetterOp)reportValidity },
532
  { prototypes::id::HTMLOutputElement },
533
  { PrototypeTraits<prototypes::id::HTMLOutputElement>::Depth },
534
  JSJitInfo::Method,
535
  JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
536
  JSVAL_TYPE_BOOLEAN,  /* returnType.  Not relevant for setters. */
537
  true,  /* isInfallible. False in setters. */
538
  false,  /* isMovable.  Not relevant for setters. */
539
  false, /* isEliminatable.  Not relevant for setters. */
540
  false, /* isAlwaysInSlot.  Only relevant for getters. */
541
  false, /* isLazilyCachedInSlot.  Only relevant for getters. */
542
  false,  /* isTypedMethod.  Only relevant for methods. */
543
  0   /* Reserved slot index, if we're stored in a slot, else 0. */
544
};
545
static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
546
static_assert(0 < 1, "There is no slot for us");
547
548
MOZ_CAN_RUN_SCRIPT static bool
549
setCustomValidity(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLOutputElement* self, const JSJitMethodCallArgs& args)
550
0
{
551
0
  AUTO_PROFILER_LABEL_FAST("HTMLOutputElement.setCustomValidity", DOM, cx);
552
0
553
0
  if (MOZ_UNLIKELY(args.length() < 1)) {
554
0
    return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "HTMLOutputElement.setCustomValidity");
555
0
  }
556
0
  binding_detail::FakeString arg0;
557
0
  if (!ConvertJSValueToString(cx, args[0], eStringify, eStringify, arg0)) {
558
0
    return false;
559
0
  }
560
0
  self->SetCustomValidity(NonNullHelper(Constify(arg0)));
561
0
  MOZ_ASSERT(!JS_IsExceptionPending(cx));
562
0
  args.rval().setUndefined();
563
0
  return true;
564
0
}
565
566
static const JSJitInfo setCustomValidity_methodinfo = {
567
  { (JSJitGetterOp)setCustomValidity },
568
  { prototypes::id::HTMLOutputElement },
569
  { PrototypeTraits<prototypes::id::HTMLOutputElement>::Depth },
570
  JSJitInfo::Method,
571
  JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
572
  JSVAL_TYPE_UNDEFINED,  /* returnType.  Not relevant for setters. */
573
  false,  /* isInfallible. False in setters. */
574
  false,  /* isMovable.  Not relevant for setters. */
575
  false, /* isEliminatable.  Not relevant for setters. */
576
  false, /* isAlwaysInSlot.  Only relevant for getters. */
577
  false, /* isLazilyCachedInSlot.  Only relevant for getters. */
578
  false,  /* isTypedMethod.  Only relevant for methods. */
579
  0   /* Reserved slot index, if we're stored in a slot, else 0. */
580
};
581
static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
582
static_assert(0 < 1, "There is no slot for us");
583
584
MOZ_CAN_RUN_SCRIPT static bool
585
get_labels(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLOutputElement* self, JSJitGetterCallArgs args)
586
0
{
587
0
  AUTO_PROFILER_LABEL_FAST("get HTMLOutputElement.labels", DOM, cx);
588
0
589
0
  auto result(StrongOrRawPtr<nsINodeList>(self->Labels()));
590
0
  MOZ_ASSERT(!JS_IsExceptionPending(cx));
591
0
  if (!GetOrCreateDOMReflector(cx, result, args.rval())) {
592
0
    MOZ_ASSERT(JS_IsExceptionPending(cx));
593
0
    return false;
594
0
  }
595
0
  return true;
596
0
}
597
598
static const JSJitInfo labels_getterinfo = {
599
  { (JSJitGetterOp)get_labels },
600
  { prototypes::id::HTMLOutputElement },
601
  { PrototypeTraits<prototypes::id::HTMLOutputElement>::Depth },
602
  JSJitInfo::Getter,
603
  JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
604
  JSVAL_TYPE_OBJECT,  /* returnType.  Not relevant for setters. */
605
  false,  /* isInfallible. False in setters. */
606
  false,  /* isMovable.  Not relevant for setters. */
607
  false, /* isEliminatable.  Not relevant for setters. */
608
  false, /* isAlwaysInSlot.  Only relevant for getters. */
609
  false, /* isLazilyCachedInSlot.  Only relevant for getters. */
610
  false,  /* isTypedMethod.  Only relevant for methods. */
611
  0   /* Reserved slot index, if we're stored in a slot, else 0. */
612
};
613
static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
614
static_assert(0 < 1, "There is no slot for us");
615
616
static bool
617
_addProperty(JSContext* cx, JS::Handle<JSObject*> obj, JS::Handle<jsid> id, JS::Handle<JS::Value> val)
618
0
{
619
0
  mozilla::dom::HTMLOutputElement* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::dom::HTMLOutputElement>(obj);
620
0
  // We don't want to preserve if we don't have a wrapper, and we
621
0
  // obviously can't preserve if we're not initialized.
622
0
  if (self && self->GetWrapperPreserveColor()) {
623
0
    PreserveWrapper(self);
624
0
  }
625
0
  return true;
626
0
}
627
628
static void
629
_finalize(js::FreeOp* fop, JSObject* obj)
630
0
{
631
0
  mozilla::dom::HTMLOutputElement* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::dom::HTMLOutputElement>(obj);
632
0
  if (self) {
633
0
    ClearWrapper(self, self, obj);
634
0
    AddForDeferredFinalization<mozilla::dom::HTMLOutputElement>(self);
635
0
  }
636
0
}
637
638
static size_t
639
_objectMoved(JSObject* obj, JSObject* old)
640
0
{
641
0
  mozilla::dom::HTMLOutputElement* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::dom::HTMLOutputElement>(obj);
642
0
  if (self) {
643
0
    UpdateWrapper(self, self, obj, old);
644
0
  }
645
0
646
0
  return 0;
647
0
}
648
649
// We deliberately use brace-elision to make Visual Studio produce better initalization code.
650
#if defined(__clang__)
651
#pragma clang diagnostic push
652
#pragma clang diagnostic ignored "-Wmissing-braces"
653
#endif
654
static const JSFunctionSpec sMethods_specs[] = {
655
  JS_FNSPEC("checkValidity", (GenericMethod<NormalThisPolicy, ThrowExceptions>), reinterpret_cast<const JSJitInfo*>(&checkValidity_methodinfo), 0, JSPROP_ENUMERATE, nullptr),
656
  JS_FNSPEC("reportValidity", (GenericMethod<NormalThisPolicy, ThrowExceptions>), reinterpret_cast<const JSJitInfo*>(&reportValidity_methodinfo), 0, JSPROP_ENUMERATE, nullptr),
657
  JS_FNSPEC("setCustomValidity", (GenericMethod<NormalThisPolicy, ThrowExceptions>), reinterpret_cast<const JSJitInfo*>(&setCustomValidity_methodinfo), 1, JSPROP_ENUMERATE, nullptr),
658
  JS_FS_END
659
};
660
#if defined(__clang__)
661
#pragma clang diagnostic pop
662
#endif
663
664
665
static const Prefable<const JSFunctionSpec> sMethods[] = {
666
  { nullptr, &sMethods_specs[0] },
667
  { nullptr, nullptr }
668
};
669
670
static_assert(1 <= 1ull << NUM_BITS_PROPERTY_INFO_PREF_INDEX,
671
    "We have a prefable index that is >= (1 << NUM_BITS_PROPERTY_INFO_PREF_INDEX)");
672
static_assert(3 <= 1ull << NUM_BITS_PROPERTY_INFO_SPEC_INDEX,
673
    "We have a spec index that is >= (1 << NUM_BITS_PROPERTY_INFO_SPEC_INDEX)");
674
675
// We deliberately use brace-elision to make Visual Studio produce better initalization code.
676
#if defined(__clang__)
677
#pragma clang diagnostic push
678
#pragma clang diagnostic ignored "-Wmissing-braces"
679
#endif
680
static const JSPropertySpec sAttributes_specs[] = {
681
  { "htmlFor", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &htmlFor_getterinfo, GenericSetter<NormalThisPolicy>, &htmlFor_setterinfo },
682
  { "form", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &form_getterinfo, nullptr, nullptr },
683
  { "name", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &name_getterinfo, GenericSetter<NormalThisPolicy>, &name_setterinfo },
684
  { "type", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &type_getterinfo, nullptr, nullptr },
685
  { "defaultValue", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &defaultValue_getterinfo, GenericSetter<NormalThisPolicy>, &defaultValue_setterinfo },
686
  { "value", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &value_getterinfo, GenericSetter<NormalThisPolicy>, &value_setterinfo },
687
  { "willValidate", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &willValidate_getterinfo, nullptr, nullptr },
688
  { "validity", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &validity_getterinfo, nullptr, nullptr },
689
  { "validationMessage", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &validationMessage_getterinfo, nullptr, nullptr },
690
  { "labels", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &labels_getterinfo, nullptr, nullptr },
691
  { nullptr, 0, nullptr, nullptr, nullptr, nullptr }
692
};
693
#if defined(__clang__)
694
#pragma clang diagnostic pop
695
#endif
696
697
698
static const Prefable<const JSPropertySpec> sAttributes[] = {
699
  { nullptr, &sAttributes_specs[0] },
700
  { nullptr, nullptr }
701
};
702
703
static_assert(1 <= 1ull << NUM_BITS_PROPERTY_INFO_PREF_INDEX,
704
    "We have a prefable index that is >= (1 << NUM_BITS_PROPERTY_INFO_PREF_INDEX)");
705
static_assert(10 <= 1ull << NUM_BITS_PROPERTY_INFO_SPEC_INDEX,
706
    "We have a spec index that is >= (1 << NUM_BITS_PROPERTY_INFO_SPEC_INDEX)");
707
708
709
static uint16_t sNativeProperties_sortedPropertyIndices[13];
710
static PropertyInfo sNativeProperties_propertyInfos[13];
711
712
static const NativePropertiesN<2> sNativeProperties = {
713
  false, 0,
714
  false, 0,
715
  true,  0 /* sMethods */,
716
  true,  1 /* sAttributes */,
717
  false, 0,
718
  false, 0,
719
  false, 0,
720
  -1,
721
  13,
722
  sNativeProperties_sortedPropertyIndices,
723
  {
724
    { sMethods, &sNativeProperties_propertyInfos[0] },
725
    { sAttributes, &sNativeProperties_propertyInfos[3] }
726
  }
727
};
728
static_assert(13 < 1ull << CHAR_BIT * sizeof(sNativeProperties.propertyInfoCount),
729
    "We have a property info count that is oversized");
730
731
static bool
732
_constructor(JSContext* cx, unsigned argc, JS::Value* vp)
733
0
{
734
0
  AUTO_PROFILER_LABEL_FAST("HTMLOutputElement constructor", DOM, cx);
735
0
736
0
  return HTMLConstructor(cx, argc, vp,
737
0
                         constructors::id::HTMLOutputElement,
738
0
                         prototypes::id::HTMLOutputElement,
739
0
                         CreateInterfaceObjects);
740
0
}
741
742
static const js::ClassOps sInterfaceObjectClassOps = {
743
    nullptr,               /* addProperty */
744
    nullptr,               /* delProperty */
745
    nullptr,               /* enumerate */
746
    nullptr,               /* newEnumerate */
747
    nullptr,               /* resolve */
748
    nullptr,               /* mayResolve */
749
    nullptr,               /* finalize */
750
    _constructor, /* call */
751
    nullptr,               /* hasInstance */
752
    _constructor, /* construct */
753
    nullptr,               /* trace */
754
};
755
756
static const DOMIfaceAndProtoJSClass sInterfaceObjectClass = {
757
  {
758
    "Function",
759
    JSCLASS_IS_DOMIFACEANDPROTOJSCLASS | JSCLASS_HAS_RESERVED_SLOTS(DOM_INTERFACE_SLOTS_BASE),
760
    &sInterfaceObjectClassOps,
761
    JS_NULL_CLASS_SPEC,
762
    JS_NULL_CLASS_EXT,
763
    &sInterfaceObjectClassObjectOps
764
  },
765
  eInterface,
766
  true,
767
  prototypes::id::HTMLOutputElement,
768
  PrototypeTraits<prototypes::id::HTMLOutputElement>::Depth,
769
  sNativePropertyHooks,
770
  "function HTMLOutputElement() {\n    [native code]\n}",
771
  HTMLElement_Binding::GetConstructorObject
772
};
773
774
static const DOMIfaceAndProtoJSClass sPrototypeClass = {
775
  {
776
    "HTMLOutputElementPrototype",
777
    JSCLASS_IS_DOMIFACEANDPROTOJSCLASS | JSCLASS_HAS_RESERVED_SLOTS(DOM_INTERFACE_PROTO_SLOTS_BASE),
778
    JS_NULL_CLASS_OPS,
779
    JS_NULL_CLASS_SPEC,
780
    JS_NULL_CLASS_EXT,
781
    JS_NULL_OBJECT_OPS
782
  },
783
  eInterfacePrototype,
784
  false,
785
  prototypes::id::HTMLOutputElement,
786
  PrototypeTraits<prototypes::id::HTMLOutputElement>::Depth,
787
  sNativePropertyHooks,
788
  "[object HTMLOutputElementPrototype]",
789
  HTMLElement_Binding::GetProtoObject
790
};
791
792
static const js::ClassOps sClassOps = {
793
  _addProperty, /* addProperty */
794
  nullptr,               /* delProperty */
795
  nullptr,               /* enumerate */
796
  nullptr, /* newEnumerate */
797
  nullptr, /* resolve */
798
  nullptr, /* mayResolve */
799
  _finalize, /* finalize */
800
  nullptr, /* call */
801
  nullptr,               /* hasInstance */
802
  nullptr,               /* construct */
803
  nullptr, /* trace */
804
};
805
806
static const js::ClassExtension sClassExtension = {
807
  nullptr, /* weakmapKeyDelegateOp */
808
  _objectMoved /* objectMovedOp */
809
};
810
811
static const DOMJSClass sClass = {
812
  { "HTMLOutputElement",
813
    JSCLASS_IS_DOMJSCLASS | JSCLASS_FOREGROUND_FINALIZE | JSCLASS_HAS_RESERVED_SLOTS(1),
814
    &sClassOps,
815
    JS_NULL_CLASS_SPEC,
816
    &sClassExtension,
817
    JS_NULL_OBJECT_OPS
818
  },
819
  { prototypes::id::EventTarget, prototypes::id::Node, prototypes::id::Element, prototypes::id::HTMLElement, prototypes::id::HTMLOutputElement, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count },
820
  IsBaseOf<nsISupports, mozilla::dom::HTMLOutputElement >::value,
821
  sNativePropertyHooks,
822
  FindAssociatedGlobalForNative<mozilla::dom::HTMLOutputElement>::Get,
823
  GetProtoObjectHandle,
824
  GetCCParticipant<mozilla::dom::HTMLOutputElement>::Get()
825
};
826
static_assert(1 == DOM_INSTANCE_RESERVED_SLOTS,
827
              "Must have the right minimal number of reserved slots.");
828
static_assert(1 >= 1,
829
              "Must have enough reserved slots.");
830
831
const JSClass*
832
GetJSClass()
833
0
{
834
0
  return sClass.ToJSClass();
835
0
}
836
837
bool
838
Wrap(JSContext* aCx, mozilla::dom::HTMLOutputElement* aObject, nsWrapperCache* aCache, JS::Handle<JSObject*> aGivenProto, JS::MutableHandle<JSObject*> aReflector)
839
0
{
840
0
  static_assert(!IsBaseOf<NonRefcountedDOMObject, mozilla::dom::HTMLOutputElement>::value,
841
0
                "Shouldn't have wrappercached things that are not refcounted.");
842
0
  MOZ_ASSERT(static_cast<mozilla::dom::HTMLOutputElement*>(aObject) ==
843
0
             reinterpret_cast<mozilla::dom::HTMLOutputElement*>(aObject),
844
0
             "Multiple inheritance for mozilla::dom::HTMLOutputElement is broken.");
845
0
  MOZ_ASSERT(static_cast<nsGenericHTMLElement*>(aObject) ==
846
0
             reinterpret_cast<nsGenericHTMLElement*>(aObject),
847
0
             "Multiple inheritance for nsGenericHTMLElement is broken.");
848
0
  MOZ_ASSERT(static_cast<mozilla::dom::Element*>(aObject) ==
849
0
             reinterpret_cast<mozilla::dom::Element*>(aObject),
850
0
             "Multiple inheritance for mozilla::dom::Element is broken.");
851
0
  MOZ_ASSERT(static_cast<nsINode*>(aObject) ==
852
0
             reinterpret_cast<nsINode*>(aObject),
853
0
             "Multiple inheritance for nsINode is broken.");
854
0
  MOZ_ASSERT(static_cast<mozilla::dom::EventTarget*>(aObject) ==
855
0
             reinterpret_cast<mozilla::dom::EventTarget*>(aObject),
856
0
             "Multiple inheritance for mozilla::dom::EventTarget is broken.");
857
0
  MOZ_ASSERT(ToSupportsIsCorrect(aObject));
858
0
  MOZ_ASSERT_IF(aGivenProto, js::IsObjectInContextCompartment(aGivenProto, aCx));
859
0
  MOZ_ASSERT(!aCache->GetWrapper(),
860
0
             "You should probably not be using Wrap() directly; use "
861
0
             "GetOrCreateDOMReflector instead");
862
0
863
0
  MOZ_ASSERT(ToSupportsIsOnPrimaryInheritanceChain(aObject, aCache),
864
0
             "nsISupports must be on our primary inheritance chain");
865
0
866
0
  JS::Rooted<JSObject*> global(aCx, FindAssociatedGlobal(aCx, aObject->GetParentObject()));
867
0
  if (!global) {
868
0
    return false;
869
0
  }
870
0
  MOZ_ASSERT(JS_IsGlobalObject(global));
871
0
  MOZ_ASSERT(JS::ObjectIsNotGray(global));
872
0
873
0
  // That might have ended up wrapping us already, due to the wonders
874
0
  // of XBL.  Check for that, and bail out as needed.
875
0
  aReflector.set(aCache->GetWrapper());
876
0
  if (aReflector) {
877
#ifdef DEBUG
878
    AssertReflectorHasGivenProto(aCx, aReflector, aGivenProto);
879
#endif // DEBUG
880
    return true;
881
0
  }
882
0
883
0
  JSAutoRealm ar(aCx, global);
884
0
  JS::Handle<JSObject*> canonicalProto = GetProtoObjectHandle(aCx);
885
0
  if (!canonicalProto) {
886
0
    return false;
887
0
  }
888
0
  JS::Rooted<JSObject*> proto(aCx);
889
0
  if (aGivenProto) {
890
0
    proto = aGivenProto;
891
0
    // Unfortunately, while aGivenProto was in the compartment of aCx
892
0
    // coming in, we changed compartments to that of "parent" so may need
893
0
    // to wrap the proto here.
894
0
    if (js::GetContextCompartment(aCx) != js::GetObjectCompartment(proto)) {
895
0
      if (!JS_WrapObject(aCx, &proto)) {
896
0
        return false;
897
0
      }
898
0
    }
899
0
  } else {
900
0
    proto = canonicalProto;
901
0
  }
902
0
903
0
  BindingJSObjectCreator<mozilla::dom::HTMLOutputElement> creator(aCx);
904
0
  creator.CreateObject(aCx, sClass.ToJSClass(), proto, aObject, aReflector);
905
0
  if (!aReflector) {
906
0
    return false;
907
0
  }
908
0
909
0
  aCache->SetWrapper(aReflector);
910
0
  creator.InitializationSucceeded();
911
0
912
0
  MOZ_ASSERT(aCache->GetWrapperPreserveColor() &&
913
0
             aCache->GetWrapperPreserveColor() == aReflector);
914
0
  // If proto != canonicalProto, we have to preserve our wrapper;
915
0
  // otherwise we won't be able to properly recreate it later, since
916
0
  // we won't know what proto to use.  Note that we don't check
917
0
  // aGivenProto here, since it's entirely possible (and even
918
0
  // somewhat common) to have a non-null aGivenProto which is the
919
0
  // same as canonicalProto.
920
0
  if (proto != canonicalProto) {
921
0
    PreserveWrapper(aObject);
922
0
  }
923
0
924
0
  return true;
925
0
}
926
927
const NativePropertyHooks sNativePropertyHooks[] = { {
928
  nullptr,
929
  nullptr,
930
  nullptr,
931
  { sNativeProperties.Upcast(), nullptr },
932
  prototypes::id::HTMLOutputElement,
933
  constructors::id::HTMLOutputElement,
934
  HTMLElement_Binding::sNativePropertyHooks,
935
  &DefaultXrayExpandoObjectClass
936
} };
937
938
void
939
CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, bool aDefineOnGlobal)
940
0
{
941
0
  JS::Handle<JSObject*> parentProto(HTMLElement_Binding::GetProtoObjectHandle(aCx));
942
0
  if (!parentProto) {
943
0
    return;
944
0
  }
945
0
946
0
  JS::Handle<JSObject*> constructorProto(HTMLElement_Binding::GetConstructorObjectHandle(aCx));
947
0
  if (!constructorProto) {
948
0
    return;
949
0
  }
950
0
951
0
  static bool sIdsInited = false;
952
0
  if (!sIdsInited && NS_IsMainThread()) {
953
0
    if (!InitIds(aCx, sNativeProperties.Upcast())) {
954
0
      return;
955
0
    }
956
0
    sIdsInited = true;
957
0
  }
958
0
959
0
  JS::Heap<JSObject*>* protoCache = &aProtoAndIfaceCache.EntrySlotOrCreate(prototypes::id::HTMLOutputElement);
960
0
  JS::Heap<JSObject*>* interfaceCache = &aProtoAndIfaceCache.EntrySlotOrCreate(constructors::id::HTMLOutputElement);
961
0
  dom::CreateInterfaceObjects(aCx, aGlobal, parentProto,
962
0
                              &sPrototypeClass.mBase, protoCache,
963
0
                              nullptr,
964
0
                              constructorProto, &sInterfaceObjectClass.mBase, 0, nullptr,
965
0
                              interfaceCache,
966
0
                              sNativeProperties.Upcast(),
967
0
                              nullptr,
968
0
                              "HTMLOutputElement", aDefineOnGlobal,
969
0
                              nullptr,
970
0
                              false);
971
0
}
972
973
JSObject*
974
GetConstructorObject(JSContext* aCx)
975
0
{
976
0
  return GetConstructorObjectHandle(aCx);
977
0
}
978
979
} // namespace HTMLOutputElement_Binding
980
981
982
983
} // namespace dom
984
} // namespace mozilla