Coverage Report

Created: 2018-09-25 14:53

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