Coverage Report

Created: 2018-09-25 14:53

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