Coverage Report

Created: 2018-09-25 14:53

/work/obj-fuzz/dom/bindings/TextTrackListBinding.cpp
Line
Count
Source (jump to first uncovered line)
1
/* THIS FILE IS AUTOGENERATED FROM TextTrackList.webidl BY Codegen.py - DO NOT EDIT */
2
3
#include "EventHandlerBinding.h"
4
#include "EventTargetBinding.h"
5
#include "TextTrackListBinding.h"
6
#include "WrapperFactory.h"
7
#include "mozilla/OwningNonNull.h"
8
#include "mozilla/dom/BindingUtils.h"
9
#include "mozilla/dom/DOMJSClass.h"
10
#include "mozilla/dom/DOMJSProxyHandler.h"
11
#include "mozilla/dom/HTMLMediaElement.h"
12
#include "mozilla/dom/NonRefcountedDOMObject.h"
13
#include "mozilla/dom/Nullable.h"
14
#include "mozilla/dom/PrimitiveConversions.h"
15
#include "mozilla/dom/TextTrack.h"
16
#include "mozilla/dom/TextTrackList.h"
17
#include "mozilla/dom/XrayExpandoClass.h"
18
#include "nsContentUtils.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 TextTrackList_Binding {
28
29
static_assert(IsRefcounted<NativeType>::value == IsRefcounted<EventTarget_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_length(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::TextTrackList* self, JSJitGetterCallArgs args)
34
0
{
35
0
  AUTO_PROFILER_LABEL_FAST("get TextTrackList.length", DOM, cx);
36
0
37
0
  uint32_t result(self->Length());
38
0
  MOZ_ASSERT(!JS_IsExceptionPending(cx));
39
0
  args.rval().setNumber(result);
40
0
  return true;
41
0
}
42
43
static const JSJitInfo length_getterinfo = {
44
  { (JSJitGetterOp)get_length },
45
  { prototypes::id::TextTrackList },
46
  { PrototypeTraits<prototypes::id::TextTrackList>::Depth },
47
  JSJitInfo::Getter,
48
  JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
49
  JSVAL_TYPE_DOUBLE,  /* returnType.  Not relevant for setters. */
50
  true,  /* isInfallible. False in setters. */
51
  false,  /* isMovable.  Not relevant for setters. */
52
  false, /* isEliminatable.  Not relevant for setters. */
53
  false, /* isAlwaysInSlot.  Only relevant for getters. */
54
  false, /* isLazilyCachedInSlot.  Only relevant for getters. */
55
  false,  /* isTypedMethod.  Only relevant for methods. */
56
  0   /* Reserved slot index, if we're stored in a slot, else 0. */
57
};
58
static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
59
static_assert(0 < 1, "There is no slot for us");
60
61
MOZ_CAN_RUN_SCRIPT static bool
62
getTrackById(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::TextTrackList* self, const JSJitMethodCallArgs& args)
63
0
{
64
0
  AUTO_PROFILER_LABEL_FAST("TextTrackList.getTrackById", DOM, cx);
65
0
66
0
  if (MOZ_UNLIKELY(args.length() < 1)) {
67
0
    return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "TextTrackList.getTrackById");
68
0
  }
69
0
  binding_detail::FakeString arg0;
70
0
  if (!ConvertJSValueToString(cx, args[0], eStringify, eStringify, arg0)) {
71
0
    return false;
72
0
  }
73
0
  auto result(StrongOrRawPtr<mozilla::dom::TextTrack>(self->GetTrackById(NonNullHelper(Constify(arg0)))));
74
0
  MOZ_ASSERT(!JS_IsExceptionPending(cx));
75
0
  if (!result) {
76
0
    args.rval().setNull();
77
0
    return true;
78
0
  }
79
0
  if (!GetOrCreateDOMReflector(cx, result, args.rval())) {
80
0
    MOZ_ASSERT(JS_IsExceptionPending(cx));
81
0
    return false;
82
0
  }
83
0
  return true;
84
0
}
85
86
static const JSJitInfo getTrackById_methodinfo = {
87
  { (JSJitGetterOp)getTrackById },
88
  { prototypes::id::TextTrackList },
89
  { PrototypeTraits<prototypes::id::TextTrackList>::Depth },
90
  JSJitInfo::Method,
91
  JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
92
  JSVAL_TYPE_UNKNOWN,  /* 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_onchange(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::TextTrackList* self, JSJitGetterCallArgs args)
106
0
{
107
0
  AUTO_PROFILER_LABEL_FAST("get TextTrackList.onchange", DOM, cx);
108
0
109
0
  RefPtr<EventHandlerNonNull> result(self->GetOnchange());
110
0
  MOZ_ASSERT(!JS_IsExceptionPending(cx));
111
0
  if (result) {
112
0
    args.rval().setObjectOrNull(GetCallbackFromCallbackObject(cx, result));
113
0
    if (!MaybeWrapObjectOrNullValue(cx, args.rval())) {
114
0
      return false;
115
0
    }
116
0
    return true;
117
0
  } else {
118
0
    args.rval().setNull();
119
0
    return true;
120
0
  }
121
0
}
122
123
MOZ_CAN_RUN_SCRIPT static bool
124
set_onchange(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::TextTrackList* self, JSJitSetterCallArgs args)
125
0
{
126
0
  AUTO_PROFILER_LABEL_FAST("set TextTrackList.onchange", DOM, cx);
127
0
128
0
  RootedCallback<RefPtr<binding_detail::FastEventHandlerNonNull>> arg0(cx);
129
0
  if (args[0].isObject()) {
130
0
    { // scope for tempRoot and tempGlobalRoot if needed
131
0
      arg0 = new binding_detail::FastEventHandlerNonNull(&args[0].toObject(), JS::CurrentGlobalOrNull(cx));
132
0
    }
133
0
  } else {
134
0
    arg0 = nullptr;
135
0
  }
136
0
  self->SetOnchange(Constify(arg0));
137
0
  MOZ_ASSERT(!JS_IsExceptionPending(cx));
138
0
139
0
  return true;
140
0
}
141
142
static const JSJitInfo onchange_getterinfo = {
143
  { (JSJitGetterOp)get_onchange },
144
  { prototypes::id::TextTrackList },
145
  { PrototypeTraits<prototypes::id::TextTrackList>::Depth },
146
  JSJitInfo::Getter,
147
  JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
148
  JSVAL_TYPE_UNKNOWN,  /* returnType.  Not relevant for setters. */
149
  false,  /* isInfallible. False in setters. */
150
  false,  /* isMovable.  Not relevant for setters. */
151
  false, /* isEliminatable.  Not relevant for setters. */
152
  false, /* isAlwaysInSlot.  Only relevant for getters. */
153
  false, /* isLazilyCachedInSlot.  Only relevant for getters. */
154
  false,  /* isTypedMethod.  Only relevant for methods. */
155
  0   /* Reserved slot index, if we're stored in a slot, else 0. */
156
};
157
static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
158
static_assert(0 < 1, "There is no slot for us");
159
static const JSJitInfo onchange_setterinfo = {
160
  { (JSJitGetterOp)set_onchange },
161
  { prototypes::id::TextTrackList },
162
  { PrototypeTraits<prototypes::id::TextTrackList>::Depth },
163
  JSJitInfo::Setter,
164
  JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
165
  JSVAL_TYPE_UNDEFINED,  /* returnType.  Not relevant for setters. */
166
  false,  /* isInfallible. False in setters. */
167
  false,  /* isMovable.  Not relevant for setters. */
168
  false, /* isEliminatable.  Not relevant for setters. */
169
  false, /* isAlwaysInSlot.  Only relevant for getters. */
170
  false, /* isLazilyCachedInSlot.  Only relevant for getters. */
171
  false,  /* isTypedMethod.  Only relevant for methods. */
172
  0   /* Reserved slot index, if we're stored in a slot, else 0. */
173
};
174
static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
175
static_assert(0 < 1, "There is no slot for us");
176
177
MOZ_CAN_RUN_SCRIPT static bool
178
get_onaddtrack(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::TextTrackList* self, JSJitGetterCallArgs args)
179
0
{
180
0
  AUTO_PROFILER_LABEL_FAST("get TextTrackList.onaddtrack", DOM, cx);
181
0
182
0
  RefPtr<EventHandlerNonNull> result(self->GetOnaddtrack());
183
0
  MOZ_ASSERT(!JS_IsExceptionPending(cx));
184
0
  if (result) {
185
0
    args.rval().setObjectOrNull(GetCallbackFromCallbackObject(cx, result));
186
0
    if (!MaybeWrapObjectOrNullValue(cx, args.rval())) {
187
0
      return false;
188
0
    }
189
0
    return true;
190
0
  } else {
191
0
    args.rval().setNull();
192
0
    return true;
193
0
  }
194
0
}
195
196
MOZ_CAN_RUN_SCRIPT static bool
197
set_onaddtrack(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::TextTrackList* self, JSJitSetterCallArgs args)
198
0
{
199
0
  AUTO_PROFILER_LABEL_FAST("set TextTrackList.onaddtrack", DOM, cx);
200
0
201
0
  RootedCallback<RefPtr<binding_detail::FastEventHandlerNonNull>> arg0(cx);
202
0
  if (args[0].isObject()) {
203
0
    { // scope for tempRoot and tempGlobalRoot if needed
204
0
      arg0 = new binding_detail::FastEventHandlerNonNull(&args[0].toObject(), JS::CurrentGlobalOrNull(cx));
205
0
    }
206
0
  } else {
207
0
    arg0 = nullptr;
208
0
  }
209
0
  self->SetOnaddtrack(Constify(arg0));
210
0
  MOZ_ASSERT(!JS_IsExceptionPending(cx));
211
0
212
0
  return true;
213
0
}
214
215
static const JSJitInfo onaddtrack_getterinfo = {
216
  { (JSJitGetterOp)get_onaddtrack },
217
  { prototypes::id::TextTrackList },
218
  { PrototypeTraits<prototypes::id::TextTrackList>::Depth },
219
  JSJitInfo::Getter,
220
  JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
221
  JSVAL_TYPE_UNKNOWN,  /* 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 onaddtrack_setterinfo = {
233
  { (JSJitGetterOp)set_onaddtrack },
234
  { prototypes::id::TextTrackList },
235
  { PrototypeTraits<prototypes::id::TextTrackList>::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_onremovetrack(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::TextTrackList* self, JSJitGetterCallArgs args)
252
0
{
253
0
  AUTO_PROFILER_LABEL_FAST("get TextTrackList.onremovetrack", DOM, cx);
254
0
255
0
  RefPtr<EventHandlerNonNull> result(self->GetOnremovetrack());
256
0
  MOZ_ASSERT(!JS_IsExceptionPending(cx));
257
0
  if (result) {
258
0
    args.rval().setObjectOrNull(GetCallbackFromCallbackObject(cx, result));
259
0
    if (!MaybeWrapObjectOrNullValue(cx, args.rval())) {
260
0
      return false;
261
0
    }
262
0
    return true;
263
0
  } else {
264
0
    args.rval().setNull();
265
0
    return true;
266
0
  }
267
0
}
268
269
MOZ_CAN_RUN_SCRIPT static bool
270
set_onremovetrack(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::TextTrackList* self, JSJitSetterCallArgs args)
271
0
{
272
0
  AUTO_PROFILER_LABEL_FAST("set TextTrackList.onremovetrack", DOM, cx);
273
0
274
0
  RootedCallback<RefPtr<binding_detail::FastEventHandlerNonNull>> arg0(cx);
275
0
  if (args[0].isObject()) {
276
0
    { // scope for tempRoot and tempGlobalRoot if needed
277
0
      arg0 = new binding_detail::FastEventHandlerNonNull(&args[0].toObject(), JS::CurrentGlobalOrNull(cx));
278
0
    }
279
0
  } else {
280
0
    arg0 = nullptr;
281
0
  }
282
0
  self->SetOnremovetrack(Constify(arg0));
283
0
  MOZ_ASSERT(!JS_IsExceptionPending(cx));
284
0
285
0
  return true;
286
0
}
287
288
static const JSJitInfo onremovetrack_getterinfo = {
289
  { (JSJitGetterOp)get_onremovetrack },
290
  { prototypes::id::TextTrackList },
291
  { PrototypeTraits<prototypes::id::TextTrackList>::Depth },
292
  JSJitInfo::Getter,
293
  JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
294
  JSVAL_TYPE_UNKNOWN,  /* returnType.  Not relevant for setters. */
295
  false,  /* isInfallible. False in setters. */
296
  false,  /* isMovable.  Not relevant for setters. */
297
  false, /* isEliminatable.  Not relevant for setters. */
298
  false, /* isAlwaysInSlot.  Only relevant for getters. */
299
  false, /* isLazilyCachedInSlot.  Only relevant for getters. */
300
  false,  /* isTypedMethod.  Only relevant for methods. */
301
  0   /* Reserved slot index, if we're stored in a slot, else 0. */
302
};
303
static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
304
static_assert(0 < 1, "There is no slot for us");
305
static const JSJitInfo onremovetrack_setterinfo = {
306
  { (JSJitGetterOp)set_onremovetrack },
307
  { prototypes::id::TextTrackList },
308
  { PrototypeTraits<prototypes::id::TextTrackList>::Depth },
309
  JSJitInfo::Setter,
310
  JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
311
  JSVAL_TYPE_UNDEFINED,  /* returnType.  Not relevant for setters. */
312
  false,  /* isInfallible. False in setters. */
313
  false,  /* isMovable.  Not relevant for setters. */
314
  false, /* isEliminatable.  Not relevant for setters. */
315
  false, /* isAlwaysInSlot.  Only relevant for getters. */
316
  false, /* isLazilyCachedInSlot.  Only relevant for getters. */
317
  false,  /* isTypedMethod.  Only relevant for methods. */
318
  0   /* Reserved slot index, if we're stored in a slot, else 0. */
319
};
320
static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
321
static_assert(0 < 1, "There is no slot for us");
322
323
MOZ_CAN_RUN_SCRIPT static bool
324
get_mediaElement(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::TextTrackList* self, JSJitGetterCallArgs args)
325
0
{
326
0
  AUTO_PROFILER_LABEL_FAST("get TextTrackList.mediaElement", DOM, cx);
327
0
328
0
  auto result(StrongOrRawPtr<mozilla::dom::HTMLMediaElement>(self->GetMediaElement()));
329
0
  MOZ_ASSERT(!JS_IsExceptionPending(cx));
330
0
  if (!result) {
331
0
    args.rval().setNull();
332
0
    return true;
333
0
  }
334
0
  if (!GetOrCreateDOMReflector(cx, result, args.rval())) {
335
0
    MOZ_ASSERT(JS_IsExceptionPending(cx));
336
0
    return false;
337
0
  }
338
0
  return true;
339
0
}
340
341
static const JSJitInfo mediaElement_getterinfo = {
342
  { (JSJitGetterOp)get_mediaElement },
343
  { prototypes::id::TextTrackList },
344
  { PrototypeTraits<prototypes::id::TextTrackList>::Depth },
345
  JSJitInfo::Getter,
346
  JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
347
  JSVAL_TYPE_UNKNOWN,  /* returnType.  Not relevant for setters. */
348
  false,  /* isInfallible. False in setters. */
349
  false,  /* isMovable.  Not relevant for setters. */
350
  false, /* isEliminatable.  Not relevant for setters. */
351
  false, /* isAlwaysInSlot.  Only relevant for getters. */
352
  false, /* isLazilyCachedInSlot.  Only relevant for getters. */
353
  false,  /* isTypedMethod.  Only relevant for methods. */
354
  0   /* Reserved slot index, if we're stored in a slot, else 0. */
355
};
356
static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
357
static_assert(0 < 1, "There is no slot for us");
358
359
// We deliberately use brace-elision to make Visual Studio produce better initalization code.
360
#if defined(__clang__)
361
#pragma clang diagnostic push
362
#pragma clang diagnostic ignored "-Wmissing-braces"
363
#endif
364
static const JSFunctionSpec sMethods_specs[] = {
365
  JS_FNSPEC("getTrackById", (GenericMethod<NormalThisPolicy, ThrowExceptions>), reinterpret_cast<const JSJitInfo*>(&getTrackById_methodinfo), 1, JSPROP_ENUMERATE, nullptr),
366
  JS_SYM_FNSPEC(iterator, nullptr, nullptr, 0, 0, "ArrayValues"),
367
  JS_FS_END
368
};
369
#if defined(__clang__)
370
#pragma clang diagnostic pop
371
#endif
372
373
374
static const Prefable<const JSFunctionSpec> sMethods[] = {
375
  { nullptr, &sMethods_specs[0] },
376
  { nullptr, nullptr }
377
};
378
379
static_assert(1 <= 1ull << NUM_BITS_PROPERTY_INFO_PREF_INDEX,
380
    "We have a prefable index that is >= (1 << NUM_BITS_PROPERTY_INFO_PREF_INDEX)");
381
static_assert(2 <= 1ull << NUM_BITS_PROPERTY_INFO_SPEC_INDEX,
382
    "We have a spec index that is >= (1 << NUM_BITS_PROPERTY_INFO_SPEC_INDEX)");
383
384
// We deliberately use brace-elision to make Visual Studio produce better initalization code.
385
#if defined(__clang__)
386
#pragma clang diagnostic push
387
#pragma clang diagnostic ignored "-Wmissing-braces"
388
#endif
389
static const JSPropertySpec sAttributes_specs[] = {
390
  { "length", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &length_getterinfo, nullptr, nullptr },
391
  { "onchange", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &onchange_getterinfo, GenericSetter<NormalThisPolicy>, &onchange_setterinfo },
392
  { "onaddtrack", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &onaddtrack_getterinfo, GenericSetter<NormalThisPolicy>, &onaddtrack_setterinfo },
393
  { "onremovetrack", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &onremovetrack_getterinfo, GenericSetter<NormalThisPolicy>, &onremovetrack_setterinfo },
394
  { nullptr, 0, nullptr, nullptr, nullptr, nullptr }
395
};
396
#if defined(__clang__)
397
#pragma clang diagnostic pop
398
#endif
399
400
401
static const Prefable<const JSPropertySpec> sAttributes[] = {
402
  { nullptr, &sAttributes_specs[0] },
403
  { nullptr, nullptr }
404
};
405
406
static_assert(1 <= 1ull << NUM_BITS_PROPERTY_INFO_PREF_INDEX,
407
    "We have a prefable index that is >= (1 << NUM_BITS_PROPERTY_INFO_PREF_INDEX)");
408
static_assert(4 <= 1ull << NUM_BITS_PROPERTY_INFO_SPEC_INDEX,
409
    "We have a spec index that is >= (1 << NUM_BITS_PROPERTY_INFO_SPEC_INDEX)");
410
411
// We deliberately use brace-elision to make Visual Studio produce better initalization code.
412
#if defined(__clang__)
413
#pragma clang diagnostic push
414
#pragma clang diagnostic ignored "-Wmissing-braces"
415
#endif
416
static const JSPropertySpec sChromeAttributes_specs[] = {
417
  { "mediaElement", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &mediaElement_getterinfo, nullptr, nullptr },
418
  { nullptr, 0, nullptr, nullptr, nullptr, nullptr }
419
};
420
#if defined(__clang__)
421
#pragma clang diagnostic pop
422
#endif
423
424
425
static const Prefable<const JSPropertySpec> sChromeAttributes[] = {
426
  { nullptr, &sChromeAttributes_specs[0] },
427
  { nullptr, nullptr }
428
};
429
430
static_assert(1 <= 1ull << NUM_BITS_PROPERTY_INFO_PREF_INDEX,
431
    "We have a prefable index that is >= (1 << NUM_BITS_PROPERTY_INFO_PREF_INDEX)");
432
static_assert(1 <= 1ull << NUM_BITS_PROPERTY_INFO_SPEC_INDEX,
433
    "We have a spec index that is >= (1 << NUM_BITS_PROPERTY_INFO_SPEC_INDEX)");
434
435
436
static uint16_t sNativeProperties_sortedPropertyIndices[6];
437
static PropertyInfo sNativeProperties_propertyInfos[6];
438
439
static const NativePropertiesN<2> sNativeProperties = {
440
  false, 0,
441
  false, 0,
442
  true,  0 /* sMethods */,
443
  true,  1 /* sAttributes */,
444
  false, 0,
445
  false, 0,
446
  false, 0,
447
  -1,
448
  6,
449
  sNativeProperties_sortedPropertyIndices,
450
  {
451
    { sMethods, &sNativeProperties_propertyInfos[0] },
452
    { sAttributes, &sNativeProperties_propertyInfos[2] }
453
  }
454
};
455
static_assert(6 < 1ull << CHAR_BIT * sizeof(sNativeProperties.propertyInfoCount),
456
    "We have a property info count that is oversized");
457
458
static uint16_t sChromeOnlyNativeProperties_sortedPropertyIndices[1];
459
static PropertyInfo sChromeOnlyNativeProperties_propertyInfos[1];
460
461
static const NativePropertiesN<1> sChromeOnlyNativeProperties = {
462
  false, 0,
463
  false, 0,
464
  false, 0,
465
  true,  0 /* sChromeAttributes */,
466
  false, 0,
467
  false, 0,
468
  false, 0,
469
  -1,
470
  1,
471
  sChromeOnlyNativeProperties_sortedPropertyIndices,
472
  {
473
    { sChromeAttributes, &sChromeOnlyNativeProperties_propertyInfos[0] }
474
  }
475
};
476
static_assert(1 < 1ull << CHAR_BIT * sizeof(sChromeOnlyNativeProperties.propertyInfoCount),
477
    "We have a property info count that is oversized");
478
479
static const DOMIfaceAndProtoJSClass sInterfaceObjectClass = {
480
  {
481
    "Function",
482
    JSCLASS_IS_DOMIFACEANDPROTOJSCLASS | JSCLASS_HAS_RESERVED_SLOTS(DOM_INTERFACE_SLOTS_BASE),
483
    &sBoringInterfaceObjectClassClassOps,
484
    JS_NULL_CLASS_SPEC,
485
    JS_NULL_CLASS_EXT,
486
    &sInterfaceObjectClassObjectOps
487
  },
488
  eInterface,
489
  true,
490
  prototypes::id::TextTrackList,
491
  PrototypeTraits<prototypes::id::TextTrackList>::Depth,
492
  sNativePropertyHooks,
493
  "function TextTrackList() {\n    [native code]\n}",
494
  EventTarget_Binding::GetConstructorObject
495
};
496
497
static const DOMIfaceAndProtoJSClass sPrototypeClass = {
498
  {
499
    "TextTrackListPrototype",
500
    JSCLASS_IS_DOMIFACEANDPROTOJSCLASS | JSCLASS_HAS_RESERVED_SLOTS(DOM_INTERFACE_PROTO_SLOTS_BASE),
501
    JS_NULL_CLASS_OPS,
502
    JS_NULL_CLASS_SPEC,
503
    JS_NULL_CLASS_EXT,
504
    JS_NULL_OBJECT_OPS
505
  },
506
  eInterfacePrototype,
507
  false,
508
  prototypes::id::TextTrackList,
509
  PrototypeTraits<prototypes::id::TextTrackList>::Depth,
510
  sNativePropertyHooks,
511
  "[object TextTrackListPrototype]",
512
  EventTarget_Binding::GetProtoObject
513
};
514
515
static_assert(IsBaseOf<nsISupports, mozilla::dom::TextTrackList >::value,
516
                  "We don't support non-nsISupports native classes for "
517
                  "proxy-based bindings yet");
518
519
520
class DOMProxyHandler : public mozilla::dom::DOMProxyHandler
521
{
522
public:
523
  explicit constexpr DOMProxyHandler()
524
0
  {
525
0
  }
526
527
  virtual bool
528
  getOwnPropDescriptor(JSContext* cx, JS::Handle<JSObject*> proxy, JS::Handle<jsid> id, bool ignoreNamedProps, JS::MutableHandle<JS::PropertyDescriptor> desc) const override;
529
530
  virtual bool
531
  defineProperty(JSContext* cx, JS::Handle<JSObject*> proxy, JS::Handle<jsid> id, JS::Handle<JS::PropertyDescriptor> desc, JS::ObjectOpResult& opresult, bool* defined) const override;
532
533
  using mozilla::dom::DOMProxyHandler::defineProperty;
534
535
  virtual bool
536
  ownPropNames(JSContext* cx, JS::Handle<JSObject*> proxy, unsigned flags, JS::AutoIdVector& props) const override;
537
538
  virtual bool
539
  hasOwn(JSContext* cx, JS::Handle<JSObject*> proxy, JS::Handle<jsid> id, bool* bp) const override;
540
541
  virtual bool
542
  get(JSContext* cx, JS::Handle<JSObject*> proxy, JS::Handle<JS::Value> receiver, JS::Handle<jsid> id, JS::MutableHandle<JS::Value> vp) const override;
543
544
  virtual const char*
545
  className(JSContext* cx, JS::Handle<JSObject*> proxy) const override;
546
547
  virtual bool
548
  finalizeInBackground(const JS::Value& priv) const override;
549
550
  virtual void
551
  finalize(JSFreeOp* fop, JSObject* proxy) const override;
552
553
  static const DOMProxyHandler*
554
  getInstance();
555
556
  virtual bool
557
  delete_(JSContext* cx, JS::Handle<JSObject*> proxy, JS::Handle<jsid> id, JS::ObjectOpResult& opresult) const override;
558
559
  virtual bool
560
  getElements(JSContext* cx, JS::Handle<JSObject*> proxy, uint32_t begin, uint32_t end, js::ElementAdder* adder) const override;
561
562
  virtual size_t
563
  objectMoved(JSObject* obj, JSObject* old) const override;
564
};
565
566
MOZ_ALWAYS_INLINE bool
567
IsProxy(JSObject* obj)
568
0
{
569
0
  return js::IsProxy(obj) && js::GetProxyHandler(obj) == DOMProxyHandler::getInstance();
570
0
}
571
572
MOZ_ALWAYS_INLINE mozilla::dom::TextTrackList*
573
UnwrapProxy(JSObject* obj)
574
0
{
575
0
  MOZ_ASSERT(js::IsProxy(obj));
576
0
  if (js::GetProxyHandler(obj) != DOMProxyHandler::getInstance()) {
577
0
    MOZ_ASSERT(xpc::WrapperFactory::IsXrayWrapper(obj));
578
0
    obj = js::UncheckedUnwrap(obj);
579
0
  }
580
0
  MOZ_ASSERT(IsProxy(obj));
581
0
  return static_cast<mozilla::dom::TextTrackList*>(js::GetProxyReservedSlot(obj, DOM_OBJECT_SLOT).toPrivate());
582
0
}
583
584
bool
585
DOMProxyHandler::getOwnPropDescriptor(JSContext* cx, JS::Handle<JSObject*> proxy, JS::Handle<jsid> id, bool ignoreNamedProps, JS::MutableHandle<JS::PropertyDescriptor> desc) const
586
0
{
587
0
  bool isXray = xpc::WrapperFactory::IsXrayWrapper(proxy);
588
0
  uint32_t index = GetArrayIndexFromId(cx, id);
589
0
  if (IsArrayIndex(index)) {
590
0
    mozilla::dom::TextTrackList* self = UnwrapProxy(proxy);
591
0
    bool found = false;
592
0
    auto result(StrongOrRawPtr<mozilla::dom::TextTrack>(self->IndexedGetter(index, found)));
593
0
    MOZ_ASSERT(!JS_IsExceptionPending(cx));
594
0
595
0
    if (found) {
596
0
      if (!GetOrCreateDOMReflector(cx, result, desc.value())) {
597
0
        MOZ_ASSERT(JS_IsExceptionPending(cx));
598
0
        return false;
599
0
      }
600
0
      FillPropertyDescriptor(desc, proxy, true);
601
0
      return true;
602
0
    }
603
0
  }
604
0
605
0
  JS::Rooted<JSObject*> expando(cx);
606
0
  if (!isXray && (expando = GetExpandoObject(proxy))) {
607
0
    if (!JS_GetOwnPropertyDescriptorById(cx, expando, id, desc)) {
608
0
      return false;
609
0
    }
610
0
    if (desc.object()) {
611
0
      // Pretend the property lives on the wrapper.
612
0
      desc.object().set(proxy);
613
0
      return true;
614
0
    }
615
0
  }
616
0
617
0
  desc.object().set(nullptr);
618
0
  return true;
619
0
}
620
621
bool
622
DOMProxyHandler::defineProperty(JSContext* cx, JS::Handle<JSObject*> proxy, JS::Handle<jsid> id, JS::Handle<JS::PropertyDescriptor> desc, JS::ObjectOpResult& opresult, bool* defined) const
623
0
{
624
0
  if (IsArrayIndex(GetArrayIndexFromId(cx, id))) {
625
0
    *defined = true;
626
0
    return opresult.failNoIndexedSetter();
627
0
  }
628
0
  return mozilla::dom::DOMProxyHandler::defineProperty(cx, proxy, id, desc, opresult, defined);
629
0
}
630
631
632
bool
633
DOMProxyHandler::ownPropNames(JSContext* cx, JS::Handle<JSObject*> proxy, unsigned flags, JS::AutoIdVector& props) const
634
0
{
635
0
  bool isXray = xpc::WrapperFactory::IsXrayWrapper(proxy);
636
0
637
0
  uint32_t length = UnwrapProxy(proxy)->Length();
638
0
  MOZ_ASSERT(int32_t(length) >= 0);
639
0
  for (int32_t i = 0; i < int32_t(length); ++i) {
640
0
    if (!props.append(INT_TO_JSID(i))) {
641
0
      return false;
642
0
    }
643
0
  }
644
0
645
0
  JS::Rooted<JSObject*> expando(cx);
646
0
  if (!isXray && (expando = DOMProxyHandler::GetExpandoObject(proxy)) &&
647
0
      !js::GetPropertyKeys(cx, expando, flags, &props)) {
648
0
    return false;
649
0
  }
650
0
651
0
  return true;
652
0
}
653
654
bool
655
DOMProxyHandler::hasOwn(JSContext* cx, JS::Handle<JSObject*> proxy, JS::Handle<jsid> id, bool* bp) const
656
0
{
657
0
  MOZ_ASSERT(!xpc::WrapperFactory::IsXrayWrapper(proxy),
658
0
            "Should not have a XrayWrapper here");
659
0
660
0
  uint32_t index = GetArrayIndexFromId(cx, id);
661
0
  if (IsArrayIndex(index)) {
662
0
    bool found = false;
663
0
    mozilla::dom::TextTrackList* self = UnwrapProxy(proxy);
664
0
    auto result(StrongOrRawPtr<mozilla::dom::TextTrack>(self->IndexedGetter(index, found)));
665
0
    MOZ_ASSERT(!JS_IsExceptionPending(cx));
666
0
    (void)result;
667
0
668
0
    *bp = found;
669
0
    return true;
670
0
  }
671
0
672
0
673
0
  JS::Rooted<JSObject*> expando(cx, GetExpandoObject(proxy));
674
0
  if (expando) {
675
0
    bool b = true;
676
0
    bool ok = JS_HasPropertyById(cx, expando, id, &b);
677
0
    *bp = !!b;
678
0
    if (!ok || *bp) {
679
0
      return ok;
680
0
    }
681
0
  }
682
0
683
0
  *bp = false;
684
0
  return true;
685
0
}
686
687
bool
688
DOMProxyHandler::get(JSContext* cx, JS::Handle<JSObject*> proxy, JS::Handle<JS::Value> receiver, JS::Handle<jsid> id, JS::MutableHandle<JS::Value> vp) const
689
0
{
690
0
  MOZ_ASSERT(!xpc::WrapperFactory::IsXrayWrapper(proxy),
691
0
              "Should not have a XrayWrapper here");
692
0
693
0
  uint32_t index = GetArrayIndexFromId(cx, id);
694
0
  if (IsArrayIndex(index)) {
695
0
    mozilla::dom::TextTrackList* self = UnwrapProxy(proxy);
696
0
    bool found = false;
697
0
    auto result(StrongOrRawPtr<mozilla::dom::TextTrack>(self->IndexedGetter(index, found)));
698
0
    MOZ_ASSERT(!JS_IsExceptionPending(cx));
699
0
700
0
    if (found) {
701
0
      if (!GetOrCreateDOMReflector(cx, result, vp)) {
702
0
        MOZ_ASSERT(JS_IsExceptionPending(cx));
703
0
        return false;
704
0
      }
705
0
      return true;
706
0
    }
707
0
    // Even if we don't have this index, we don't forward the
708
0
    // get on to our expando object.
709
0
  } else {
710
0
    { // Scope for expando
711
0
      JS::Rooted<JSObject*> expando(cx, DOMProxyHandler::GetExpandoObject(proxy));
712
0
      if (expando) {
713
0
        bool hasProp;
714
0
        if (!JS_HasPropertyById(cx, expando, id, &hasProp)) {
715
0
          return false;
716
0
        }
717
0
718
0
        if (hasProp) {
719
0
          // Forward the get to the expando object, but our receiver is whatever our
720
0
          // receiver is.
721
0
          return JS_ForwardGetPropertyTo(cx, expando, id, receiver, vp);
722
0
        }
723
0
      }
724
0
    }
725
0
  }
726
0
727
0
  bool foundOnPrototype;
728
0
  if (!GetPropertyOnPrototype(cx, proxy, receiver, id, &foundOnPrototype, vp)) {
729
0
    return false;
730
0
  }
731
0
732
0
  if (foundOnPrototype) {
733
0
    return true;
734
0
  }
735
0
736
0
  vp.setUndefined();
737
0
  return true;
738
0
}
739
740
const char*
741
DOMProxyHandler::className(JSContext* cx, JS::Handle<JSObject*> proxy) const
742
0
{
743
0
  return "TextTrackList";
744
0
}
745
746
bool
747
DOMProxyHandler::finalizeInBackground(const JS::Value& priv) const
748
0
{
749
0
  return false;
750
0
}
751
752
void
753
DOMProxyHandler::finalize(JSFreeOp* fop, JSObject* proxy) const
754
0
{
755
0
  mozilla::dom::TextTrackList* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::dom::TextTrackList>(proxy);
756
0
  if (self) {
757
0
    ClearWrapper(self, self, proxy);
758
0
    AddForDeferredFinalization<mozilla::dom::TextTrackList>(self);
759
0
  }
760
0
}
761
762
const DOMProxyHandler*
763
DOMProxyHandler::getInstance()
764
0
{
765
0
  static const DOMProxyHandler instance;
766
0
  return &instance;
767
0
}
768
769
bool
770
DOMProxyHandler::delete_(JSContext* cx, JS::Handle<JSObject*> proxy, JS::Handle<jsid> id, JS::ObjectOpResult& opresult) const
771
0
{
772
0
  MOZ_ASSERT(!xpc::WrapperFactory::IsXrayWrapper(proxy),
773
0
            "Should not have a XrayWrapper here");
774
0
775
0
  uint32_t index = GetArrayIndexFromId(cx, id);
776
0
  if (IsArrayIndex(index)) {
777
0
    bool deleteSucceeded;
778
0
    bool found = false;
779
0
    mozilla::dom::TextTrackList* self = UnwrapProxy(proxy);
780
0
    auto result(StrongOrRawPtr<mozilla::dom::TextTrack>(self->IndexedGetter(index, found)));
781
0
    MOZ_ASSERT(!JS_IsExceptionPending(cx));
782
0
    (void)result;
783
0
    deleteSucceeded = !found;
784
0
    return deleteSucceeded ? opresult.succeed() : opresult.failCantDelete();
785
0
  }
786
0
787
0
  return dom::DOMProxyHandler::delete_(cx, proxy, id, opresult);
788
0
}
789
790
bool
791
DOMProxyHandler::getElements(JSContext* cx, JS::Handle<JSObject*> proxy, uint32_t begin, uint32_t end, js::ElementAdder* adder) const
792
0
{
793
0
  JS::Rooted<JS::Value> temp(cx);
794
0
  MOZ_ASSERT(!xpc::WrapperFactory::IsXrayWrapper(proxy),
795
0
             "Should not have a XrayWrapper here");
796
0
797
0
  mozilla::dom::TextTrackList* self = UnwrapProxy(proxy);
798
0
  uint32_t length = self->Length();
799
0
  // Compute the end of the indices we'll get ourselves
800
0
  uint32_t ourEnd = std::max(begin, std::min(end, length));
801
0
802
0
  for (uint32_t index = begin; index < ourEnd; ++index) {
803
0
    bool found = false;
804
0
    auto result(StrongOrRawPtr<mozilla::dom::TextTrack>(self->IndexedGetter(index, found)));
805
0
    MOZ_ASSERT(!JS_IsExceptionPending(cx));
806
0
807
0
    MOZ_ASSERT(found);
808
0
    if (!GetOrCreateDOMReflector(cx, result, &temp)) {
809
0
      MOZ_ASSERT(JS_IsExceptionPending(cx));
810
0
      return false;
811
0
    }
812
0
    if (!adder->append(cx, temp)) return false;
813
0
    continue;
814
0
  }
815
0
816
0
  if (end > ourEnd) {
817
0
    JS::Rooted<JSObject*> proto(cx);
818
0
    if (!js::GetObjectProto(cx, proxy, &proto)) {
819
0
      return false;
820
0
    }
821
0
    return js::GetElementsWithAdder(cx, proto, proxy, ourEnd, end, adder);
822
0
  }
823
0
824
0
  return true;
825
0
}
826
827
size_t
828
DOMProxyHandler::objectMoved(JSObject* obj, JSObject* old) const
829
0
{
830
0
  mozilla::dom::TextTrackList* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::dom::TextTrackList>(obj);
831
0
  if (self) {
832
0
    UpdateWrapper(self, self, obj, old);
833
0
  }
834
0
835
0
  return 0;
836
0
}
837
838
static const DOMJSClass sClass = {
839
  PROXY_CLASS_DEF("TextTrackList",
840
                  JSCLASS_IS_DOMJSCLASS | JSCLASS_HAS_RESERVED_SLOTS(1)),
841
  { prototypes::id::EventTarget, prototypes::id::TextTrackList, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count },
842
  IsBaseOf<nsISupports, mozilla::dom::TextTrackList >::value,
843
  sNativePropertyHooks,
844
  FindAssociatedGlobalForNative<mozilla::dom::TextTrackList>::Get,
845
  GetProtoObjectHandle,
846
  GetCCParticipant<mozilla::dom::TextTrackList>::Get()
847
};
848
849
bool
850
Wrap(JSContext* aCx, mozilla::dom::TextTrackList* aObject, nsWrapperCache* aCache, JS::Handle<JSObject*> aGivenProto, JS::MutableHandle<JSObject*> aReflector)
851
0
{
852
0
  static_assert(!IsBaseOf<NonRefcountedDOMObject, mozilla::dom::TextTrackList>::value,
853
0
                "Shouldn't have wrappercached things that are not refcounted.");
854
0
  MOZ_ASSERT(static_cast<mozilla::dom::TextTrackList*>(aObject) ==
855
0
             reinterpret_cast<mozilla::dom::TextTrackList*>(aObject),
856
0
             "Multiple inheritance for mozilla::dom::TextTrackList is broken.");
857
0
  MOZ_ASSERT(static_cast<mozilla::dom::EventTarget*>(aObject) ==
858
0
             reinterpret_cast<mozilla::dom::EventTarget*>(aObject),
859
0
             "Multiple inheritance for mozilla::dom::EventTarget is broken.");
860
0
  MOZ_ASSERT(ToSupportsIsCorrect(aObject));
861
0
  MOZ_ASSERT_IF(aGivenProto, js::IsObjectInContextCompartment(aGivenProto, aCx));
862
0
  MOZ_ASSERT(!aCache->GetWrapper(),
863
0
             "You should probably not be using Wrap() directly; use "
864
0
             "GetOrCreateDOMReflector instead");
865
0
866
0
  MOZ_ASSERT(ToSupportsIsOnPrimaryInheritanceChain(aObject, aCache),
867
0
             "nsISupports must be on our primary inheritance chain");
868
0
869
0
  JS::Rooted<JSObject*> global(aCx, FindAssociatedGlobal(aCx, aObject->GetParentObject()));
870
0
  if (!global) {
871
0
    return false;
872
0
  }
873
0
  MOZ_ASSERT(JS_IsGlobalObject(global));
874
0
  MOZ_ASSERT(JS::ObjectIsNotGray(global));
875
0
876
0
  // That might have ended up wrapping us already, due to the wonders
877
0
  // of XBL.  Check for that, and bail out as needed.
878
0
  aReflector.set(aCache->GetWrapper());
879
0
  if (aReflector) {
880
#ifdef DEBUG
881
    AssertReflectorHasGivenProto(aCx, aReflector, aGivenProto);
882
#endif // DEBUG
883
    return true;
884
0
  }
885
0
886
0
  JSAutoRealm ar(aCx, global);
887
0
  JS::Handle<JSObject*> canonicalProto = GetProtoObjectHandle(aCx);
888
0
  if (!canonicalProto) {
889
0
    return false;
890
0
  }
891
0
  JS::Rooted<JSObject*> proto(aCx);
892
0
  if (aGivenProto) {
893
0
    proto = aGivenProto;
894
0
    // Unfortunately, while aGivenProto was in the compartment of aCx
895
0
    // coming in, we changed compartments to that of "parent" so may need
896
0
    // to wrap the proto here.
897
0
    if (js::GetContextCompartment(aCx) != js::GetObjectCompartment(proto)) {
898
0
      if (!JS_WrapObject(aCx, &proto)) {
899
0
        return false;
900
0
      }
901
0
    }
902
0
  } else {
903
0
    proto = canonicalProto;
904
0
  }
905
0
906
0
  BindingJSObjectCreator<mozilla::dom::TextTrackList> creator(aCx);
907
0
  creator.CreateProxyObject(aCx, &sClass.mBase, DOMProxyHandler::getInstance(),
908
0
                            proto, aObject, JS::UndefinedHandleValue, aReflector);
909
0
  if (!aReflector) {
910
0
    return false;
911
0
  }
912
0
913
0
  aCache->SetWrapper(aReflector);
914
0
  creator.InitializationSucceeded();
915
0
916
0
  MOZ_ASSERT(aCache->GetWrapperPreserveColor() &&
917
0
             aCache->GetWrapperPreserveColor() == aReflector);
918
0
  // If proto != canonicalProto, we have to preserve our wrapper;
919
0
  // otherwise we won't be able to properly recreate it later, since
920
0
  // we won't know what proto to use.  Note that we don't check
921
0
  // aGivenProto here, since it's entirely possible (and even
922
0
  // somewhat common) to have a non-null aGivenProto which is the
923
0
  // same as canonicalProto.
924
0
  if (proto != canonicalProto) {
925
0
    PreserveWrapper(aObject);
926
0
  }
927
0
928
0
  return true;
929
0
}
930
931
static bool
932
ResolveOwnProperty(JSContext* cx, JS::Handle<JSObject*> wrapper, JS::Handle<JSObject*> obj, JS::Handle<jsid> id, JS::MutableHandle<JS::PropertyDescriptor> desc)
933
0
{
934
0
  return js::GetProxyHandler(obj)->getOwnPropertyDescriptor(cx, wrapper, id, desc);
935
0
}
936
937
static bool
938
EnumerateOwnProperties(JSContext* cx, JS::Handle<JSObject*> wrapper, JS::Handle<JSObject*> obj, JS::AutoIdVector& props)
939
0
{
940
0
  return js::GetProxyHandler(obj)->ownPropertyKeys(cx, wrapper, props);
941
0
}
942
943
const NativePropertyHooks sNativePropertyHooks[] = { {
944
  ResolveOwnProperty,
945
  EnumerateOwnProperties,
946
  nullptr,
947
  { sNativeProperties.Upcast(), sChromeOnlyNativeProperties.Upcast() },
948
  prototypes::id::TextTrackList,
949
  constructors::id::TextTrackList,
950
  EventTarget_Binding::sNativePropertyHooks,
951
  &DefaultXrayExpandoObjectClass
952
} };
953
954
void
955
CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, bool aDefineOnGlobal)
956
0
{
957
0
  JS::Handle<JSObject*> parentProto(EventTarget_Binding::GetProtoObjectHandle(aCx));
958
0
  if (!parentProto) {
959
0
    return;
960
0
  }
961
0
962
0
  JS::Handle<JSObject*> constructorProto(EventTarget_Binding::GetConstructorObjectHandle(aCx));
963
0
  if (!constructorProto) {
964
0
    return;
965
0
  }
966
0
967
0
  static bool sIdsInited = false;
968
0
  if (!sIdsInited && NS_IsMainThread()) {
969
0
    if (!InitIds(aCx, sNativeProperties.Upcast())) {
970
0
      return;
971
0
    }
972
0
    if (!InitIds(aCx, sChromeOnlyNativeProperties.Upcast())) {
973
0
      return;
974
0
    }
975
0
    sIdsInited = true;
976
0
  }
977
0
978
0
  JS::Heap<JSObject*>* protoCache = &aProtoAndIfaceCache.EntrySlotOrCreate(prototypes::id::TextTrackList);
979
0
  JS::Heap<JSObject*>* interfaceCache = &aProtoAndIfaceCache.EntrySlotOrCreate(constructors::id::TextTrackList);
980
0
  dom::CreateInterfaceObjects(aCx, aGlobal, parentProto,
981
0
                              &sPrototypeClass.mBase, protoCache,
982
0
                              nullptr,
983
0
                              constructorProto, &sInterfaceObjectClass.mBase, 0, nullptr,
984
0
                              interfaceCache,
985
0
                              sNativeProperties.Upcast(),
986
0
                              sChromeOnlyNativeProperties.Upcast(),
987
0
                              "TextTrackList", aDefineOnGlobal,
988
0
                              nullptr,
989
0
                              false);
990
0
}
991
992
JSObject*
993
GetConstructorObject(JSContext* aCx)
994
0
{
995
0
  return GetConstructorObjectHandle(aCx);
996
0
}
997
998
} // namespace TextTrackList_Binding
999
1000
1001
1002
} // namespace dom
1003
} // namespace mozilla