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

          Line data    Source code
       1             : /* THIS FILE IS AUTOGENERATED FROM SVGNumberList.webidl BY Codegen.py - DO NOT EDIT */
       2             : 
       3             : #include "DOMSVGNumber.h"
       4             : #include "DOMSVGNumberList.h"
       5             : #include "SVGNumberListBinding.h"
       6             : #include "WrapperFactory.h"
       7             : #include "mozilla/OwningNonNull.h"
       8             : #include "mozilla/dom/BindingUtils.h"
       9             : #include "mozilla/dom/DOMJSClass.h"
      10             : #include "mozilla/dom/DOMJSProxyHandler.h"
      11             : #include "mozilla/dom/NonRefcountedDOMObject.h"
      12             : #include "mozilla/dom/PrimitiveConversions.h"
      13             : #include "mozilla/dom/XrayExpandoClass.h"
      14             : #include "nsISupports.h"
      15             : #include "xpcjsid.h"
      16             : 
      17             : namespace mozilla {
      18             : namespace dom {
      19             : 
      20             : namespace SVGNumberListBinding {
      21             : 
      22             : static bool
      23           0 : get_numberOfItems(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::DOMSVGNumberList* self, JSJitGetterCallArgs args)
      24             : {
      25           0 :   uint32_t result(self->NumberOfItems());
      26           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
      27           0 :   args.rval().setNumber(result);
      28           0 :   return true;
      29             : }
      30             : 
      31             : static const JSJitInfo numberOfItems_getterinfo = {
      32             :   { (JSJitGetterOp)get_numberOfItems },
      33             :   { prototypes::id::SVGNumberList },
      34             :   { PrototypeTraits<prototypes::id::SVGNumberList>::Depth },
      35             :   JSJitInfo::Getter,
      36             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
      37             :   JSVAL_TYPE_DOUBLE,  /* returnType.  Not relevant for setters. */
      38             :   true,  /* isInfallible. False in setters. */
      39             :   false,  /* isMovable.  Not relevant for setters. */
      40             :   false, /* isEliminatable.  Not relevant for setters. */
      41             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
      42             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
      43             :   false,  /* isTypedMethod.  Only relevant for methods. */
      44             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
      45             : };
      46             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
      47             : static_assert(0 < 1, "There is no slot for us");
      48             : 
      49             : static bool
      50           0 : clear(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::DOMSVGNumberList* self, const JSJitMethodCallArgs& args)
      51             : {
      52           0 :   binding_detail::FastErrorResult rv;
      53           0 :   self->Clear(rv);
      54           0 :   if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
      55           0 :     return false;
      56             :   }
      57           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
      58           0 :   args.rval().setUndefined();
      59           0 :   return true;
      60             : }
      61             : 
      62             : static const JSJitInfo clear_methodinfo = {
      63             :   { (JSJitGetterOp)clear },
      64             :   { prototypes::id::SVGNumberList },
      65             :   { PrototypeTraits<prototypes::id::SVGNumberList>::Depth },
      66             :   JSJitInfo::Method,
      67             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
      68             :   JSVAL_TYPE_UNDEFINED,  /* returnType.  Not relevant for setters. */
      69             :   false,  /* isInfallible. False in setters. */
      70             :   false,  /* isMovable.  Not relevant for setters. */
      71             :   false, /* isEliminatable.  Not relevant for setters. */
      72             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
      73             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
      74             :   false,  /* isTypedMethod.  Only relevant for methods. */
      75             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
      76             : };
      77             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
      78             : static_assert(0 < 1, "There is no slot for us");
      79             : 
      80             : static bool
      81           0 : initialize(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::DOMSVGNumberList* self, const JSJitMethodCallArgs& args)
      82             : {
      83           0 :   if (MOZ_UNLIKELY(args.length() < 1)) {
      84           0 :     return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "SVGNumberList.initialize");
      85             :   }
      86           0 :   NonNull<mozilla::DOMSVGNumber> arg0;
      87           0 :   if (args[0].isObject()) {
      88             :     {
      89           0 :       nsresult rv = UnwrapObject<prototypes::id::SVGNumber, mozilla::DOMSVGNumber>(args[0], arg0);
      90           0 :       if (NS_FAILED(rv)) {
      91           0 :         ThrowErrorMessage(cx, MSG_DOES_NOT_IMPLEMENT_INTERFACE, "Argument 1 of SVGNumberList.initialize", "SVGNumber");
      92           0 :         return false;
      93             :       }
      94             :     }
      95             :   } else {
      96           0 :     ThrowErrorMessage(cx, MSG_NOT_OBJECT, "Argument 1 of SVGNumberList.initialize");
      97           0 :     return false;
      98             :   }
      99           0 :   binding_detail::FastErrorResult rv;
     100           0 :   auto result(StrongOrRawPtr<mozilla::DOMSVGNumber>(self->Initialize(NonNullHelper(arg0), rv)));
     101           0 :   if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
     102           0 :     return false;
     103             :   }
     104           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
     105           0 :   if (!GetOrCreateDOMReflector(cx, result, args.rval())) {
     106           0 :     MOZ_ASSERT(true || JS_IsExceptionPending(cx));
     107           0 :     return false;
     108             :   }
     109           0 :   return true;
     110             : }
     111             : 
     112             : static const JSJitInfo initialize_methodinfo = {
     113             :   { (JSJitGetterOp)initialize },
     114             :   { prototypes::id::SVGNumberList },
     115             :   { PrototypeTraits<prototypes::id::SVGNumberList>::Depth },
     116             :   JSJitInfo::Method,
     117             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
     118             :   JSVAL_TYPE_OBJECT,  /* returnType.  Not relevant for setters. */
     119             :   false,  /* isInfallible. False in setters. */
     120             :   false,  /* isMovable.  Not relevant for setters. */
     121             :   false, /* isEliminatable.  Not relevant for setters. */
     122             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
     123             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
     124             :   false,  /* isTypedMethod.  Only relevant for methods. */
     125             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
     126             : };
     127             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
     128             : static_assert(0 < 1, "There is no slot for us");
     129             : 
     130             : static bool
     131           0 : getItem(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::DOMSVGNumberList* self, const JSJitMethodCallArgs& args)
     132             : {
     133           0 :   if (MOZ_UNLIKELY(args.length() < 1)) {
     134           0 :     return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "SVGNumberList.getItem");
     135             :   }
     136             :   uint32_t arg0;
     137           0 :   if (!ValueToPrimitive<uint32_t, eDefault>(cx, args[0], &arg0)) {
     138           0 :     return false;
     139             :   }
     140           0 :   binding_detail::FastErrorResult rv;
     141           0 :   auto result(StrongOrRawPtr<mozilla::DOMSVGNumber>(self->GetItem(arg0, rv)));
     142           0 :   if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
     143           0 :     return false;
     144             :   }
     145           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
     146           0 :   if (!GetOrCreateDOMReflector(cx, result, args.rval())) {
     147           0 :     MOZ_ASSERT(true || JS_IsExceptionPending(cx));
     148           0 :     return false;
     149             :   }
     150           0 :   return true;
     151             : }
     152             : 
     153             : static const JSJitInfo getItem_methodinfo = {
     154             :   { (JSJitGetterOp)getItem },
     155             :   { prototypes::id::SVGNumberList },
     156             :   { PrototypeTraits<prototypes::id::SVGNumberList>::Depth },
     157             :   JSJitInfo::Method,
     158             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
     159             :   JSVAL_TYPE_OBJECT,  /* returnType.  Not relevant for setters. */
     160             :   false,  /* isInfallible. False in setters. */
     161             :   false,  /* isMovable.  Not relevant for setters. */
     162             :   false, /* isEliminatable.  Not relevant for setters. */
     163             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
     164             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
     165             :   false,  /* isTypedMethod.  Only relevant for methods. */
     166             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
     167             : };
     168             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
     169             : static_assert(0 < 1, "There is no slot for us");
     170             : 
     171             : static bool
     172           0 : insertItemBefore(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::DOMSVGNumberList* self, const JSJitMethodCallArgs& args)
     173             : {
     174           0 :   if (MOZ_UNLIKELY(args.length() < 2)) {
     175           0 :     return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "SVGNumberList.insertItemBefore");
     176             :   }
     177           0 :   NonNull<mozilla::DOMSVGNumber> arg0;
     178           0 :   if (args[0].isObject()) {
     179             :     {
     180           0 :       nsresult rv = UnwrapObject<prototypes::id::SVGNumber, mozilla::DOMSVGNumber>(args[0], arg0);
     181           0 :       if (NS_FAILED(rv)) {
     182           0 :         ThrowErrorMessage(cx, MSG_DOES_NOT_IMPLEMENT_INTERFACE, "Argument 1 of SVGNumberList.insertItemBefore", "SVGNumber");
     183           0 :         return false;
     184             :       }
     185             :     }
     186             :   } else {
     187           0 :     ThrowErrorMessage(cx, MSG_NOT_OBJECT, "Argument 1 of SVGNumberList.insertItemBefore");
     188           0 :     return false;
     189             :   }
     190             :   uint32_t arg1;
     191           0 :   if (!ValueToPrimitive<uint32_t, eDefault>(cx, args[1], &arg1)) {
     192           0 :     return false;
     193             :   }
     194           0 :   binding_detail::FastErrorResult rv;
     195           0 :   auto result(StrongOrRawPtr<mozilla::DOMSVGNumber>(self->InsertItemBefore(NonNullHelper(arg0), arg1, rv)));
     196           0 :   if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
     197           0 :     return false;
     198             :   }
     199           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
     200           0 :   if (!GetOrCreateDOMReflector(cx, result, args.rval())) {
     201           0 :     MOZ_ASSERT(true || JS_IsExceptionPending(cx));
     202           0 :     return false;
     203             :   }
     204           0 :   return true;
     205             : }
     206             : 
     207             : static const JSJitInfo insertItemBefore_methodinfo = {
     208             :   { (JSJitGetterOp)insertItemBefore },
     209             :   { prototypes::id::SVGNumberList },
     210             :   { PrototypeTraits<prototypes::id::SVGNumberList>::Depth },
     211             :   JSJitInfo::Method,
     212             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
     213             :   JSVAL_TYPE_OBJECT,  /* returnType.  Not relevant for setters. */
     214             :   false,  /* isInfallible. False in setters. */
     215             :   false,  /* isMovable.  Not relevant for setters. */
     216             :   false, /* isEliminatable.  Not relevant for setters. */
     217             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
     218             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
     219             :   false,  /* isTypedMethod.  Only relevant for methods. */
     220             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
     221             : };
     222             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
     223             : static_assert(0 < 1, "There is no slot for us");
     224             : 
     225             : static bool
     226           0 : replaceItem(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::DOMSVGNumberList* self, const JSJitMethodCallArgs& args)
     227             : {
     228           0 :   if (MOZ_UNLIKELY(args.length() < 2)) {
     229           0 :     return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "SVGNumberList.replaceItem");
     230             :   }
     231           0 :   NonNull<mozilla::DOMSVGNumber> arg0;
     232           0 :   if (args[0].isObject()) {
     233             :     {
     234           0 :       nsresult rv = UnwrapObject<prototypes::id::SVGNumber, mozilla::DOMSVGNumber>(args[0], arg0);
     235           0 :       if (NS_FAILED(rv)) {
     236           0 :         ThrowErrorMessage(cx, MSG_DOES_NOT_IMPLEMENT_INTERFACE, "Argument 1 of SVGNumberList.replaceItem", "SVGNumber");
     237           0 :         return false;
     238             :       }
     239             :     }
     240             :   } else {
     241           0 :     ThrowErrorMessage(cx, MSG_NOT_OBJECT, "Argument 1 of SVGNumberList.replaceItem");
     242           0 :     return false;
     243             :   }
     244             :   uint32_t arg1;
     245           0 :   if (!ValueToPrimitive<uint32_t, eDefault>(cx, args[1], &arg1)) {
     246           0 :     return false;
     247             :   }
     248           0 :   binding_detail::FastErrorResult rv;
     249           0 :   auto result(StrongOrRawPtr<mozilla::DOMSVGNumber>(self->ReplaceItem(NonNullHelper(arg0), arg1, rv)));
     250           0 :   if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
     251           0 :     return false;
     252             :   }
     253           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
     254           0 :   if (!GetOrCreateDOMReflector(cx, result, args.rval())) {
     255           0 :     MOZ_ASSERT(true || JS_IsExceptionPending(cx));
     256           0 :     return false;
     257             :   }
     258           0 :   return true;
     259             : }
     260             : 
     261             : static const JSJitInfo replaceItem_methodinfo = {
     262             :   { (JSJitGetterOp)replaceItem },
     263             :   { prototypes::id::SVGNumberList },
     264             :   { PrototypeTraits<prototypes::id::SVGNumberList>::Depth },
     265             :   JSJitInfo::Method,
     266             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
     267             :   JSVAL_TYPE_OBJECT,  /* returnType.  Not relevant for setters. */
     268             :   false,  /* isInfallible. False in setters. */
     269             :   false,  /* isMovable.  Not relevant for setters. */
     270             :   false, /* isEliminatable.  Not relevant for setters. */
     271             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
     272             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
     273             :   false,  /* isTypedMethod.  Only relevant for methods. */
     274             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
     275             : };
     276             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
     277             : static_assert(0 < 1, "There is no slot for us");
     278             : 
     279             : static bool
     280           0 : removeItem(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::DOMSVGNumberList* self, const JSJitMethodCallArgs& args)
     281             : {
     282           0 :   if (MOZ_UNLIKELY(args.length() < 1)) {
     283           0 :     return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "SVGNumberList.removeItem");
     284             :   }
     285             :   uint32_t arg0;
     286           0 :   if (!ValueToPrimitive<uint32_t, eDefault>(cx, args[0], &arg0)) {
     287           0 :     return false;
     288             :   }
     289           0 :   binding_detail::FastErrorResult rv;
     290           0 :   auto result(StrongOrRawPtr<mozilla::DOMSVGNumber>(self->RemoveItem(arg0, rv)));
     291           0 :   if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
     292           0 :     return false;
     293             :   }
     294           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
     295           0 :   if (!GetOrCreateDOMReflector(cx, result, args.rval())) {
     296           0 :     MOZ_ASSERT(true || JS_IsExceptionPending(cx));
     297           0 :     return false;
     298             :   }
     299           0 :   return true;
     300             : }
     301             : 
     302             : static const JSJitInfo removeItem_methodinfo = {
     303             :   { (JSJitGetterOp)removeItem },
     304             :   { prototypes::id::SVGNumberList },
     305             :   { PrototypeTraits<prototypes::id::SVGNumberList>::Depth },
     306             :   JSJitInfo::Method,
     307             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
     308             :   JSVAL_TYPE_OBJECT,  /* returnType.  Not relevant for setters. */
     309             :   false,  /* isInfallible. False in setters. */
     310             :   false,  /* isMovable.  Not relevant for setters. */
     311             :   false, /* isEliminatable.  Not relevant for setters. */
     312             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
     313             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
     314             :   false,  /* isTypedMethod.  Only relevant for methods. */
     315             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
     316             : };
     317             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
     318             : static_assert(0 < 1, "There is no slot for us");
     319             : 
     320             : static bool
     321           0 : appendItem(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::DOMSVGNumberList* self, const JSJitMethodCallArgs& args)
     322             : {
     323           0 :   if (MOZ_UNLIKELY(args.length() < 1)) {
     324           0 :     return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "SVGNumberList.appendItem");
     325             :   }
     326           0 :   NonNull<mozilla::DOMSVGNumber> arg0;
     327           0 :   if (args[0].isObject()) {
     328             :     {
     329           0 :       nsresult rv = UnwrapObject<prototypes::id::SVGNumber, mozilla::DOMSVGNumber>(args[0], arg0);
     330           0 :       if (NS_FAILED(rv)) {
     331           0 :         ThrowErrorMessage(cx, MSG_DOES_NOT_IMPLEMENT_INTERFACE, "Argument 1 of SVGNumberList.appendItem", "SVGNumber");
     332           0 :         return false;
     333             :       }
     334             :     }
     335             :   } else {
     336           0 :     ThrowErrorMessage(cx, MSG_NOT_OBJECT, "Argument 1 of SVGNumberList.appendItem");
     337           0 :     return false;
     338             :   }
     339           0 :   binding_detail::FastErrorResult rv;
     340           0 :   auto result(StrongOrRawPtr<mozilla::DOMSVGNumber>(self->AppendItem(NonNullHelper(arg0), rv)));
     341           0 :   if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
     342           0 :     return false;
     343             :   }
     344           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
     345           0 :   if (!GetOrCreateDOMReflector(cx, result, args.rval())) {
     346           0 :     MOZ_ASSERT(true || JS_IsExceptionPending(cx));
     347           0 :     return false;
     348             :   }
     349           0 :   return true;
     350             : }
     351             : 
     352             : static const JSJitInfo appendItem_methodinfo = {
     353             :   { (JSJitGetterOp)appendItem },
     354             :   { prototypes::id::SVGNumberList },
     355             :   { PrototypeTraits<prototypes::id::SVGNumberList>::Depth },
     356             :   JSJitInfo::Method,
     357             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
     358             :   JSVAL_TYPE_OBJECT,  /* returnType.  Not relevant for setters. */
     359             :   false,  /* isInfallible. False in setters. */
     360             :   false,  /* isMovable.  Not relevant for setters. */
     361             :   false, /* isEliminatable.  Not relevant for setters. */
     362             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
     363             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
     364             :   false,  /* isTypedMethod.  Only relevant for methods. */
     365             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
     366             : };
     367             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
     368             : static_assert(0 < 1, "There is no slot for us");
     369             : 
     370             : static bool
     371           0 : get_length(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::DOMSVGNumberList* self, JSJitGetterCallArgs args)
     372             : {
     373           0 :   uint32_t result(self->Length());
     374           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
     375           0 :   args.rval().setNumber(result);
     376           0 :   return true;
     377             : }
     378             : 
     379             : static const JSJitInfo length_getterinfo = {
     380             :   { (JSJitGetterOp)get_length },
     381             :   { prototypes::id::SVGNumberList },
     382             :   { PrototypeTraits<prototypes::id::SVGNumberList>::Depth },
     383             :   JSJitInfo::Getter,
     384             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
     385             :   JSVAL_TYPE_DOUBLE,  /* returnType.  Not relevant for setters. */
     386             :   true,  /* isInfallible. False in setters. */
     387             :   false,  /* isMovable.  Not relevant for setters. */
     388             :   false, /* isEliminatable.  Not relevant for setters. */
     389             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
     390             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
     391             :   false,  /* isTypedMethod.  Only relevant for methods. */
     392             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
     393             : };
     394             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
     395             : static_assert(0 < 1, "There is no slot for us");
     396             : 
     397             : static void
     398           0 : _objectMoved(JSObject* obj, const JSObject* old)
     399             : {
     400           0 :   mozilla::DOMSVGNumberList* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::DOMSVGNumberList>(obj);
     401           0 :   if (self) {
     402           0 :     UpdateWrapper(self, self, obj, old);
     403             :   }
     404           0 : }
     405             : 
     406             : // We deliberately use brace-elision to make Visual Studio produce better initalization code.
     407             : #if defined(__clang__)
     408             : #pragma clang diagnostic push
     409             : #pragma clang diagnostic ignored "-Wmissing-braces"
     410             : #endif
     411             : static const JSFunctionSpec sMethods_specs[] = {
     412             :   JS_FNSPEC("clear", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&clear_methodinfo), 0, JSPROP_ENUMERATE, nullptr),
     413             :   JS_FNSPEC("initialize", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&initialize_methodinfo), 1, JSPROP_ENUMERATE, nullptr),
     414             :   JS_FNSPEC("getItem", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&getItem_methodinfo), 1, JSPROP_ENUMERATE, nullptr),
     415             :   JS_FNSPEC("insertItemBefore", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&insertItemBefore_methodinfo), 2, JSPROP_ENUMERATE, nullptr),
     416             :   JS_FNSPEC("replaceItem", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&replaceItem_methodinfo), 2, JSPROP_ENUMERATE, nullptr),
     417             :   JS_FNSPEC("removeItem", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&removeItem_methodinfo), 1, JSPROP_ENUMERATE, nullptr),
     418             :   JS_FNSPEC("appendItem", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&appendItem_methodinfo), 1, JSPROP_ENUMERATE, nullptr),
     419             :   JS_FS_END,
     420             :   JS_FNSPEC("QueryInterface", QueryInterface, nullptr, 1, 0, nullptr),
     421             :   JS_FS_END,
     422             :   JS_SYM_FNSPEC(iterator, nullptr, nullptr, 0, 0, "ArrayValues"),
     423             :   JS_FS_END
     424             : };
     425             : #if defined(__clang__)
     426             : #pragma clang diagnostic pop
     427             : #endif
     428             : 
     429             : static PrefableDisablers sMethods_disablers8 = {
     430             :   true, false, 0, &WantsQueryInterface<mozilla::DOMSVGNumberList>::Enabled
     431             : };
     432             : 
     433             : // Can't be const because the pref-enabled boolean needs to be writable
     434             : static Prefable<const JSFunctionSpec> sMethods[] = {
     435             :   { nullptr, &sMethods_specs[0] },
     436             :   { &sMethods_disablers8, &sMethods_specs[8] },
     437             :   { nullptr, &sMethods_specs[10] },
     438             :   { nullptr, nullptr }
     439             : };
     440             : 
     441             : static_assert(3 <= 1ull << NUM_BITS_PROPERTY_INFO_PREF_INDEX,
     442             :     "We have a prefable index that is >= (1 << NUM_BITS_PROPERTY_INFO_PREF_INDEX)");
     443             : static_assert(7 <= 1ull << NUM_BITS_PROPERTY_INFO_SPEC_INDEX,
     444             :     "We have a spec index that is >= (1 << NUM_BITS_PROPERTY_INFO_SPEC_INDEX)");
     445             : 
     446             : // We deliberately use brace-elision to make Visual Studio produce better initalization code.
     447             : #if defined(__clang__)
     448             : #pragma clang diagnostic push
     449             : #pragma clang diagnostic ignored "-Wmissing-braces"
     450             : #endif
     451             : static const JSPropertySpec sAttributes_specs[] = {
     452             :   { "numberOfItems", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &numberOfItems_getterinfo, nullptr, nullptr },
     453             :   { "length", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &length_getterinfo, nullptr, nullptr },
     454             :   { nullptr, 0, nullptr, nullptr, nullptr, nullptr }
     455             : };
     456             : #if defined(__clang__)
     457             : #pragma clang diagnostic pop
     458             : #endif
     459             : 
     460             : 
     461             : // Can't be const because the pref-enabled boolean needs to be writable
     462             : static Prefable<const JSPropertySpec> sAttributes[] = {
     463             :   { nullptr, &sAttributes_specs[0] },
     464             :   { nullptr, nullptr }
     465             : };
     466             : 
     467             : static_assert(1 <= 1ull << NUM_BITS_PROPERTY_INFO_PREF_INDEX,
     468             :     "We have a prefable index that is >= (1 << NUM_BITS_PROPERTY_INFO_PREF_INDEX)");
     469             : static_assert(2 <= 1ull << NUM_BITS_PROPERTY_INFO_SPEC_INDEX,
     470             :     "We have a spec index that is >= (1 << NUM_BITS_PROPERTY_INFO_SPEC_INDEX)");
     471             : 
     472             : 
     473             : static uint16_t sNativeProperties_sortedPropertyIndices[11];
     474             : static PropertyInfo sNativeProperties_propertyInfos[11];
     475             : 
     476             : static const NativePropertiesN<2> sNativeProperties = {
     477             :   false, 0,
     478             :   false, 0,
     479             :   true,  0 /* sMethods */,
     480             :   true,  1 /* sAttributes */,
     481             :   false, 0,
     482             :   false, 0,
     483             :   false, 0,
     484             :   -1,
     485             :   11,
     486             :   sNativeProperties_sortedPropertyIndices,
     487             :   {
     488             :     { sMethods, &sNativeProperties_propertyInfos[0] },
     489             :     { sAttributes, &sNativeProperties_propertyInfos[9] }
     490             :   }
     491             : };
     492             : static_assert(11 < 1ull << CHAR_BIT * sizeof(sNativeProperties.propertyInfoCount),
     493             :     "We have a property info count that is oversized");
     494             : 
     495             : static const DOMIfaceAndProtoJSClass sInterfaceObjectClass = {
     496             :   {
     497             :     "Function",
     498             :     JSCLASS_IS_DOMIFACEANDPROTOJSCLASS | JSCLASS_HAS_RESERVED_SLOTS(DOM_INTERFACE_SLOTS_BASE),
     499             :     &sBoringInterfaceObjectClassClassOps,
     500             :     JS_NULL_CLASS_SPEC,
     501             :     JS_NULL_CLASS_EXT,
     502             :     &sInterfaceObjectClassObjectOps
     503             :   },
     504             :   eInterface,
     505             :   true,
     506             :   prototypes::id::SVGNumberList,
     507             :   PrototypeTraits<prototypes::id::SVGNumberList>::Depth,
     508             :   sNativePropertyHooks,
     509             :   "function SVGNumberList() {\n    [native code]\n}",
     510             :   JS::GetRealmFunctionPrototype
     511             : };
     512             : 
     513             : static const DOMIfaceAndProtoJSClass sPrototypeClass = {
     514             :   {
     515             :     "SVGNumberListPrototype",
     516             :     JSCLASS_IS_DOMIFACEANDPROTOJSCLASS | JSCLASS_HAS_RESERVED_SLOTS(DOM_INTERFACE_PROTO_SLOTS_BASE),
     517             :     JS_NULL_CLASS_OPS,
     518             :     JS_NULL_CLASS_SPEC,
     519             :     JS_NULL_CLASS_EXT,
     520             :     JS_NULL_OBJECT_OPS
     521             :   },
     522             :   eInterfacePrototype,
     523             :   false,
     524             :   prototypes::id::SVGNumberList,
     525             :   PrototypeTraits<prototypes::id::SVGNumberList>::Depth,
     526             :   sNativePropertyHooks,
     527             :   "[object SVGNumberListPrototype]",
     528             :   JS::GetRealmObjectPrototype
     529             : };
     530             : 
     531             : JSObject*
     532           0 : DefineDOMInterface(JSContext* aCx, JS::Handle<JSObject*> aGlobal, JS::Handle<jsid> id, bool aDefineOnGlobal)
     533             : {
     534           0 :   return GetConstructorObjectHandle(aCx, aDefineOnGlobal);
     535             : }
     536             : 
     537             : static_assert(IsBaseOf<nsISupports, mozilla::DOMSVGNumberList >::value,
     538             :                   "We don't support non-nsISupports native classes for "
     539             :                   "proxy-based bindings yet");
     540             : 
     541             : 
     542             : class DOMProxyHandler : public mozilla::dom::DOMProxyHandler
     543             : {
     544             : public:
     545             :   explicit constexpr DOMProxyHandler()
     546             :   {
     547             :   }
     548             : 
     549             :   virtual bool
     550             :   getOwnPropDescriptor(JSContext* cx, JS::Handle<JSObject*> proxy, JS::Handle<jsid> id, bool ignoreNamedProps, JS::MutableHandle<JS::PropertyDescriptor> desc) const override;
     551             : 
     552             :   virtual bool
     553             :   defineProperty(JSContext* cx, JS::Handle<JSObject*> proxy, JS::Handle<jsid> id, JS::Handle<JS::PropertyDescriptor> desc, JS::ObjectOpResult& opresult, bool* defined) const override;
     554             : 
     555             :   using mozilla::dom::DOMProxyHandler::defineProperty;
     556             : 
     557             :   virtual bool
     558             :   ownPropNames(JSContext* cx, JS::Handle<JSObject*> proxy, unsigned flags, JS::AutoIdVector& props) const override;
     559             : 
     560             :   virtual bool
     561             :   hasOwn(JSContext* cx, JS::Handle<JSObject*> proxy, JS::Handle<jsid> id, bool* bp) const override;
     562             : 
     563             :   virtual bool
     564             :   get(JSContext* cx, JS::Handle<JSObject*> proxy, JS::Handle<JS::Value> receiver, JS::Handle<jsid> id, JS::MutableHandle<JS::Value> vp) const override;
     565             : 
     566             :   virtual const char*
     567             :   className(JSContext* cx, JS::Handle<JSObject*> proxy) const override;
     568             : 
     569             :   virtual bool
     570             :   finalizeInBackground(const JS::Value& priv) const override;
     571             : 
     572             :   virtual void
     573             :   finalize(JSFreeOp* fop, JSObject* proxy) const override;
     574             : 
     575             :   static const DOMProxyHandler*
     576             :   getInstance();
     577             : 
     578             :   virtual bool
     579             :   delete_(JSContext* cx, JS::Handle<JSObject*> proxy, JS::Handle<jsid> id, JS::ObjectOpResult& opresult) const override;
     580             : 
     581             :   virtual bool
     582             :   getElements(JSContext* cx, JS::Handle<JSObject*> proxy, uint32_t begin, uint32_t end, js::ElementAdder* adder) const override;
     583             : };
     584             : 
     585             : MOZ_ALWAYS_INLINE bool
     586           0 : IsProxy(JSObject* obj)
     587             : {
     588           0 :   return js::IsProxy(obj) && js::GetProxyHandler(obj) == DOMProxyHandler::getInstance();
     589             : }
     590             : 
     591             : MOZ_ALWAYS_INLINE mozilla::DOMSVGNumberList*
     592           0 : UnwrapProxy(JSObject* obj)
     593             : {
     594           0 :   MOZ_ASSERT(js::IsProxy(obj));
     595           0 :   if (js::GetProxyHandler(obj) != DOMProxyHandler::getInstance()) {
     596           0 :     MOZ_ASSERT(xpc::WrapperFactory::IsXrayWrapper(obj));
     597           0 :     obj = js::UncheckedUnwrap(obj);
     598             :   }
     599           0 :   MOZ_ASSERT(IsProxy(obj));
     600           0 :   return static_cast<mozilla::DOMSVGNumberList*>(js::GetProxyReservedSlot(obj, DOM_OBJECT_SLOT).toPrivate());
     601             : }
     602             : 
     603             : bool
     604           0 : DOMProxyHandler::getOwnPropDescriptor(JSContext* cx, JS::Handle<JSObject*> proxy, JS::Handle<jsid> id, bool ignoreNamedProps, JS::MutableHandle<JS::PropertyDescriptor> desc) const
     605             : {
     606           0 :   bool isXray = xpc::WrapperFactory::IsXrayWrapper(proxy);
     607           0 :   uint32_t index = GetArrayIndexFromId(cx, id);
     608           0 :   if (IsArrayIndex(index)) {
     609           0 :     mozilla::DOMSVGNumberList* self = UnwrapProxy(proxy);
     610           0 :     bool found = false;
     611           0 :     binding_detail::FastErrorResult rv;
     612           0 :     auto result(StrongOrRawPtr<mozilla::DOMSVGNumber>(self->IndexedGetter(index, found, rv)));
     613           0 :     if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
     614           0 :       return false;
     615             :     }
     616           0 :     MOZ_ASSERT(!JS_IsExceptionPending(cx));
     617             : 
     618           0 :     if (found) {
     619           0 :       if (!GetOrCreateDOMReflector(cx, result, desc.value())) {
     620           0 :         MOZ_ASSERT(true || JS_IsExceptionPending(cx));
     621           0 :         return false;
     622             :       }
     623           0 :       FillPropertyDescriptor(desc, proxy, true);
     624           0 :       return true;
     625             :     }
     626             :   }
     627             : 
     628           0 :   JS::Rooted<JSObject*> expando(cx);
     629           0 :   if (!isXray && (expando = GetExpandoObject(proxy))) {
     630           0 :     if (!JS_GetOwnPropertyDescriptorById(cx, expando, id, desc)) {
     631           0 :       return false;
     632             :     }
     633           0 :     if (desc.object()) {
     634             :       // Pretend the property lives on the wrapper.
     635           0 :       desc.object().set(proxy);
     636           0 :       return true;
     637             :     }
     638             :   }
     639             : 
     640           0 :   desc.object().set(nullptr);
     641           0 :   return true;
     642             : }
     643             : 
     644             : bool
     645           0 : DOMProxyHandler::defineProperty(JSContext* cx, JS::Handle<JSObject*> proxy, JS::Handle<jsid> id, JS::Handle<JS::PropertyDescriptor> desc, JS::ObjectOpResult& opresult, bool* defined) const
     646             : {
     647           0 :   if (IsArrayIndex(GetArrayIndexFromId(cx, id))) {
     648           0 :     *defined = true;
     649           0 :     return opresult.failNoIndexedSetter();
     650             :   }
     651           0 :   return mozilla::dom::DOMProxyHandler::defineProperty(cx, proxy, id, desc, opresult, defined);
     652             : }
     653             : 
     654             : 
     655             : bool
     656           0 : DOMProxyHandler::ownPropNames(JSContext* cx, JS::Handle<JSObject*> proxy, unsigned flags, JS::AutoIdVector& props) const
     657             : {
     658           0 :   bool isXray = xpc::WrapperFactory::IsXrayWrapper(proxy);
     659             : 
     660           0 :   uint32_t length = UnwrapProxy(proxy)->Length();
     661           0 :   MOZ_ASSERT(int32_t(length) >= 0);
     662           0 :   for (int32_t i = 0; i < int32_t(length); ++i) {
     663           0 :     if (!props.append(INT_TO_JSID(i))) {
     664           0 :       return false;
     665             :     }
     666             :   }
     667             : 
     668           0 :   JS::Rooted<JSObject*> expando(cx);
     669           0 :   if (!isXray && (expando = DOMProxyHandler::GetExpandoObject(proxy)) &&
     670           0 :       !js::GetPropertyKeys(cx, expando, flags, &props)) {
     671           0 :     return false;
     672             :   }
     673             : 
     674           0 :   return true;
     675             : }
     676             : 
     677             : bool
     678           0 : DOMProxyHandler::hasOwn(JSContext* cx, JS::Handle<JSObject*> proxy, JS::Handle<jsid> id, bool* bp) const
     679             : {
     680           0 :   MOZ_ASSERT(!xpc::WrapperFactory::IsXrayWrapper(proxy),
     681             :             "Should not have a XrayWrapper here");
     682             : 
     683           0 :   uint32_t index = GetArrayIndexFromId(cx, id);
     684           0 :   if (IsArrayIndex(index)) {
     685           0 :     bool found = false;
     686           0 :     mozilla::DOMSVGNumberList* self = UnwrapProxy(proxy);
     687           0 :     binding_detail::FastErrorResult rv;
     688           0 :     auto result(StrongOrRawPtr<mozilla::DOMSVGNumber>(self->IndexedGetter(index, found, rv)));
     689           0 :     if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
     690           0 :       return false;
     691             :     }
     692           0 :     MOZ_ASSERT(!JS_IsExceptionPending(cx));
     693             :     (void)result;
     694             : 
     695           0 :     *bp = found;
     696           0 :     return true;
     697             :   }
     698             : 
     699             : 
     700           0 :   JS::Rooted<JSObject*> expando(cx, GetExpandoObject(proxy));
     701           0 :   if (expando) {
     702           0 :     bool b = true;
     703           0 :     bool ok = JS_HasPropertyById(cx, expando, id, &b);
     704           0 :     *bp = !!b;
     705           0 :     if (!ok || *bp) {
     706           0 :       return ok;
     707             :     }
     708             :   }
     709             : 
     710           0 :   *bp = false;
     711           0 :   return true;
     712             : }
     713             : 
     714             : bool
     715           0 : DOMProxyHandler::get(JSContext* cx, JS::Handle<JSObject*> proxy, JS::Handle<JS::Value> receiver, JS::Handle<jsid> id, JS::MutableHandle<JS::Value> vp) const
     716             : {
     717           0 :   MOZ_ASSERT(!xpc::WrapperFactory::IsXrayWrapper(proxy),
     718             :               "Should not have a XrayWrapper here");
     719             : 
     720           0 :   uint32_t index = GetArrayIndexFromId(cx, id);
     721           0 :   if (IsArrayIndex(index)) {
     722           0 :     mozilla::DOMSVGNumberList* self = UnwrapProxy(proxy);
     723           0 :     bool found = false;
     724           0 :     binding_detail::FastErrorResult rv;
     725           0 :     auto result(StrongOrRawPtr<mozilla::DOMSVGNumber>(self->IndexedGetter(index, found, rv)));
     726           0 :     if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
     727           0 :       return false;
     728             :     }
     729           0 :     MOZ_ASSERT(!JS_IsExceptionPending(cx));
     730             : 
     731           0 :     if (found) {
     732           0 :       if (!GetOrCreateDOMReflector(cx, result, vp)) {
     733           0 :         MOZ_ASSERT(true || JS_IsExceptionPending(cx));
     734           0 :         return false;
     735             :       }
     736           0 :       return true;
     737             :     }
     738             :     // Even if we don't have this index, we don't forward the
     739             :     // get on to our expando object.
     740             :   } else {
     741             :     { // Scope for expando
     742           0 :       JS::Rooted<JSObject*> expando(cx, DOMProxyHandler::GetExpandoObject(proxy));
     743           0 :       if (expando) {
     744             :         bool hasProp;
     745           0 :         if (!JS_HasPropertyById(cx, expando, id, &hasProp)) {
     746           0 :           return false;
     747             :         }
     748             : 
     749           0 :         if (hasProp) {
     750             :           // Forward the get to the expando object, but our receiver is whatever our
     751             :           // receiver is.
     752           0 :           return JS_ForwardGetPropertyTo(cx, expando, id, receiver, vp);
     753             :         }
     754             :       }
     755             :     }
     756             :   }
     757             : 
     758             :   bool foundOnPrototype;
     759           0 :   if (!GetPropertyOnPrototype(cx, proxy, receiver, id, &foundOnPrototype, vp)) {
     760           0 :     return false;
     761             :   }
     762             : 
     763           0 :   if (foundOnPrototype) {
     764           0 :     return true;
     765             :   }
     766             : 
     767           0 :   vp.setUndefined();
     768           0 :   return true;
     769             : }
     770             : 
     771             : const char*
     772           0 : DOMProxyHandler::className(JSContext* cx, JS::Handle<JSObject*> proxy) const
     773             : {
     774           0 :   return "SVGNumberList";
     775             : }
     776             : 
     777             : bool
     778           0 : DOMProxyHandler::finalizeInBackground(const JS::Value& priv) const
     779             : {
     780           0 :   return false;
     781             : }
     782             : 
     783             : void
     784           0 : DOMProxyHandler::finalize(JSFreeOp* fop, JSObject* proxy) const
     785             : {
     786           0 :   mozilla::DOMSVGNumberList* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::DOMSVGNumberList>(proxy);
     787           0 :   if (self) {
     788           0 :     ClearWrapper(self, self, proxy);
     789           0 :     AddForDeferredFinalization<mozilla::DOMSVGNumberList>(self);
     790             :   }
     791           0 : }
     792             : 
     793             : const DOMProxyHandler*
     794           0 : DOMProxyHandler::getInstance()
     795             : {
     796             :   static const DOMProxyHandler instance;
     797           0 :   return &instance;
     798             : }
     799             : 
     800             : bool
     801           0 : DOMProxyHandler::delete_(JSContext* cx, JS::Handle<JSObject*> proxy, JS::Handle<jsid> id, JS::ObjectOpResult& opresult) const
     802             : {
     803           0 :   MOZ_ASSERT(!xpc::WrapperFactory::IsXrayWrapper(proxy),
     804             :             "Should not have a XrayWrapper here");
     805             : 
     806           0 :   uint32_t index = GetArrayIndexFromId(cx, id);
     807           0 :   if (IsArrayIndex(index)) {
     808             :     bool deleteSucceeded;
     809           0 :     bool found = false;
     810           0 :     mozilla::DOMSVGNumberList* self = UnwrapProxy(proxy);
     811           0 :     binding_detail::FastErrorResult rv;
     812           0 :     auto result(StrongOrRawPtr<mozilla::DOMSVGNumber>(self->IndexedGetter(index, found, rv)));
     813           0 :     if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
     814           0 :       return false;
     815             :     }
     816           0 :     MOZ_ASSERT(!JS_IsExceptionPending(cx));
     817             :     (void)result;
     818           0 :     deleteSucceeded = !found;
     819           0 :     return deleteSucceeded ? opresult.succeed() : opresult.failCantDelete();
     820             :   }
     821             : 
     822           0 :   return dom::DOMProxyHandler::delete_(cx, proxy, id, opresult);
     823             : }
     824             : 
     825             : bool
     826           0 : DOMProxyHandler::getElements(JSContext* cx, JS::Handle<JSObject*> proxy, uint32_t begin, uint32_t end, js::ElementAdder* adder) const
     827             : {
     828           0 :   JS::Rooted<JS::Value> temp(cx);
     829           0 :   MOZ_ASSERT(!xpc::WrapperFactory::IsXrayWrapper(proxy),
     830             :              "Should not have a XrayWrapper here");
     831             : 
     832           0 :   mozilla::DOMSVGNumberList* self = UnwrapProxy(proxy);
     833           0 :   uint32_t length = self->Length();
     834             :   // Compute the end of the indices we'll get ourselves
     835           0 :   uint32_t ourEnd = std::max(begin, std::min(end, length));
     836             : 
     837           0 :   for (uint32_t index = begin; index < ourEnd; ++index) {
     838           0 :     bool found = false;
     839           0 :     binding_detail::FastErrorResult rv;
     840           0 :     auto result(StrongOrRawPtr<mozilla::DOMSVGNumber>(self->IndexedGetter(index, found, rv)));
     841           0 :     if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
     842           0 :       return false;
     843             :     }
     844           0 :     MOZ_ASSERT(!JS_IsExceptionPending(cx));
     845             : 
     846           0 :     MOZ_ASSERT(found);
     847           0 :     if (!GetOrCreateDOMReflector(cx, result, &temp)) {
     848           0 :       MOZ_ASSERT(true || JS_IsExceptionPending(cx));
     849           0 :       return false;
     850             :     }
     851           0 :     if (!adder->append(cx, temp)) return false;
     852           0 :     continue;
     853             :   }
     854             : 
     855           0 :   if (end > ourEnd) {
     856           0 :     JS::Rooted<JSObject*> proto(cx);
     857           0 :     if (!js::GetObjectProto(cx, proxy, &proto)) {
     858           0 :       return false;
     859             :     }
     860           0 :     return js::GetElementsWithAdder(cx, proto, proxy, ourEnd, end, adder);
     861             :   }
     862             : 
     863           0 :   return true;
     864             : }
     865             : 
     866             : static const js::ClassExtension sClassExtension = PROXY_MAKE_EXT(
     867             :     _objectMoved
     868             : );
     869             : 
     870             : static const DOMJSClass sClass = {
     871             :   PROXY_CLASS_WITH_EXT("SVGNumberList",
     872             :                        JSCLASS_IS_DOMJSCLASS | JSCLASS_HAS_RESERVED_SLOTS(1),
     873             :                        &sClassExtension),
     874             :   { prototypes::id::SVGNumberList, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count },
     875             :   IsBaseOf<nsISupports, mozilla::DOMSVGNumberList >::value,
     876             :   sNativePropertyHooks,
     877             :   FindAssociatedGlobalForNative<mozilla::DOMSVGNumberList>::Get,
     878             :   GetProtoObjectHandle,
     879             :   GetCCParticipant<mozilla::DOMSVGNumberList>::Get()
     880             : };
     881             : 
     882             : bool
     883           0 : Wrap(JSContext* aCx, mozilla::DOMSVGNumberList* aObject, nsWrapperCache* aCache, JS::Handle<JSObject*> aGivenProto, JS::MutableHandle<JSObject*> aReflector)
     884             : {
     885             :   MOZ_ASSERT(static_cast<mozilla::DOMSVGNumberList*>(aObject) ==
     886             :              reinterpret_cast<mozilla::DOMSVGNumberList*>(aObject),
     887             :              "Multiple inheritance for mozilla::DOMSVGNumberList is broken.");
     888           0 :   MOZ_ASSERT(ToSupportsIsCorrect(aObject));
     889           0 :   MOZ_ASSERT_IF(aGivenProto, js::IsObjectInContextCompartment(aGivenProto, aCx));
     890           0 :   MOZ_ASSERT(!aCache->GetWrapper(),
     891             :              "You should probably not be using Wrap() directly; use "
     892             :              "GetOrCreateDOMReflector instead");
     893             : 
     894           0 :   MOZ_ASSERT(ToSupportsIsOnPrimaryInheritanceChain(aObject, aCache),
     895             :              "nsISupports must be on our primary inheritance chain");
     896             : 
     897           0 :   JS::Rooted<JSObject*> global(aCx, FindAssociatedGlobal(aCx, aObject->GetParentObject()));
     898           0 :   if (!global) {
     899           0 :     return false;
     900             :   }
     901           0 :   MOZ_ASSERT(JS_IsGlobalObject(global));
     902           0 :   MOZ_ASSERT(JS::ObjectIsNotGray(global));
     903             : 
     904             :   // That might have ended up wrapping us already, due to the wonders
     905             :   // of XBL.  Check for that, and bail out as needed.
     906           0 :   aReflector.set(aCache->GetWrapper());
     907           0 :   if (aReflector) {
     908             : #ifdef DEBUG
     909           0 :     binding_detail::AssertReflectorHasGivenProto(aCx, aReflector, aGivenProto);
     910             : #endif // DEBUG
     911           0 :     return true;
     912             :   }
     913             : 
     914           0 :   JSAutoCompartment ac(aCx, global);
     915           0 :   JS::Handle<JSObject*> canonicalProto = GetProtoObjectHandle(aCx);
     916           0 :   if (!canonicalProto) {
     917           0 :     return false;
     918             :   }
     919           0 :   JS::Rooted<JSObject*> proto(aCx);
     920           0 :   if (aGivenProto) {
     921           0 :     proto = aGivenProto;
     922             :     // Unfortunately, while aGivenProto was in the compartment of aCx
     923             :     // coming in, we changed compartments to that of "parent" so may need
     924             :     // to wrap the proto here.
     925           0 :     if (js::GetContextCompartment(aCx) != js::GetObjectCompartment(proto)) {
     926           0 :       if (!JS_WrapObject(aCx, &proto)) {
     927           0 :         return false;
     928             :       }
     929             :     }
     930             :   } else {
     931           0 :     proto = canonicalProto;
     932             :   }
     933             : 
     934           0 :   BindingJSObjectCreator<mozilla::DOMSVGNumberList> creator(aCx);
     935           0 :   JS::Rooted<JS::Value> expandoValue(aCx, JS::UndefinedValue());
     936           0 :   creator.CreateProxyObject(aCx, &sClass.mBase, DOMProxyHandler::getInstance(),
     937           0 :                             proto, aObject, expandoValue, aReflector);
     938           0 :   if (!aReflector) {
     939           0 :     return false;
     940             :   }
     941             : 
     942             : 
     943           0 :   aCache->SetWrapper(aReflector);
     944           0 :   creator.InitializationSucceeded();
     945             : 
     946           0 :   MOZ_ASSERT(aCache->GetWrapperPreserveColor() &&
     947             :              aCache->GetWrapperPreserveColor() == aReflector);
     948             :   // If proto != canonicalProto, we have to preserve our wrapper;
     949             :   // otherwise we won't be able to properly recreate it later, since
     950             :   // we won't know what proto to use.  Note that we don't check
     951             :   // aGivenProto here, since it's entirely possible (and even
     952             :   // somewhat common) to have a non-null aGivenProto which is the
     953             :   // same as canonicalProto.
     954           0 :   if (proto != canonicalProto) {
     955           0 :     PreserveWrapper(aObject);
     956             :   }
     957             : 
     958           0 :   return true;
     959             : }
     960             : 
     961             : static bool
     962           0 : ResolveOwnProperty(JSContext* cx, JS::Handle<JSObject*> wrapper, JS::Handle<JSObject*> obj, JS::Handle<jsid> id, JS::MutableHandle<JS::PropertyDescriptor> desc)
     963             : {
     964           0 :   return js::GetProxyHandler(obj)->getOwnPropertyDescriptor(cx, wrapper, id, desc);
     965             : }
     966             : 
     967             : static bool
     968           0 : EnumerateOwnProperties(JSContext* cx, JS::Handle<JSObject*> wrapper, JS::Handle<JSObject*> obj, JS::AutoIdVector& props)
     969             : {
     970           0 :   return js::GetProxyHandler(obj)->ownPropertyKeys(cx, wrapper, props);
     971             : }
     972             : 
     973             : const NativePropertyHooks sNativePropertyHooks[] = { {
     974             :   ResolveOwnProperty,
     975             :   EnumerateOwnProperties,
     976             :   nullptr,
     977             :   { sNativeProperties.Upcast(), nullptr },
     978             :   prototypes::id::SVGNumberList,
     979             :   constructors::id::SVGNumberList,
     980             :   nullptr,
     981             :   &DefaultXrayExpandoObjectClass
     982             : } };
     983             : 
     984             : void
     985           0 : CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, bool aDefineOnGlobal)
     986             : {
     987           0 :   JS::Rooted<JSObject*> parentProto(aCx, JS::GetRealmObjectPrototype(aCx));
     988           0 :   if (!parentProto) {
     989           0 :     return;
     990             :   }
     991             : 
     992           0 :   JS::Rooted<JSObject*> constructorProto(aCx, JS::GetRealmFunctionPrototype(aCx));
     993           0 :   if (!constructorProto) {
     994           0 :     return;
     995             :   }
     996             : 
     997             :   static bool sIdsInited = false;
     998           0 :   if (!sIdsInited && NS_IsMainThread()) {
     999           0 :     if (!InitIds(aCx, sNativeProperties.Upcast())) {
    1000           0 :       return;
    1001             :     }
    1002           0 :     sIdsInited = true;
    1003             :   }
    1004             : 
    1005           0 :   JS::Heap<JSObject*>* protoCache = &aProtoAndIfaceCache.EntrySlotOrCreate(prototypes::id::SVGNumberList);
    1006           0 :   JS::Heap<JSObject*>* interfaceCache = &aProtoAndIfaceCache.EntrySlotOrCreate(constructors::id::SVGNumberList);
    1007           0 :   dom::CreateInterfaceObjects(aCx, aGlobal, parentProto,
    1008             :                               &sPrototypeClass.mBase, protoCache,
    1009             :                               constructorProto, &sInterfaceObjectClass.mBase, 0, nullptr,
    1010             :                               interfaceCache,
    1011             :                               sNativeProperties.Upcast(),
    1012             :                               nullptr,
    1013             :                               "SVGNumberList", aDefineOnGlobal,
    1014             :                               nullptr,
    1015           0 :                               false);
    1016             : }
    1017             : 
    1018             : JS::Handle<JSObject*>
    1019           0 : GetProtoObjectHandle(JSContext* aCx)
    1020             : {
    1021             :   /* Get the interface prototype object for this class.  This will create the
    1022             :      object as needed. */
    1023           0 :   bool aDefineOnGlobal = true;
    1024             : 
    1025             :   /* Make sure our global is sane.  Hopefully we can remove this sometime */
    1026           0 :   JSObject* global = JS::CurrentGlobalOrNull(aCx);
    1027           0 :   if (!(js::GetObjectClass(global)->flags & JSCLASS_DOM_GLOBAL)) {
    1028           0 :     return nullptr;
    1029             :   }
    1030             : 
    1031             :   /* Check to see whether the interface objects are already installed */
    1032           0 :   ProtoAndIfaceCache& protoAndIfaceCache = *GetProtoAndIfaceCache(global);
    1033           0 :   if (!protoAndIfaceCache.HasEntryInSlot(prototypes::id::SVGNumberList)) {
    1034           0 :     JS::Rooted<JSObject*> rootedGlobal(aCx, global);
    1035           0 :     CreateInterfaceObjects(aCx, rootedGlobal, protoAndIfaceCache, aDefineOnGlobal);
    1036             :   }
    1037             : 
    1038             :   /*
    1039             :    * The object might _still_ be null, but that's OK.
    1040             :    *
    1041             :    * Calling fromMarkedLocation() is safe because protoAndIfaceCache is
    1042             :    * traced by TraceProtoAndIfaceCache() and its contents are never
    1043             :    * changed after they have been set.
    1044             :    *
    1045             :    * Calling address() avoids the read read barrier that does gray
    1046             :    * unmarking, but it's not possible for the object to be gray here.
    1047             :    */
    1048             : 
    1049           0 :   const JS::Heap<JSObject*>& entrySlot = protoAndIfaceCache.EntrySlotMustExist(prototypes::id::SVGNumberList);
    1050           0 :   MOZ_ASSERT(JS::ObjectIsNotGray(entrySlot));
    1051           0 :   return JS::Handle<JSObject*>::fromMarkedLocation(entrySlot.address());
    1052             : }
    1053             : 
    1054             : JS::Handle<JSObject*>
    1055           0 : GetConstructorObjectHandle(JSContext* aCx, bool aDefineOnGlobal)
    1056             : {
    1057             :   /* Get the interface object for this class.  This will create the object as
    1058             :      needed. */
    1059             : 
    1060             :   /* Make sure our global is sane.  Hopefully we can remove this sometime */
    1061           0 :   JSObject* global = JS::CurrentGlobalOrNull(aCx);
    1062           0 :   if (!(js::GetObjectClass(global)->flags & JSCLASS_DOM_GLOBAL)) {
    1063           0 :     return nullptr;
    1064             :   }
    1065             : 
    1066             :   /* Check to see whether the interface objects are already installed */
    1067           0 :   ProtoAndIfaceCache& protoAndIfaceCache = *GetProtoAndIfaceCache(global);
    1068           0 :   if (!protoAndIfaceCache.HasEntryInSlot(constructors::id::SVGNumberList)) {
    1069           0 :     JS::Rooted<JSObject*> rootedGlobal(aCx, global);
    1070           0 :     CreateInterfaceObjects(aCx, rootedGlobal, protoAndIfaceCache, aDefineOnGlobal);
    1071             :   }
    1072             : 
    1073             :   /*
    1074             :    * The object might _still_ be null, but that's OK.
    1075             :    *
    1076             :    * Calling fromMarkedLocation() is safe because protoAndIfaceCache is
    1077             :    * traced by TraceProtoAndIfaceCache() and its contents are never
    1078             :    * changed after they have been set.
    1079             :    *
    1080             :    * Calling address() avoids the read read barrier that does gray
    1081             :    * unmarking, but it's not possible for the object to be gray here.
    1082             :    */
    1083             : 
    1084           0 :   const JS::Heap<JSObject*>& entrySlot = protoAndIfaceCache.EntrySlotMustExist(constructors::id::SVGNumberList);
    1085           0 :   MOZ_ASSERT(JS::ObjectIsNotGray(entrySlot));
    1086           0 :   return JS::Handle<JSObject*>::fromMarkedLocation(entrySlot.address());
    1087             : }
    1088             : 
    1089             : JSObject*
    1090           0 : GetConstructorObject(JSContext* aCx)
    1091             : {
    1092           0 :   return GetConstructorObjectHandle(aCx);
    1093             : }
    1094             : 
    1095             : } // namespace SVGNumberListBinding
    1096             : 
    1097             : 
    1098             : 
    1099             : } // namespace dom
    1100             : } // namespace mozilla

Generated by: LCOV version 1.13