Coverage Report

Created: 2018-09-25 14:53

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