Coverage Report

Created: 2018-09-25 14:53

/work/obj-fuzz/dom/bindings/XPathEvaluatorBinding.cpp
Line
Count
Source (jump to first uncovered line)
1
/* THIS FILE IS AUTOGENERATED FROM XPathEvaluator.webidl BY Codegen.py - DO NOT EDIT */
2
3
#include "DocumentBinding.h"
4
#include "WrapperFactory.h"
5
#include "XPathEvaluatorBinding.h"
6
#include "XPathNSResolverBinding.h"
7
#include "mozilla/OwningNonNull.h"
8
#include "mozilla/dom/BindingUtils.h"
9
#include "mozilla/dom/DOMJSClass.h"
10
#include "mozilla/dom/NonRefcountedDOMObject.h"
11
#include "mozilla/dom/Nullable.h"
12
#include "mozilla/dom/PrimitiveConversions.h"
13
#include "mozilla/dom/XPathEvaluator.h"
14
#include "mozilla/dom/XPathExpression.h"
15
#include "mozilla/dom/XPathResult.h"
16
#include "mozilla/dom/XrayExpandoClass.h"
17
#include "nsINode.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 XPathEvaluator_Binding {
27
28
MOZ_CAN_RUN_SCRIPT static bool
29
createExpression(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::XPathEvaluator* self, const JSJitMethodCallArgs& args)
30
0
{
31
0
  AUTO_PROFILER_LABEL_FAST("XPathEvaluator.createExpression", DOM, cx);
32
0
33
0
  if (MOZ_UNLIKELY(args.length() < 1)) {
34
0
    return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "XPathEvaluator.createExpression");
35
0
  }
36
0
  binding_detail::FakeString arg0;
37
0
  if (!ConvertJSValueToString(cx, args[0], eStringify, eStringify, arg0)) {
38
0
    return false;
39
0
  }
40
0
  RootedCallback<RefPtr<binding_detail::FastXPathNSResolver>> arg1(cx);
41
0
  if (args.hasDefined(1)) {
42
0
    if (args[1].isObject()) {
43
0
      { // scope for tempRoot and tempGlobalRoot if needed
44
0
        arg1 = new binding_detail::FastXPathNSResolver(&args[1].toObject(), JS::CurrentGlobalOrNull(cx));
45
0
      }
46
0
    } else if (args[1].isNullOrUndefined()) {
47
0
      arg1 = nullptr;
48
0
    } else {
49
0
      ThrowErrorMessage(cx, MSG_NOT_OBJECT, "Argument 2 of XPathEvaluator.createExpression");
50
0
      return false;
51
0
    }
52
0
  } else {
53
0
    arg1 = nullptr;
54
0
  }
55
0
  FastErrorResult rv;
56
0
  auto result(StrongOrRawPtr<mozilla::dom::XPathExpression>(self->CreateExpression(NonNullHelper(Constify(arg0)), MOZ_KnownLive(Constify(arg1)), rv)));
57
0
  if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
58
0
    return false;
59
0
  }
60
0
  MOZ_ASSERT(!JS_IsExceptionPending(cx));
61
0
  static_assert(!IsPointer<decltype(result)>::value,
62
0
                "NewObject implies that we need to keep the object alive with a strong reference.");
63
0
  if (!WrapNewBindingNonWrapperCachedObject(cx, obj, result, args.rval())) {
64
0
    MOZ_ASSERT(JS_IsExceptionPending(cx));
65
0
    return false;
66
0
  }
67
0
  return true;
68
0
}
69
70
static const JSJitInfo createExpression_methodinfo = {
71
  { (JSJitGetterOp)createExpression },
72
  { prototypes::id::XPathEvaluator },
73
  { PrototypeTraits<prototypes::id::XPathEvaluator>::Depth },
74
  JSJitInfo::Method,
75
  JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
76
  JSVAL_TYPE_OBJECT,  /* returnType.  Not relevant for setters. */
77
  false,  /* isInfallible. False in setters. */
78
  false,  /* isMovable.  Not relevant for setters. */
79
  false, /* isEliminatable.  Not relevant for setters. */
80
  false, /* isAlwaysInSlot.  Only relevant for getters. */
81
  false, /* isLazilyCachedInSlot.  Only relevant for getters. */
82
  false,  /* isTypedMethod.  Only relevant for methods. */
83
  0   /* Reserved slot index, if we're stored in a slot, else 0. */
84
};
85
static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
86
static_assert(0 < 1, "There is no slot for us");
87
88
MOZ_CAN_RUN_SCRIPT static bool
89
createNSResolver(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::XPathEvaluator* self, const JSJitMethodCallArgs& args)
90
0
{
91
0
  AUTO_PROFILER_LABEL_FAST("XPathEvaluator.createNSResolver", DOM, cx);
92
0
93
0
  if (MOZ_UNLIKELY(args.length() < 1)) {
94
0
    return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "XPathEvaluator.createNSResolver");
95
0
  }
96
0
  NonNull<nsINode> arg0;
97
0
  if (args[0].isObject()) {
98
0
    {
99
0
      nsresult rv = UnwrapObject<prototypes::id::Node, nsINode>(args[0], arg0);
100
0
      if (NS_FAILED(rv)) {
101
0
        ThrowErrorMessage(cx, MSG_DOES_NOT_IMPLEMENT_INTERFACE, "Argument 1 of XPathEvaluator.createNSResolver", "Node");
102
0
        return false;
103
0
      }
104
0
    }
105
0
  } else {
106
0
    ThrowErrorMessage(cx, MSG_NOT_OBJECT, "Argument 1 of XPathEvaluator.createNSResolver");
107
0
    return false;
108
0
  }
109
0
  auto result(StrongOrRawPtr<nsINode>(self->CreateNSResolver(MOZ_KnownLive(NonNullHelper(arg0)))));
110
0
  MOZ_ASSERT(!JS_IsExceptionPending(cx));
111
0
  if (!GetOrCreateDOMReflector(cx, result, args.rval())) {
112
0
    MOZ_ASSERT(JS_IsExceptionPending(cx));
113
0
    return false;
114
0
  }
115
0
  return true;
116
0
}
117
118
static const JSJitInfo::ArgType createNSResolver_methodinfo_argTypes[] = { JSJitInfo::Object, JSJitInfo::ArgTypeListEnd };
119
static const JSTypedMethodJitInfo createNSResolver_methodinfo = {
120
  {
121
    { (JSJitGetterOp)createNSResolver },
122
    { prototypes::id::XPathEvaluator },
123
    { PrototypeTraits<prototypes::id::XPathEvaluator>::Depth },
124
    JSJitInfo::Method,
125
    JSJitInfo::AliasDOMSets, /* aliasSet.  Not relevant for setters. */
126
    JSVAL_TYPE_OBJECT,  /* returnType.  Not relevant for setters. */
127
    false,  /* isInfallible. False in setters. */
128
    true,  /* isMovable.  Not relevant for setters. */
129
    true, /* isEliminatable.  Not relevant for setters. */
130
    false, /* isAlwaysInSlot.  Only relevant for getters. */
131
    false, /* isLazilyCachedInSlot.  Only relevant for getters. */
132
    true,  /* isTypedMethod.  Only relevant for methods. */
133
    0   /* Reserved slot index, if we're stored in a slot, else 0. */
134
  },
135
  createNSResolver_methodinfo_argTypes
136
};
137
static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
138
static_assert(0 < 1, "There is no slot for us");
139
140
MOZ_CAN_RUN_SCRIPT static bool
141
evaluate(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::XPathEvaluator* self, const JSJitMethodCallArgs& args)
142
0
{
143
0
  AUTO_PROFILER_LABEL_FAST("XPathEvaluator.evaluate", DOM, cx);
144
0
145
0
  if (MOZ_UNLIKELY(args.length() < 2)) {
146
0
    return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "XPathEvaluator.evaluate");
147
0
  }
148
0
  binding_detail::FakeString arg0;
149
0
  if (!ConvertJSValueToString(cx, args[0], eStringify, eStringify, arg0)) {
150
0
    return false;
151
0
  }
152
0
  NonNull<nsINode> arg1;
153
0
  if (args[1].isObject()) {
154
0
    {
155
0
      nsresult rv = UnwrapObject<prototypes::id::Node, nsINode>(args[1], arg1);
156
0
      if (NS_FAILED(rv)) {
157
0
        ThrowErrorMessage(cx, MSG_DOES_NOT_IMPLEMENT_INTERFACE, "Argument 2 of XPathEvaluator.evaluate", "Node");
158
0
        return false;
159
0
      }
160
0
    }
161
0
  } else {
162
0
    ThrowErrorMessage(cx, MSG_NOT_OBJECT, "Argument 2 of XPathEvaluator.evaluate");
163
0
    return false;
164
0
  }
165
0
  RootedCallback<RefPtr<binding_detail::FastXPathNSResolver>> arg2(cx);
166
0
  if (args.hasDefined(2)) {
167
0
    if (args[2].isObject()) {
168
0
      { // scope for tempRoot and tempGlobalRoot if needed
169
0
        arg2 = new binding_detail::FastXPathNSResolver(&args[2].toObject(), JS::CurrentGlobalOrNull(cx));
170
0
      }
171
0
    } else if (args[2].isNullOrUndefined()) {
172
0
      arg2 = nullptr;
173
0
    } else {
174
0
      ThrowErrorMessage(cx, MSG_NOT_OBJECT, "Argument 3 of XPathEvaluator.evaluate");
175
0
      return false;
176
0
    }
177
0
  } else {
178
0
    arg2 = nullptr;
179
0
  }
180
0
  uint16_t arg3;
181
0
  if (args.hasDefined(3)) {
182
0
    if (!ValueToPrimitive<uint16_t, eDefault>(cx, args[3], &arg3)) {
183
0
      return false;
184
0
    }
185
0
  } else {
186
0
    arg3 = 0;
187
0
  }
188
0
  JS::Rooted<JSObject*> arg4(cx);
189
0
  if (args.hasDefined(4)) {
190
0
    if (args[4].isObject()) {
191
0
      arg4 = &args[4].toObject();
192
0
    } else if (args[4].isNullOrUndefined()) {
193
0
      arg4 = nullptr;
194
0
    } else {
195
0
      ThrowErrorMessage(cx, MSG_NOT_OBJECT, "Argument 5 of XPathEvaluator.evaluate");
196
0
      return false;
197
0
    }
198
0
  } else {
199
0
    arg4 = nullptr;
200
0
  }
201
0
  FastErrorResult rv;
202
0
  auto result(StrongOrRawPtr<mozilla::dom::XPathResult>(self->Evaluate(cx, NonNullHelper(Constify(arg0)), MOZ_KnownLive(NonNullHelper(arg1)), MOZ_KnownLive(Constify(arg2)), arg3, arg4, rv)));
203
0
  if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
204
0
    return false;
205
0
  }
206
0
  MOZ_ASSERT(!JS_IsExceptionPending(cx));
207
0
  if (!GetOrCreateDOMReflector(cx, result, args.rval())) {
208
0
    MOZ_ASSERT(JS_IsExceptionPending(cx));
209
0
    return false;
210
0
  }
211
0
  return true;
212
0
}
213
214
static const JSJitInfo evaluate_methodinfo = {
215
  { (JSJitGetterOp)evaluate },
216
  { prototypes::id::XPathEvaluator },
217
  { PrototypeTraits<prototypes::id::XPathEvaluator>::Depth },
218
  JSJitInfo::Method,
219
  JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
220
  JSVAL_TYPE_OBJECT,  /* returnType.  Not relevant for setters. */
221
  false,  /* isInfallible. False in setters. */
222
  false,  /* isMovable.  Not relevant for setters. */
223
  false, /* isEliminatable.  Not relevant for setters. */
224
  false, /* isAlwaysInSlot.  Only relevant for getters. */
225
  false, /* isLazilyCachedInSlot.  Only relevant for getters. */
226
  false,  /* isTypedMethod.  Only relevant for methods. */
227
  0   /* Reserved slot index, if we're stored in a slot, else 0. */
228
};
229
static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
230
static_assert(0 < 1, "There is no slot for us");
231
232
static void
233
_finalize(js::FreeOp* fop, JSObject* obj)
234
0
{
235
0
  mozilla::dom::XPathEvaluator* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::dom::XPathEvaluator>(obj);
236
0
  if (self) {
237
0
    AddForDeferredFinalization<mozilla::dom::XPathEvaluator>(self);
238
0
  }
239
0
}
240
241
// We deliberately use brace-elision to make Visual Studio produce better initalization code.
242
#if defined(__clang__)
243
#pragma clang diagnostic push
244
#pragma clang diagnostic ignored "-Wmissing-braces"
245
#endif
246
static const JSFunctionSpec sMethods_specs[] = {
247
  JS_FNSPEC("createExpression", (GenericMethod<NormalThisPolicy, ThrowExceptions>), reinterpret_cast<const JSJitInfo*>(&createExpression_methodinfo), 1, JSPROP_ENUMERATE, nullptr),
248
  JS_FNSPEC("createNSResolver", (GenericMethod<NormalThisPolicy, ThrowExceptions>), reinterpret_cast<const JSJitInfo*>(&createNSResolver_methodinfo), 1, JSPROP_ENUMERATE, nullptr),
249
  JS_FNSPEC("evaluate", (GenericMethod<NormalThisPolicy, ThrowExceptions>), reinterpret_cast<const JSJitInfo*>(&evaluate_methodinfo), 2, JSPROP_ENUMERATE, nullptr),
250
  JS_FS_END
251
};
252
#if defined(__clang__)
253
#pragma clang diagnostic pop
254
#endif
255
256
257
static const Prefable<const JSFunctionSpec> sMethods[] = {
258
  { nullptr, &sMethods_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(3 <= 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[3];
269
static PropertyInfo sNativeProperties_propertyInfos[3];
270
271
static const NativePropertiesN<1> sNativeProperties = {
272
  false, 0,
273
  false, 0,
274
  true,  0 /* sMethods */,
275
  false, 0,
276
  false, 0,
277
  false, 0,
278
  false, 0,
279
  -1,
280
  3,
281
  sNativeProperties_sortedPropertyIndices,
282
  {
283
    { sMethods, &sNativeProperties_propertyInfos[0] }
284
  }
285
};
286
static_assert(3 < 1ull << CHAR_BIT * sizeof(sNativeProperties.propertyInfoCount),
287
    "We have a property info count that is oversized");
288
289
static bool
290
_constructor(JSContext* cx, unsigned argc, JS::Value* vp)
291
0
{
292
0
  AUTO_PROFILER_LABEL_FAST("XPathEvaluator constructor", DOM, cx);
293
0
294
0
  JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
295
0
  JS::Rooted<JSObject*> obj(cx, &args.callee());
296
0
  if (!args.isConstructing()) {
297
0
    // XXXbz wish I could get the name from the callee instead of
298
0
    // Adding more relocations
299
0
    return ThrowConstructorWithoutNew(cx, "XPathEvaluator");
300
0
  }
301
0
302
0
  JS::Rooted<JSObject*> desiredProto(cx);
303
0
  if (!GetDesiredProto(cx, args, &desiredProto)) {
304
0
    return false;
305
0
  }
306
0
307
0
  GlobalObject global(cx, obj);
308
0
  if (global.Failed()) {
309
0
    return false;
310
0
  }
311
0
312
0
  bool objIsXray = xpc::WrapperFactory::IsXrayWrapper(obj);
313
0
  Maybe<JSAutoRealm> ar;
314
0
  if (objIsXray) {
315
0
    obj = js::CheckedUnwrap(obj);
316
0
    if (!obj) {
317
0
      return false;
318
0
    }
319
0
    ar.emplace(cx, obj);
320
0
    if (!JS_WrapObject(cx, &desiredProto)) {
321
0
      return false;
322
0
    }
323
0
  }
324
0
  FastErrorResult rv;
325
0
  auto result(StrongOrRawPtr<mozilla::dom::XPathEvaluator>(mozilla::dom::XPathEvaluator::Constructor(global, rv)));
326
0
  if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
327
0
    return false;
328
0
  }
329
0
  MOZ_ASSERT(!JS_IsExceptionPending(cx));
330
0
  static_assert(!IsPointer<decltype(result)>::value,
331
0
                "NewObject implies that we need to keep the object alive with a strong reference.");
332
0
  if (!WrapNewBindingNonWrapperCachedObject(cx, obj, result, args.rval(), desiredProto)) {
333
0
    MOZ_ASSERT(JS_IsExceptionPending(cx));
334
0
    return false;
335
0
  }
336
0
  return true;
337
0
}
338
339
static const js::ClassOps sInterfaceObjectClassOps = {
340
    nullptr,               /* addProperty */
341
    nullptr,               /* delProperty */
342
    nullptr,               /* enumerate */
343
    nullptr,               /* newEnumerate */
344
    nullptr,               /* resolve */
345
    nullptr,               /* mayResolve */
346
    nullptr,               /* finalize */
347
    _constructor, /* call */
348
    nullptr,               /* hasInstance */
349
    _constructor, /* construct */
350
    nullptr,               /* trace */
351
};
352
353
static const DOMIfaceAndProtoJSClass sInterfaceObjectClass = {
354
  {
355
    "Function",
356
    JSCLASS_IS_DOMIFACEANDPROTOJSCLASS | JSCLASS_HAS_RESERVED_SLOTS(DOM_INTERFACE_SLOTS_BASE),
357
    &sInterfaceObjectClassOps,
358
    JS_NULL_CLASS_SPEC,
359
    JS_NULL_CLASS_EXT,
360
    &sInterfaceObjectClassObjectOps
361
  },
362
  eInterface,
363
  true,
364
  prototypes::id::XPathEvaluator,
365
  PrototypeTraits<prototypes::id::XPathEvaluator>::Depth,
366
  sNativePropertyHooks,
367
  "function XPathEvaluator() {\n    [native code]\n}",
368
  JS::GetRealmFunctionPrototype
369
};
370
371
static const DOMIfaceAndProtoJSClass sPrototypeClass = {
372
  {
373
    "XPathEvaluatorPrototype",
374
    JSCLASS_IS_DOMIFACEANDPROTOJSCLASS | JSCLASS_HAS_RESERVED_SLOTS(DOM_INTERFACE_PROTO_SLOTS_BASE),
375
    JS_NULL_CLASS_OPS,
376
    JS_NULL_CLASS_SPEC,
377
    JS_NULL_CLASS_EXT,
378
    JS_NULL_OBJECT_OPS
379
  },
380
  eInterfacePrototype,
381
  false,
382
  prototypes::id::XPathEvaluator,
383
  PrototypeTraits<prototypes::id::XPathEvaluator>::Depth,
384
  sNativePropertyHooks,
385
  "[object XPathEvaluatorPrototype]",
386
  JS::GetRealmObjectPrototype
387
};
388
389
static const js::ClassOps sClassOps = {
390
  nullptr, /* addProperty */
391
  nullptr,               /* delProperty */
392
  nullptr,               /* enumerate */
393
  nullptr, /* newEnumerate */
394
  nullptr, /* resolve */
395
  nullptr, /* mayResolve */
396
  _finalize, /* finalize */
397
  nullptr, /* call */
398
  nullptr,               /* hasInstance */
399
  nullptr,               /* construct */
400
  nullptr, /* trace */
401
};
402
403
static const js::ClassExtension sClassExtension = {
404
  nullptr, /* weakmapKeyDelegateOp */
405
  nullptr /* objectMovedOp */
406
};
407
408
static const DOMJSClass sClass = {
409
  { "XPathEvaluator",
410
    JSCLASS_IS_DOMJSCLASS | JSCLASS_FOREGROUND_FINALIZE | JSCLASS_HAS_RESERVED_SLOTS(1),
411
    &sClassOps,
412
    JS_NULL_CLASS_SPEC,
413
    &sClassExtension,
414
    JS_NULL_OBJECT_OPS
415
  },
416
  { prototypes::id::XPathEvaluator, 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 },
417
  IsBaseOf<nsISupports, mozilla::dom::XPathEvaluator >::value,
418
  sNativePropertyHooks,
419
  FindAssociatedGlobalForNative<mozilla::dom::XPathEvaluator>::Get,
420
  GetProtoObjectHandle,
421
  GetCCParticipant<mozilla::dom::XPathEvaluator>::Get()
422
};
423
static_assert(1 == DOM_INSTANCE_RESERVED_SLOTS,
424
              "Must have the right minimal number of reserved slots.");
425
static_assert(1 >= 1,
426
              "Must have enough reserved slots.");
427
428
const JSClass*
429
GetJSClass()
430
0
{
431
0
  return sClass.ToJSClass();
432
0
}
433
434
bool
435
Wrap(JSContext* aCx, mozilla::dom::XPathEvaluator* aObject, JS::Handle<JSObject*> aGivenProto, JS::MutableHandle<JSObject*> aReflector)
436
0
{
437
0
  MOZ_ASSERT(static_cast<mozilla::dom::XPathEvaluator*>(aObject) ==
438
0
             reinterpret_cast<mozilla::dom::XPathEvaluator*>(aObject),
439
0
             "Multiple inheritance for mozilla::dom::XPathEvaluator is broken.");
440
0
  MOZ_ASSERT(ToSupportsIsCorrect(aObject));
441
0
  MOZ_ASSERT_IF(aGivenProto, js::IsObjectInContextCompartment(aGivenProto, aCx));
442
0
443
0
  JS::Rooted<JSObject*> global(aCx, JS::CurrentGlobalOrNull(aCx));
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::XPathEvaluator> 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
470
0
471
0
  creator.InitializationSucceeded();
472
0
  return true;
473
0
}
474
475
const NativePropertyHooks sNativePropertyHooks[] = { {
476
  nullptr,
477
  nullptr,
478
  nullptr,
479
  { sNativeProperties.Upcast(), nullptr },
480
  prototypes::id::XPathEvaluator,
481
  constructors::id::XPathEvaluator,
482
  nullptr,
483
  &DefaultXrayExpandoObjectClass
484
} };
485
486
void
487
CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, bool aDefineOnGlobal)
488
0
{
489
0
  JS::Rooted<JSObject*> parentProto(aCx, JS::GetRealmObjectPrototype(aCx));
490
0
  if (!parentProto) {
491
0
    return;
492
0
  }
493
0
494
0
  JS::Rooted<JSObject*> constructorProto(aCx, JS::GetRealmFunctionPrototype(aCx));
495
0
  if (!constructorProto) {
496
0
    return;
497
0
  }
498
0
499
0
  static bool sIdsInited = false;
500
0
  if (!sIdsInited && NS_IsMainThread()) {
501
0
    if (!InitIds(aCx, sNativeProperties.Upcast())) {
502
0
      return;
503
0
    }
504
0
    sIdsInited = true;
505
0
  }
506
0
507
0
  JS::Heap<JSObject*>* protoCache = &aProtoAndIfaceCache.EntrySlotOrCreate(prototypes::id::XPathEvaluator);
508
0
  JS::Heap<JSObject*>* interfaceCache = &aProtoAndIfaceCache.EntrySlotOrCreate(constructors::id::XPathEvaluator);
509
0
  dom::CreateInterfaceObjects(aCx, aGlobal, parentProto,
510
0
                              &sPrototypeClass.mBase, protoCache,
511
0
                              nullptr,
512
0
                              constructorProto, &sInterfaceObjectClass.mBase, 0, nullptr,
513
0
                              interfaceCache,
514
0
                              sNativeProperties.Upcast(),
515
0
                              nullptr,
516
0
                              "XPathEvaluator", aDefineOnGlobal,
517
0
                              nullptr,
518
0
                              false);
519
0
}
520
521
JSObject*
522
GetConstructorObject(JSContext* aCx)
523
0
{
524
0
  return GetConstructorObjectHandle(aCx);
525
0
}
526
527
} // namespace XPathEvaluator_Binding
528
529
530
531
} // namespace dom
532
} // namespace mozilla