Coverage Report

Created: 2018-09-25 14:53

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