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

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

Generated by: LCOV version 1.13