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

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

Generated by: LCOV version 1.13