Coverage Report

Created: 2018-09-25 14:53

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