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

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

Generated by: LCOV version 1.13