Coverage Report

Created: 2018-09-25 14:53

/work/obj-fuzz/dom/bindings/MIDIAccessBinding.cpp
Line
Count
Source (jump to first uncovered line)
1
/* THIS FILE IS AUTOGENERATED FROM MIDIAccess.webidl BY Codegen.py - DO NOT EDIT */
2
3
#include "EventHandlerBinding.h"
4
#include "EventTargetBinding.h"
5
#include "MIDIAccessBinding.h"
6
#include "WrapperFactory.h"
7
#include "mozilla/OwningNonNull.h"
8
#include "mozilla/Preferences.h"
9
#include "mozilla/dom/BindingUtils.h"
10
#include "mozilla/dom/DOMJSClass.h"
11
#include "mozilla/dom/MIDIAccess.h"
12
#include "mozilla/dom/MIDIInputMap.h"
13
#include "mozilla/dom/MIDIOutputMap.h"
14
#include "mozilla/dom/NonRefcountedDOMObject.h"
15
#include "mozilla/dom/Nullable.h"
16
#include "mozilla/dom/PrimitiveConversions.h"
17
#include "mozilla/dom/XrayExpandoClass.h"
18
19
namespace mozilla {
20
namespace dom {
21
22
namespace binding_detail {}; // Just to make sure it's known as a namespace
23
using namespace mozilla::dom::binding_detail;
24
25
26
namespace MIDIAccess_Binding {
27
28
static_assert(IsRefcounted<NativeType>::value == IsRefcounted<EventTarget_Binding::NativeType>::value,
29
              "Can't inherit from an interface with a different ownership model.");
30
31
MOZ_CAN_RUN_SCRIPT static bool
32
get_inputs(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::MIDIAccess* self, JSJitGetterCallArgs args)
33
0
{
34
0
  AUTO_PROFILER_LABEL_FAST("get MIDIAccess.inputs", DOM, cx);
35
0
36
0
  auto result(StrongOrRawPtr<mozilla::dom::MIDIInputMap>(self->Inputs()));
37
0
  MOZ_ASSERT(!JS_IsExceptionPending(cx));
38
0
  if (!GetOrCreateDOMReflector(cx, result, args.rval())) {
39
0
    MOZ_ASSERT(JS_IsExceptionPending(cx));
40
0
    return false;
41
0
  }
42
0
  return true;
43
0
}
44
45
static const JSJitInfo inputs_getterinfo = {
46
  { (JSJitGetterOp)get_inputs },
47
  { prototypes::id::MIDIAccess },
48
  { PrototypeTraits<prototypes::id::MIDIAccess>::Depth },
49
  JSJitInfo::Getter,
50
  JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
51
  JSVAL_TYPE_OBJECT,  /* returnType.  Not relevant for setters. */
52
  false,  /* isInfallible. False in setters. */
53
  false,  /* isMovable.  Not relevant for setters. */
54
  false, /* isEliminatable.  Not relevant for setters. */
55
  false, /* isAlwaysInSlot.  Only relevant for getters. */
56
  false, /* isLazilyCachedInSlot.  Only relevant for getters. */
57
  false,  /* isTypedMethod.  Only relevant for methods. */
58
  0   /* Reserved slot index, if we're stored in a slot, else 0. */
59
};
60
static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
61
static_assert(0 < 1, "There is no slot for us");
62
63
MOZ_CAN_RUN_SCRIPT static bool
64
get_outputs(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::MIDIAccess* self, JSJitGetterCallArgs args)
65
0
{
66
0
  AUTO_PROFILER_LABEL_FAST("get MIDIAccess.outputs", DOM, cx);
67
0
68
0
  auto result(StrongOrRawPtr<mozilla::dom::MIDIOutputMap>(self->Outputs()));
69
0
  MOZ_ASSERT(!JS_IsExceptionPending(cx));
70
0
  if (!GetOrCreateDOMReflector(cx, result, args.rval())) {
71
0
    MOZ_ASSERT(JS_IsExceptionPending(cx));
72
0
    return false;
73
0
  }
74
0
  return true;
75
0
}
76
77
static const JSJitInfo outputs_getterinfo = {
78
  { (JSJitGetterOp)get_outputs },
79
  { prototypes::id::MIDIAccess },
80
  { PrototypeTraits<prototypes::id::MIDIAccess>::Depth },
81
  JSJitInfo::Getter,
82
  JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
83
  JSVAL_TYPE_OBJECT,  /* returnType.  Not relevant for setters. */
84
  false,  /* isInfallible. False in setters. */
85
  false,  /* isMovable.  Not relevant for setters. */
86
  false, /* isEliminatable.  Not relevant for setters. */
87
  false, /* isAlwaysInSlot.  Only relevant for getters. */
88
  false, /* isLazilyCachedInSlot.  Only relevant for getters. */
89
  false,  /* isTypedMethod.  Only relevant for methods. */
90
  0   /* Reserved slot index, if we're stored in a slot, else 0. */
91
};
92
static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
93
static_assert(0 < 1, "There is no slot for us");
94
95
MOZ_CAN_RUN_SCRIPT static bool
96
get_onstatechange(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::MIDIAccess* self, JSJitGetterCallArgs args)
97
0
{
98
0
  AUTO_PROFILER_LABEL_FAST("get MIDIAccess.onstatechange", DOM, cx);
99
0
100
0
  RefPtr<EventHandlerNonNull> result(self->GetOnstatechange());
101
0
  MOZ_ASSERT(!JS_IsExceptionPending(cx));
102
0
  if (result) {
103
0
    args.rval().setObjectOrNull(GetCallbackFromCallbackObject(cx, result));
104
0
    if (!MaybeWrapObjectOrNullValue(cx, args.rval())) {
105
0
      return false;
106
0
    }
107
0
    return true;
108
0
  } else {
109
0
    args.rval().setNull();
110
0
    return true;
111
0
  }
112
0
}
113
114
MOZ_CAN_RUN_SCRIPT static bool
115
set_onstatechange(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::MIDIAccess* self, JSJitSetterCallArgs args)
116
0
{
117
0
  AUTO_PROFILER_LABEL_FAST("set MIDIAccess.onstatechange", DOM, cx);
118
0
119
0
  RootedCallback<RefPtr<binding_detail::FastEventHandlerNonNull>> arg0(cx);
120
0
  if (args[0].isObject()) {
121
0
    { // scope for tempRoot and tempGlobalRoot if needed
122
0
      arg0 = new binding_detail::FastEventHandlerNonNull(&args[0].toObject(), JS::CurrentGlobalOrNull(cx));
123
0
    }
124
0
  } else {
125
0
    arg0 = nullptr;
126
0
  }
127
0
  self->SetOnstatechange(Constify(arg0));
128
0
  MOZ_ASSERT(!JS_IsExceptionPending(cx));
129
0
130
0
  return true;
131
0
}
132
133
static const JSJitInfo onstatechange_getterinfo = {
134
  { (JSJitGetterOp)get_onstatechange },
135
  { prototypes::id::MIDIAccess },
136
  { PrototypeTraits<prototypes::id::MIDIAccess>::Depth },
137
  JSJitInfo::Getter,
138
  JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
139
  JSVAL_TYPE_UNKNOWN,  /* returnType.  Not relevant for setters. */
140
  false,  /* isInfallible. False in setters. */
141
  false,  /* isMovable.  Not relevant for setters. */
142
  false, /* isEliminatable.  Not relevant for setters. */
143
  false, /* isAlwaysInSlot.  Only relevant for getters. */
144
  false, /* isLazilyCachedInSlot.  Only relevant for getters. */
145
  false,  /* isTypedMethod.  Only relevant for methods. */
146
  0   /* Reserved slot index, if we're stored in a slot, else 0. */
147
};
148
static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
149
static_assert(0 < 1, "There is no slot for us");
150
static const JSJitInfo onstatechange_setterinfo = {
151
  { (JSJitGetterOp)set_onstatechange },
152
  { prototypes::id::MIDIAccess },
153
  { PrototypeTraits<prototypes::id::MIDIAccess>::Depth },
154
  JSJitInfo::Setter,
155
  JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
156
  JSVAL_TYPE_UNDEFINED,  /* returnType.  Not relevant for setters. */
157
  false,  /* isInfallible. False in setters. */
158
  false,  /* isMovable.  Not relevant for setters. */
159
  false, /* isEliminatable.  Not relevant for setters. */
160
  false, /* isAlwaysInSlot.  Only relevant for getters. */
161
  false, /* isLazilyCachedInSlot.  Only relevant for getters. */
162
  false,  /* isTypedMethod.  Only relevant for methods. */
163
  0   /* Reserved slot index, if we're stored in a slot, else 0. */
164
};
165
static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
166
static_assert(0 < 1, "There is no slot for us");
167
168
MOZ_CAN_RUN_SCRIPT static bool
169
get_sysexEnabled(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::MIDIAccess* self, JSJitGetterCallArgs args)
170
0
{
171
0
  AUTO_PROFILER_LABEL_FAST("get MIDIAccess.sysexEnabled", DOM, cx);
172
0
173
0
  bool result(self->SysexEnabled());
174
0
  MOZ_ASSERT(!JS_IsExceptionPending(cx));
175
0
  args.rval().setBoolean(result);
176
0
  return true;
177
0
}
178
179
static const JSJitInfo sysexEnabled_getterinfo = {
180
  { (JSJitGetterOp)get_sysexEnabled },
181
  { prototypes::id::MIDIAccess },
182
  { PrototypeTraits<prototypes::id::MIDIAccess>::Depth },
183
  JSJitInfo::Getter,
184
  JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
185
  JSVAL_TYPE_BOOLEAN,  /* returnType.  Not relevant for setters. */
186
  true,  /* isInfallible. False in setters. */
187
  false,  /* isMovable.  Not relevant for setters. */
188
  false, /* isEliminatable.  Not relevant for setters. */
189
  false, /* isAlwaysInSlot.  Only relevant for getters. */
190
  false, /* isLazilyCachedInSlot.  Only relevant for getters. */
191
  false,  /* isTypedMethod.  Only relevant for methods. */
192
  0   /* Reserved slot index, if we're stored in a slot, else 0. */
193
};
194
static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
195
static_assert(0 < 1, "There is no slot for us");
196
197
static bool
198
_addProperty(JSContext* cx, JS::Handle<JSObject*> obj, JS::Handle<jsid> id, JS::Handle<JS::Value> val)
199
0
{
200
0
  mozilla::dom::MIDIAccess* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::dom::MIDIAccess>(obj);
201
0
  // We don't want to preserve if we don't have a wrapper, and we
202
0
  // obviously can't preserve if we're not initialized.
203
0
  if (self && self->GetWrapperPreserveColor()) {
204
0
    PreserveWrapper(self);
205
0
  }
206
0
  return true;
207
0
}
208
209
static void
210
_finalize(js::FreeOp* fop, JSObject* obj)
211
0
{
212
0
  mozilla::dom::MIDIAccess* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::dom::MIDIAccess>(obj);
213
0
  if (self) {
214
0
    ClearWrapper(self, self, obj);
215
0
    AddForDeferredFinalization<mozilla::dom::MIDIAccess>(self);
216
0
  }
217
0
}
218
219
static size_t
220
_objectMoved(JSObject* obj, JSObject* old)
221
0
{
222
0
  mozilla::dom::MIDIAccess* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::dom::MIDIAccess>(obj);
223
0
  if (self) {
224
0
    UpdateWrapper(self, self, obj, old);
225
0
  }
226
0
227
0
  return 0;
228
0
}
229
230
// We deliberately use brace-elision to make Visual Studio produce better initalization code.
231
#if defined(__clang__)
232
#pragma clang diagnostic push
233
#pragma clang diagnostic ignored "-Wmissing-braces"
234
#endif
235
static const JSPropertySpec sAttributes_specs[] = {
236
  { "inputs", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &inputs_getterinfo, nullptr, nullptr },
237
  { "outputs", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &outputs_getterinfo, nullptr, nullptr },
238
  { "onstatechange", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &onstatechange_getterinfo, GenericSetter<NormalThisPolicy>, &onstatechange_setterinfo },
239
  { "sysexEnabled", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &sysexEnabled_getterinfo, nullptr, nullptr },
240
  { nullptr, 0, nullptr, nullptr, nullptr, nullptr }
241
};
242
#if defined(__clang__)
243
#pragma clang diagnostic pop
244
#endif
245
246
// Can't be const because the pref-enabled boolean needs to be writable
247
static PrefableDisablers sAttributes_disablers0 = {
248
  true, true, 0, nullptr
249
};
250
251
static const Prefable<const JSPropertySpec> sAttributes[] = {
252
  { &sAttributes_disablers0, &sAttributes_specs[0] },
253
  { nullptr, nullptr }
254
};
255
256
static_assert(1 <= 1ull << NUM_BITS_PROPERTY_INFO_PREF_INDEX,
257
    "We have a prefable index that is >= (1 << NUM_BITS_PROPERTY_INFO_PREF_INDEX)");
258
static_assert(4 <= 1ull << NUM_BITS_PROPERTY_INFO_SPEC_INDEX,
259
    "We have a spec index that is >= (1 << NUM_BITS_PROPERTY_INFO_SPEC_INDEX)");
260
261
262
static uint16_t sNativeProperties_sortedPropertyIndices[4];
263
static PropertyInfo sNativeProperties_propertyInfos[4];
264
265
static const NativePropertiesN<1> sNativeProperties = {
266
  false, 0,
267
  false, 0,
268
  false, 0,
269
  true,  0 /* sAttributes */,
270
  false, 0,
271
  false, 0,
272
  false, 0,
273
  -1,
274
  4,
275
  sNativeProperties_sortedPropertyIndices,
276
  {
277
    { sAttributes, &sNativeProperties_propertyInfos[0] }
278
  }
279
};
280
static_assert(4 < 1ull << CHAR_BIT * sizeof(sNativeProperties.propertyInfoCount),
281
    "We have a property info count that is oversized");
282
283
static const DOMIfaceAndProtoJSClass sInterfaceObjectClass = {
284
  {
285
    "Function",
286
    JSCLASS_IS_DOMIFACEANDPROTOJSCLASS | JSCLASS_HAS_RESERVED_SLOTS(DOM_INTERFACE_SLOTS_BASE),
287
    &sBoringInterfaceObjectClassClassOps,
288
    JS_NULL_CLASS_SPEC,
289
    JS_NULL_CLASS_EXT,
290
    &sInterfaceObjectClassObjectOps
291
  },
292
  eInterface,
293
  true,
294
  prototypes::id::MIDIAccess,
295
  PrototypeTraits<prototypes::id::MIDIAccess>::Depth,
296
  sNativePropertyHooks,
297
  "function MIDIAccess() {\n    [native code]\n}",
298
  EventTarget_Binding::GetConstructorObject
299
};
300
301
static const DOMIfaceAndProtoJSClass sPrototypeClass = {
302
  {
303
    "MIDIAccessPrototype",
304
    JSCLASS_IS_DOMIFACEANDPROTOJSCLASS | JSCLASS_HAS_RESERVED_SLOTS(DOM_INTERFACE_PROTO_SLOTS_BASE),
305
    JS_NULL_CLASS_OPS,
306
    JS_NULL_CLASS_SPEC,
307
    JS_NULL_CLASS_EXT,
308
    JS_NULL_OBJECT_OPS
309
  },
310
  eInterfacePrototype,
311
  false,
312
  prototypes::id::MIDIAccess,
313
  PrototypeTraits<prototypes::id::MIDIAccess>::Depth,
314
  sNativePropertyHooks,
315
  "[object MIDIAccessPrototype]",
316
  EventTarget_Binding::GetProtoObject
317
};
318
319
bool
320
ConstructorEnabled(JSContext* aCx, JS::Handle<JSObject*> aObj)
321
0
{
322
0
  static bool sPrefValue;
323
0
  static bool sPrefCacheSetUp = false;
324
0
  if (!sPrefCacheSetUp) {
325
0
    sPrefCacheSetUp = true;
326
0
    Preferences::AddBoolVarCache(&sPrefValue, "dom.webmidi.enabled");
327
0
  }
328
0
329
0
  return sPrefValue &&
330
0
         mozilla::dom::IsSecureContextOrObjectIsFromSecureContext(aCx, aObj);
331
0
}
332
333
static const js::ClassOps sClassOps = {
334
  _addProperty, /* addProperty */
335
  nullptr,               /* delProperty */
336
  nullptr,               /* enumerate */
337
  nullptr, /* newEnumerate */
338
  nullptr, /* resolve */
339
  nullptr, /* mayResolve */
340
  _finalize, /* finalize */
341
  nullptr, /* call */
342
  nullptr,               /* hasInstance */
343
  nullptr,               /* construct */
344
  nullptr, /* trace */
345
};
346
347
static const js::ClassExtension sClassExtension = {
348
  nullptr, /* weakmapKeyDelegateOp */
349
  _objectMoved /* objectMovedOp */
350
};
351
352
static const DOMJSClass sClass = {
353
  { "MIDIAccess",
354
    JSCLASS_IS_DOMJSCLASS | JSCLASS_FOREGROUND_FINALIZE | JSCLASS_HAS_RESERVED_SLOTS(1),
355
    &sClassOps,
356
    JS_NULL_CLASS_SPEC,
357
    &sClassExtension,
358
    JS_NULL_OBJECT_OPS
359
  },
360
  { prototypes::id::EventTarget, prototypes::id::MIDIAccess, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count },
361
  IsBaseOf<nsISupports, mozilla::dom::MIDIAccess >::value,
362
  sNativePropertyHooks,
363
  FindAssociatedGlobalForNative<mozilla::dom::MIDIAccess>::Get,
364
  GetProtoObjectHandle,
365
  GetCCParticipant<mozilla::dom::MIDIAccess>::Get()
366
};
367
static_assert(1 == DOM_INSTANCE_RESERVED_SLOTS,
368
              "Must have the right minimal number of reserved slots.");
369
static_assert(1 >= 1,
370
              "Must have enough reserved slots.");
371
372
const JSClass*
373
GetJSClass()
374
0
{
375
0
  return sClass.ToJSClass();
376
0
}
377
378
bool
379
Wrap(JSContext* aCx, mozilla::dom::MIDIAccess* aObject, nsWrapperCache* aCache, JS::Handle<JSObject*> aGivenProto, JS::MutableHandle<JSObject*> aReflector)
380
0
{
381
0
  static_assert(!IsBaseOf<NonRefcountedDOMObject, mozilla::dom::MIDIAccess>::value,
382
0
                "Shouldn't have wrappercached things that are not refcounted.");
383
0
  MOZ_ASSERT(static_cast<mozilla::dom::MIDIAccess*>(aObject) ==
384
0
             reinterpret_cast<mozilla::dom::MIDIAccess*>(aObject),
385
0
             "Multiple inheritance for mozilla::dom::MIDIAccess is broken.");
386
0
  MOZ_ASSERT(static_cast<mozilla::dom::EventTarget*>(aObject) ==
387
0
             reinterpret_cast<mozilla::dom::EventTarget*>(aObject),
388
0
             "Multiple inheritance for mozilla::dom::EventTarget is broken.");
389
0
  MOZ_ASSERT(ToSupportsIsCorrect(aObject));
390
0
  MOZ_ASSERT_IF(aGivenProto, js::IsObjectInContextCompartment(aGivenProto, aCx));
391
0
  MOZ_ASSERT(!aCache->GetWrapper(),
392
0
             "You should probably not be using Wrap() directly; use "
393
0
             "GetOrCreateDOMReflector instead");
394
0
395
0
  MOZ_ASSERT(ToSupportsIsOnPrimaryInheritanceChain(aObject, aCache),
396
0
             "nsISupports must be on our primary inheritance chain");
397
0
398
0
  JS::Rooted<JSObject*> global(aCx, FindAssociatedGlobal(aCx, aObject->GetParentObject()));
399
0
  if (!global) {
400
0
    return false;
401
0
  }
402
0
  MOZ_ASSERT(JS_IsGlobalObject(global));
403
0
  MOZ_ASSERT(JS::ObjectIsNotGray(global));
404
0
405
0
  // That might have ended up wrapping us already, due to the wonders
406
0
  // of XBL.  Check for that, and bail out as needed.
407
0
  aReflector.set(aCache->GetWrapper());
408
0
  if (aReflector) {
409
#ifdef DEBUG
410
    AssertReflectorHasGivenProto(aCx, aReflector, aGivenProto);
411
#endif // DEBUG
412
    return true;
413
0
  }
414
0
415
0
  JSAutoRealm ar(aCx, global);
416
0
  JS::Handle<JSObject*> canonicalProto = GetProtoObjectHandle(aCx);
417
0
  if (!canonicalProto) {
418
0
    return false;
419
0
  }
420
0
  JS::Rooted<JSObject*> proto(aCx);
421
0
  if (aGivenProto) {
422
0
    proto = aGivenProto;
423
0
    // Unfortunately, while aGivenProto was in the compartment of aCx
424
0
    // coming in, we changed compartments to that of "parent" so may need
425
0
    // to wrap the proto here.
426
0
    if (js::GetContextCompartment(aCx) != js::GetObjectCompartment(proto)) {
427
0
      if (!JS_WrapObject(aCx, &proto)) {
428
0
        return false;
429
0
      }
430
0
    }
431
0
  } else {
432
0
    proto = canonicalProto;
433
0
  }
434
0
435
0
  BindingJSObjectCreator<mozilla::dom::MIDIAccess> creator(aCx);
436
0
  creator.CreateObject(aCx, sClass.ToJSClass(), proto, aObject, aReflector);
437
0
  if (!aReflector) {
438
0
    return false;
439
0
  }
440
0
441
0
  aCache->SetWrapper(aReflector);
442
0
  creator.InitializationSucceeded();
443
0
444
0
  MOZ_ASSERT(aCache->GetWrapperPreserveColor() &&
445
0
             aCache->GetWrapperPreserveColor() == aReflector);
446
0
  // If proto != canonicalProto, we have to preserve our wrapper;
447
0
  // otherwise we won't be able to properly recreate it later, since
448
0
  // we won't know what proto to use.  Note that we don't check
449
0
  // aGivenProto here, since it's entirely possible (and even
450
0
  // somewhat common) to have a non-null aGivenProto which is the
451
0
  // same as canonicalProto.
452
0
  if (proto != canonicalProto) {
453
0
    PreserveWrapper(aObject);
454
0
  }
455
0
456
0
  return true;
457
0
}
458
459
const NativePropertyHooks sNativePropertyHooks[] = { {
460
  nullptr,
461
  nullptr,
462
  nullptr,
463
  { sNativeProperties.Upcast(), nullptr },
464
  prototypes::id::MIDIAccess,
465
  constructors::id::MIDIAccess,
466
  EventTarget_Binding::sNativePropertyHooks,
467
  &DefaultXrayExpandoObjectClass
468
} };
469
470
void
471
CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, bool aDefineOnGlobal)
472
0
{
473
0
  JS::Handle<JSObject*> parentProto(EventTarget_Binding::GetProtoObjectHandle(aCx));
474
0
  if (!parentProto) {
475
0
    return;
476
0
  }
477
0
478
0
  JS::Handle<JSObject*> constructorProto(EventTarget_Binding::GetConstructorObjectHandle(aCx));
479
0
  if (!constructorProto) {
480
0
    return;
481
0
  }
482
0
483
0
  static bool sIdsInited = false;
484
0
  if (!sIdsInited && NS_IsMainThread()) {
485
0
    if (!InitIds(aCx, sNativeProperties.Upcast())) {
486
0
      return;
487
0
    }
488
0
    sIdsInited = true;
489
0
  }
490
0
491
0
  JS::Heap<JSObject*>* protoCache = &aProtoAndIfaceCache.EntrySlotOrCreate(prototypes::id::MIDIAccess);
492
0
  JS::Heap<JSObject*>* interfaceCache = &aProtoAndIfaceCache.EntrySlotOrCreate(constructors::id::MIDIAccess);
493
0
  dom::CreateInterfaceObjects(aCx, aGlobal, parentProto,
494
0
                              &sPrototypeClass.mBase, protoCache,
495
0
                              nullptr,
496
0
                              constructorProto, &sInterfaceObjectClass.mBase, 0, nullptr,
497
0
                              interfaceCache,
498
0
                              sNativeProperties.Upcast(),
499
0
                              nullptr,
500
0
                              "MIDIAccess", aDefineOnGlobal,
501
0
                              nullptr,
502
0
                              false);
503
0
}
504
505
JSObject*
506
GetConstructorObject(JSContext* aCx)
507
0
{
508
0
  return GetConstructorObjectHandle(aCx);
509
0
}
510
511
} // namespace MIDIAccess_Binding
512
513
514
515
} // namespace dom
516
} // namespace mozilla