Coverage Report

Created: 2018-09-25 14:53

/work/obj-fuzz/dom/bindings/HTMLButtonElementBinding.cpp
Line
Count
Source (jump to first uncovered line)
1
/* THIS FILE IS AUTOGENERATED FROM HTMLButtonElement.webidl BY Codegen.py - DO NOT EDIT */
2
3
#include "HTMLButtonElementBinding.h"
4
#include "HTMLElementBinding.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/HTMLButtonElement.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 "nsINodeList.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 HTMLButtonElement_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_autofocus(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLButtonElement* self, JSJitGetterCallArgs args)
34
0
{
35
0
  AUTO_PROFILER_LABEL_FAST("get HTMLButtonElement.autofocus", DOM, cx);
36
0
37
0
  bool result(self->Autofocus());
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_autofocus(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLButtonElement* self, JSJitSetterCallArgs args)
45
0
{
46
0
  AUTO_PROFILER_LABEL_FAST("set HTMLButtonElement.autofocus", 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->SetAutofocus(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 autofocus_getterinfo = {
70
  { (JSJitGetterOp)get_autofocus },
71
  { prototypes::id::HTMLButtonElement },
72
  { PrototypeTraits<prototypes::id::HTMLButtonElement>::Depth },
73
  JSJitInfo::Getter,
74
  JSJitInfo::AliasDOMSets, /* aliasSet.  Not relevant for setters. */
75
  JSVAL_TYPE_BOOLEAN,  /* returnType.  Not relevant for setters. */
76
  true,  /* isInfallible. False in setters. */
77
  true,  /* isMovable.  Not relevant for setters. */
78
  true, /* 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 autofocus_setterinfo = {
87
  { (JSJitGetterOp)set_autofocus },
88
  { prototypes::id::HTMLButtonElement },
89
  { PrototypeTraits<prototypes::id::HTMLButtonElement>::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_disabled(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLButtonElement* self, JSJitGetterCallArgs args)
106
0
{
107
0
  AUTO_PROFILER_LABEL_FAST("get HTMLButtonElement.disabled", DOM, cx);
108
0
109
0
  bool result(self->Disabled());
110
0
  MOZ_ASSERT(!JS_IsExceptionPending(cx));
111
0
  args.rval().setBoolean(result);
112
0
  return true;
113
0
}
114
115
MOZ_CAN_RUN_SCRIPT static bool
116
set_disabled(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLButtonElement* self, JSJitSetterCallArgs args)
117
0
{
118
0
  AUTO_PROFILER_LABEL_FAST("set HTMLButtonElement.disabled", DOM, cx);
119
0
120
0
  bool arg0;
121
0
  if (!ValueToPrimitive<bool, eDefault>(cx, args[0], &arg0)) {
122
0
    return false;
123
0
  }
124
0
  Maybe<AutoCEReaction> ceReaction;
125
0
  if (CustomElementRegistry::IsCustomElementEnabled(cx, obj)) {
126
0
    DocGroup* docGroup = self->GetDocGroup();
127
0
    if (docGroup) {
128
0
      ceReaction.emplace(docGroup->CustomElementReactionsStack(), cx);
129
0
    }
130
0
  }
131
0
  FastErrorResult rv;
132
0
  self->SetDisabled(arg0, rv);
133
0
  if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
134
0
    return false;
135
0
  }
136
0
  MOZ_ASSERT(!JS_IsExceptionPending(cx));
137
0
138
0
  return true;
139
0
}
140
141
static const JSJitInfo disabled_getterinfo = {
142
  { (JSJitGetterOp)get_disabled },
143
  { prototypes::id::HTMLButtonElement },
144
  { PrototypeTraits<prototypes::id::HTMLButtonElement>::Depth },
145
  JSJitInfo::Getter,
146
  JSJitInfo::AliasDOMSets, /* aliasSet.  Not relevant for setters. */
147
  JSVAL_TYPE_BOOLEAN,  /* returnType.  Not relevant for setters. */
148
  true,  /* isInfallible. False in setters. */
149
  true,  /* isMovable.  Not relevant for setters. */
150
  true, /* isEliminatable.  Not relevant for setters. */
151
  false, /* isAlwaysInSlot.  Only relevant for getters. */
152
  false, /* isLazilyCachedInSlot.  Only relevant for getters. */
153
  false,  /* isTypedMethod.  Only relevant for methods. */
154
  0   /* Reserved slot index, if we're stored in a slot, else 0. */
155
};
156
static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
157
static_assert(0 < 1, "There is no slot for us");
158
static const JSJitInfo disabled_setterinfo = {
159
  { (JSJitGetterOp)set_disabled },
160
  { prototypes::id::HTMLButtonElement },
161
  { PrototypeTraits<prototypes::id::HTMLButtonElement>::Depth },
162
  JSJitInfo::Setter,
163
  JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
164
  JSVAL_TYPE_UNDEFINED,  /* returnType.  Not relevant for setters. */
165
  false,  /* isInfallible. False in setters. */
166
  false,  /* isMovable.  Not relevant for setters. */
167
  false, /* isEliminatable.  Not relevant for setters. */
168
  false, /* isAlwaysInSlot.  Only relevant for getters. */
169
  false, /* isLazilyCachedInSlot.  Only relevant for getters. */
170
  false,  /* isTypedMethod.  Only relevant for methods. */
171
  0   /* Reserved slot index, if we're stored in a slot, else 0. */
172
};
173
static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
174
static_assert(0 < 1, "There is no slot for us");
175
176
MOZ_CAN_RUN_SCRIPT static bool
177
get_form(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLButtonElement* self, JSJitGetterCallArgs args)
178
0
{
179
0
  AUTO_PROFILER_LABEL_FAST("get HTMLButtonElement.form", DOM, cx);
180
0
181
0
  auto result(StrongOrRawPtr<mozilla::dom::HTMLFormElement>(self->GetForm()));
182
0
  MOZ_ASSERT(!JS_IsExceptionPending(cx));
183
0
  if (!result) {
184
0
    args.rval().setNull();
185
0
    return true;
186
0
  }
187
0
  if (!GetOrCreateDOMReflector(cx, result, args.rval())) {
188
0
    MOZ_ASSERT(JS_IsExceptionPending(cx));
189
0
    return false;
190
0
  }
191
0
  return true;
192
0
}
193
194
static const JSJitInfo form_getterinfo = {
195
  { (JSJitGetterOp)get_form },
196
  { prototypes::id::HTMLButtonElement },
197
  { PrototypeTraits<prototypes::id::HTMLButtonElement>::Depth },
198
  JSJitInfo::Getter,
199
  JSJitInfo::AliasDOMSets, /* aliasSet.  Not relevant for setters. */
200
  JSVAL_TYPE_UNKNOWN,  /* returnType.  Not relevant for setters. */
201
  false,  /* isInfallible. False in setters. */
202
  true,  /* isMovable.  Not relevant for setters. */
203
  true, /* isEliminatable.  Not relevant for setters. */
204
  false, /* isAlwaysInSlot.  Only relevant for getters. */
205
  false, /* isLazilyCachedInSlot.  Only relevant for getters. */
206
  false,  /* isTypedMethod.  Only relevant for methods. */
207
  0   /* Reserved slot index, if we're stored in a slot, else 0. */
208
};
209
static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
210
static_assert(0 < 1, "There is no slot for us");
211
212
MOZ_CAN_RUN_SCRIPT static bool
213
get_formAction(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLButtonElement* self, JSJitGetterCallArgs args)
214
0
{
215
0
  AUTO_PROFILER_LABEL_FAST("get HTMLButtonElement.formAction", DOM, cx);
216
0
217
0
  DOMString result;
218
0
  self->GetFormAction(result);
219
0
  MOZ_ASSERT(!JS_IsExceptionPending(cx));
220
0
  if (!xpc::NonVoidStringToJsval(cx, result, args.rval())) {
221
0
    return false;
222
0
  }
223
0
  return true;
224
0
}
225
226
MOZ_CAN_RUN_SCRIPT static bool
227
set_formAction(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLButtonElement* self, JSJitSetterCallArgs args)
228
0
{
229
0
  AUTO_PROFILER_LABEL_FAST("set HTMLButtonElement.formAction", DOM, cx);
230
0
231
0
  binding_detail::FakeString arg0;
232
0
  if (!ConvertJSValueToString(cx, args[0], eStringify, eStringify, arg0)) {
233
0
    return false;
234
0
  }
235
0
  Maybe<AutoCEReaction> ceReaction;
236
0
  if (CustomElementRegistry::IsCustomElementEnabled(cx, obj)) {
237
0
    DocGroup* docGroup = self->GetDocGroup();
238
0
    if (docGroup) {
239
0
      ceReaction.emplace(docGroup->CustomElementReactionsStack(), cx);
240
0
    }
241
0
  }
242
0
  FastErrorResult rv;
243
0
  self->SetFormAction(NonNullHelper(Constify(arg0)), rv);
244
0
  if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
245
0
    return false;
246
0
  }
247
0
  MOZ_ASSERT(!JS_IsExceptionPending(cx));
248
0
249
0
  return true;
250
0
}
251
252
static const JSJitInfo formAction_getterinfo = {
253
  { (JSJitGetterOp)get_formAction },
254
  { prototypes::id::HTMLButtonElement },
255
  { PrototypeTraits<prototypes::id::HTMLButtonElement>::Depth },
256
  JSJitInfo::Getter,
257
  JSJitInfo::AliasDOMSets, /* aliasSet.  Not relevant for setters. */
258
  JSVAL_TYPE_STRING,  /* returnType.  Not relevant for setters. */
259
  false,  /* isInfallible. False in setters. */
260
  true,  /* isMovable.  Not relevant for setters. */
261
  true, /* isEliminatable.  Not relevant for setters. */
262
  false, /* isAlwaysInSlot.  Only relevant for getters. */
263
  false, /* isLazilyCachedInSlot.  Only relevant for getters. */
264
  false,  /* isTypedMethod.  Only relevant for methods. */
265
  0   /* Reserved slot index, if we're stored in a slot, else 0. */
266
};
267
static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
268
static_assert(0 < 1, "There is no slot for us");
269
static const JSJitInfo formAction_setterinfo = {
270
  { (JSJitGetterOp)set_formAction },
271
  { prototypes::id::HTMLButtonElement },
272
  { PrototypeTraits<prototypes::id::HTMLButtonElement>::Depth },
273
  JSJitInfo::Setter,
274
  JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
275
  JSVAL_TYPE_UNDEFINED,  /* returnType.  Not relevant for setters. */
276
  false,  /* isInfallible. False in setters. */
277
  false,  /* isMovable.  Not relevant for setters. */
278
  false, /* isEliminatable.  Not relevant for setters. */
279
  false, /* isAlwaysInSlot.  Only relevant for getters. */
280
  false, /* isLazilyCachedInSlot.  Only relevant for getters. */
281
  false,  /* isTypedMethod.  Only relevant for methods. */
282
  0   /* Reserved slot index, if we're stored in a slot, else 0. */
283
};
284
static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
285
static_assert(0 < 1, "There is no slot for us");
286
287
MOZ_CAN_RUN_SCRIPT static bool
288
get_formEnctype(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLButtonElement* self, JSJitGetterCallArgs args)
289
0
{
290
0
  AUTO_PROFILER_LABEL_FAST("get HTMLButtonElement.formEnctype", DOM, cx);
291
0
292
0
  DOMString result;
293
0
  self->GetFormEnctype(result);
294
0
  MOZ_ASSERT(!JS_IsExceptionPending(cx));
295
0
  if (!xpc::NonVoidStringToJsval(cx, result, args.rval())) {
296
0
    return false;
297
0
  }
298
0
  return true;
299
0
}
300
301
MOZ_CAN_RUN_SCRIPT static bool
302
set_formEnctype(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLButtonElement* self, JSJitSetterCallArgs args)
303
0
{
304
0
  AUTO_PROFILER_LABEL_FAST("set HTMLButtonElement.formEnctype", DOM, cx);
305
0
306
0
  binding_detail::FakeString arg0;
307
0
  if (!ConvertJSValueToString(cx, args[0], eStringify, eStringify, arg0)) {
308
0
    return false;
309
0
  }
310
0
  Maybe<AutoCEReaction> ceReaction;
311
0
  if (CustomElementRegistry::IsCustomElementEnabled(cx, obj)) {
312
0
    DocGroup* docGroup = self->GetDocGroup();
313
0
    if (docGroup) {
314
0
      ceReaction.emplace(docGroup->CustomElementReactionsStack(), cx);
315
0
    }
316
0
  }
317
0
  FastErrorResult rv;
318
0
  self->SetFormEnctype(NonNullHelper(Constify(arg0)), rv);
319
0
  if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
320
0
    return false;
321
0
  }
322
0
  MOZ_ASSERT(!JS_IsExceptionPending(cx));
323
0
324
0
  return true;
325
0
}
326
327
static const JSJitInfo formEnctype_getterinfo = {
328
  { (JSJitGetterOp)get_formEnctype },
329
  { prototypes::id::HTMLButtonElement },
330
  { PrototypeTraits<prototypes::id::HTMLButtonElement>::Depth },
331
  JSJitInfo::Getter,
332
  JSJitInfo::AliasDOMSets, /* aliasSet.  Not relevant for setters. */
333
  JSVAL_TYPE_STRING,  /* returnType.  Not relevant for setters. */
334
  false,  /* isInfallible. False in setters. */
335
  true,  /* isMovable.  Not relevant for setters. */
336
  true, /* isEliminatable.  Not relevant for setters. */
337
  false, /* isAlwaysInSlot.  Only relevant for getters. */
338
  false, /* isLazilyCachedInSlot.  Only relevant for getters. */
339
  false,  /* isTypedMethod.  Only relevant for methods. */
340
  0   /* Reserved slot index, if we're stored in a slot, else 0. */
341
};
342
static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
343
static_assert(0 < 1, "There is no slot for us");
344
static const JSJitInfo formEnctype_setterinfo = {
345
  { (JSJitGetterOp)set_formEnctype },
346
  { prototypes::id::HTMLButtonElement },
347
  { PrototypeTraits<prototypes::id::HTMLButtonElement>::Depth },
348
  JSJitInfo::Setter,
349
  JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
350
  JSVAL_TYPE_UNDEFINED,  /* returnType.  Not relevant for setters. */
351
  false,  /* isInfallible. False in setters. */
352
  false,  /* isMovable.  Not relevant for setters. */
353
  false, /* isEliminatable.  Not relevant for setters. */
354
  false, /* isAlwaysInSlot.  Only relevant for getters. */
355
  false, /* isLazilyCachedInSlot.  Only relevant for getters. */
356
  false,  /* isTypedMethod.  Only relevant for methods. */
357
  0   /* Reserved slot index, if we're stored in a slot, else 0. */
358
};
359
static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
360
static_assert(0 < 1, "There is no slot for us");
361
362
MOZ_CAN_RUN_SCRIPT static bool
363
get_formMethod(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLButtonElement* self, JSJitGetterCallArgs args)
364
0
{
365
0
  AUTO_PROFILER_LABEL_FAST("get HTMLButtonElement.formMethod", DOM, cx);
366
0
367
0
  DOMString result;
368
0
  self->GetFormMethod(result);
369
0
  MOZ_ASSERT(!JS_IsExceptionPending(cx));
370
0
  if (!xpc::NonVoidStringToJsval(cx, result, args.rval())) {
371
0
    return false;
372
0
  }
373
0
  return true;
374
0
}
375
376
MOZ_CAN_RUN_SCRIPT static bool
377
set_formMethod(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLButtonElement* self, JSJitSetterCallArgs args)
378
0
{
379
0
  AUTO_PROFILER_LABEL_FAST("set HTMLButtonElement.formMethod", DOM, cx);
380
0
381
0
  binding_detail::FakeString arg0;
382
0
  if (!ConvertJSValueToString(cx, args[0], eStringify, eStringify, arg0)) {
383
0
    return false;
384
0
  }
385
0
  Maybe<AutoCEReaction> ceReaction;
386
0
  if (CustomElementRegistry::IsCustomElementEnabled(cx, obj)) {
387
0
    DocGroup* docGroup = self->GetDocGroup();
388
0
    if (docGroup) {
389
0
      ceReaction.emplace(docGroup->CustomElementReactionsStack(), cx);
390
0
    }
391
0
  }
392
0
  FastErrorResult rv;
393
0
  self->SetFormMethod(NonNullHelper(Constify(arg0)), rv);
394
0
  if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
395
0
    return false;
396
0
  }
397
0
  MOZ_ASSERT(!JS_IsExceptionPending(cx));
398
0
399
0
  return true;
400
0
}
401
402
static const JSJitInfo formMethod_getterinfo = {
403
  { (JSJitGetterOp)get_formMethod },
404
  { prototypes::id::HTMLButtonElement },
405
  { PrototypeTraits<prototypes::id::HTMLButtonElement>::Depth },
406
  JSJitInfo::Getter,
407
  JSJitInfo::AliasDOMSets, /* aliasSet.  Not relevant for setters. */
408
  JSVAL_TYPE_STRING,  /* returnType.  Not relevant for setters. */
409
  false,  /* isInfallible. False in setters. */
410
  true,  /* isMovable.  Not relevant for setters. */
411
  true, /* isEliminatable.  Not relevant for setters. */
412
  false, /* isAlwaysInSlot.  Only relevant for getters. */
413
  false, /* isLazilyCachedInSlot.  Only relevant for getters. */
414
  false,  /* isTypedMethod.  Only relevant for methods. */
415
  0   /* Reserved slot index, if we're stored in a slot, else 0. */
416
};
417
static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
418
static_assert(0 < 1, "There is no slot for us");
419
static const JSJitInfo formMethod_setterinfo = {
420
  { (JSJitGetterOp)set_formMethod },
421
  { prototypes::id::HTMLButtonElement },
422
  { PrototypeTraits<prototypes::id::HTMLButtonElement>::Depth },
423
  JSJitInfo::Setter,
424
  JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
425
  JSVAL_TYPE_UNDEFINED,  /* returnType.  Not relevant for setters. */
426
  false,  /* isInfallible. False in setters. */
427
  false,  /* isMovable.  Not relevant for setters. */
428
  false, /* isEliminatable.  Not relevant for setters. */
429
  false, /* isAlwaysInSlot.  Only relevant for getters. */
430
  false, /* isLazilyCachedInSlot.  Only relevant for getters. */
431
  false,  /* isTypedMethod.  Only relevant for methods. */
432
  0   /* Reserved slot index, if we're stored in a slot, else 0. */
433
};
434
static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
435
static_assert(0 < 1, "There is no slot for us");
436
437
MOZ_CAN_RUN_SCRIPT static bool
438
get_formNoValidate(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLButtonElement* self, JSJitGetterCallArgs args)
439
0
{
440
0
  AUTO_PROFILER_LABEL_FAST("get HTMLButtonElement.formNoValidate", DOM, cx);
441
0
442
0
  bool result(self->FormNoValidate());
443
0
  MOZ_ASSERT(!JS_IsExceptionPending(cx));
444
0
  args.rval().setBoolean(result);
445
0
  return true;
446
0
}
447
448
MOZ_CAN_RUN_SCRIPT static bool
449
set_formNoValidate(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLButtonElement* self, JSJitSetterCallArgs args)
450
0
{
451
0
  AUTO_PROFILER_LABEL_FAST("set HTMLButtonElement.formNoValidate", DOM, cx);
452
0
453
0
  bool arg0;
454
0
  if (!ValueToPrimitive<bool, eDefault>(cx, args[0], &arg0)) {
455
0
    return false;
456
0
  }
457
0
  Maybe<AutoCEReaction> ceReaction;
458
0
  if (CustomElementRegistry::IsCustomElementEnabled(cx, obj)) {
459
0
    DocGroup* docGroup = self->GetDocGroup();
460
0
    if (docGroup) {
461
0
      ceReaction.emplace(docGroup->CustomElementReactionsStack(), cx);
462
0
    }
463
0
  }
464
0
  FastErrorResult rv;
465
0
  self->SetFormNoValidate(arg0, rv);
466
0
  if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
467
0
    return false;
468
0
  }
469
0
  MOZ_ASSERT(!JS_IsExceptionPending(cx));
470
0
471
0
  return true;
472
0
}
473
474
static const JSJitInfo formNoValidate_getterinfo = {
475
  { (JSJitGetterOp)get_formNoValidate },
476
  { prototypes::id::HTMLButtonElement },
477
  { PrototypeTraits<prototypes::id::HTMLButtonElement>::Depth },
478
  JSJitInfo::Getter,
479
  JSJitInfo::AliasDOMSets, /* aliasSet.  Not relevant for setters. */
480
  JSVAL_TYPE_BOOLEAN,  /* returnType.  Not relevant for setters. */
481
  true,  /* isInfallible. False in setters. */
482
  true,  /* isMovable.  Not relevant for setters. */
483
  true, /* isEliminatable.  Not relevant for setters. */
484
  false, /* isAlwaysInSlot.  Only relevant for getters. */
485
  false, /* isLazilyCachedInSlot.  Only relevant for getters. */
486
  false,  /* isTypedMethod.  Only relevant for methods. */
487
  0   /* Reserved slot index, if we're stored in a slot, else 0. */
488
};
489
static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
490
static_assert(0 < 1, "There is no slot for us");
491
static const JSJitInfo formNoValidate_setterinfo = {
492
  { (JSJitGetterOp)set_formNoValidate },
493
  { prototypes::id::HTMLButtonElement },
494
  { PrototypeTraits<prototypes::id::HTMLButtonElement>::Depth },
495
  JSJitInfo::Setter,
496
  JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
497
  JSVAL_TYPE_UNDEFINED,  /* returnType.  Not relevant for setters. */
498
  false,  /* isInfallible. False in setters. */
499
  false,  /* isMovable.  Not relevant for setters. */
500
  false, /* isEliminatable.  Not relevant for setters. */
501
  false, /* isAlwaysInSlot.  Only relevant for getters. */
502
  false, /* isLazilyCachedInSlot.  Only relevant for getters. */
503
  false,  /* isTypedMethod.  Only relevant for methods. */
504
  0   /* Reserved slot index, if we're stored in a slot, else 0. */
505
};
506
static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
507
static_assert(0 < 1, "There is no slot for us");
508
509
MOZ_CAN_RUN_SCRIPT static bool
510
get_formTarget(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLButtonElement* self, JSJitGetterCallArgs args)
511
0
{
512
0
  AUTO_PROFILER_LABEL_FAST("get HTMLButtonElement.formTarget", DOM, cx);
513
0
514
0
  DOMString result;
515
0
  self->GetFormTarget(result);
516
0
  MOZ_ASSERT(!JS_IsExceptionPending(cx));
517
0
  if (!xpc::NonVoidStringToJsval(cx, result, args.rval())) {
518
0
    return false;
519
0
  }
520
0
  return true;
521
0
}
522
523
MOZ_CAN_RUN_SCRIPT static bool
524
set_formTarget(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLButtonElement* self, JSJitSetterCallArgs args)
525
0
{
526
0
  AUTO_PROFILER_LABEL_FAST("set HTMLButtonElement.formTarget", DOM, cx);
527
0
528
0
  binding_detail::FakeString arg0;
529
0
  if (!ConvertJSValueToString(cx, args[0], eStringify, eStringify, arg0)) {
530
0
    return false;
531
0
  }
532
0
  Maybe<AutoCEReaction> ceReaction;
533
0
  if (CustomElementRegistry::IsCustomElementEnabled(cx, obj)) {
534
0
    DocGroup* docGroup = self->GetDocGroup();
535
0
    if (docGroup) {
536
0
      ceReaction.emplace(docGroup->CustomElementReactionsStack(), cx);
537
0
    }
538
0
  }
539
0
  FastErrorResult rv;
540
0
  self->SetFormTarget(NonNullHelper(Constify(arg0)), rv);
541
0
  if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
542
0
    return false;
543
0
  }
544
0
  MOZ_ASSERT(!JS_IsExceptionPending(cx));
545
0
546
0
  return true;
547
0
}
548
549
static const JSJitInfo formTarget_getterinfo = {
550
  { (JSJitGetterOp)get_formTarget },
551
  { prototypes::id::HTMLButtonElement },
552
  { PrototypeTraits<prototypes::id::HTMLButtonElement>::Depth },
553
  JSJitInfo::Getter,
554
  JSJitInfo::AliasDOMSets, /* aliasSet.  Not relevant for setters. */
555
  JSVAL_TYPE_STRING,  /* returnType.  Not relevant for setters. */
556
  false,  /* isInfallible. False in setters. */
557
  true,  /* isMovable.  Not relevant for setters. */
558
  true, /* isEliminatable.  Not relevant for setters. */
559
  false, /* isAlwaysInSlot.  Only relevant for getters. */
560
  false, /* isLazilyCachedInSlot.  Only relevant for getters. */
561
  false,  /* isTypedMethod.  Only relevant for methods. */
562
  0   /* Reserved slot index, if we're stored in a slot, else 0. */
563
};
564
static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
565
static_assert(0 < 1, "There is no slot for us");
566
static const JSJitInfo formTarget_setterinfo = {
567
  { (JSJitGetterOp)set_formTarget },
568
  { prototypes::id::HTMLButtonElement },
569
  { PrototypeTraits<prototypes::id::HTMLButtonElement>::Depth },
570
  JSJitInfo::Setter,
571
  JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
572
  JSVAL_TYPE_UNDEFINED,  /* returnType.  Not relevant for setters. */
573
  false,  /* isInfallible. False in setters. */
574
  false,  /* isMovable.  Not relevant for setters. */
575
  false, /* isEliminatable.  Not relevant for setters. */
576
  false, /* isAlwaysInSlot.  Only relevant for getters. */
577
  false, /* isLazilyCachedInSlot.  Only relevant for getters. */
578
  false,  /* isTypedMethod.  Only relevant for methods. */
579
  0   /* Reserved slot index, if we're stored in a slot, else 0. */
580
};
581
static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
582
static_assert(0 < 1, "There is no slot for us");
583
584
MOZ_CAN_RUN_SCRIPT static bool
585
get_name(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLButtonElement* self, JSJitGetterCallArgs args)
586
0
{
587
0
  AUTO_PROFILER_LABEL_FAST("get HTMLButtonElement.name", DOM, cx);
588
0
589
0
  DOMString result;
590
0
  self->GetName(result);
591
0
  MOZ_ASSERT(!JS_IsExceptionPending(cx));
592
0
  if (!xpc::NonVoidStringToJsval(cx, result, args.rval())) {
593
0
    return false;
594
0
  }
595
0
  return true;
596
0
}
597
598
MOZ_CAN_RUN_SCRIPT static bool
599
set_name(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLButtonElement* self, JSJitSetterCallArgs args)
600
0
{
601
0
  AUTO_PROFILER_LABEL_FAST("set HTMLButtonElement.name", DOM, cx);
602
0
603
0
  binding_detail::FakeString arg0;
604
0
  if (!ConvertJSValueToString(cx, args[0], eStringify, eStringify, arg0)) {
605
0
    return false;
606
0
  }
607
0
  Maybe<AutoCEReaction> ceReaction;
608
0
  if (CustomElementRegistry::IsCustomElementEnabled(cx, obj)) {
609
0
    DocGroup* docGroup = self->GetDocGroup();
610
0
    if (docGroup) {
611
0
      ceReaction.emplace(docGroup->CustomElementReactionsStack(), cx);
612
0
    }
613
0
  }
614
0
  FastErrorResult rv;
615
0
  self->SetName(NonNullHelper(Constify(arg0)), rv);
616
0
  if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
617
0
    return false;
618
0
  }
619
0
  MOZ_ASSERT(!JS_IsExceptionPending(cx));
620
0
621
0
  return true;
622
0
}
623
624
static const JSJitInfo name_getterinfo = {
625
  { (JSJitGetterOp)get_name },
626
  { prototypes::id::HTMLButtonElement },
627
  { PrototypeTraits<prototypes::id::HTMLButtonElement>::Depth },
628
  JSJitInfo::Getter,
629
  JSJitInfo::AliasDOMSets, /* aliasSet.  Not relevant for setters. */
630
  JSVAL_TYPE_STRING,  /* returnType.  Not relevant for setters. */
631
  false,  /* isInfallible. False in setters. */
632
  true,  /* isMovable.  Not relevant for setters. */
633
  true, /* isEliminatable.  Not relevant for setters. */
634
  false, /* isAlwaysInSlot.  Only relevant for getters. */
635
  false, /* isLazilyCachedInSlot.  Only relevant for getters. */
636
  false,  /* isTypedMethod.  Only relevant for methods. */
637
  0   /* Reserved slot index, if we're stored in a slot, else 0. */
638
};
639
static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
640
static_assert(0 < 1, "There is no slot for us");
641
static const JSJitInfo name_setterinfo = {
642
  { (JSJitGetterOp)set_name },
643
  { prototypes::id::HTMLButtonElement },
644
  { PrototypeTraits<prototypes::id::HTMLButtonElement>::Depth },
645
  JSJitInfo::Setter,
646
  JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
647
  JSVAL_TYPE_UNDEFINED,  /* returnType.  Not relevant for setters. */
648
  false,  /* isInfallible. False in setters. */
649
  false,  /* isMovable.  Not relevant for setters. */
650
  false, /* isEliminatable.  Not relevant for setters. */
651
  false, /* isAlwaysInSlot.  Only relevant for getters. */
652
  false, /* isLazilyCachedInSlot.  Only relevant for getters. */
653
  false,  /* isTypedMethod.  Only relevant for methods. */
654
  0   /* Reserved slot index, if we're stored in a slot, else 0. */
655
};
656
static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
657
static_assert(0 < 1, "There is no slot for us");
658
659
MOZ_CAN_RUN_SCRIPT static bool
660
get_type(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLButtonElement* self, JSJitGetterCallArgs args)
661
0
{
662
0
  AUTO_PROFILER_LABEL_FAST("get HTMLButtonElement.type", DOM, cx);
663
0
664
0
  DOMString result;
665
0
  self->GetType(result);
666
0
  MOZ_ASSERT(!JS_IsExceptionPending(cx));
667
0
  if (!xpc::NonVoidStringToJsval(cx, result, args.rval())) {
668
0
    return false;
669
0
  }
670
0
  return true;
671
0
}
672
673
MOZ_CAN_RUN_SCRIPT static bool
674
set_type(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLButtonElement* self, JSJitSetterCallArgs args)
675
0
{
676
0
  AUTO_PROFILER_LABEL_FAST("set HTMLButtonElement.type", DOM, cx);
677
0
678
0
  binding_detail::FakeString arg0;
679
0
  if (!ConvertJSValueToString(cx, args[0], eStringify, eStringify, arg0)) {
680
0
    return false;
681
0
  }
682
0
  Maybe<AutoCEReaction> ceReaction;
683
0
  if (CustomElementRegistry::IsCustomElementEnabled(cx, obj)) {
684
0
    DocGroup* docGroup = self->GetDocGroup();
685
0
    if (docGroup) {
686
0
      ceReaction.emplace(docGroup->CustomElementReactionsStack(), cx);
687
0
    }
688
0
  }
689
0
  FastErrorResult rv;
690
0
  self->SetType(NonNullHelper(Constify(arg0)), rv);
691
0
  if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
692
0
    return false;
693
0
  }
694
0
  MOZ_ASSERT(!JS_IsExceptionPending(cx));
695
0
696
0
  return true;
697
0
}
698
699
static const JSJitInfo type_getterinfo = {
700
  { (JSJitGetterOp)get_type },
701
  { prototypes::id::HTMLButtonElement },
702
  { PrototypeTraits<prototypes::id::HTMLButtonElement>::Depth },
703
  JSJitInfo::Getter,
704
  JSJitInfo::AliasDOMSets, /* aliasSet.  Not relevant for setters. */
705
  JSVAL_TYPE_STRING,  /* returnType.  Not relevant for setters. */
706
  false,  /* isInfallible. False in setters. */
707
  true,  /* isMovable.  Not relevant for setters. */
708
  true, /* isEliminatable.  Not relevant for setters. */
709
  false, /* isAlwaysInSlot.  Only relevant for getters. */
710
  false, /* isLazilyCachedInSlot.  Only relevant for getters. */
711
  false,  /* isTypedMethod.  Only relevant for methods. */
712
  0   /* Reserved slot index, if we're stored in a slot, else 0. */
713
};
714
static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
715
static_assert(0 < 1, "There is no slot for us");
716
static const JSJitInfo type_setterinfo = {
717
  { (JSJitGetterOp)set_type },
718
  { prototypes::id::HTMLButtonElement },
719
  { PrototypeTraits<prototypes::id::HTMLButtonElement>::Depth },
720
  JSJitInfo::Setter,
721
  JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
722
  JSVAL_TYPE_UNDEFINED,  /* returnType.  Not relevant for setters. */
723
  false,  /* isInfallible. False in setters. */
724
  false,  /* isMovable.  Not relevant for setters. */
725
  false, /* isEliminatable.  Not relevant for setters. */
726
  false, /* isAlwaysInSlot.  Only relevant for getters. */
727
  false, /* isLazilyCachedInSlot.  Only relevant for getters. */
728
  false,  /* isTypedMethod.  Only relevant for methods. */
729
  0   /* Reserved slot index, if we're stored in a slot, else 0. */
730
};
731
static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
732
static_assert(0 < 1, "There is no slot for us");
733
734
MOZ_CAN_RUN_SCRIPT static bool
735
get_value(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLButtonElement* self, JSJitGetterCallArgs args)
736
0
{
737
0
  AUTO_PROFILER_LABEL_FAST("get HTMLButtonElement.value", DOM, cx);
738
0
739
0
  DOMString result;
740
0
  self->GetValue(result);
741
0
  MOZ_ASSERT(!JS_IsExceptionPending(cx));
742
0
  if (!xpc::NonVoidStringToJsval(cx, result, args.rval())) {
743
0
    return false;
744
0
  }
745
0
  return true;
746
0
}
747
748
MOZ_CAN_RUN_SCRIPT static bool
749
set_value(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLButtonElement* self, JSJitSetterCallArgs args)
750
0
{
751
0
  AUTO_PROFILER_LABEL_FAST("set HTMLButtonElement.value", DOM, cx);
752
0
753
0
  binding_detail::FakeString arg0;
754
0
  if (!ConvertJSValueToString(cx, args[0], eStringify, eStringify, arg0)) {
755
0
    return false;
756
0
  }
757
0
  Maybe<AutoCEReaction> ceReaction;
758
0
  if (CustomElementRegistry::IsCustomElementEnabled(cx, obj)) {
759
0
    DocGroup* docGroup = self->GetDocGroup();
760
0
    if (docGroup) {
761
0
      ceReaction.emplace(docGroup->CustomElementReactionsStack(), cx);
762
0
    }
763
0
  }
764
0
  FastErrorResult rv;
765
0
  self->SetValue(NonNullHelper(Constify(arg0)), rv);
766
0
  if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
767
0
    return false;
768
0
  }
769
0
  MOZ_ASSERT(!JS_IsExceptionPending(cx));
770
0
771
0
  return true;
772
0
}
773
774
static const JSJitInfo value_getterinfo = {
775
  { (JSJitGetterOp)get_value },
776
  { prototypes::id::HTMLButtonElement },
777
  { PrototypeTraits<prototypes::id::HTMLButtonElement>::Depth },
778
  JSJitInfo::Getter,
779
  JSJitInfo::AliasDOMSets, /* aliasSet.  Not relevant for setters. */
780
  JSVAL_TYPE_STRING,  /* returnType.  Not relevant for setters. */
781
  false,  /* isInfallible. False in setters. */
782
  true,  /* isMovable.  Not relevant for setters. */
783
  true, /* isEliminatable.  Not relevant for setters. */
784
  false, /* isAlwaysInSlot.  Only relevant for getters. */
785
  false, /* isLazilyCachedInSlot.  Only relevant for getters. */
786
  false,  /* isTypedMethod.  Only relevant for methods. */
787
  0   /* Reserved slot index, if we're stored in a slot, else 0. */
788
};
789
static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
790
static_assert(0 < 1, "There is no slot for us");
791
static const JSJitInfo value_setterinfo = {
792
  { (JSJitGetterOp)set_value },
793
  { prototypes::id::HTMLButtonElement },
794
  { PrototypeTraits<prototypes::id::HTMLButtonElement>::Depth },
795
  JSJitInfo::Setter,
796
  JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
797
  JSVAL_TYPE_UNDEFINED,  /* returnType.  Not relevant for setters. */
798
  false,  /* isInfallible. False in setters. */
799
  false,  /* isMovable.  Not relevant for setters. */
800
  false, /* isEliminatable.  Not relevant for setters. */
801
  false, /* isAlwaysInSlot.  Only relevant for getters. */
802
  false, /* isLazilyCachedInSlot.  Only relevant for getters. */
803
  false,  /* isTypedMethod.  Only relevant for methods. */
804
  0   /* Reserved slot index, if we're stored in a slot, else 0. */
805
};
806
static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
807
static_assert(0 < 1, "There is no slot for us");
808
809
MOZ_CAN_RUN_SCRIPT static bool
810
get_willValidate(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLButtonElement* self, JSJitGetterCallArgs args)
811
0
{
812
0
  AUTO_PROFILER_LABEL_FAST("get HTMLButtonElement.willValidate", DOM, cx);
813
0
814
0
  bool result(self->WillValidate());
815
0
  MOZ_ASSERT(!JS_IsExceptionPending(cx));
816
0
  args.rval().setBoolean(result);
817
0
  return true;
818
0
}
819
820
static const JSJitInfo willValidate_getterinfo = {
821
  { (JSJitGetterOp)get_willValidate },
822
  { prototypes::id::HTMLButtonElement },
823
  { PrototypeTraits<prototypes::id::HTMLButtonElement>::Depth },
824
  JSJitInfo::Getter,
825
  JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
826
  JSVAL_TYPE_BOOLEAN,  /* returnType.  Not relevant for setters. */
827
  true,  /* isInfallible. False in setters. */
828
  false,  /* isMovable.  Not relevant for setters. */
829
  false, /* isEliminatable.  Not relevant for setters. */
830
  false, /* isAlwaysInSlot.  Only relevant for getters. */
831
  false, /* isLazilyCachedInSlot.  Only relevant for getters. */
832
  false,  /* isTypedMethod.  Only relevant for methods. */
833
  0   /* Reserved slot index, if we're stored in a slot, else 0. */
834
};
835
static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
836
static_assert(0 < 1, "There is no slot for us");
837
838
MOZ_CAN_RUN_SCRIPT static bool
839
get_validity(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLButtonElement* self, JSJitGetterCallArgs args)
840
0
{
841
0
  AUTO_PROFILER_LABEL_FAST("get HTMLButtonElement.validity", DOM, cx);
842
0
843
0
  auto result(StrongOrRawPtr<mozilla::dom::ValidityState>(self->Validity()));
844
0
  MOZ_ASSERT(!JS_IsExceptionPending(cx));
845
0
  if (!GetOrCreateDOMReflector(cx, result, args.rval())) {
846
0
    MOZ_ASSERT(JS_IsExceptionPending(cx));
847
0
    return false;
848
0
  }
849
0
  return true;
850
0
}
851
852
static const JSJitInfo validity_getterinfo = {
853
  { (JSJitGetterOp)get_validity },
854
  { prototypes::id::HTMLButtonElement },
855
  { PrototypeTraits<prototypes::id::HTMLButtonElement>::Depth },
856
  JSJitInfo::Getter,
857
  JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
858
  JSVAL_TYPE_OBJECT,  /* returnType.  Not relevant for setters. */
859
  false,  /* isInfallible. False in setters. */
860
  false,  /* isMovable.  Not relevant for setters. */
861
  false, /* isEliminatable.  Not relevant for setters. */
862
  false, /* isAlwaysInSlot.  Only relevant for getters. */
863
  false, /* isLazilyCachedInSlot.  Only relevant for getters. */
864
  false,  /* isTypedMethod.  Only relevant for methods. */
865
  0   /* Reserved slot index, if we're stored in a slot, else 0. */
866
};
867
static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
868
static_assert(0 < 1, "There is no slot for us");
869
870
MOZ_CAN_RUN_SCRIPT static bool
871
get_validationMessage(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLButtonElement* self, JSJitGetterCallArgs args)
872
0
{
873
0
  AUTO_PROFILER_LABEL_FAST("get HTMLButtonElement.validationMessage", DOM, cx);
874
0
875
0
  FastErrorResult rv;
876
0
  DOMString result;
877
0
  self->GetValidationMessage(result, rv);
878
0
  if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
879
0
    return false;
880
0
  }
881
0
  MOZ_ASSERT(!JS_IsExceptionPending(cx));
882
0
  if (!xpc::NonVoidStringToJsval(cx, result, args.rval())) {
883
0
    return false;
884
0
  }
885
0
  return true;
886
0
}
887
888
static const JSJitInfo validationMessage_getterinfo = {
889
  { (JSJitGetterOp)get_validationMessage },
890
  { prototypes::id::HTMLButtonElement },
891
  { PrototypeTraits<prototypes::id::HTMLButtonElement>::Depth },
892
  JSJitInfo::Getter,
893
  JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
894
  JSVAL_TYPE_STRING,  /* returnType.  Not relevant for setters. */
895
  false,  /* isInfallible. False in setters. */
896
  false,  /* isMovable.  Not relevant for setters. */
897
  false, /* isEliminatable.  Not relevant for setters. */
898
  false, /* isAlwaysInSlot.  Only relevant for getters. */
899
  false, /* isLazilyCachedInSlot.  Only relevant for getters. */
900
  false,  /* isTypedMethod.  Only relevant for methods. */
901
  0   /* Reserved slot index, if we're stored in a slot, else 0. */
902
};
903
static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
904
static_assert(0 < 1, "There is no slot for us");
905
906
MOZ_CAN_RUN_SCRIPT static bool
907
checkValidity(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLButtonElement* self, const JSJitMethodCallArgs& args)
908
0
{
909
0
  AUTO_PROFILER_LABEL_FAST("HTMLButtonElement.checkValidity", DOM, cx);
910
0
911
0
  bool result(self->CheckValidity());
912
0
  MOZ_ASSERT(!JS_IsExceptionPending(cx));
913
0
  args.rval().setBoolean(result);
914
0
  return true;
915
0
}
916
917
static const JSJitInfo checkValidity_methodinfo = {
918
  { (JSJitGetterOp)checkValidity },
919
  { prototypes::id::HTMLButtonElement },
920
  { PrototypeTraits<prototypes::id::HTMLButtonElement>::Depth },
921
  JSJitInfo::Method,
922
  JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
923
  JSVAL_TYPE_BOOLEAN,  /* returnType.  Not relevant for setters. */
924
  true,  /* isInfallible. False in setters. */
925
  false,  /* isMovable.  Not relevant for setters. */
926
  false, /* isEliminatable.  Not relevant for setters. */
927
  false, /* isAlwaysInSlot.  Only relevant for getters. */
928
  false, /* isLazilyCachedInSlot.  Only relevant for getters. */
929
  false,  /* isTypedMethod.  Only relevant for methods. */
930
  0   /* Reserved slot index, if we're stored in a slot, else 0. */
931
};
932
static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
933
static_assert(0 < 1, "There is no slot for us");
934
935
MOZ_CAN_RUN_SCRIPT static bool
936
reportValidity(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLButtonElement* self, const JSJitMethodCallArgs& args)
937
0
{
938
0
  AUTO_PROFILER_LABEL_FAST("HTMLButtonElement.reportValidity", DOM, cx);
939
0
940
0
  bool result(self->ReportValidity());
941
0
  MOZ_ASSERT(!JS_IsExceptionPending(cx));
942
0
  args.rval().setBoolean(result);
943
0
  return true;
944
0
}
945
946
static const JSJitInfo reportValidity_methodinfo = {
947
  { (JSJitGetterOp)reportValidity },
948
  { prototypes::id::HTMLButtonElement },
949
  { PrototypeTraits<prototypes::id::HTMLButtonElement>::Depth },
950
  JSJitInfo::Method,
951
  JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
952
  JSVAL_TYPE_BOOLEAN,  /* returnType.  Not relevant for setters. */
953
  true,  /* isInfallible. False in setters. */
954
  false,  /* isMovable.  Not relevant for setters. */
955
  false, /* isEliminatable.  Not relevant for setters. */
956
  false, /* isAlwaysInSlot.  Only relevant for getters. */
957
  false, /* isLazilyCachedInSlot.  Only relevant for getters. */
958
  false,  /* isTypedMethod.  Only relevant for methods. */
959
  0   /* Reserved slot index, if we're stored in a slot, else 0. */
960
};
961
static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
962
static_assert(0 < 1, "There is no slot for us");
963
964
MOZ_CAN_RUN_SCRIPT static bool
965
setCustomValidity(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLButtonElement* self, const JSJitMethodCallArgs& args)
966
0
{
967
0
  AUTO_PROFILER_LABEL_FAST("HTMLButtonElement.setCustomValidity", DOM, cx);
968
0
969
0
  if (MOZ_UNLIKELY(args.length() < 1)) {
970
0
    return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "HTMLButtonElement.setCustomValidity");
971
0
  }
972
0
  binding_detail::FakeString arg0;
973
0
  if (!ConvertJSValueToString(cx, args[0], eStringify, eStringify, arg0)) {
974
0
    return false;
975
0
  }
976
0
  self->SetCustomValidity(NonNullHelper(Constify(arg0)));
977
0
  MOZ_ASSERT(!JS_IsExceptionPending(cx));
978
0
  args.rval().setUndefined();
979
0
  return true;
980
0
}
981
982
static const JSJitInfo setCustomValidity_methodinfo = {
983
  { (JSJitGetterOp)setCustomValidity },
984
  { prototypes::id::HTMLButtonElement },
985
  { PrototypeTraits<prototypes::id::HTMLButtonElement>::Depth },
986
  JSJitInfo::Method,
987
  JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
988
  JSVAL_TYPE_UNDEFINED,  /* returnType.  Not relevant for setters. */
989
  false,  /* isInfallible. False in setters. */
990
  false,  /* isMovable.  Not relevant for setters. */
991
  false, /* isEliminatable.  Not relevant for setters. */
992
  false, /* isAlwaysInSlot.  Only relevant for getters. */
993
  false, /* isLazilyCachedInSlot.  Only relevant for getters. */
994
  false,  /* isTypedMethod.  Only relevant for methods. */
995
  0   /* Reserved slot index, if we're stored in a slot, else 0. */
996
};
997
static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
998
static_assert(0 < 1, "There is no slot for us");
999
1000
MOZ_CAN_RUN_SCRIPT static bool
1001
get_labels(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLButtonElement* self, JSJitGetterCallArgs args)
1002
0
{
1003
0
  AUTO_PROFILER_LABEL_FAST("get HTMLButtonElement.labels", DOM, cx);
1004
0
1005
0
  auto result(StrongOrRawPtr<nsINodeList>(self->Labels()));
1006
0
  MOZ_ASSERT(!JS_IsExceptionPending(cx));
1007
0
  if (!GetOrCreateDOMReflector(cx, result, args.rval())) {
1008
0
    MOZ_ASSERT(JS_IsExceptionPending(cx));
1009
0
    return false;
1010
0
  }
1011
0
  return true;
1012
0
}
1013
1014
static const JSJitInfo labels_getterinfo = {
1015
  { (JSJitGetterOp)get_labels },
1016
  { prototypes::id::HTMLButtonElement },
1017
  { PrototypeTraits<prototypes::id::HTMLButtonElement>::Depth },
1018
  JSJitInfo::Getter,
1019
  JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
1020
  JSVAL_TYPE_OBJECT,  /* returnType.  Not relevant for setters. */
1021
  false,  /* isInfallible. False in setters. */
1022
  false,  /* isMovable.  Not relevant for setters. */
1023
  false, /* isEliminatable.  Not relevant for setters. */
1024
  false, /* isAlwaysInSlot.  Only relevant for getters. */
1025
  false, /* isLazilyCachedInSlot.  Only relevant for getters. */
1026
  false,  /* isTypedMethod.  Only relevant for methods. */
1027
  0   /* Reserved slot index, if we're stored in a slot, else 0. */
1028
};
1029
static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
1030
static_assert(0 < 1, "There is no slot for us");
1031
1032
static bool
1033
_addProperty(JSContext* cx, JS::Handle<JSObject*> obj, JS::Handle<jsid> id, JS::Handle<JS::Value> val)
1034
0
{
1035
0
  mozilla::dom::HTMLButtonElement* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::dom::HTMLButtonElement>(obj);
1036
0
  // We don't want to preserve if we don't have a wrapper, and we
1037
0
  // obviously can't preserve if we're not initialized.
1038
0
  if (self && self->GetWrapperPreserveColor()) {
1039
0
    PreserveWrapper(self);
1040
0
  }
1041
0
  return true;
1042
0
}
1043
1044
static void
1045
_finalize(js::FreeOp* fop, JSObject* obj)
1046
0
{
1047
0
  mozilla::dom::HTMLButtonElement* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::dom::HTMLButtonElement>(obj);
1048
0
  if (self) {
1049
0
    ClearWrapper(self, self, obj);
1050
0
    AddForDeferredFinalization<mozilla::dom::HTMLButtonElement>(self);
1051
0
  }
1052
0
}
1053
1054
static size_t
1055
_objectMoved(JSObject* obj, JSObject* old)
1056
0
{
1057
0
  mozilla::dom::HTMLButtonElement* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::dom::HTMLButtonElement>(obj);
1058
0
  if (self) {
1059
0
    UpdateWrapper(self, self, obj, old);
1060
0
  }
1061
0
1062
0
  return 0;
1063
0
}
1064
1065
// We deliberately use brace-elision to make Visual Studio produce better initalization code.
1066
#if defined(__clang__)
1067
#pragma clang diagnostic push
1068
#pragma clang diagnostic ignored "-Wmissing-braces"
1069
#endif
1070
static const JSFunctionSpec sMethods_specs[] = {
1071
  JS_FNSPEC("checkValidity", (GenericMethod<NormalThisPolicy, ThrowExceptions>), reinterpret_cast<const JSJitInfo*>(&checkValidity_methodinfo), 0, JSPROP_ENUMERATE, nullptr),
1072
  JS_FNSPEC("reportValidity", (GenericMethod<NormalThisPolicy, ThrowExceptions>), reinterpret_cast<const JSJitInfo*>(&reportValidity_methodinfo), 0, JSPROP_ENUMERATE, nullptr),
1073
  JS_FNSPEC("setCustomValidity", (GenericMethod<NormalThisPolicy, ThrowExceptions>), reinterpret_cast<const JSJitInfo*>(&setCustomValidity_methodinfo), 1, JSPROP_ENUMERATE, nullptr),
1074
  JS_FS_END
1075
};
1076
#if defined(__clang__)
1077
#pragma clang diagnostic pop
1078
#endif
1079
1080
1081
static const Prefable<const JSFunctionSpec> sMethods[] = {
1082
  { nullptr, &sMethods_specs[0] },
1083
  { nullptr, nullptr }
1084
};
1085
1086
static_assert(1 <= 1ull << NUM_BITS_PROPERTY_INFO_PREF_INDEX,
1087
    "We have a prefable index that is >= (1 << NUM_BITS_PROPERTY_INFO_PREF_INDEX)");
1088
static_assert(3 <= 1ull << NUM_BITS_PROPERTY_INFO_SPEC_INDEX,
1089
    "We have a spec index that is >= (1 << NUM_BITS_PROPERTY_INFO_SPEC_INDEX)");
1090
1091
// We deliberately use brace-elision to make Visual Studio produce better initalization code.
1092
#if defined(__clang__)
1093
#pragma clang diagnostic push
1094
#pragma clang diagnostic ignored "-Wmissing-braces"
1095
#endif
1096
static const JSPropertySpec sAttributes_specs[] = {
1097
  { "autofocus", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &autofocus_getterinfo, GenericSetter<NormalThisPolicy>, &autofocus_setterinfo },
1098
  { "disabled", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &disabled_getterinfo, GenericSetter<NormalThisPolicy>, &disabled_setterinfo },
1099
  { "form", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &form_getterinfo, nullptr, nullptr },
1100
  { "formAction", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &formAction_getterinfo, GenericSetter<NormalThisPolicy>, &formAction_setterinfo },
1101
  { "formEnctype", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &formEnctype_getterinfo, GenericSetter<NormalThisPolicy>, &formEnctype_setterinfo },
1102
  { "formMethod", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &formMethod_getterinfo, GenericSetter<NormalThisPolicy>, &formMethod_setterinfo },
1103
  { "formNoValidate", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &formNoValidate_getterinfo, GenericSetter<NormalThisPolicy>, &formNoValidate_setterinfo },
1104
  { "formTarget", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &formTarget_getterinfo, GenericSetter<NormalThisPolicy>, &formTarget_setterinfo },
1105
  { "name", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &name_getterinfo, GenericSetter<NormalThisPolicy>, &name_setterinfo },
1106
  { "type", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &type_getterinfo, GenericSetter<NormalThisPolicy>, &type_setterinfo },
1107
  { "value", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &value_getterinfo, GenericSetter<NormalThisPolicy>, &value_setterinfo },
1108
  { "willValidate", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &willValidate_getterinfo, nullptr, nullptr },
1109
  { "validity", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &validity_getterinfo, nullptr, nullptr },
1110
  { "validationMessage", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &validationMessage_getterinfo, nullptr, nullptr },
1111
  { "labels", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &labels_getterinfo, nullptr, nullptr },
1112
  { nullptr, 0, nullptr, nullptr, nullptr, nullptr }
1113
};
1114
#if defined(__clang__)
1115
#pragma clang diagnostic pop
1116
#endif
1117
1118
1119
static const Prefable<const JSPropertySpec> sAttributes[] = {
1120
  { nullptr, &sAttributes_specs[0] },
1121
  { nullptr, nullptr }
1122
};
1123
1124
static_assert(1 <= 1ull << NUM_BITS_PROPERTY_INFO_PREF_INDEX,
1125
    "We have a prefable index that is >= (1 << NUM_BITS_PROPERTY_INFO_PREF_INDEX)");
1126
static_assert(15 <= 1ull << NUM_BITS_PROPERTY_INFO_SPEC_INDEX,
1127
    "We have a spec index that is >= (1 << NUM_BITS_PROPERTY_INFO_SPEC_INDEX)");
1128
1129
1130
static uint16_t sNativeProperties_sortedPropertyIndices[18];
1131
static PropertyInfo sNativeProperties_propertyInfos[18];
1132
1133
static const NativePropertiesN<2> sNativeProperties = {
1134
  false, 0,
1135
  false, 0,
1136
  true,  0 /* sMethods */,
1137
  true,  1 /* sAttributes */,
1138
  false, 0,
1139
  false, 0,
1140
  false, 0,
1141
  -1,
1142
  18,
1143
  sNativeProperties_sortedPropertyIndices,
1144
  {
1145
    { sMethods, &sNativeProperties_propertyInfos[0] },
1146
    { sAttributes, &sNativeProperties_propertyInfos[3] }
1147
  }
1148
};
1149
static_assert(18 < 1ull << CHAR_BIT * sizeof(sNativeProperties.propertyInfoCount),
1150
    "We have a property info count that is oversized");
1151
1152
static bool
1153
_constructor(JSContext* cx, unsigned argc, JS::Value* vp)
1154
0
{
1155
0
  AUTO_PROFILER_LABEL_FAST("HTMLButtonElement constructor", DOM, cx);
1156
0
1157
0
  return HTMLConstructor(cx, argc, vp,
1158
0
                         constructors::id::HTMLButtonElement,
1159
0
                         prototypes::id::HTMLButtonElement,
1160
0
                         CreateInterfaceObjects);
1161
0
}
1162
1163
static const js::ClassOps sInterfaceObjectClassOps = {
1164
    nullptr,               /* addProperty */
1165
    nullptr,               /* delProperty */
1166
    nullptr,               /* enumerate */
1167
    nullptr,               /* newEnumerate */
1168
    nullptr,               /* resolve */
1169
    nullptr,               /* mayResolve */
1170
    nullptr,               /* finalize */
1171
    _constructor, /* call */
1172
    nullptr,               /* hasInstance */
1173
    _constructor, /* construct */
1174
    nullptr,               /* trace */
1175
};
1176
1177
static const DOMIfaceAndProtoJSClass sInterfaceObjectClass = {
1178
  {
1179
    "Function",
1180
    JSCLASS_IS_DOMIFACEANDPROTOJSCLASS | JSCLASS_HAS_RESERVED_SLOTS(DOM_INTERFACE_SLOTS_BASE),
1181
    &sInterfaceObjectClassOps,
1182
    JS_NULL_CLASS_SPEC,
1183
    JS_NULL_CLASS_EXT,
1184
    &sInterfaceObjectClassObjectOps
1185
  },
1186
  eInterface,
1187
  true,
1188
  prototypes::id::HTMLButtonElement,
1189
  PrototypeTraits<prototypes::id::HTMLButtonElement>::Depth,
1190
  sNativePropertyHooks,
1191
  "function HTMLButtonElement() {\n    [native code]\n}",
1192
  HTMLElement_Binding::GetConstructorObject
1193
};
1194
1195
static const DOMIfaceAndProtoJSClass sPrototypeClass = {
1196
  {
1197
    "HTMLButtonElementPrototype",
1198
    JSCLASS_IS_DOMIFACEANDPROTOJSCLASS | JSCLASS_HAS_RESERVED_SLOTS(DOM_INTERFACE_PROTO_SLOTS_BASE),
1199
    JS_NULL_CLASS_OPS,
1200
    JS_NULL_CLASS_SPEC,
1201
    JS_NULL_CLASS_EXT,
1202
    JS_NULL_OBJECT_OPS
1203
  },
1204
  eInterfacePrototype,
1205
  false,
1206
  prototypes::id::HTMLButtonElement,
1207
  PrototypeTraits<prototypes::id::HTMLButtonElement>::Depth,
1208
  sNativePropertyHooks,
1209
  "[object HTMLButtonElementPrototype]",
1210
  HTMLElement_Binding::GetProtoObject
1211
};
1212
1213
static const js::ClassOps sClassOps = {
1214
  _addProperty, /* addProperty */
1215
  nullptr,               /* delProperty */
1216
  nullptr,               /* enumerate */
1217
  nullptr, /* newEnumerate */
1218
  nullptr, /* resolve */
1219
  nullptr, /* mayResolve */
1220
  _finalize, /* finalize */
1221
  nullptr, /* call */
1222
  nullptr,               /* hasInstance */
1223
  nullptr,               /* construct */
1224
  nullptr, /* trace */
1225
};
1226
1227
static const js::ClassExtension sClassExtension = {
1228
  nullptr, /* weakmapKeyDelegateOp */
1229
  _objectMoved /* objectMovedOp */
1230
};
1231
1232
static const DOMJSClass sClass = {
1233
  { "HTMLButtonElement",
1234
    JSCLASS_IS_DOMJSCLASS | JSCLASS_FOREGROUND_FINALIZE | JSCLASS_HAS_RESERVED_SLOTS(1),
1235
    &sClassOps,
1236
    JS_NULL_CLASS_SPEC,
1237
    &sClassExtension,
1238
    JS_NULL_OBJECT_OPS
1239
  },
1240
  { prototypes::id::EventTarget, prototypes::id::Node, prototypes::id::Element, prototypes::id::HTMLElement, prototypes::id::HTMLButtonElement, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count },
1241
  IsBaseOf<nsISupports, mozilla::dom::HTMLButtonElement >::value,
1242
  sNativePropertyHooks,
1243
  FindAssociatedGlobalForNative<mozilla::dom::HTMLButtonElement>::Get,
1244
  GetProtoObjectHandle,
1245
  GetCCParticipant<mozilla::dom::HTMLButtonElement>::Get()
1246
};
1247
static_assert(1 == DOM_INSTANCE_RESERVED_SLOTS,
1248
              "Must have the right minimal number of reserved slots.");
1249
static_assert(1 >= 1,
1250
              "Must have enough reserved slots.");
1251
1252
const JSClass*
1253
GetJSClass()
1254
0
{
1255
0
  return sClass.ToJSClass();
1256
0
}
1257
1258
bool
1259
Wrap(JSContext* aCx, mozilla::dom::HTMLButtonElement* aObject, nsWrapperCache* aCache, JS::Handle<JSObject*> aGivenProto, JS::MutableHandle<JSObject*> aReflector)
1260
0
{
1261
0
  static_assert(!IsBaseOf<NonRefcountedDOMObject, mozilla::dom::HTMLButtonElement>::value,
1262
0
                "Shouldn't have wrappercached things that are not refcounted.");
1263
0
  MOZ_ASSERT(static_cast<mozilla::dom::HTMLButtonElement*>(aObject) ==
1264
0
             reinterpret_cast<mozilla::dom::HTMLButtonElement*>(aObject),
1265
0
             "Multiple inheritance for mozilla::dom::HTMLButtonElement is broken.");
1266
0
  MOZ_ASSERT(static_cast<nsGenericHTMLElement*>(aObject) ==
1267
0
             reinterpret_cast<nsGenericHTMLElement*>(aObject),
1268
0
             "Multiple inheritance for nsGenericHTMLElement is broken.");
1269
0
  MOZ_ASSERT(static_cast<mozilla::dom::Element*>(aObject) ==
1270
0
             reinterpret_cast<mozilla::dom::Element*>(aObject),
1271
0
             "Multiple inheritance for mozilla::dom::Element is broken.");
1272
0
  MOZ_ASSERT(static_cast<nsINode*>(aObject) ==
1273
0
             reinterpret_cast<nsINode*>(aObject),
1274
0
             "Multiple inheritance for nsINode is broken.");
1275
0
  MOZ_ASSERT(static_cast<mozilla::dom::EventTarget*>(aObject) ==
1276
0
             reinterpret_cast<mozilla::dom::EventTarget*>(aObject),
1277
0
             "Multiple inheritance for mozilla::dom::EventTarget is broken.");
1278
0
  MOZ_ASSERT(ToSupportsIsCorrect(aObject));
1279
0
  MOZ_ASSERT_IF(aGivenProto, js::IsObjectInContextCompartment(aGivenProto, aCx));
1280
0
  MOZ_ASSERT(!aCache->GetWrapper(),
1281
0
             "You should probably not be using Wrap() directly; use "
1282
0
             "GetOrCreateDOMReflector instead");
1283
0
1284
0
  MOZ_ASSERT(ToSupportsIsOnPrimaryInheritanceChain(aObject, aCache),
1285
0
             "nsISupports must be on our primary inheritance chain");
1286
0
1287
0
  JS::Rooted<JSObject*> global(aCx, FindAssociatedGlobal(aCx, aObject->GetParentObject()));
1288
0
  if (!global) {
1289
0
    return false;
1290
0
  }
1291
0
  MOZ_ASSERT(JS_IsGlobalObject(global));
1292
0
  MOZ_ASSERT(JS::ObjectIsNotGray(global));
1293
0
1294
0
  // That might have ended up wrapping us already, due to the wonders
1295
0
  // of XBL.  Check for that, and bail out as needed.
1296
0
  aReflector.set(aCache->GetWrapper());
1297
0
  if (aReflector) {
1298
#ifdef DEBUG
1299
    AssertReflectorHasGivenProto(aCx, aReflector, aGivenProto);
1300
#endif // DEBUG
1301
    return true;
1302
0
  }
1303
0
1304
0
  JSAutoRealm ar(aCx, global);
1305
0
  JS::Handle<JSObject*> canonicalProto = GetProtoObjectHandle(aCx);
1306
0
  if (!canonicalProto) {
1307
0
    return false;
1308
0
  }
1309
0
  JS::Rooted<JSObject*> proto(aCx);
1310
0
  if (aGivenProto) {
1311
0
    proto = aGivenProto;
1312
0
    // Unfortunately, while aGivenProto was in the compartment of aCx
1313
0
    // coming in, we changed compartments to that of "parent" so may need
1314
0
    // to wrap the proto here.
1315
0
    if (js::GetContextCompartment(aCx) != js::GetObjectCompartment(proto)) {
1316
0
      if (!JS_WrapObject(aCx, &proto)) {
1317
0
        return false;
1318
0
      }
1319
0
    }
1320
0
  } else {
1321
0
    proto = canonicalProto;
1322
0
  }
1323
0
1324
0
  BindingJSObjectCreator<mozilla::dom::HTMLButtonElement> creator(aCx);
1325
0
  creator.CreateObject(aCx, sClass.ToJSClass(), proto, aObject, aReflector);
1326
0
  if (!aReflector) {
1327
0
    return false;
1328
0
  }
1329
0
1330
0
  aCache->SetWrapper(aReflector);
1331
0
  creator.InitializationSucceeded();
1332
0
1333
0
  MOZ_ASSERT(aCache->GetWrapperPreserveColor() &&
1334
0
             aCache->GetWrapperPreserveColor() == aReflector);
1335
0
  // If proto != canonicalProto, we have to preserve our wrapper;
1336
0
  // otherwise we won't be able to properly recreate it later, since
1337
0
  // we won't know what proto to use.  Note that we don't check
1338
0
  // aGivenProto here, since it's entirely possible (and even
1339
0
  // somewhat common) to have a non-null aGivenProto which is the
1340
0
  // same as canonicalProto.
1341
0
  if (proto != canonicalProto) {
1342
0
    PreserveWrapper(aObject);
1343
0
  }
1344
0
1345
0
  return true;
1346
0
}
1347
1348
const NativePropertyHooks sNativePropertyHooks[] = { {
1349
  nullptr,
1350
  nullptr,
1351
  nullptr,
1352
  { sNativeProperties.Upcast(), nullptr },
1353
  prototypes::id::HTMLButtonElement,
1354
  constructors::id::HTMLButtonElement,
1355
  HTMLElement_Binding::sNativePropertyHooks,
1356
  &DefaultXrayExpandoObjectClass
1357
} };
1358
1359
void
1360
CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, bool aDefineOnGlobal)
1361
0
{
1362
0
  JS::Handle<JSObject*> parentProto(HTMLElement_Binding::GetProtoObjectHandle(aCx));
1363
0
  if (!parentProto) {
1364
0
    return;
1365
0
  }
1366
0
1367
0
  JS::Handle<JSObject*> constructorProto(HTMLElement_Binding::GetConstructorObjectHandle(aCx));
1368
0
  if (!constructorProto) {
1369
0
    return;
1370
0
  }
1371
0
1372
0
  static bool sIdsInited = false;
1373
0
  if (!sIdsInited && NS_IsMainThread()) {
1374
0
    if (!InitIds(aCx, sNativeProperties.Upcast())) {
1375
0
      return;
1376
0
    }
1377
0
    sIdsInited = true;
1378
0
  }
1379
0
1380
0
  JS::Heap<JSObject*>* protoCache = &aProtoAndIfaceCache.EntrySlotOrCreate(prototypes::id::HTMLButtonElement);
1381
0
  JS::Heap<JSObject*>* interfaceCache = &aProtoAndIfaceCache.EntrySlotOrCreate(constructors::id::HTMLButtonElement);
1382
0
  dom::CreateInterfaceObjects(aCx, aGlobal, parentProto,
1383
0
                              &sPrototypeClass.mBase, protoCache,
1384
0
                              nullptr,
1385
0
                              constructorProto, &sInterfaceObjectClass.mBase, 0, nullptr,
1386
0
                              interfaceCache,
1387
0
                              sNativeProperties.Upcast(),
1388
0
                              nullptr,
1389
0
                              "HTMLButtonElement", aDefineOnGlobal,
1390
0
                              nullptr,
1391
0
                              false);
1392
0
}
1393
1394
JSObject*
1395
GetConstructorObject(JSContext* aCx)
1396
0
{
1397
0
  return GetConstructorObjectHandle(aCx);
1398
0
}
1399
1400
} // namespace HTMLButtonElement_Binding
1401
1402
1403
1404
} // namespace dom
1405
} // namespace mozilla