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

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

Generated by: LCOV version 1.13