Coverage Report

Created: 2018-09-25 14:53

/work/obj-fuzz/dom/bindings/ValidityStateBinding.cpp
Line
Count
Source (jump to first uncovered line)
1
/* THIS FILE IS AUTOGENERATED FROM ValidityState.webidl BY Codegen.py - DO NOT EDIT */
2
3
#include "ValidityStateBinding.h"
4
#include "WrapperFactory.h"
5
#include "mozilla/OwningNonNull.h"
6
#include "mozilla/dom/BindingUtils.h"
7
#include "mozilla/dom/DOMJSClass.h"
8
#include "mozilla/dom/NonRefcountedDOMObject.h"
9
#include "mozilla/dom/PrimitiveConversions.h"
10
#include "mozilla/dom/ValidityState.h"
11
#include "mozilla/dom/XrayExpandoClass.h"
12
13
namespace mozilla {
14
namespace dom {
15
16
namespace binding_detail {}; // Just to make sure it's known as a namespace
17
using namespace mozilla::dom::binding_detail;
18
19
20
namespace ValidityState_Binding {
21
22
MOZ_CAN_RUN_SCRIPT static bool
23
get_valueMissing(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::ValidityState* self, JSJitGetterCallArgs args)
24
0
{
25
0
  AUTO_PROFILER_LABEL_FAST("get ValidityState.valueMissing", DOM, cx);
26
0
27
0
  bool result(self->ValueMissing());
28
0
  MOZ_ASSERT(!JS_IsExceptionPending(cx));
29
0
  args.rval().setBoolean(result);
30
0
  return true;
31
0
}
32
33
static const JSJitInfo valueMissing_getterinfo = {
34
  { (JSJitGetterOp)get_valueMissing },
35
  { prototypes::id::ValidityState },
36
  { PrototypeTraits<prototypes::id::ValidityState>::Depth },
37
  JSJitInfo::Getter,
38
  JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
39
  JSVAL_TYPE_BOOLEAN,  /* returnType.  Not relevant for setters. */
40
  true,  /* isInfallible. False in setters. */
41
  false,  /* isMovable.  Not relevant for setters. */
42
  false, /* isEliminatable.  Not relevant for setters. */
43
  false, /* isAlwaysInSlot.  Only relevant for getters. */
44
  false, /* isLazilyCachedInSlot.  Only relevant for getters. */
45
  false,  /* isTypedMethod.  Only relevant for methods. */
46
  0   /* Reserved slot index, if we're stored in a slot, else 0. */
47
};
48
static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
49
static_assert(0 < 1, "There is no slot for us");
50
51
MOZ_CAN_RUN_SCRIPT static bool
52
get_typeMismatch(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::ValidityState* self, JSJitGetterCallArgs args)
53
0
{
54
0
  AUTO_PROFILER_LABEL_FAST("get ValidityState.typeMismatch", DOM, cx);
55
0
56
0
  bool result(self->TypeMismatch());
57
0
  MOZ_ASSERT(!JS_IsExceptionPending(cx));
58
0
  args.rval().setBoolean(result);
59
0
  return true;
60
0
}
61
62
static const JSJitInfo typeMismatch_getterinfo = {
63
  { (JSJitGetterOp)get_typeMismatch },
64
  { prototypes::id::ValidityState },
65
  { PrototypeTraits<prototypes::id::ValidityState>::Depth },
66
  JSJitInfo::Getter,
67
  JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
68
  JSVAL_TYPE_BOOLEAN,  /* returnType.  Not relevant for setters. */
69
  true,  /* isInfallible. False in setters. */
70
  false,  /* isMovable.  Not relevant for setters. */
71
  false, /* isEliminatable.  Not relevant for setters. */
72
  false, /* isAlwaysInSlot.  Only relevant for getters. */
73
  false, /* isLazilyCachedInSlot.  Only relevant for getters. */
74
  false,  /* isTypedMethod.  Only relevant for methods. */
75
  0   /* Reserved slot index, if we're stored in a slot, else 0. */
76
};
77
static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
78
static_assert(0 < 1, "There is no slot for us");
79
80
MOZ_CAN_RUN_SCRIPT static bool
81
get_patternMismatch(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::ValidityState* self, JSJitGetterCallArgs args)
82
0
{
83
0
  AUTO_PROFILER_LABEL_FAST("get ValidityState.patternMismatch", DOM, cx);
84
0
85
0
  bool result(self->PatternMismatch());
86
0
  MOZ_ASSERT(!JS_IsExceptionPending(cx));
87
0
  args.rval().setBoolean(result);
88
0
  return true;
89
0
}
90
91
static const JSJitInfo patternMismatch_getterinfo = {
92
  { (JSJitGetterOp)get_patternMismatch },
93
  { prototypes::id::ValidityState },
94
  { PrototypeTraits<prototypes::id::ValidityState>::Depth },
95
  JSJitInfo::Getter,
96
  JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
97
  JSVAL_TYPE_BOOLEAN,  /* returnType.  Not relevant for setters. */
98
  true,  /* isInfallible. False in setters. */
99
  false,  /* isMovable.  Not relevant for setters. */
100
  false, /* isEliminatable.  Not relevant for setters. */
101
  false, /* isAlwaysInSlot.  Only relevant for getters. */
102
  false, /* isLazilyCachedInSlot.  Only relevant for getters. */
103
  false,  /* isTypedMethod.  Only relevant for methods. */
104
  0   /* Reserved slot index, if we're stored in a slot, else 0. */
105
};
106
static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
107
static_assert(0 < 1, "There is no slot for us");
108
109
MOZ_CAN_RUN_SCRIPT static bool
110
get_tooLong(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::ValidityState* self, JSJitGetterCallArgs args)
111
0
{
112
0
  AUTO_PROFILER_LABEL_FAST("get ValidityState.tooLong", DOM, cx);
113
0
114
0
  bool result(self->TooLong());
115
0
  MOZ_ASSERT(!JS_IsExceptionPending(cx));
116
0
  args.rval().setBoolean(result);
117
0
  return true;
118
0
}
119
120
static const JSJitInfo tooLong_getterinfo = {
121
  { (JSJitGetterOp)get_tooLong },
122
  { prototypes::id::ValidityState },
123
  { PrototypeTraits<prototypes::id::ValidityState>::Depth },
124
  JSJitInfo::Getter,
125
  JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
126
  JSVAL_TYPE_BOOLEAN,  /* returnType.  Not relevant for setters. */
127
  true,  /* isInfallible. False in setters. */
128
  false,  /* isMovable.  Not relevant for setters. */
129
  false, /* isEliminatable.  Not relevant for setters. */
130
  false, /* isAlwaysInSlot.  Only relevant for getters. */
131
  false, /* isLazilyCachedInSlot.  Only relevant for getters. */
132
  false,  /* isTypedMethod.  Only relevant for methods. */
133
  0   /* Reserved slot index, if we're stored in a slot, else 0. */
134
};
135
static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
136
static_assert(0 < 1, "There is no slot for us");
137
138
MOZ_CAN_RUN_SCRIPT static bool
139
get_tooShort(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::ValidityState* self, JSJitGetterCallArgs args)
140
0
{
141
0
  AUTO_PROFILER_LABEL_FAST("get ValidityState.tooShort", DOM, cx);
142
0
143
0
  bool result(self->TooShort());
144
0
  MOZ_ASSERT(!JS_IsExceptionPending(cx));
145
0
  args.rval().setBoolean(result);
146
0
  return true;
147
0
}
148
149
static const JSJitInfo tooShort_getterinfo = {
150
  { (JSJitGetterOp)get_tooShort },
151
  { prototypes::id::ValidityState },
152
  { PrototypeTraits<prototypes::id::ValidityState>::Depth },
153
  JSJitInfo::Getter,
154
  JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
155
  JSVAL_TYPE_BOOLEAN,  /* returnType.  Not relevant for setters. */
156
  true,  /* isInfallible. False in setters. */
157
  false,  /* isMovable.  Not relevant for setters. */
158
  false, /* isEliminatable.  Not relevant for setters. */
159
  false, /* isAlwaysInSlot.  Only relevant for getters. */
160
  false, /* isLazilyCachedInSlot.  Only relevant for getters. */
161
  false,  /* isTypedMethod.  Only relevant for methods. */
162
  0   /* Reserved slot index, if we're stored in a slot, else 0. */
163
};
164
static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
165
static_assert(0 < 1, "There is no slot for us");
166
167
MOZ_CAN_RUN_SCRIPT static bool
168
get_rangeUnderflow(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::ValidityState* self, JSJitGetterCallArgs args)
169
0
{
170
0
  AUTO_PROFILER_LABEL_FAST("get ValidityState.rangeUnderflow", DOM, cx);
171
0
172
0
  bool result(self->RangeUnderflow());
173
0
  MOZ_ASSERT(!JS_IsExceptionPending(cx));
174
0
  args.rval().setBoolean(result);
175
0
  return true;
176
0
}
177
178
static const JSJitInfo rangeUnderflow_getterinfo = {
179
  { (JSJitGetterOp)get_rangeUnderflow },
180
  { prototypes::id::ValidityState },
181
  { PrototypeTraits<prototypes::id::ValidityState>::Depth },
182
  JSJitInfo::Getter,
183
  JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
184
  JSVAL_TYPE_BOOLEAN,  /* returnType.  Not relevant for setters. */
185
  true,  /* isInfallible. False in setters. */
186
  false,  /* isMovable.  Not relevant for setters. */
187
  false, /* isEliminatable.  Not relevant for setters. */
188
  false, /* isAlwaysInSlot.  Only relevant for getters. */
189
  false, /* isLazilyCachedInSlot.  Only relevant for getters. */
190
  false,  /* isTypedMethod.  Only relevant for methods. */
191
  0   /* Reserved slot index, if we're stored in a slot, else 0. */
192
};
193
static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
194
static_assert(0 < 1, "There is no slot for us");
195
196
MOZ_CAN_RUN_SCRIPT static bool
197
get_rangeOverflow(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::ValidityState* self, JSJitGetterCallArgs args)
198
0
{
199
0
  AUTO_PROFILER_LABEL_FAST("get ValidityState.rangeOverflow", DOM, cx);
200
0
201
0
  bool result(self->RangeOverflow());
202
0
  MOZ_ASSERT(!JS_IsExceptionPending(cx));
203
0
  args.rval().setBoolean(result);
204
0
  return true;
205
0
}
206
207
static const JSJitInfo rangeOverflow_getterinfo = {
208
  { (JSJitGetterOp)get_rangeOverflow },
209
  { prototypes::id::ValidityState },
210
  { PrototypeTraits<prototypes::id::ValidityState>::Depth },
211
  JSJitInfo::Getter,
212
  JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
213
  JSVAL_TYPE_BOOLEAN,  /* returnType.  Not relevant for setters. */
214
  true,  /* isInfallible. False in setters. */
215
  false,  /* isMovable.  Not relevant for setters. */
216
  false, /* isEliminatable.  Not relevant for setters. */
217
  false, /* isAlwaysInSlot.  Only relevant for getters. */
218
  false, /* isLazilyCachedInSlot.  Only relevant for getters. */
219
  false,  /* isTypedMethod.  Only relevant for methods. */
220
  0   /* Reserved slot index, if we're stored in a slot, else 0. */
221
};
222
static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
223
static_assert(0 < 1, "There is no slot for us");
224
225
MOZ_CAN_RUN_SCRIPT static bool
226
get_stepMismatch(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::ValidityState* self, JSJitGetterCallArgs args)
227
0
{
228
0
  AUTO_PROFILER_LABEL_FAST("get ValidityState.stepMismatch", DOM, cx);
229
0
230
0
  bool result(self->StepMismatch());
231
0
  MOZ_ASSERT(!JS_IsExceptionPending(cx));
232
0
  args.rval().setBoolean(result);
233
0
  return true;
234
0
}
235
236
static const JSJitInfo stepMismatch_getterinfo = {
237
  { (JSJitGetterOp)get_stepMismatch },
238
  { prototypes::id::ValidityState },
239
  { PrototypeTraits<prototypes::id::ValidityState>::Depth },
240
  JSJitInfo::Getter,
241
  JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
242
  JSVAL_TYPE_BOOLEAN,  /* returnType.  Not relevant for setters. */
243
  true,  /* isInfallible. False in setters. */
244
  false,  /* isMovable.  Not relevant for setters. */
245
  false, /* isEliminatable.  Not relevant for setters. */
246
  false, /* isAlwaysInSlot.  Only relevant for getters. */
247
  false, /* isLazilyCachedInSlot.  Only relevant for getters. */
248
  false,  /* isTypedMethod.  Only relevant for methods. */
249
  0   /* Reserved slot index, if we're stored in a slot, else 0. */
250
};
251
static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
252
static_assert(0 < 1, "There is no slot for us");
253
254
MOZ_CAN_RUN_SCRIPT static bool
255
get_badInput(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::ValidityState* self, JSJitGetterCallArgs args)
256
0
{
257
0
  AUTO_PROFILER_LABEL_FAST("get ValidityState.badInput", DOM, cx);
258
0
259
0
  bool result(self->BadInput());
260
0
  MOZ_ASSERT(!JS_IsExceptionPending(cx));
261
0
  args.rval().setBoolean(result);
262
0
  return true;
263
0
}
264
265
static const JSJitInfo badInput_getterinfo = {
266
  { (JSJitGetterOp)get_badInput },
267
  { prototypes::id::ValidityState },
268
  { PrototypeTraits<prototypes::id::ValidityState>::Depth },
269
  JSJitInfo::Getter,
270
  JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
271
  JSVAL_TYPE_BOOLEAN,  /* returnType.  Not relevant for setters. */
272
  true,  /* isInfallible. False in setters. */
273
  false,  /* isMovable.  Not relevant for setters. */
274
  false, /* isEliminatable.  Not relevant for setters. */
275
  false, /* isAlwaysInSlot.  Only relevant for getters. */
276
  false, /* isLazilyCachedInSlot.  Only relevant for getters. */
277
  false,  /* isTypedMethod.  Only relevant for methods. */
278
  0   /* Reserved slot index, if we're stored in a slot, else 0. */
279
};
280
static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
281
static_assert(0 < 1, "There is no slot for us");
282
283
MOZ_CAN_RUN_SCRIPT static bool
284
get_customError(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::ValidityState* self, JSJitGetterCallArgs args)
285
0
{
286
0
  AUTO_PROFILER_LABEL_FAST("get ValidityState.customError", DOM, cx);
287
0
288
0
  bool result(self->CustomError());
289
0
  MOZ_ASSERT(!JS_IsExceptionPending(cx));
290
0
  args.rval().setBoolean(result);
291
0
  return true;
292
0
}
293
294
static const JSJitInfo customError_getterinfo = {
295
  { (JSJitGetterOp)get_customError },
296
  { prototypes::id::ValidityState },
297
  { PrototypeTraits<prototypes::id::ValidityState>::Depth },
298
  JSJitInfo::Getter,
299
  JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
300
  JSVAL_TYPE_BOOLEAN,  /* returnType.  Not relevant for setters. */
301
  true,  /* isInfallible. False in setters. */
302
  false,  /* isMovable.  Not relevant for setters. */
303
  false, /* isEliminatable.  Not relevant for setters. */
304
  false, /* isAlwaysInSlot.  Only relevant for getters. */
305
  false, /* isLazilyCachedInSlot.  Only relevant for getters. */
306
  false,  /* isTypedMethod.  Only relevant for methods. */
307
  0   /* Reserved slot index, if we're stored in a slot, else 0. */
308
};
309
static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
310
static_assert(0 < 1, "There is no slot for us");
311
312
MOZ_CAN_RUN_SCRIPT static bool
313
get_valid(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::ValidityState* self, JSJitGetterCallArgs args)
314
0
{
315
0
  AUTO_PROFILER_LABEL_FAST("get ValidityState.valid", DOM, cx);
316
0
317
0
  bool result(self->Valid());
318
0
  MOZ_ASSERT(!JS_IsExceptionPending(cx));
319
0
  args.rval().setBoolean(result);
320
0
  return true;
321
0
}
322
323
static const JSJitInfo valid_getterinfo = {
324
  { (JSJitGetterOp)get_valid },
325
  { prototypes::id::ValidityState },
326
  { PrototypeTraits<prototypes::id::ValidityState>::Depth },
327
  JSJitInfo::Getter,
328
  JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
329
  JSVAL_TYPE_BOOLEAN,  /* returnType.  Not relevant for setters. */
330
  true,  /* isInfallible. False in setters. */
331
  false,  /* isMovable.  Not relevant for setters. */
332
  false, /* isEliminatable.  Not relevant for setters. */
333
  false, /* isAlwaysInSlot.  Only relevant for getters. */
334
  false, /* isLazilyCachedInSlot.  Only relevant for getters. */
335
  false,  /* isTypedMethod.  Only relevant for methods. */
336
  0   /* Reserved slot index, if we're stored in a slot, else 0. */
337
};
338
static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
339
static_assert(0 < 1, "There is no slot for us");
340
341
static bool
342
_addProperty(JSContext* cx, JS::Handle<JSObject*> obj, JS::Handle<jsid> id, JS::Handle<JS::Value> val)
343
0
{
344
0
  mozilla::dom::ValidityState* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::dom::ValidityState>(obj);
345
0
  // We don't want to preserve if we don't have a wrapper, and we
346
0
  // obviously can't preserve if we're not initialized.
347
0
  if (self && self->GetWrapperPreserveColor()) {
348
0
    PreserveWrapper(self);
349
0
  }
350
0
  return true;
351
0
}
352
353
static void
354
_finalize(js::FreeOp* fop, JSObject* obj)
355
0
{
356
0
  mozilla::dom::ValidityState* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::dom::ValidityState>(obj);
357
0
  if (self) {
358
0
    ClearWrapper(self, self, obj);
359
0
    AddForDeferredFinalization<mozilla::dom::ValidityState>(self);
360
0
  }
361
0
}
362
363
static size_t
364
_objectMoved(JSObject* obj, JSObject* old)
365
0
{
366
0
  mozilla::dom::ValidityState* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::dom::ValidityState>(obj);
367
0
  if (self) {
368
0
    UpdateWrapper(self, self, obj, old);
369
0
  }
370
0
371
0
  return 0;
372
0
}
373
374
// We deliberately use brace-elision to make Visual Studio produce better initalization code.
375
#if defined(__clang__)
376
#pragma clang diagnostic push
377
#pragma clang diagnostic ignored "-Wmissing-braces"
378
#endif
379
static const JSPropertySpec sAttributes_specs[] = {
380
  { "valueMissing", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &valueMissing_getterinfo, nullptr, nullptr },
381
  { "typeMismatch", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &typeMismatch_getterinfo, nullptr, nullptr },
382
  { "patternMismatch", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &patternMismatch_getterinfo, nullptr, nullptr },
383
  { "tooLong", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &tooLong_getterinfo, nullptr, nullptr },
384
  { "tooShort", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &tooShort_getterinfo, nullptr, nullptr },
385
  { "rangeUnderflow", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &rangeUnderflow_getterinfo, nullptr, nullptr },
386
  { "rangeOverflow", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &rangeOverflow_getterinfo, nullptr, nullptr },
387
  { "stepMismatch", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &stepMismatch_getterinfo, nullptr, nullptr },
388
  { "badInput", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &badInput_getterinfo, nullptr, nullptr },
389
  { "customError", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &customError_getterinfo, nullptr, nullptr },
390
  { "valid", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &valid_getterinfo, nullptr, nullptr },
391
  { nullptr, 0, nullptr, nullptr, nullptr, nullptr }
392
};
393
#if defined(__clang__)
394
#pragma clang diagnostic pop
395
#endif
396
397
398
static const Prefable<const JSPropertySpec> sAttributes[] = {
399
  { nullptr, &sAttributes_specs[0] },
400
  { nullptr, nullptr }
401
};
402
403
static_assert(1 <= 1ull << NUM_BITS_PROPERTY_INFO_PREF_INDEX,
404
    "We have a prefable index that is >= (1 << NUM_BITS_PROPERTY_INFO_PREF_INDEX)");
405
static_assert(11 <= 1ull << NUM_BITS_PROPERTY_INFO_SPEC_INDEX,
406
    "We have a spec index that is >= (1 << NUM_BITS_PROPERTY_INFO_SPEC_INDEX)");
407
408
409
static uint16_t sNativeProperties_sortedPropertyIndices[11];
410
static PropertyInfo sNativeProperties_propertyInfos[11];
411
412
static const NativePropertiesN<1> sNativeProperties = {
413
  false, 0,
414
  false, 0,
415
  false, 0,
416
  true,  0 /* sAttributes */,
417
  false, 0,
418
  false, 0,
419
  false, 0,
420
  -1,
421
  11,
422
  sNativeProperties_sortedPropertyIndices,
423
  {
424
    { sAttributes, &sNativeProperties_propertyInfos[0] }
425
  }
426
};
427
static_assert(11 < 1ull << CHAR_BIT * sizeof(sNativeProperties.propertyInfoCount),
428
    "We have a property info count that is oversized");
429
430
static const DOMIfaceAndProtoJSClass sInterfaceObjectClass = {
431
  {
432
    "Function",
433
    JSCLASS_IS_DOMIFACEANDPROTOJSCLASS | JSCLASS_HAS_RESERVED_SLOTS(DOM_INTERFACE_SLOTS_BASE),
434
    &sBoringInterfaceObjectClassClassOps,
435
    JS_NULL_CLASS_SPEC,
436
    JS_NULL_CLASS_EXT,
437
    &sInterfaceObjectClassObjectOps
438
  },
439
  eInterface,
440
  true,
441
  prototypes::id::ValidityState,
442
  PrototypeTraits<prototypes::id::ValidityState>::Depth,
443
  sNativePropertyHooks,
444
  "function ValidityState() {\n    [native code]\n}",
445
  JS::GetRealmFunctionPrototype
446
};
447
448
static const DOMIfaceAndProtoJSClass sPrototypeClass = {
449
  {
450
    "ValidityStatePrototype",
451
    JSCLASS_IS_DOMIFACEANDPROTOJSCLASS | JSCLASS_HAS_RESERVED_SLOTS(DOM_INTERFACE_PROTO_SLOTS_BASE),
452
    JS_NULL_CLASS_OPS,
453
    JS_NULL_CLASS_SPEC,
454
    JS_NULL_CLASS_EXT,
455
    JS_NULL_OBJECT_OPS
456
  },
457
  eInterfacePrototype,
458
  false,
459
  prototypes::id::ValidityState,
460
  PrototypeTraits<prototypes::id::ValidityState>::Depth,
461
  sNativePropertyHooks,
462
  "[object ValidityStatePrototype]",
463
  JS::GetRealmObjectPrototype
464
};
465
466
static const js::ClassOps sClassOps = {
467
  _addProperty, /* addProperty */
468
  nullptr,               /* delProperty */
469
  nullptr,               /* enumerate */
470
  nullptr, /* newEnumerate */
471
  nullptr, /* resolve */
472
  nullptr, /* mayResolve */
473
  _finalize, /* finalize */
474
  nullptr, /* call */
475
  nullptr,               /* hasInstance */
476
  nullptr,               /* construct */
477
  nullptr, /* trace */
478
};
479
480
static const js::ClassExtension sClassExtension = {
481
  nullptr, /* weakmapKeyDelegateOp */
482
  _objectMoved /* objectMovedOp */
483
};
484
485
static const DOMJSClass sClass = {
486
  { "ValidityState",
487
    JSCLASS_IS_DOMJSCLASS | JSCLASS_FOREGROUND_FINALIZE | JSCLASS_HAS_RESERVED_SLOTS(1),
488
    &sClassOps,
489
    JS_NULL_CLASS_SPEC,
490
    &sClassExtension,
491
    JS_NULL_OBJECT_OPS
492
  },
493
  { prototypes::id::ValidityState, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count },
494
  IsBaseOf<nsISupports, mozilla::dom::ValidityState >::value,
495
  sNativePropertyHooks,
496
  FindAssociatedGlobalForNative<mozilla::dom::ValidityState>::Get,
497
  GetProtoObjectHandle,
498
  GetCCParticipant<mozilla::dom::ValidityState>::Get()
499
};
500
static_assert(1 == DOM_INSTANCE_RESERVED_SLOTS,
501
              "Must have the right minimal number of reserved slots.");
502
static_assert(1 >= 1,
503
              "Must have enough reserved slots.");
504
505
const JSClass*
506
GetJSClass()
507
0
{
508
0
  return sClass.ToJSClass();
509
0
}
510
511
bool
512
Wrap(JSContext* aCx, mozilla::dom::ValidityState* aObject, nsWrapperCache* aCache, JS::Handle<JSObject*> aGivenProto, JS::MutableHandle<JSObject*> aReflector)
513
0
{
514
0
  static_assert(!IsBaseOf<NonRefcountedDOMObject, mozilla::dom::ValidityState>::value,
515
0
                "Shouldn't have wrappercached things that are not refcounted.");
516
0
  MOZ_ASSERT(static_cast<mozilla::dom::ValidityState*>(aObject) ==
517
0
             reinterpret_cast<mozilla::dom::ValidityState*>(aObject),
518
0
             "Multiple inheritance for mozilla::dom::ValidityState is broken.");
519
0
  MOZ_ASSERT(ToSupportsIsCorrect(aObject));
520
0
  MOZ_ASSERT_IF(aGivenProto, js::IsObjectInContextCompartment(aGivenProto, aCx));
521
0
  MOZ_ASSERT(!aCache->GetWrapper(),
522
0
             "You should probably not be using Wrap() directly; use "
523
0
             "GetOrCreateDOMReflector instead");
524
0
525
0
  MOZ_ASSERT(ToSupportsIsOnPrimaryInheritanceChain(aObject, aCache),
526
0
             "nsISupports must be on our primary inheritance chain");
527
0
528
0
  JS::Rooted<JSObject*> global(aCx, FindAssociatedGlobal(aCx, aObject->GetParentObject()));
529
0
  if (!global) {
530
0
    return false;
531
0
  }
532
0
  MOZ_ASSERT(JS_IsGlobalObject(global));
533
0
  MOZ_ASSERT(JS::ObjectIsNotGray(global));
534
0
535
0
  // That might have ended up wrapping us already, due to the wonders
536
0
  // of XBL.  Check for that, and bail out as needed.
537
0
  aReflector.set(aCache->GetWrapper());
538
0
  if (aReflector) {
539
#ifdef DEBUG
540
    AssertReflectorHasGivenProto(aCx, aReflector, aGivenProto);
541
#endif // DEBUG
542
    return true;
543
0
  }
544
0
545
0
  JSAutoRealm ar(aCx, global);
546
0
  JS::Handle<JSObject*> canonicalProto = GetProtoObjectHandle(aCx);
547
0
  if (!canonicalProto) {
548
0
    return false;
549
0
  }
550
0
  JS::Rooted<JSObject*> proto(aCx);
551
0
  if (aGivenProto) {
552
0
    proto = aGivenProto;
553
0
    // Unfortunately, while aGivenProto was in the compartment of aCx
554
0
    // coming in, we changed compartments to that of "parent" so may need
555
0
    // to wrap the proto here.
556
0
    if (js::GetContextCompartment(aCx) != js::GetObjectCompartment(proto)) {
557
0
      if (!JS_WrapObject(aCx, &proto)) {
558
0
        return false;
559
0
      }
560
0
    }
561
0
  } else {
562
0
    proto = canonicalProto;
563
0
  }
564
0
565
0
  BindingJSObjectCreator<mozilla::dom::ValidityState> creator(aCx);
566
0
  creator.CreateObject(aCx, sClass.ToJSClass(), proto, aObject, aReflector);
567
0
  if (!aReflector) {
568
0
    return false;
569
0
  }
570
0
571
0
  aCache->SetWrapper(aReflector);
572
0
  creator.InitializationSucceeded();
573
0
574
0
  MOZ_ASSERT(aCache->GetWrapperPreserveColor() &&
575
0
             aCache->GetWrapperPreserveColor() == aReflector);
576
0
  // If proto != canonicalProto, we have to preserve our wrapper;
577
0
  // otherwise we won't be able to properly recreate it later, since
578
0
  // we won't know what proto to use.  Note that we don't check
579
0
  // aGivenProto here, since it's entirely possible (and even
580
0
  // somewhat common) to have a non-null aGivenProto which is the
581
0
  // same as canonicalProto.
582
0
  if (proto != canonicalProto) {
583
0
    PreserveWrapper(aObject);
584
0
  }
585
0
586
0
  return true;
587
0
}
588
589
const NativePropertyHooks sNativePropertyHooks[] = { {
590
  nullptr,
591
  nullptr,
592
  nullptr,
593
  { sNativeProperties.Upcast(), nullptr },
594
  prototypes::id::ValidityState,
595
  constructors::id::ValidityState,
596
  nullptr,
597
  &DefaultXrayExpandoObjectClass
598
} };
599
600
void
601
CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, bool aDefineOnGlobal)
602
0
{
603
0
  JS::Rooted<JSObject*> parentProto(aCx, JS::GetRealmObjectPrototype(aCx));
604
0
  if (!parentProto) {
605
0
    return;
606
0
  }
607
0
608
0
  JS::Rooted<JSObject*> constructorProto(aCx, JS::GetRealmFunctionPrototype(aCx));
609
0
  if (!constructorProto) {
610
0
    return;
611
0
  }
612
0
613
0
  static bool sIdsInited = false;
614
0
  if (!sIdsInited && NS_IsMainThread()) {
615
0
    if (!InitIds(aCx, sNativeProperties.Upcast())) {
616
0
      return;
617
0
    }
618
0
    sIdsInited = true;
619
0
  }
620
0
621
0
  JS::Heap<JSObject*>* protoCache = &aProtoAndIfaceCache.EntrySlotOrCreate(prototypes::id::ValidityState);
622
0
  JS::Heap<JSObject*>* interfaceCache = &aProtoAndIfaceCache.EntrySlotOrCreate(constructors::id::ValidityState);
623
0
  dom::CreateInterfaceObjects(aCx, aGlobal, parentProto,
624
0
                              &sPrototypeClass.mBase, protoCache,
625
0
                              nullptr,
626
0
                              constructorProto, &sInterfaceObjectClass.mBase, 0, nullptr,
627
0
                              interfaceCache,
628
0
                              sNativeProperties.Upcast(),
629
0
                              nullptr,
630
0
                              "ValidityState", aDefineOnGlobal,
631
0
                              nullptr,
632
0
                              false);
633
0
}
634
635
JSObject*
636
GetConstructorObject(JSContext* aCx)
637
0
{
638
0
  return GetConstructorObjectHandle(aCx);
639
0
}
640
641
} // namespace ValidityState_Binding
642
643
644
645
} // namespace dom
646
} // namespace mozilla