LCOV - code coverage report
Current view: top level - obj-x86_64-pc-linux-gnu/dom/bindings - XPathExpressionBinding.cpp (source / functions) Hit Total Coverage
Test: output.info Lines: 0 134 0.0 %
Date: 2017-07-14 16:53:18 Functions: 0 10 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* THIS FILE IS AUTOGENERATED FROM XPathExpression.webidl BY Codegen.py - DO NOT EDIT */
       2             : 
       3             : #include "WrapperFactory.h"
       4             : #include "XPathExpressionBinding.h"
       5             : #include "mozilla/OwningNonNull.h"
       6             : #include "mozilla/dom/BindingUtils.h"
       7             : #include "mozilla/dom/DOMJSClass.h"
       8             : #include "mozilla/dom/NonRefcountedDOMObject.h"
       9             : #include "mozilla/dom/Nullable.h"
      10             : #include "mozilla/dom/PrimitiveConversions.h"
      11             : #include "mozilla/dom/XPathExpression.h"
      12             : #include "mozilla/dom/XPathResult.h"
      13             : #include "mozilla/dom/XrayExpandoClass.h"
      14             : #include "nsContentUtils.h"
      15             : #include "nsINode.h"
      16             : 
      17             : namespace mozilla {
      18             : namespace dom {
      19             : 
      20             : namespace XPathExpressionBinding {
      21             : 
      22             : static bool
      23           0 : evaluate(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::XPathExpression* self, const JSJitMethodCallArgs& args)
      24             : {
      25           0 :   if (MOZ_UNLIKELY(args.length() < 3)) {
      26           0 :     return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "XPathExpression.evaluate");
      27             :   }
      28           0 :   NonNull<nsINode> arg0;
      29           0 :   if (args[0].isObject()) {
      30             :     {
      31           0 :       nsresult rv = UnwrapObject<prototypes::id::Node, nsINode>(args[0], arg0);
      32           0 :       if (NS_FAILED(rv)) {
      33           0 :         ThrowErrorMessage(cx, MSG_DOES_NOT_IMPLEMENT_INTERFACE, "Argument 1 of XPathExpression.evaluate", "Node");
      34           0 :         return false;
      35             :       }
      36             :     }
      37             :   } else {
      38           0 :     ThrowErrorMessage(cx, MSG_NOT_OBJECT, "Argument 1 of XPathExpression.evaluate");
      39           0 :     return false;
      40             :   }
      41             :   uint16_t arg1;
      42           0 :   if (!ValueToPrimitive<uint16_t, eDefault>(cx, args[1], &arg1)) {
      43           0 :     return false;
      44             :   }
      45           0 :   JS::Rooted<JSObject*> arg2(cx);
      46           0 :   if (args[2].isObject()) {
      47           0 :     arg2 = &args[2].toObject();
      48           0 :   } else if (args[2].isNullOrUndefined()) {
      49           0 :     arg2 = nullptr;
      50             :   } else {
      51           0 :     ThrowErrorMessage(cx, MSG_NOT_OBJECT, "Argument 3 of XPathExpression.evaluate");
      52           0 :     return false;
      53             :   }
      54           0 :   binding_detail::FastErrorResult rv;
      55           0 :   auto result(StrongOrRawPtr<mozilla::dom::XPathResult>(self->Evaluate(cx, NonNullHelper(arg0), arg1, arg2, rv)));
      56           0 :   if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
      57           0 :     return false;
      58             :   }
      59           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
      60           0 :   if (!GetOrCreateDOMReflector(cx, result, args.rval())) {
      61           0 :     MOZ_ASSERT(true || JS_IsExceptionPending(cx));
      62           0 :     return false;
      63             :   }
      64           0 :   return true;
      65             : }
      66             : 
      67             : static const JSJitInfo evaluate_methodinfo = {
      68             :   { (JSJitGetterOp)evaluate },
      69             :   { prototypes::id::XPathExpression },
      70             :   { PrototypeTraits<prototypes::id::XPathExpression>::Depth },
      71             :   JSJitInfo::Method,
      72             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
      73             :   JSVAL_TYPE_OBJECT,  /* returnType.  Not relevant for setters. */
      74             :   false,  /* isInfallible. False in setters. */
      75             :   false,  /* isMovable.  Not relevant for setters. */
      76             :   false, /* isEliminatable.  Not relevant for setters. */
      77             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
      78             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
      79             :   false,  /* isTypedMethod.  Only relevant for methods. */
      80             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
      81             : };
      82             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
      83             : static_assert(0 < 1, "There is no slot for us");
      84             : 
      85             : static bool
      86           0 : evaluateWithContext(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::XPathExpression* self, const JSJitMethodCallArgs& args)
      87             : {
      88           0 :   if (MOZ_UNLIKELY(args.length() < 5)) {
      89           0 :     return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "XPathExpression.evaluateWithContext");
      90             :   }
      91           0 :   NonNull<nsINode> arg0;
      92           0 :   if (args[0].isObject()) {
      93             :     {
      94           0 :       nsresult rv = UnwrapObject<prototypes::id::Node, nsINode>(args[0], arg0);
      95           0 :       if (NS_FAILED(rv)) {
      96           0 :         ThrowErrorMessage(cx, MSG_DOES_NOT_IMPLEMENT_INTERFACE, "Argument 1 of XPathExpression.evaluateWithContext", "Node");
      97           0 :         return false;
      98             :       }
      99             :     }
     100             :   } else {
     101           0 :     ThrowErrorMessage(cx, MSG_NOT_OBJECT, "Argument 1 of XPathExpression.evaluateWithContext");
     102           0 :     return false;
     103             :   }
     104             :   uint32_t arg1;
     105           0 :   if (!ValueToPrimitive<uint32_t, eDefault>(cx, args[1], &arg1)) {
     106           0 :     return false;
     107             :   }
     108             :   uint32_t arg2;
     109           0 :   if (!ValueToPrimitive<uint32_t, eDefault>(cx, args[2], &arg2)) {
     110           0 :     return false;
     111             :   }
     112             :   uint16_t arg3;
     113           0 :   if (!ValueToPrimitive<uint16_t, eDefault>(cx, args[3], &arg3)) {
     114           0 :     return false;
     115             :   }
     116           0 :   JS::Rooted<JSObject*> arg4(cx);
     117           0 :   if (args[4].isObject()) {
     118           0 :     arg4 = &args[4].toObject();
     119           0 :   } else if (args[4].isNullOrUndefined()) {
     120           0 :     arg4 = nullptr;
     121             :   } else {
     122           0 :     ThrowErrorMessage(cx, MSG_NOT_OBJECT, "Argument 5 of XPathExpression.evaluateWithContext");
     123           0 :     return false;
     124             :   }
     125           0 :   binding_detail::FastErrorResult rv;
     126           0 :   auto result(StrongOrRawPtr<mozilla::dom::XPathResult>(self->EvaluateWithContext(cx, NonNullHelper(arg0), arg1, arg2, arg3, arg4, rv)));
     127           0 :   if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
     128           0 :     return false;
     129             :   }
     130           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
     131           0 :   if (!GetOrCreateDOMReflector(cx, result, args.rval())) {
     132           0 :     MOZ_ASSERT(true || JS_IsExceptionPending(cx));
     133           0 :     return false;
     134             :   }
     135           0 :   return true;
     136             : }
     137             : 
     138             : static const JSJitInfo evaluateWithContext_methodinfo = {
     139             :   { (JSJitGetterOp)evaluateWithContext },
     140             :   { prototypes::id::XPathExpression },
     141             :   { PrototypeTraits<prototypes::id::XPathExpression>::Depth },
     142             :   JSJitInfo::Method,
     143             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
     144             :   JSVAL_TYPE_OBJECT,  /* returnType.  Not relevant for setters. */
     145             :   false,  /* isInfallible. False in setters. */
     146             :   false,  /* isMovable.  Not relevant for setters. */
     147             :   false, /* isEliminatable.  Not relevant for setters. */
     148             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
     149             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
     150             :   false,  /* isTypedMethod.  Only relevant for methods. */
     151             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
     152             : };
     153             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
     154             : static_assert(0 < 1, "There is no slot for us");
     155             : 
     156             : static void
     157           0 : _finalize(js::FreeOp* fop, JSObject* obj)
     158             : {
     159           0 :   mozilla::dom::XPathExpression* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::dom::XPathExpression>(obj);
     160           0 :   if (self) {
     161           0 :     AddForDeferredFinalization<mozilla::dom::XPathExpression>(self);
     162             :   }
     163           0 : }
     164             : 
     165             : // We deliberately use brace-elision to make Visual Studio produce better initalization code.
     166             : #if defined(__clang__)
     167             : #pragma clang diagnostic push
     168             : #pragma clang diagnostic ignored "-Wmissing-braces"
     169             : #endif
     170             : static const JSFunctionSpec sMethods_specs[] = {
     171             :   JS_FNSPEC("evaluate", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&evaluate_methodinfo), 3, JSPROP_ENUMERATE, nullptr),
     172             :   JS_FS_END
     173             : };
     174             : #if defined(__clang__)
     175             : #pragma clang diagnostic pop
     176             : #endif
     177             : 
     178             : 
     179             : // Can't be const because the pref-enabled boolean needs to be writable
     180             : static Prefable<const JSFunctionSpec> sMethods[] = {
     181             :   { nullptr, &sMethods_specs[0] },
     182             :   { nullptr, nullptr }
     183             : };
     184             : 
     185             : static_assert(1 <= 1ull << NUM_BITS_PROPERTY_INFO_PREF_INDEX,
     186             :     "We have a prefable index that is >= (1 << NUM_BITS_PROPERTY_INFO_PREF_INDEX)");
     187             : static_assert(1 <= 1ull << NUM_BITS_PROPERTY_INFO_SPEC_INDEX,
     188             :     "We have a spec index that is >= (1 << NUM_BITS_PROPERTY_INFO_SPEC_INDEX)");
     189             : 
     190             : // We deliberately use brace-elision to make Visual Studio produce better initalization code.
     191             : #if defined(__clang__)
     192             : #pragma clang diagnostic push
     193             : #pragma clang diagnostic ignored "-Wmissing-braces"
     194             : #endif
     195             : static const JSFunctionSpec sChromeMethods_specs[] = {
     196             :   JS_FNSPEC("evaluateWithContext", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&evaluateWithContext_methodinfo), 5, JSPROP_ENUMERATE, nullptr),
     197             :   JS_FS_END
     198             : };
     199             : #if defined(__clang__)
     200             : #pragma clang diagnostic pop
     201             : #endif
     202             : 
     203             : 
     204             : // Can't be const because the pref-enabled boolean needs to be writable
     205             : static Prefable<const JSFunctionSpec> sChromeMethods[] = {
     206             :   { nullptr, &sChromeMethods_specs[0] },
     207             :   { nullptr, nullptr }
     208             : };
     209             : 
     210             : static_assert(1 <= 1ull << NUM_BITS_PROPERTY_INFO_PREF_INDEX,
     211             :     "We have a prefable index that is >= (1 << NUM_BITS_PROPERTY_INFO_PREF_INDEX)");
     212             : static_assert(1 <= 1ull << NUM_BITS_PROPERTY_INFO_SPEC_INDEX,
     213             :     "We have a spec index that is >= (1 << NUM_BITS_PROPERTY_INFO_SPEC_INDEX)");
     214             : 
     215             : 
     216             : static uint16_t sNativeProperties_sortedPropertyIndices[1];
     217             : static PropertyInfo sNativeProperties_propertyInfos[1];
     218             : 
     219             : static const NativePropertiesN<1> sNativeProperties = {
     220             :   false, 0,
     221             :   false, 0,
     222             :   true,  0 /* sMethods */,
     223             :   false, 0,
     224             :   false, 0,
     225             :   false, 0,
     226             :   false, 0,
     227             :   -1,
     228             :   1,
     229             :   sNativeProperties_sortedPropertyIndices,
     230             :   {
     231             :     { sMethods, &sNativeProperties_propertyInfos[0] }
     232             :   }
     233             : };
     234             : static_assert(1 < 1ull << CHAR_BIT * sizeof(sNativeProperties.propertyInfoCount),
     235             :     "We have a property info count that is oversized");
     236             : 
     237             : static uint16_t sChromeOnlyNativeProperties_sortedPropertyIndices[1];
     238             : static PropertyInfo sChromeOnlyNativeProperties_propertyInfos[1];
     239             : 
     240             : static const NativePropertiesN<1> sChromeOnlyNativeProperties = {
     241             :   false, 0,
     242             :   false, 0,
     243             :   true,  0 /* sChromeMethods */,
     244             :   false, 0,
     245             :   false, 0,
     246             :   false, 0,
     247             :   false, 0,
     248             :   -1,
     249             :   1,
     250             :   sChromeOnlyNativeProperties_sortedPropertyIndices,
     251             :   {
     252             :     { sChromeMethods, &sChromeOnlyNativeProperties_propertyInfos[0] }
     253             :   }
     254             : };
     255             : static_assert(1 < 1ull << CHAR_BIT * sizeof(sChromeOnlyNativeProperties.propertyInfoCount),
     256             :     "We have a property info count that is oversized");
     257             : 
     258             : static const DOMIfaceAndProtoJSClass sInterfaceObjectClass = {
     259             :   {
     260             :     "Function",
     261             :     JSCLASS_IS_DOMIFACEANDPROTOJSCLASS | JSCLASS_HAS_RESERVED_SLOTS(DOM_INTERFACE_SLOTS_BASE),
     262             :     &sBoringInterfaceObjectClassClassOps,
     263             :     JS_NULL_CLASS_SPEC,
     264             :     JS_NULL_CLASS_EXT,
     265             :     &sInterfaceObjectClassObjectOps
     266             :   },
     267             :   eInterface,
     268             :   true,
     269             :   prototypes::id::XPathExpression,
     270             :   PrototypeTraits<prototypes::id::XPathExpression>::Depth,
     271             :   sNativePropertyHooks,
     272             :   "function XPathExpression() {\n    [native code]\n}",
     273             :   JS::GetRealmFunctionPrototype
     274             : };
     275             : 
     276             : static const DOMIfaceAndProtoJSClass sPrototypeClass = {
     277             :   {
     278             :     "XPathExpressionPrototype",
     279             :     JSCLASS_IS_DOMIFACEANDPROTOJSCLASS | JSCLASS_HAS_RESERVED_SLOTS(DOM_INTERFACE_PROTO_SLOTS_BASE),
     280             :     JS_NULL_CLASS_OPS,
     281             :     JS_NULL_CLASS_SPEC,
     282             :     JS_NULL_CLASS_EXT,
     283             :     JS_NULL_OBJECT_OPS
     284             :   },
     285             :   eInterfacePrototype,
     286             :   false,
     287             :   prototypes::id::XPathExpression,
     288             :   PrototypeTraits<prototypes::id::XPathExpression>::Depth,
     289             :   sNativePropertyHooks,
     290             :   "[object XPathExpressionPrototype]",
     291             :   JS::GetRealmObjectPrototype
     292             : };
     293             : 
     294             : JSObject*
     295           0 : DefineDOMInterface(JSContext* aCx, JS::Handle<JSObject*> aGlobal, JS::Handle<jsid> id, bool aDefineOnGlobal)
     296             : {
     297           0 :   return GetConstructorObjectHandle(aCx, aDefineOnGlobal);
     298             : }
     299             : 
     300             : static const js::ClassOps sClassOps = {
     301             :   nullptr, /* addProperty */
     302             :   nullptr,               /* delProperty */
     303             :   nullptr,               /* getProperty */
     304             :   nullptr,               /* setProperty */
     305             :   nullptr,               /* enumerate */
     306             :   nullptr, /* newEnumerate */
     307             :   nullptr, /* resolve */
     308             :   nullptr, /* mayResolve */
     309             :   _finalize, /* finalize */
     310             :   nullptr, /* call */
     311             :   nullptr,               /* hasInstance */
     312             :   nullptr,               /* construct */
     313             :   nullptr, /* trace */
     314             : };
     315             : 
     316             : static const js::ClassExtension sClassExtension = {
     317             :   nullptr, /* weakmapKeyDelegateOp */
     318             :   nullptr /* objectMovedOp */
     319             : };
     320             : 
     321             : static const DOMJSClass sClass = {
     322             :   { "XPathExpression",
     323             :     JSCLASS_IS_DOMJSCLASS | JSCLASS_FOREGROUND_FINALIZE | JSCLASS_HAS_RESERVED_SLOTS(1),
     324             :     &sClassOps,
     325             :     JS_NULL_CLASS_SPEC,
     326             :     &sClassExtension,
     327             :     JS_NULL_OBJECT_OPS
     328             :   },
     329             :   { prototypes::id::XPathExpression, 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 },
     330             :   IsBaseOf<nsISupports, mozilla::dom::XPathExpression >::value,
     331             :   sNativePropertyHooks,
     332             :   FindAssociatedGlobalForNative<mozilla::dom::XPathExpression>::Get,
     333             :   GetProtoObjectHandle,
     334             :   GetCCParticipant<mozilla::dom::XPathExpression>::Get()
     335             : };
     336             : static_assert(1 == DOM_INSTANCE_RESERVED_SLOTS,
     337             :               "Must have the right minimal number of reserved slots.");
     338             : static_assert(1 >= 1,
     339             :               "Must have enough reserved slots.");
     340             : 
     341             : const JSClass*
     342           0 : GetJSClass()
     343             : {
     344           0 :   return sClass.ToJSClass();
     345             : }
     346             : 
     347             : bool
     348           0 : Wrap(JSContext* aCx, mozilla::dom::XPathExpression* aObject, JS::Handle<JSObject*> aGivenProto, JS::MutableHandle<JSObject*> aReflector)
     349             : {
     350             :   MOZ_ASSERT(static_cast<mozilla::dom::XPathExpression*>(aObject) ==
     351             :              reinterpret_cast<mozilla::dom::XPathExpression*>(aObject),
     352             :              "Multiple inheritance for mozilla::dom::XPathExpression is broken.");
     353           0 :   MOZ_ASSERT(ToSupportsIsCorrect(aObject));
     354           0 :   MOZ_ASSERT_IF(aGivenProto, js::IsObjectInContextCompartment(aGivenProto, aCx));
     355             : 
     356           0 :   JS::Rooted<JSObject*> global(aCx, JS::CurrentGlobalOrNull(aCx));
     357           0 :   JS::Handle<JSObject*> canonicalProto = GetProtoObjectHandle(aCx);
     358           0 :   if (!canonicalProto) {
     359           0 :     return false;
     360             :   }
     361           0 :   JS::Rooted<JSObject*> proto(aCx);
     362           0 :   if (aGivenProto) {
     363           0 :     proto = aGivenProto;
     364             :     // Unfortunately, while aGivenProto was in the compartment of aCx
     365             :     // coming in, we changed compartments to that of "parent" so may need
     366             :     // to wrap the proto here.
     367           0 :     if (js::GetContextCompartment(aCx) != js::GetObjectCompartment(proto)) {
     368           0 :       if (!JS_WrapObject(aCx, &proto)) {
     369           0 :         return false;
     370             :       }
     371             :     }
     372             :   } else {
     373           0 :     proto = canonicalProto;
     374             :   }
     375             : 
     376           0 :   BindingJSObjectCreator<mozilla::dom::XPathExpression> creator(aCx);
     377           0 :   creator.CreateObject(aCx, sClass.ToJSClass(), proto, aObject, aReflector);
     378           0 :   if (!aReflector) {
     379           0 :     return false;
     380             :   }
     381             : 
     382             : 
     383             : 
     384           0 :   creator.InitializationSucceeded();
     385           0 :   return true;
     386             : }
     387             : 
     388             : const NativePropertyHooks sNativePropertyHooks[] = { {
     389             :   nullptr,
     390             :   nullptr,
     391             :   nullptr,
     392             :   { sNativeProperties.Upcast(), sChromeOnlyNativeProperties.Upcast() },
     393             :   prototypes::id::XPathExpression,
     394             :   constructors::id::XPathExpression,
     395             :   nullptr,
     396             :   &DefaultXrayExpandoObjectClass
     397             : } };
     398             : 
     399             : void
     400           0 : CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, bool aDefineOnGlobal)
     401             : {
     402           0 :   JS::Rooted<JSObject*> parentProto(aCx, JS::GetRealmObjectPrototype(aCx));
     403           0 :   if (!parentProto) {
     404           0 :     return;
     405             :   }
     406             : 
     407           0 :   JS::Rooted<JSObject*> constructorProto(aCx, JS::GetRealmFunctionPrototype(aCx));
     408           0 :   if (!constructorProto) {
     409           0 :     return;
     410             :   }
     411             : 
     412             :   static bool sIdsInited = false;
     413           0 :   if (!sIdsInited && NS_IsMainThread()) {
     414           0 :     if (!InitIds(aCx, sNativeProperties.Upcast())) {
     415           0 :       return;
     416             :     }
     417           0 :     if (!InitIds(aCx, sChromeOnlyNativeProperties.Upcast())) {
     418           0 :       return;
     419             :     }
     420           0 :     sIdsInited = true;
     421             :   }
     422             : 
     423           0 :   JS::Heap<JSObject*>* protoCache = &aProtoAndIfaceCache.EntrySlotOrCreate(prototypes::id::XPathExpression);
     424           0 :   JS::Heap<JSObject*>* interfaceCache = &aProtoAndIfaceCache.EntrySlotOrCreate(constructors::id::XPathExpression);
     425           0 :   dom::CreateInterfaceObjects(aCx, aGlobal, parentProto,
     426             :                               &sPrototypeClass.mBase, protoCache,
     427             :                               constructorProto, &sInterfaceObjectClass.mBase, 0, nullptr,
     428             :                               interfaceCache,
     429             :                               sNativeProperties.Upcast(),
     430           0 :                               nsContentUtils::ThreadsafeIsSystemCaller(aCx) ? sChromeOnlyNativeProperties.Upcast() : nullptr,
     431             :                               "XPathExpression", aDefineOnGlobal,
     432             :                               nullptr,
     433           0 :                               false);
     434             : }
     435             : 
     436             : JS::Handle<JSObject*>
     437           0 : GetProtoObjectHandle(JSContext* aCx)
     438             : {
     439             :   /* Get the interface prototype object for this class.  This will create the
     440             :      object as needed. */
     441           0 :   bool aDefineOnGlobal = true;
     442             : 
     443             :   /* Make sure our global is sane.  Hopefully we can remove this sometime */
     444           0 :   JSObject* global = JS::CurrentGlobalOrNull(aCx);
     445           0 :   if (!(js::GetObjectClass(global)->flags & JSCLASS_DOM_GLOBAL)) {
     446           0 :     return nullptr;
     447             :   }
     448             : 
     449             :   /* Check to see whether the interface objects are already installed */
     450           0 :   ProtoAndIfaceCache& protoAndIfaceCache = *GetProtoAndIfaceCache(global);
     451           0 :   if (!protoAndIfaceCache.HasEntryInSlot(prototypes::id::XPathExpression)) {
     452           0 :     JS::Rooted<JSObject*> rootedGlobal(aCx, global);
     453           0 :     CreateInterfaceObjects(aCx, rootedGlobal, protoAndIfaceCache, aDefineOnGlobal);
     454             :   }
     455             : 
     456             :   /*
     457             :    * The object might _still_ be null, but that's OK.
     458             :    *
     459             :    * Calling fromMarkedLocation() is safe because protoAndIfaceCache is
     460             :    * traced by TraceProtoAndIfaceCache() and its contents are never
     461             :    * changed after they have been set.
     462             :    *
     463             :    * Calling address() avoids the read read barrier that does gray
     464             :    * unmarking, but it's not possible for the object to be gray here.
     465             :    */
     466             : 
     467           0 :   const JS::Heap<JSObject*>& entrySlot = protoAndIfaceCache.EntrySlotMustExist(prototypes::id::XPathExpression);
     468           0 :   MOZ_ASSERT(JS::ObjectIsNotGray(entrySlot));
     469           0 :   return JS::Handle<JSObject*>::fromMarkedLocation(entrySlot.address());
     470             : }
     471             : 
     472             : JS::Handle<JSObject*>
     473           0 : GetConstructorObjectHandle(JSContext* aCx, bool aDefineOnGlobal)
     474             : {
     475             :   /* Get the interface object for this class.  This will create the object as
     476             :      needed. */
     477             : 
     478             :   /* Make sure our global is sane.  Hopefully we can remove this sometime */
     479           0 :   JSObject* global = JS::CurrentGlobalOrNull(aCx);
     480           0 :   if (!(js::GetObjectClass(global)->flags & JSCLASS_DOM_GLOBAL)) {
     481           0 :     return nullptr;
     482             :   }
     483             : 
     484             :   /* Check to see whether the interface objects are already installed */
     485           0 :   ProtoAndIfaceCache& protoAndIfaceCache = *GetProtoAndIfaceCache(global);
     486           0 :   if (!protoAndIfaceCache.HasEntryInSlot(constructors::id::XPathExpression)) {
     487           0 :     JS::Rooted<JSObject*> rootedGlobal(aCx, global);
     488           0 :     CreateInterfaceObjects(aCx, rootedGlobal, protoAndIfaceCache, aDefineOnGlobal);
     489             :   }
     490             : 
     491             :   /*
     492             :    * The object might _still_ be null, but that's OK.
     493             :    *
     494             :    * Calling fromMarkedLocation() is safe because protoAndIfaceCache is
     495             :    * traced by TraceProtoAndIfaceCache() and its contents are never
     496             :    * changed after they have been set.
     497             :    *
     498             :    * Calling address() avoids the read read barrier that does gray
     499             :    * unmarking, but it's not possible for the object to be gray here.
     500             :    */
     501             : 
     502           0 :   const JS::Heap<JSObject*>& entrySlot = protoAndIfaceCache.EntrySlotMustExist(constructors::id::XPathExpression);
     503           0 :   MOZ_ASSERT(JS::ObjectIsNotGray(entrySlot));
     504           0 :   return JS::Handle<JSObject*>::fromMarkedLocation(entrySlot.address());
     505             : }
     506             : 
     507             : JSObject*
     508           0 : GetConstructorObject(JSContext* aCx)
     509             : {
     510           0 :   return GetConstructorObjectHandle(aCx);
     511             : }
     512             : 
     513             : } // namespace XPathExpressionBinding
     514             : 
     515             : 
     516             : 
     517             : } // namespace dom
     518             : } // namespace mozilla

Generated by: LCOV version 1.13