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

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

Generated by: LCOV version 1.13