Coverage Report

Created: 2018-09-25 14:53

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